diff --git a/core/lib/Thelia/Log/TlogDestinationConfig.php b/core/lib/Thelia/Log/TlogDestinationConfig.php
index 98fec28dd..b945b9dfd 100644
--- a/core/lib/Thelia/Log/TlogDestinationConfig.php
+++ b/core/lib/Thelia/Log/TlogDestinationConfig.php
@@ -24,6 +24,7 @@
namespace Thelia\Log;
use Thelia\Model\Config;
+use Thelia\Model\ConfigDesc;
use Thelia\Model\ConfigQuery;
class TlogDestinationConfig
diff --git a/core/lib/Thelia/Model/AttributeAvI18n.php b/core/lib/Thelia/Model/AttributeAvI18n.php
new file mode 100644
index 000000000..58cfabad1
--- /dev/null
+++ b/core/lib/Thelia/Model/AttributeAvI18n.php
@@ -0,0 +1,21 @@
+setName('attribute_av_i18n');
+ $this->setPhpName('AttributeAvI18n');
+ $this->setClassname('Thelia\\Model\\AttributeAvI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute_av', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('AttributeAv', 'Thelia\\Model\\AttributeAv', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // AttributeAvI18nTableMap
diff --git a/core/lib/Thelia/Model/map/AttributeAvTableMap.php b/core/lib/Thelia/Model/map/AttributeAvTableMap.php
index 5581fb919..be008dc76 100644
--- a/core/lib/Thelia/Model/map/AttributeAvTableMap.php
+++ b/core/lib/Thelia/Model/map/AttributeAvTableMap.php
@@ -56,8 +56,8 @@ class AttributeAvTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('Attribute', 'Thelia\\Model\\Attribute', RelationMap::MANY_TO_ONE, array('attribute_id' => 'id', ), 'CASCADE', 'RESTRICT');
- $this->addRelation('AttributeAvDesc', 'Thelia\\Model\\AttributeAvDesc', RelationMap::ONE_TO_MANY, array('id' => 'attribute_av_id', ), 'CASCADE', 'RESTRICT', 'AttributeAvDescs');
$this->addRelation('AttributeCombination', 'Thelia\\Model\\AttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'attribute_av_id', ), 'CASCADE', 'RESTRICT', 'AttributeCombinations');
+ $this->addRelation('AttributeAvI18n', 'Thelia\\Model\\AttributeAvI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'AttributeAvI18ns');
} // buildRelations()
/**
@@ -70,6 +70,7 @@ class AttributeAvTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/AttributeI18nTableMap.php b/core/lib/Thelia/Model/map/AttributeI18nTableMap.php
new file mode 100644
index 000000000..9a6e570bc
--- /dev/null
+++ b/core/lib/Thelia/Model/map/AttributeI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('attribute_i18n');
+ $this->setPhpName('AttributeI18n');
+ $this->setClassname('Thelia\\Model\\AttributeI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Attribute', 'Thelia\\Model\\Attribute', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // AttributeI18nTableMap
diff --git a/core/lib/Thelia/Model/map/AttributeTableMap.php b/core/lib/Thelia/Model/map/AttributeTableMap.php
index e7c62ef58..96880b24a 100644
--- a/core/lib/Thelia/Model/map/AttributeTableMap.php
+++ b/core/lib/Thelia/Model/map/AttributeTableMap.php
@@ -54,10 +54,10 @@ class AttributeTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('AttributeDesc', 'Thelia\\Model\\AttributeDesc', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeDescs');
$this->addRelation('AttributeAv', 'Thelia\\Model\\AttributeAv', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeAvs');
$this->addRelation('AttributeCombination', 'Thelia\\Model\\AttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeCombinations');
$this->addRelation('AttributeCategory', 'Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT', 'AttributeCategorys');
+ $this->addRelation('AttributeI18n', 'Thelia\\Model\\AttributeI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'AttributeI18ns');
} // buildRelations()
/**
@@ -70,6 +70,7 @@ class AttributeTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/CategoryI18nTableMap.php b/core/lib/Thelia/Model/map/CategoryI18nTableMap.php
new file mode 100644
index 000000000..788e303a8
--- /dev/null
+++ b/core/lib/Thelia/Model/map/CategoryI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('category_i18n');
+ $this->setPhpName('CategoryI18n');
+ $this->setClassname('Thelia\\Model\\CategoryI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'category', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // CategoryI18nTableMap
diff --git a/core/lib/Thelia/Model/map/CategoryTableMap.php b/core/lib/Thelia/Model/map/CategoryTableMap.php
index 166b8091c..a94c63143 100644
--- a/core/lib/Thelia/Model/map/CategoryTableMap.php
+++ b/core/lib/Thelia/Model/map/CategoryTableMap.php
@@ -57,7 +57,6 @@ class CategoryTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('CategoryDesc', 'Thelia\\Model\\CategoryDesc', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'CategoryDescs');
$this->addRelation('ProductCategory', 'Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'ProductCategorys');
$this->addRelation('FeatureCategory', 'Thelia\\Model\\FeatureCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'FeatureCategorys');
$this->addRelation('AttributeCategory', 'Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'AttributeCategorys');
@@ -65,6 +64,7 @@ class CategoryTableMap extends TableMap
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'Images');
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'Documents');
$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');
} // buildRelations()
/**
@@ -77,6 +77,7 @@ class CategoryTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/ConfigI18nTableMap.php b/core/lib/Thelia/Model/map/ConfigI18nTableMap.php
new file mode 100644
index 000000000..8cb51434d
--- /dev/null
+++ b/core/lib/Thelia/Model/map/ConfigI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('config_i18n');
+ $this->setPhpName('ConfigI18n');
+ $this->setClassname('Thelia\\Model\\ConfigI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'config', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Config', 'Thelia\\Model\\Config', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // ConfigI18nTableMap
diff --git a/core/lib/Thelia/Model/map/ConfigTableMap.php b/core/lib/Thelia/Model/map/ConfigTableMap.php
index f009de1ba..b52137f78 100644
--- a/core/lib/Thelia/Model/map/ConfigTableMap.php
+++ b/core/lib/Thelia/Model/map/ConfigTableMap.php
@@ -57,7 +57,7 @@ class ConfigTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('ConfigDesc', 'Thelia\\Model\\ConfigDesc', RelationMap::ONE_TO_MANY, array('id' => 'config_id', ), 'CASCADE', 'RESTRICT', 'ConfigDescs');
+ $this->addRelation('ConfigI18n', 'Thelia\\Model\\ConfigI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ConfigI18ns');
} // buildRelations()
/**
@@ -70,6 +70,7 @@ class ConfigTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/ContentI18nTableMap.php b/core/lib/Thelia/Model/map/ContentI18nTableMap.php
new file mode 100644
index 000000000..f35270b7b
--- /dev/null
+++ b/core/lib/Thelia/Model/map/ContentI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('content_i18n');
+ $this->setPhpName('ContentI18n');
+ $this->setClassname('Thelia\\Model\\ContentI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'content', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // ContentI18nTableMap
diff --git a/core/lib/Thelia/Model/map/ContentTableMap.php b/core/lib/Thelia/Model/map/ContentTableMap.php
index 566f1cd24..179987efd 100644
--- a/core/lib/Thelia/Model/map/ContentTableMap.php
+++ b/core/lib/Thelia/Model/map/ContentTableMap.php
@@ -55,12 +55,12 @@ class ContentTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('ContentDesc', 'Thelia\\Model\\ContentDesc', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentDescs');
$this->addRelation('ContentAssoc', 'Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentAssocs');
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'Images');
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'Documents');
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
$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');
} // buildRelations()
/**
@@ -73,6 +73,7 @@ class ContentTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/CountryI18nTableMap.php b/core/lib/Thelia/Model/map/CountryI18nTableMap.php
new file mode 100644
index 000000000..a89d77fda
--- /dev/null
+++ b/core/lib/Thelia/Model/map/CountryI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('country_i18n');
+ $this->setPhpName('CountryI18n');
+ $this->setClassname('Thelia\\Model\\CountryI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'country', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Country', 'Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // CountryI18nTableMap
diff --git a/core/lib/Thelia/Model/map/CountryTableMap.php b/core/lib/Thelia/Model/map/CountryTableMap.php
index c8ea73778..110bfd2ff 100644
--- a/core/lib/Thelia/Model/map/CountryTableMap.php
+++ b/core/lib/Thelia/Model/map/CountryTableMap.php
@@ -58,8 +58,8 @@ class CountryTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('Area', 'Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'SET NULL', 'RESTRICT');
- $this->addRelation('CountryDesc', 'Thelia\\Model\\CountryDesc', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', 'RESTRICT', 'CountryDescs');
$this->addRelation('TaxRuleCountry', 'Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', 'RESTRICT', 'TaxRuleCountrys');
+ $this->addRelation('CountryI18n', 'Thelia\\Model\\CountryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CountryI18ns');
} // buildRelations()
/**
@@ -72,6 +72,7 @@ class CountryTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/CustomerTitleI18nTableMap.php b/core/lib/Thelia/Model/map/CustomerTitleI18nTableMap.php
new file mode 100644
index 000000000..eebc5ce21
--- /dev/null
+++ b/core/lib/Thelia/Model/map/CustomerTitleI18nTableMap.php
@@ -0,0 +1,60 @@
+setName('customer_title_i18n');
+ $this->setPhpName('CustomerTitleI18n');
+ $this->setClassname('Thelia\\Model\\CustomerTitleI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'customer_title', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('SHORT', 'Short', 'VARCHAR', false, 10, null);
+ $this->addColumn('LONG', 'Long', 'VARCHAR', false, 45, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('CustomerTitle', 'Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // CustomerTitleI18nTableMap
diff --git a/core/lib/Thelia/Model/map/CustomerTitleTableMap.php b/core/lib/Thelia/Model/map/CustomerTitleTableMap.php
index 111b00838..90c3ff3ff 100644
--- a/core/lib/Thelia/Model/map/CustomerTitleTableMap.php
+++ b/core/lib/Thelia/Model/map/CustomerTitleTableMap.php
@@ -57,7 +57,7 @@ class CustomerTitleTableMap extends TableMap
{
$this->addRelation('Customer', 'Thelia\\Model\\Customer', RelationMap::ONE_TO_MANY, array('id' => 'customer_title_id', ), 'SET NULL', 'RESTRICT', 'Customers');
$this->addRelation('Address', 'Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'customer_title_id', ), 'RESTRICT', 'RESTRICT', 'Addresss');
- $this->addRelation('CustomerTitleDesc', 'Thelia\\Model\\CustomerTitleDesc', RelationMap::ONE_TO_MANY, array('id' => 'customer_title_id', ), 'CASCADE', null, 'CustomerTitleDescs');
+ $this->addRelation('CustomerTitleI18n', 'Thelia\\Model\\CustomerTitleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CustomerTitleI18ns');
} // buildRelations()
/**
@@ -70,6 +70,7 @@ class CustomerTitleTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'short, long', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/DocumentI18nTableMap.php b/core/lib/Thelia/Model/map/DocumentI18nTableMap.php
new file mode 100644
index 000000000..4cf4aae99
--- /dev/null
+++ b/core/lib/Thelia/Model/map/DocumentI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('document_i18n');
+ $this->setPhpName('DocumentI18n');
+ $this->setClassname('Thelia\\Model\\DocumentI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'document', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // DocumentI18nTableMap
diff --git a/core/lib/Thelia/Model/map/DocumentTableMap.php b/core/lib/Thelia/Model/map/DocumentTableMap.php
index 978887cac..f93d9806d 100644
--- a/core/lib/Thelia/Model/map/DocumentTableMap.php
+++ b/core/lib/Thelia/Model/map/DocumentTableMap.php
@@ -63,7 +63,7 @@ class DocumentTableMap extends TableMap
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::MANY_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', 'RESTRICT');
- $this->addRelation('DocumentDesc', 'Thelia\\Model\\DocumentDesc', RelationMap::ONE_TO_MANY, array('id' => 'document_id', ), 'CASCADE', 'RESTRICT', 'DocumentDescs');
+ $this->addRelation('DocumentI18n', 'Thelia\\Model\\DocumentI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'DocumentI18ns');
} // buildRelations()
/**
@@ -76,6 +76,7 @@ class DocumentTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/FeatureAvI18nTableMap.php b/core/lib/Thelia/Model/map/FeatureAvI18nTableMap.php
new file mode 100644
index 000000000..eea4107d4
--- /dev/null
+++ b/core/lib/Thelia/Model/map/FeatureAvI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('feature_av_i18n');
+ $this->setPhpName('FeatureAvI18n');
+ $this->setClassname('Thelia\\Model\\FeatureAvI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature_av', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('FeatureAv', 'Thelia\\Model\\FeatureAv', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // FeatureAvI18nTableMap
diff --git a/core/lib/Thelia/Model/map/FeatureAvTableMap.php b/core/lib/Thelia/Model/map/FeatureAvTableMap.php
index e3825d68b..1315199a5 100644
--- a/core/lib/Thelia/Model/map/FeatureAvTableMap.php
+++ b/core/lib/Thelia/Model/map/FeatureAvTableMap.php
@@ -55,8 +55,8 @@ class FeatureAvTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('Feature', 'Thelia\\Model\\Feature', RelationMap::MANY_TO_ONE, array('feature_id' => 'id', ), 'CASCADE', 'RESTRICT');
- $this->addRelation('FeatureAvDesc', 'Thelia\\Model\\FeatureAvDesc', RelationMap::ONE_TO_MANY, array('id' => 'feature_av_id', ), 'CASCADE', 'RESTRICT', 'FeatureAvDescs');
$this->addRelation('FeatureProd', 'Thelia\\Model\\FeatureProd', RelationMap::ONE_TO_MANY, array('id' => 'feature_av_id', ), 'CASCADE', 'RESTRICT', 'FeatureProds');
+ $this->addRelation('FeatureAvI18n', 'Thelia\\Model\\FeatureAvI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'FeatureAvI18ns');
} // buildRelations()
/**
@@ -69,6 +69,7 @@ class FeatureAvTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/FeatureI18nTableMap.php b/core/lib/Thelia/Model/map/FeatureI18nTableMap.php
new file mode 100644
index 000000000..d38a3758d
--- /dev/null
+++ b/core/lib/Thelia/Model/map/FeatureI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('feature_i18n');
+ $this->setPhpName('FeatureI18n');
+ $this->setClassname('Thelia\\Model\\FeatureI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Feature', 'Thelia\\Model\\Feature', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // FeatureI18nTableMap
diff --git a/core/lib/Thelia/Model/map/FeatureTableMap.php b/core/lib/Thelia/Model/map/FeatureTableMap.php
index 84ec83b3b..977554a00 100644
--- a/core/lib/Thelia/Model/map/FeatureTableMap.php
+++ b/core/lib/Thelia/Model/map/FeatureTableMap.php
@@ -55,10 +55,10 @@ class FeatureTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('FeatureDesc', 'Thelia\\Model\\FeatureDesc', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT', 'FeatureDescs');
$this->addRelation('FeatureAv', 'Thelia\\Model\\FeatureAv', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT', 'FeatureAvs');
$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');
} // buildRelations()
/**
@@ -71,6 +71,7 @@ class FeatureTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/FolderI18nTableMap.php b/core/lib/Thelia/Model/map/FolderI18nTableMap.php
new file mode 100644
index 000000000..d7af79791
--- /dev/null
+++ b/core/lib/Thelia/Model/map/FolderI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('folder_i18n');
+ $this->setPhpName('FolderI18n');
+ $this->setClassname('Thelia\\Model\\FolderI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'folder', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // FolderI18nTableMap
diff --git a/core/lib/Thelia/Model/map/FolderTableMap.php b/core/lib/Thelia/Model/map/FolderTableMap.php
index 20c65fcf6..eb45af179 100644
--- a/core/lib/Thelia/Model/map/FolderTableMap.php
+++ b/core/lib/Thelia/Model/map/FolderTableMap.php
@@ -57,11 +57,11 @@ class FolderTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('FolderDesc', 'Thelia\\Model\\FolderDesc', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'FolderDescs');
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'Images');
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'Documents');
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
$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');
} // buildRelations()
/**
@@ -74,6 +74,7 @@ class FolderTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/GroupI18nTableMap.php b/core/lib/Thelia/Model/map/GroupI18nTableMap.php
new file mode 100644
index 000000000..2d23fc795
--- /dev/null
+++ b/core/lib/Thelia/Model/map/GroupI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('group_i18n');
+ $this->setPhpName('GroupI18n');
+ $this->setClassname('Thelia\\Model\\GroupI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'group', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Group', 'Thelia\\Model\\Group', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // GroupI18nTableMap
diff --git a/core/lib/Thelia/Model/map/GroupTableMap.php b/core/lib/Thelia/Model/map/GroupTableMap.php
index 21653cb4c..097666acb 100644
--- a/core/lib/Thelia/Model/map/GroupTableMap.php
+++ b/core/lib/Thelia/Model/map/GroupTableMap.php
@@ -54,10 +54,10 @@ class GroupTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('GroupDesc', 'Thelia\\Model\\GroupDesc', RelationMap::ONE_TO_MANY, array('id' => 'group_id', ), 'CASCADE', 'RESTRICT', 'GroupDescs');
$this->addRelation('AdminGroup', 'Thelia\\Model\\AdminGroup', RelationMap::ONE_TO_MANY, array('id' => 'group_id', ), 'CASCADE', 'RESTRICT', 'AdminGroups');
$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');
} // buildRelations()
/**
@@ -70,6 +70,7 @@ class GroupTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/ImageI18nTableMap.php b/core/lib/Thelia/Model/map/ImageI18nTableMap.php
new file mode 100644
index 000000000..348690663
--- /dev/null
+++ b/core/lib/Thelia/Model/map/ImageI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('image_i18n');
+ $this->setPhpName('ImageI18n');
+ $this->setClassname('Thelia\\Model\\ImageI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'image', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // ImageI18nTableMap
diff --git a/core/lib/Thelia/Model/map/ImageTableMap.php b/core/lib/Thelia/Model/map/ImageTableMap.php
index 41f571707..71bd8d700 100644
--- a/core/lib/Thelia/Model/map/ImageTableMap.php
+++ b/core/lib/Thelia/Model/map/ImageTableMap.php
@@ -63,7 +63,7 @@ class ImageTableMap extends TableMap
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::MANY_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', 'RESTRICT');
- $this->addRelation('ImageDesc', 'Thelia\\Model\\ImageDesc', RelationMap::ONE_TO_MANY, array('id' => 'image_id', ), 'CASCADE', 'RESTRICT', 'ImageDescs');
+ $this->addRelation('ImageI18n', 'Thelia\\Model\\ImageI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ImageI18ns');
} // buildRelations()
/**
@@ -76,6 +76,7 @@ class ImageTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/MessageI18nTableMap.php b/core/lib/Thelia/Model/map/MessageI18nTableMap.php
new file mode 100644
index 000000000..a7660e6fc
--- /dev/null
+++ b/core/lib/Thelia/Model/map/MessageI18nTableMap.php
@@ -0,0 +1,61 @@
+setName('message_i18n');
+ $this->setPhpName('MessageI18n');
+ $this->setClassname('Thelia\\Model\\MessageI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'message', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('DESCRIPTION_HTML', 'DescriptionHtml', 'CLOB', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Message', 'Thelia\\Model\\Message', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // MessageI18nTableMap
diff --git a/core/lib/Thelia/Model/map/MessageTableMap.php b/core/lib/Thelia/Model/map/MessageTableMap.php
index 08865e42c..5ab6231c7 100644
--- a/core/lib/Thelia/Model/map/MessageTableMap.php
+++ b/core/lib/Thelia/Model/map/MessageTableMap.php
@@ -45,6 +45,7 @@ class MessageTableMap extends TableMap
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
$this->addColumn('SECURED', 'Secured', 'TINYINT', false, null, null);
+ $this->addColumn('REF', 'Ref', 'VARCHAR', false, 255, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
// validators
@@ -55,7 +56,7 @@ class MessageTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('MessageDesc', 'Thelia\\Model\\MessageDesc', RelationMap::ONE_TO_MANY, array('id' => 'message_id', ), 'CASCADE', 'RESTRICT', 'MessageDescs');
+ $this->addRelation('MessageI18n', 'Thelia\\Model\\MessageI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'MessageI18ns');
} // buildRelations()
/**
@@ -68,6 +69,7 @@ class MessageTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, description_html', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/ModuleI18nTableMap.php b/core/lib/Thelia/Model/map/ModuleI18nTableMap.php
new file mode 100644
index 000000000..d634ea92a
--- /dev/null
+++ b/core/lib/Thelia/Model/map/ModuleI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('module_i18n');
+ $this->setPhpName('ModuleI18n');
+ $this->setClassname('Thelia\\Model\\ModuleI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'module', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Module', 'Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // ModuleI18nTableMap
diff --git a/core/lib/Thelia/Model/map/ModuleTableMap.php b/core/lib/Thelia/Model/map/ModuleTableMap.php
index 44f4d8e92..c203d3e88 100644
--- a/core/lib/Thelia/Model/map/ModuleTableMap.php
+++ b/core/lib/Thelia/Model/map/ModuleTableMap.php
@@ -57,8 +57,8 @@ class ModuleTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('ModuleDesc', 'Thelia\\Model\\ModuleDesc', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'ModuleDescs');
$this->addRelation('GroupModule', 'Thelia\\Model\\GroupModule', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT', 'GroupModules');
+ $this->addRelation('ModuleI18n', 'Thelia\\Model\\ModuleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ModuleI18ns');
} // buildRelations()
/**
@@ -71,6 +71,7 @@ class ModuleTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/OrderStatusI18nTableMap.php b/core/lib/Thelia/Model/map/OrderStatusI18nTableMap.php
new file mode 100644
index 000000000..d31eb2dd1
--- /dev/null
+++ b/core/lib/Thelia/Model/map/OrderStatusI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('order_status_i18n');
+ $this->setPhpName('OrderStatusI18n');
+ $this->setClassname('Thelia\\Model\\OrderStatusI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order_status', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('OrderStatus', 'Thelia\\Model\\OrderStatus', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // OrderStatusI18nTableMap
diff --git a/core/lib/Thelia/Model/map/OrderStatusTableMap.php b/core/lib/Thelia/Model/map/OrderStatusTableMap.php
index f89bca400..107b7eb74 100644
--- a/core/lib/Thelia/Model/map/OrderStatusTableMap.php
+++ b/core/lib/Thelia/Model/map/OrderStatusTableMap.php
@@ -55,7 +55,7 @@ class OrderStatusTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'status_id', ), 'SET NULL', 'RESTRICT', 'Orders');
- $this->addRelation('OrderStatusDesc', 'Thelia\\Model\\OrderStatusDesc', RelationMap::ONE_TO_MANY, array('id' => 'status_id', ), 'CASCADE', 'RESTRICT', 'OrderStatusDescs');
+ $this->addRelation('OrderStatusI18n', 'Thelia\\Model\\OrderStatusI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'OrderStatusI18ns');
} // buildRelations()
/**
@@ -68,6 +68,7 @@ class OrderStatusTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/ProductI18nTableMap.php b/core/lib/Thelia/Model/map/ProductI18nTableMap.php
new file mode 100644
index 000000000..6d54a74b1
--- /dev/null
+++ b/core/lib/Thelia/Model/map/ProductI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('product_i18n');
+ $this->setPhpName('ProductI18n');
+ $this->setClassname('Thelia\\Model\\ProductI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'product', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // ProductI18nTableMap
diff --git a/core/lib/Thelia/Model/map/ProductTableMap.php b/core/lib/Thelia/Model/map/ProductTableMap.php
index 978e6907a..978face1f 100644
--- a/core/lib/Thelia/Model/map/ProductTableMap.php
+++ b/core/lib/Thelia/Model/map/ProductTableMap.php
@@ -65,7 +65,6 @@ class ProductTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('TaxRule', 'Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'SET NULL', 'RESTRICT');
- $this->addRelation('ProductDesc', 'Thelia\\Model\\ProductDesc', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductDescs');
$this->addRelation('ProductCategory', 'Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'ProductCategorys');
$this->addRelation('FeatureProd', 'Thelia\\Model\\FeatureProd', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'FeatureProds');
$this->addRelation('Stock', 'Thelia\\Model\\Stock', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'Stocks');
@@ -75,6 +74,7 @@ class ProductTableMap extends TableMap
$this->addRelation('AccessoryRelatedByProductId', 'Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'AccessorysRelatedByProductId');
$this->addRelation('AccessoryRelatedByAccessory', 'Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'accessory', ), 'CASCADE', 'RESTRICT', 'AccessorysRelatedByAccessory');
$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');
} // buildRelations()
/**
@@ -87,6 +87,7 @@ class ProductTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/ResourceI18nTableMap.php b/core/lib/Thelia/Model/map/ResourceI18nTableMap.php
new file mode 100644
index 000000000..568fa1490
--- /dev/null
+++ b/core/lib/Thelia/Model/map/ResourceI18nTableMap.php
@@ -0,0 +1,62 @@
+setName('resource_i18n');
+ $this->setPhpName('ResourceI18n');
+ $this->setClassname('Thelia\\Model\\ResourceI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'resource', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
+ $this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
+ $this->addColumn('POSTSCRIPTUM', 'Postscriptum', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Resource', 'Thelia\\Model\\Resource', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // ResourceI18nTableMap
diff --git a/core/lib/Thelia/Model/map/ResourceTableMap.php b/core/lib/Thelia/Model/map/ResourceTableMap.php
index fde1fc99b..02ee749ba 100644
--- a/core/lib/Thelia/Model/map/ResourceTableMap.php
+++ b/core/lib/Thelia/Model/map/ResourceTableMap.php
@@ -54,8 +54,8 @@ class ResourceTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('ResourceDesc', 'Thelia\\Model\\ResourceDesc', RelationMap::ONE_TO_MANY, array('id' => 'resource_id', ), 'CASCADE', 'RESTRICT', 'ResourceDescs');
$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');
} // buildRelations()
/**
@@ -68,6 +68,7 @@ class ResourceTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/TaxI18nTableMap.php b/core/lib/Thelia/Model/map/TaxI18nTableMap.php
new file mode 100644
index 000000000..48ddc478e
--- /dev/null
+++ b/core/lib/Thelia/Model/map/TaxI18nTableMap.php
@@ -0,0 +1,60 @@
+setName('tax_i18n');
+ $this->setPhpName('TaxI18n');
+ $this->setClassname('Thelia\\Model\\TaxI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('Tax', 'Thelia\\Model\\Tax', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // TaxI18nTableMap
diff --git a/core/lib/Thelia/Model/map/TaxRuleI18nTableMap.php b/core/lib/Thelia/Model/map/TaxRuleI18nTableMap.php
new file mode 100644
index 000000000..42e7b2a65
--- /dev/null
+++ b/core/lib/Thelia/Model/map/TaxRuleI18nTableMap.php
@@ -0,0 +1,58 @@
+setName('tax_rule_i18n');
+ $this->setPhpName('TaxRuleI18n');
+ $this->setClassname('Thelia\\Model\\TaxRuleI18n');
+ $this->setPackage('Thelia.Model');
+ $this->setUseIdGenerator(false);
+ // columns
+ $this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_rule', 'ID', true, null, null);
+ $this->addPrimaryKey('LOCALE', 'Locale', 'VARCHAR', true, 5, 'en_EN');
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ $this->addRelation('TaxRule', 'Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
+ } // buildRelations()
+
+} // TaxRuleI18nTableMap
diff --git a/core/lib/Thelia/Model/map/TaxRuleTableMap.php b/core/lib/Thelia/Model/map/TaxRuleTableMap.php
index 8b0afad2c..51714dc5d 100644
--- a/core/lib/Thelia/Model/map/TaxRuleTableMap.php
+++ b/core/lib/Thelia/Model/map/TaxRuleTableMap.php
@@ -44,6 +44,8 @@ class TaxRuleTableMap extends TableMap
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('CODE', 'Code', 'VARCHAR', false, 45, null);
+ $this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
+ $this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
// validators
@@ -55,8 +57,8 @@ class TaxRuleTableMap extends TableMap
public function buildRelations()
{
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::ONE_TO_MANY, array('id' => 'tax_rule_id', ), 'SET NULL', 'RESTRICT', 'Products');
- $this->addRelation('TaxRuleDesc', 'Thelia\\Model\\TaxRuleDesc', RelationMap::ONE_TO_MANY, array('id' => 'tax_rule_id', ), 'CASCADE', 'RESTRICT', 'TaxRuleDescs');
$this->addRelation('TaxRuleCountry', 'Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'tax_rule_id', ), 'CASCADE', 'RESTRICT', 'TaxRuleCountrys');
+ $this->addRelation('TaxRuleI18n', 'Thelia\\Model\\TaxRuleI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'TaxRuleI18ns');
} // buildRelations()
/**
@@ -69,6 +71,7 @@ class TaxRuleTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => '', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/map/TaxTableMap.php b/core/lib/Thelia/Model/map/TaxTableMap.php
index 5a9569fec..80505fb29 100644
--- a/core/lib/Thelia/Model/map/TaxTableMap.php
+++ b/core/lib/Thelia/Model/map/TaxTableMap.php
@@ -54,8 +54,8 @@ class TaxTableMap extends TableMap
*/
public function buildRelations()
{
- $this->addRelation('TaxDesc', 'Thelia\\Model\\TaxDesc', RelationMap::ONE_TO_MANY, array('id' => 'tax_id', ), 'CASCADE', 'RESTRICT', 'TaxDescs');
$this->addRelation('TaxRuleCountry', 'Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'tax_id', ), 'SET NULL', 'RESTRICT', 'TaxRuleCountrys');
+ $this->addRelation('TaxI18n', 'Thelia\\Model\\TaxI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'TaxI18ns');
} // buildRelations()
/**
@@ -68,6 +68,7 @@ class TaxTableMap extends TableMap
{
return array(
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
+ 'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
);
} // getBehaviors()
diff --git a/core/lib/Thelia/Model/om/BaseAttribute.php b/core/lib/Thelia/Model/om/BaseAttribute.php
index 5e31ef7b0..e9c6bfad8 100644
--- a/core/lib/Thelia/Model/om/BaseAttribute.php
+++ b/core/lib/Thelia/Model/om/BaseAttribute.php
@@ -22,8 +22,8 @@ use Thelia\Model\AttributeCategory;
use Thelia\Model\AttributeCategoryQuery;
use Thelia\Model\AttributeCombination;
use Thelia\Model\AttributeCombinationQuery;
-use Thelia\Model\AttributeDesc;
-use Thelia\Model\AttributeDescQuery;
+use Thelia\Model\AttributeI18n;
+use Thelia\Model\AttributeI18nQuery;
use Thelia\Model\AttributePeer;
use Thelia\Model\AttributeQuery;
@@ -79,12 +79,6 @@ abstract class BaseAttribute extends BaseObject implements Persistent
*/
protected $updated_at;
- /**
- * @var PropelObjectCollection|AttributeDesc[] Collection to store aggregation of AttributeDesc objects.
- */
- protected $collAttributeDescs;
- protected $collAttributeDescsPartial;
-
/**
* @var PropelObjectCollection|AttributeAv[] Collection to store aggregation of AttributeAv objects.
*/
@@ -103,6 +97,12 @@ abstract class BaseAttribute extends BaseObject implements Persistent
protected $collAttributeCategorys;
protected $collAttributeCategorysPartial;
+ /**
+ * @var PropelObjectCollection|AttributeI18n[] Collection to store aggregation of AttributeI18n objects.
+ */
+ protected $collAttributeI18ns;
+ protected $collAttributeI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -117,11 +117,19 @@ abstract class BaseAttribute extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $attributeDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[AttributeI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -141,6 +149,12 @@ abstract class BaseAttribute extends BaseObject implements Persistent
*/
protected $attributeCategorysScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $attributeI18nsScheduledForDeletion = null;
+
/**
* Get the [id] column value.
*
@@ -429,14 +443,14 @@ abstract class BaseAttribute extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
- $this->collAttributeDescs = null;
-
$this->collAttributeAvs = null;
$this->collAttributeCombinations = null;
$this->collAttributeCategorys = null;
+ $this->collAttributeI18ns = null;
+
} // if (deep)
}
@@ -572,23 +586,6 @@ abstract class BaseAttribute extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->attributeDescsScheduledForDeletion !== null) {
- if (!$this->attributeDescsScheduledForDeletion->isEmpty()) {
- AttributeDescQuery::create()
- ->filterByPrimaryKeys($this->attributeDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->attributeDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collAttributeDescs !== null) {
- foreach ($this->collAttributeDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->attributeAvsScheduledForDeletion !== null) {
if (!$this->attributeAvsScheduledForDeletion->isEmpty()) {
AttributeAvQuery::create()
@@ -640,6 +637,23 @@ abstract class BaseAttribute extends BaseObject implements Persistent
}
}
+ if ($this->attributeI18nsScheduledForDeletion !== null) {
+ if (!$this->attributeI18nsScheduledForDeletion->isEmpty()) {
+ AttributeI18nQuery::create()
+ ->filterByPrimaryKeys($this->attributeI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->attributeI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collAttributeI18ns !== null) {
+ foreach ($this->collAttributeI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -800,14 +814,6 @@ abstract class BaseAttribute extends BaseObject implements Persistent
}
- if ($this->collAttributeDescs !== null) {
- foreach ($this->collAttributeDescs as $referrerFK) {
- if (!$referrerFK->validate($columns)) {
- $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
- }
- }
- }
-
if ($this->collAttributeAvs !== null) {
foreach ($this->collAttributeAvs as $referrerFK) {
if (!$referrerFK->validate($columns)) {
@@ -832,6 +838,14 @@ abstract class BaseAttribute extends BaseObject implements Persistent
}
}
+ if ($this->collAttributeI18ns !== null) {
+ foreach ($this->collAttributeI18ns as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
$this->alreadyInValidation = false;
}
@@ -914,9 +928,6 @@ abstract class BaseAttribute extends BaseObject implements Persistent
$keys[3] => $this->getUpdatedAt(),
);
if ($includeForeignObjects) {
- if (null !== $this->collAttributeDescs) {
- $result['AttributeDescs'] = $this->collAttributeDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collAttributeAvs) {
$result['AttributeAvs'] = $this->collAttributeAvs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -926,6 +937,9 @@ abstract class BaseAttribute extends BaseObject implements Persistent
if (null !== $this->collAttributeCategorys) {
$result['AttributeCategorys'] = $this->collAttributeCategorys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collAttributeI18ns) {
+ $result['AttributeI18ns'] = $this->collAttributeI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1089,12 +1103,6 @@ abstract class BaseAttribute extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getAttributeDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addAttributeDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getAttributeAvs() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addAttributeAv($relObj->copy($deepCopy));
@@ -1113,6 +1121,12 @@ abstract class BaseAttribute extends BaseObject implements Persistent
}
}
+ foreach ($this->getAttributeI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addAttributeI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1174,9 +1188,6 @@ abstract class BaseAttribute extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('AttributeDesc' == $relationName) {
- $this->initAttributeDescs();
- }
if ('AttributeAv' == $relationName) {
$this->initAttributeAvs();
}
@@ -1186,212 +1197,8 @@ abstract class BaseAttribute extends BaseObject implements Persistent
if ('AttributeCategory' == $relationName) {
$this->initAttributeCategorys();
}
- }
-
- /**
- * Clears out the collAttributeDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addAttributeDescs()
- */
- public function clearAttributeDescs()
- {
- $this->collAttributeDescs = null; // important to set this to null since that means it is uninitialized
- $this->collAttributeDescsPartial = null;
- }
-
- /**
- * reset is the collAttributeDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialAttributeDescs($v = true)
- {
- $this->collAttributeDescsPartial = $v;
- }
-
- /**
- * Initializes the collAttributeDescs collection.
- *
- * By default this just sets the collAttributeDescs collection to an empty array (like clearcollAttributeDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initAttributeDescs($overrideExisting = true)
- {
- if (null !== $this->collAttributeDescs && !$overrideExisting) {
- return;
- }
- $this->collAttributeDescs = new PropelObjectCollection();
- $this->collAttributeDescs->setModel('AttributeDesc');
- }
-
- /**
- * Gets an array of AttributeDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * 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 Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|AttributeDesc[] List of AttributeDesc objects
- * @throws PropelException
- */
- public function getAttributeDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collAttributeDescsPartial && !$this->isNew();
- if (null === $this->collAttributeDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collAttributeDescs) {
- // return empty collection
- $this->initAttributeDescs();
- } else {
- $collAttributeDescs = AttributeDescQuery::create(null, $criteria)
- ->filterByAttribute($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collAttributeDescsPartial && count($collAttributeDescs)) {
- $this->initAttributeDescs(false);
-
- foreach($collAttributeDescs as $obj) {
- if (false == $this->collAttributeDescs->contains($obj)) {
- $this->collAttributeDescs->append($obj);
- }
- }
-
- $this->collAttributeDescsPartial = true;
- }
-
- return $collAttributeDescs;
- }
-
- if($partial && $this->collAttributeDescs) {
- foreach($this->collAttributeDescs as $obj) {
- if($obj->isNew()) {
- $collAttributeDescs[] = $obj;
- }
- }
- }
-
- $this->collAttributeDescs = $collAttributeDescs;
- $this->collAttributeDescsPartial = false;
- }
- }
-
- return $this->collAttributeDescs;
- }
-
- /**
- * Sets a collection of AttributeDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $attributeDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setAttributeDescs(PropelCollection $attributeDescs, PropelPDO $con = null)
- {
- $this->attributeDescsScheduledForDeletion = $this->getAttributeDescs(new Criteria(), $con)->diff($attributeDescs);
-
- foreach ($this->attributeDescsScheduledForDeletion as $attributeDescRemoved) {
- $attributeDescRemoved->setAttribute(null);
- }
-
- $this->collAttributeDescs = null;
- foreach ($attributeDescs as $attributeDesc) {
- $this->addAttributeDesc($attributeDesc);
- }
-
- $this->collAttributeDescs = $attributeDescs;
- $this->collAttributeDescsPartial = false;
- }
-
- /**
- * Returns the number of related AttributeDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related AttributeDesc objects.
- * @throws PropelException
- */
- public function countAttributeDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collAttributeDescsPartial && !$this->isNew();
- if (null === $this->collAttributeDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collAttributeDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getAttributeDescs());
- }
- $query = AttributeDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByAttribute($this)
- ->count($con);
- }
- } else {
- return count($this->collAttributeDescs);
- }
- }
-
- /**
- * Method called to associate a AttributeDesc object to this object
- * through the AttributeDesc foreign key attribute.
- *
- * @param AttributeDesc $l AttributeDesc
- * @return Attribute The current object (for fluent API support)
- */
- public function addAttributeDesc(AttributeDesc $l)
- {
- if ($this->collAttributeDescs === null) {
- $this->initAttributeDescs();
- $this->collAttributeDescsPartial = true;
- }
- if (!$this->collAttributeDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddAttributeDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param AttributeDesc $attributeDesc The attributeDesc object to add.
- */
- protected function doAddAttributeDesc($attributeDesc)
- {
- $this->collAttributeDescs[]= $attributeDesc;
- $attributeDesc->setAttribute($this);
- }
-
- /**
- * @param AttributeDesc $attributeDesc The attributeDesc object to remove.
- */
- public function removeAttributeDesc($attributeDesc)
- {
- if ($this->getAttributeDescs()->contains($attributeDesc)) {
- $this->collAttributeDescs->remove($this->collAttributeDescs->search($attributeDesc));
- if (null === $this->attributeDescsScheduledForDeletion) {
- $this->attributeDescsScheduledForDeletion = clone $this->collAttributeDescs;
- $this->attributeDescsScheduledForDeletion->clear();
- }
- $this->attributeDescsScheduledForDeletion[]= $attributeDesc;
- $attributeDesc->setAttribute(null);
+ if ('AttributeI18n' == $relationName) {
+ $this->initAttributeI18ns();
}
}
@@ -2091,6 +1898,217 @@ abstract class BaseAttribute extends BaseObject implements Persistent
return $this->getAttributeCategorys($query, $con);
}
+ /**
+ * Clears out the collAttributeI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addAttributeI18ns()
+ */
+ public function clearAttributeI18ns()
+ {
+ $this->collAttributeI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collAttributeI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collAttributeI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialAttributeI18ns($v = true)
+ {
+ $this->collAttributeI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collAttributeI18ns collection.
+ *
+ * By default this just sets the collAttributeI18ns collection to an empty array (like clearcollAttributeI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initAttributeI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collAttributeI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collAttributeI18ns = new PropelObjectCollection();
+ $this->collAttributeI18ns->setModel('AttributeI18n');
+ }
+
+ /**
+ * Gets an array of AttributeI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * 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 Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|AttributeI18n[] List of AttributeI18n objects
+ * @throws PropelException
+ */
+ public function getAttributeI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collAttributeI18nsPartial && !$this->isNew();
+ if (null === $this->collAttributeI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collAttributeI18ns) {
+ // return empty collection
+ $this->initAttributeI18ns();
+ } else {
+ $collAttributeI18ns = AttributeI18nQuery::create(null, $criteria)
+ ->filterByAttribute($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collAttributeI18nsPartial && count($collAttributeI18ns)) {
+ $this->initAttributeI18ns(false);
+
+ foreach($collAttributeI18ns as $obj) {
+ if (false == $this->collAttributeI18ns->contains($obj)) {
+ $this->collAttributeI18ns->append($obj);
+ }
+ }
+
+ $this->collAttributeI18nsPartial = true;
+ }
+
+ return $collAttributeI18ns;
+ }
+
+ if($partial && $this->collAttributeI18ns) {
+ foreach($this->collAttributeI18ns as $obj) {
+ if($obj->isNew()) {
+ $collAttributeI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collAttributeI18ns = $collAttributeI18ns;
+ $this->collAttributeI18nsPartial = false;
+ }
+ }
+
+ return $this->collAttributeI18ns;
+ }
+
+ /**
+ * Sets a collection of AttributeI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $attributeI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setAttributeI18ns(PropelCollection $attributeI18ns, PropelPDO $con = null)
+ {
+ $this->attributeI18nsScheduledForDeletion = $this->getAttributeI18ns(new Criteria(), $con)->diff($attributeI18ns);
+
+ foreach ($this->attributeI18nsScheduledForDeletion as $attributeI18nRemoved) {
+ $attributeI18nRemoved->setAttribute(null);
+ }
+
+ $this->collAttributeI18ns = null;
+ foreach ($attributeI18ns as $attributeI18n) {
+ $this->addAttributeI18n($attributeI18n);
+ }
+
+ $this->collAttributeI18ns = $attributeI18ns;
+ $this->collAttributeI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related AttributeI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related AttributeI18n objects.
+ * @throws PropelException
+ */
+ public function countAttributeI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collAttributeI18nsPartial && !$this->isNew();
+ if (null === $this->collAttributeI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collAttributeI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getAttributeI18ns());
+ }
+ $query = AttributeI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByAttribute($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collAttributeI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a AttributeI18n object to this object
+ * through the AttributeI18n foreign key attribute.
+ *
+ * @param AttributeI18n $l AttributeI18n
+ * @return Attribute The current object (for fluent API support)
+ */
+ public function addAttributeI18n(AttributeI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collAttributeI18ns === null) {
+ $this->initAttributeI18ns();
+ $this->collAttributeI18nsPartial = true;
+ }
+ if (!$this->collAttributeI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddAttributeI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param AttributeI18n $attributeI18n The attributeI18n object to add.
+ */
+ protected function doAddAttributeI18n($attributeI18n)
+ {
+ $this->collAttributeI18ns[]= $attributeI18n;
+ $attributeI18n->setAttribute($this);
+ }
+
+ /**
+ * @param AttributeI18n $attributeI18n The attributeI18n object to remove.
+ */
+ public function removeAttributeI18n($attributeI18n)
+ {
+ if ($this->getAttributeI18ns()->contains($attributeI18n)) {
+ $this->collAttributeI18ns->remove($this->collAttributeI18ns->search($attributeI18n));
+ if (null === $this->attributeI18nsScheduledForDeletion) {
+ $this->attributeI18nsScheduledForDeletion = clone $this->collAttributeI18ns;
+ $this->attributeI18nsScheduledForDeletion->clear();
+ }
+ $this->attributeI18nsScheduledForDeletion[]= $attributeI18n;
+ $attributeI18n->setAttribute(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -2120,11 +2138,6 @@ abstract class BaseAttribute extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collAttributeDescs) {
- foreach ($this->collAttributeDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collAttributeAvs) {
foreach ($this->collAttributeAvs as $o) {
$o->clearAllReferences($deep);
@@ -2140,12 +2153,17 @@ abstract class BaseAttribute extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
+ if ($this->collAttributeI18ns) {
+ foreach ($this->collAttributeI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collAttributeDescs instanceof PropelCollection) {
- $this->collAttributeDescs->clearIterator();
- }
- $this->collAttributeDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collAttributeAvs instanceof PropelCollection) {
$this->collAttributeAvs->clearIterator();
}
@@ -2158,6 +2176,10 @@ abstract class BaseAttribute extends BaseObject implements Persistent
$this->collAttributeCategorys->clearIterator();
}
$this->collAttributeCategorys = null;
+ if ($this->collAttributeI18ns instanceof PropelCollection) {
+ $this->collAttributeI18ns->clearIterator();
+ }
+ $this->collAttributeI18ns = null;
}
/**
@@ -2194,4 +2216,199 @@ abstract class BaseAttribute extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Attribute The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return AttributeI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collAttributeI18ns) {
+ foreach ($this->collAttributeI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new AttributeI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = AttributeI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addAttributeI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Attribute The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ AttributeI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collAttributeI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collAttributeI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return AttributeI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return AttributeI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return AttributeI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return AttributeI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return AttributeI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseAttributeAv.php b/core/lib/Thelia/Model/om/BaseAttributeAv.php
index c7cc116fd..d2d542cd3 100644
--- a/core/lib/Thelia/Model/om/BaseAttributeAv.php
+++ b/core/lib/Thelia/Model/om/BaseAttributeAv.php
@@ -17,8 +17,8 @@ use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Attribute;
use Thelia\Model\AttributeAv;
-use Thelia\Model\AttributeAvDesc;
-use Thelia\Model\AttributeAvDescQuery;
+use Thelia\Model\AttributeAvI18n;
+use Thelia\Model\AttributeAvI18nQuery;
use Thelia\Model\AttributeAvPeer;
use Thelia\Model\AttributeAvQuery;
use Thelia\Model\AttributeCombination;
@@ -88,18 +88,18 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
*/
protected $aAttribute;
- /**
- * @var PropelObjectCollection|AttributeAvDesc[] Collection to store aggregation of AttributeAvDesc objects.
- */
- protected $collAttributeAvDescs;
- protected $collAttributeAvDescsPartial;
-
/**
* @var PropelObjectCollection|AttributeCombination[] Collection to store aggregation of AttributeCombination objects.
*/
protected $collAttributeCombinations;
protected $collAttributeCombinationsPartial;
+ /**
+ * @var PropelObjectCollection|AttributeAvI18n[] Collection to store aggregation of AttributeAvI18n objects.
+ */
+ protected $collAttributeAvI18ns;
+ protected $collAttributeAvI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -114,11 +114,19 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $attributeAvDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[AttributeAvI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -126,6 +134,12 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
*/
protected $attributeCombinationsScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $attributeAvI18nsScheduledForDeletion = null;
+
/**
* Get the [id] column value.
*
@@ -454,10 +468,10 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
$this->aAttribute = null;
- $this->collAttributeAvDescs = null;
-
$this->collAttributeCombinations = null;
+ $this->collAttributeAvI18ns = null;
+
} // if (deep)
}
@@ -605,23 +619,6 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->attributeAvDescsScheduledForDeletion !== null) {
- if (!$this->attributeAvDescsScheduledForDeletion->isEmpty()) {
- AttributeAvDescQuery::create()
- ->filterByPrimaryKeys($this->attributeAvDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->attributeAvDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collAttributeAvDescs !== null) {
- foreach ($this->collAttributeAvDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->attributeCombinationsScheduledForDeletion !== null) {
if (!$this->attributeCombinationsScheduledForDeletion->isEmpty()) {
AttributeCombinationQuery::create()
@@ -639,6 +636,23 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
}
}
+ if ($this->attributeAvI18nsScheduledForDeletion !== null) {
+ if (!$this->attributeAvI18nsScheduledForDeletion->isEmpty()) {
+ AttributeAvI18nQuery::create()
+ ->filterByPrimaryKeys($this->attributeAvI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->attributeAvI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collAttributeAvI18ns !== null) {
+ foreach ($this->collAttributeAvI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -817,16 +831,16 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
}
- if ($this->collAttributeAvDescs !== null) {
- foreach ($this->collAttributeAvDescs as $referrerFK) {
+ if ($this->collAttributeCombinations !== null) {
+ foreach ($this->collAttributeCombinations as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
- if ($this->collAttributeCombinations !== null) {
- foreach ($this->collAttributeCombinations as $referrerFK) {
+ if ($this->collAttributeAvI18ns !== null) {
+ foreach ($this->collAttributeAvI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -922,12 +936,12 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
if (null !== $this->aAttribute) {
$result['Attribute'] = $this->aAttribute->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
- if (null !== $this->collAttributeAvDescs) {
- $result['AttributeAvDescs'] = $this->collAttributeAvDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collAttributeCombinations) {
$result['AttributeCombinations'] = $this->collAttributeCombinations->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collAttributeAvI18ns) {
+ $result['AttributeAvI18ns'] = $this->collAttributeAvI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1097,18 +1111,18 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getAttributeAvDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addAttributeAvDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getAttributeCombinations() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addAttributeCombination($relObj->copy($deepCopy));
}
}
+ foreach ($this->getAttributeAvI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addAttributeAvI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1221,218 +1235,11 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('AttributeAvDesc' == $relationName) {
- $this->initAttributeAvDescs();
- }
if ('AttributeCombination' == $relationName) {
$this->initAttributeCombinations();
}
- }
-
- /**
- * Clears out the collAttributeAvDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addAttributeAvDescs()
- */
- public function clearAttributeAvDescs()
- {
- $this->collAttributeAvDescs = null; // important to set this to null since that means it is uninitialized
- $this->collAttributeAvDescsPartial = null;
- }
-
- /**
- * reset is the collAttributeAvDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialAttributeAvDescs($v = true)
- {
- $this->collAttributeAvDescsPartial = $v;
- }
-
- /**
- * Initializes the collAttributeAvDescs collection.
- *
- * By default this just sets the collAttributeAvDescs collection to an empty array (like clearcollAttributeAvDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initAttributeAvDescs($overrideExisting = true)
- {
- if (null !== $this->collAttributeAvDescs && !$overrideExisting) {
- return;
- }
- $this->collAttributeAvDescs = new PropelObjectCollection();
- $this->collAttributeAvDescs->setModel('AttributeAvDesc');
- }
-
- /**
- * Gets an array of AttributeAvDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * Next time the same method is called without $criteria, the cached collection is returned.
- * If this AttributeAv is new, it will return
- * an empty collection or the current collection; the criteria is ignored on a new object.
- *
- * @param Criteria $criteria optional Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|AttributeAvDesc[] List of AttributeAvDesc objects
- * @throws PropelException
- */
- public function getAttributeAvDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collAttributeAvDescsPartial && !$this->isNew();
- if (null === $this->collAttributeAvDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collAttributeAvDescs) {
- // return empty collection
- $this->initAttributeAvDescs();
- } else {
- $collAttributeAvDescs = AttributeAvDescQuery::create(null, $criteria)
- ->filterByAttributeAv($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collAttributeAvDescsPartial && count($collAttributeAvDescs)) {
- $this->initAttributeAvDescs(false);
-
- foreach($collAttributeAvDescs as $obj) {
- if (false == $this->collAttributeAvDescs->contains($obj)) {
- $this->collAttributeAvDescs->append($obj);
- }
- }
-
- $this->collAttributeAvDescsPartial = true;
- }
-
- return $collAttributeAvDescs;
- }
-
- if($partial && $this->collAttributeAvDescs) {
- foreach($this->collAttributeAvDescs as $obj) {
- if($obj->isNew()) {
- $collAttributeAvDescs[] = $obj;
- }
- }
- }
-
- $this->collAttributeAvDescs = $collAttributeAvDescs;
- $this->collAttributeAvDescsPartial = false;
- }
- }
-
- return $this->collAttributeAvDescs;
- }
-
- /**
- * Sets a collection of AttributeAvDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $attributeAvDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setAttributeAvDescs(PropelCollection $attributeAvDescs, PropelPDO $con = null)
- {
- $this->attributeAvDescsScheduledForDeletion = $this->getAttributeAvDescs(new Criteria(), $con)->diff($attributeAvDescs);
-
- foreach ($this->attributeAvDescsScheduledForDeletion as $attributeAvDescRemoved) {
- $attributeAvDescRemoved->setAttributeAv(null);
- }
-
- $this->collAttributeAvDescs = null;
- foreach ($attributeAvDescs as $attributeAvDesc) {
- $this->addAttributeAvDesc($attributeAvDesc);
- }
-
- $this->collAttributeAvDescs = $attributeAvDescs;
- $this->collAttributeAvDescsPartial = false;
- }
-
- /**
- * Returns the number of related AttributeAvDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related AttributeAvDesc objects.
- * @throws PropelException
- */
- public function countAttributeAvDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collAttributeAvDescsPartial && !$this->isNew();
- if (null === $this->collAttributeAvDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collAttributeAvDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getAttributeAvDescs());
- }
- $query = AttributeAvDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByAttributeAv($this)
- ->count($con);
- }
- } else {
- return count($this->collAttributeAvDescs);
- }
- }
-
- /**
- * Method called to associate a AttributeAvDesc object to this object
- * through the AttributeAvDesc foreign key attribute.
- *
- * @param AttributeAvDesc $l AttributeAvDesc
- * @return AttributeAv The current object (for fluent API support)
- */
- public function addAttributeAvDesc(AttributeAvDesc $l)
- {
- if ($this->collAttributeAvDescs === null) {
- $this->initAttributeAvDescs();
- $this->collAttributeAvDescsPartial = true;
- }
- if (!$this->collAttributeAvDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddAttributeAvDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param AttributeAvDesc $attributeAvDesc The attributeAvDesc object to add.
- */
- protected function doAddAttributeAvDesc($attributeAvDesc)
- {
- $this->collAttributeAvDescs[]= $attributeAvDesc;
- $attributeAvDesc->setAttributeAv($this);
- }
-
- /**
- * @param AttributeAvDesc $attributeAvDesc The attributeAvDesc object to remove.
- */
- public function removeAttributeAvDesc($attributeAvDesc)
- {
- if ($this->getAttributeAvDescs()->contains($attributeAvDesc)) {
- $this->collAttributeAvDescs->remove($this->collAttributeAvDescs->search($attributeAvDesc));
- if (null === $this->attributeAvDescsScheduledForDeletion) {
- $this->attributeAvDescsScheduledForDeletion = clone $this->collAttributeAvDescs;
- $this->attributeAvDescsScheduledForDeletion->clear();
- }
- $this->attributeAvDescsScheduledForDeletion[]= $attributeAvDesc;
- $attributeAvDesc->setAttributeAv(null);
+ if ('AttributeAvI18n' == $relationName) {
+ $this->initAttributeAvI18ns();
}
}
@@ -1693,6 +1500,217 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
return $this->getAttributeCombinations($query, $con);
}
+ /**
+ * Clears out the collAttributeAvI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addAttributeAvI18ns()
+ */
+ public function clearAttributeAvI18ns()
+ {
+ $this->collAttributeAvI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collAttributeAvI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collAttributeAvI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialAttributeAvI18ns($v = true)
+ {
+ $this->collAttributeAvI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collAttributeAvI18ns collection.
+ *
+ * By default this just sets the collAttributeAvI18ns collection to an empty array (like clearcollAttributeAvI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initAttributeAvI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collAttributeAvI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collAttributeAvI18ns = new PropelObjectCollection();
+ $this->collAttributeAvI18ns->setModel('AttributeAvI18n');
+ }
+
+ /**
+ * Gets an array of AttributeAvI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this AttributeAv is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|AttributeAvI18n[] List of AttributeAvI18n objects
+ * @throws PropelException
+ */
+ public function getAttributeAvI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collAttributeAvI18nsPartial && !$this->isNew();
+ if (null === $this->collAttributeAvI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collAttributeAvI18ns) {
+ // return empty collection
+ $this->initAttributeAvI18ns();
+ } else {
+ $collAttributeAvI18ns = AttributeAvI18nQuery::create(null, $criteria)
+ ->filterByAttributeAv($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collAttributeAvI18nsPartial && count($collAttributeAvI18ns)) {
+ $this->initAttributeAvI18ns(false);
+
+ foreach($collAttributeAvI18ns as $obj) {
+ if (false == $this->collAttributeAvI18ns->contains($obj)) {
+ $this->collAttributeAvI18ns->append($obj);
+ }
+ }
+
+ $this->collAttributeAvI18nsPartial = true;
+ }
+
+ return $collAttributeAvI18ns;
+ }
+
+ if($partial && $this->collAttributeAvI18ns) {
+ foreach($this->collAttributeAvI18ns as $obj) {
+ if($obj->isNew()) {
+ $collAttributeAvI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collAttributeAvI18ns = $collAttributeAvI18ns;
+ $this->collAttributeAvI18nsPartial = false;
+ }
+ }
+
+ return $this->collAttributeAvI18ns;
+ }
+
+ /**
+ * Sets a collection of AttributeAvI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $attributeAvI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setAttributeAvI18ns(PropelCollection $attributeAvI18ns, PropelPDO $con = null)
+ {
+ $this->attributeAvI18nsScheduledForDeletion = $this->getAttributeAvI18ns(new Criteria(), $con)->diff($attributeAvI18ns);
+
+ foreach ($this->attributeAvI18nsScheduledForDeletion as $attributeAvI18nRemoved) {
+ $attributeAvI18nRemoved->setAttributeAv(null);
+ }
+
+ $this->collAttributeAvI18ns = null;
+ foreach ($attributeAvI18ns as $attributeAvI18n) {
+ $this->addAttributeAvI18n($attributeAvI18n);
+ }
+
+ $this->collAttributeAvI18ns = $attributeAvI18ns;
+ $this->collAttributeAvI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related AttributeAvI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related AttributeAvI18n objects.
+ * @throws PropelException
+ */
+ public function countAttributeAvI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collAttributeAvI18nsPartial && !$this->isNew();
+ if (null === $this->collAttributeAvI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collAttributeAvI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getAttributeAvI18ns());
+ }
+ $query = AttributeAvI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByAttributeAv($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collAttributeAvI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a AttributeAvI18n object to this object
+ * through the AttributeAvI18n foreign key attribute.
+ *
+ * @param AttributeAvI18n $l AttributeAvI18n
+ * @return AttributeAv The current object (for fluent API support)
+ */
+ public function addAttributeAvI18n(AttributeAvI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collAttributeAvI18ns === null) {
+ $this->initAttributeAvI18ns();
+ $this->collAttributeAvI18nsPartial = true;
+ }
+ if (!$this->collAttributeAvI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddAttributeAvI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param AttributeAvI18n $attributeAvI18n The attributeAvI18n object to add.
+ */
+ protected function doAddAttributeAvI18n($attributeAvI18n)
+ {
+ $this->collAttributeAvI18ns[]= $attributeAvI18n;
+ $attributeAvI18n->setAttributeAv($this);
+ }
+
+ /**
+ * @param AttributeAvI18n $attributeAvI18n The attributeAvI18n object to remove.
+ */
+ public function removeAttributeAvI18n($attributeAvI18n)
+ {
+ if ($this->getAttributeAvI18ns()->contains($attributeAvI18n)) {
+ $this->collAttributeAvI18ns->remove($this->collAttributeAvI18ns->search($attributeAvI18n));
+ if (null === $this->attributeAvI18nsScheduledForDeletion) {
+ $this->attributeAvI18nsScheduledForDeletion = clone $this->collAttributeAvI18ns;
+ $this->attributeAvI18nsScheduledForDeletion->clear();
+ }
+ $this->attributeAvI18nsScheduledForDeletion[]= $attributeAvI18n;
+ $attributeAvI18n->setAttributeAv(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -1723,26 +1741,30 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collAttributeAvDescs) {
- foreach ($this->collAttributeAvDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collAttributeCombinations) {
foreach ($this->collAttributeCombinations as $o) {
$o->clearAllReferences($deep);
}
}
+ if ($this->collAttributeAvI18ns) {
+ foreach ($this->collAttributeAvI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collAttributeAvDescs instanceof PropelCollection) {
- $this->collAttributeAvDescs->clearIterator();
- }
- $this->collAttributeAvDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collAttributeCombinations instanceof PropelCollection) {
$this->collAttributeCombinations->clearIterator();
}
$this->collAttributeCombinations = null;
+ if ($this->collAttributeAvI18ns instanceof PropelCollection) {
+ $this->collAttributeAvI18ns->clearIterator();
+ }
+ $this->collAttributeAvI18ns = null;
$this->aAttribute = null;
}
@@ -1780,4 +1802,199 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return AttributeAv The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return AttributeAvI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collAttributeAvI18ns) {
+ foreach ($this->collAttributeAvI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new AttributeAvI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = AttributeAvI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addAttributeAvI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return AttributeAv The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ AttributeAvI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collAttributeAvI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collAttributeAvI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return AttributeAvI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return AttributeAvI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return AttributeAvI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return AttributeAvI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return AttributeAvI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseAttributeAvI18n.php b/core/lib/Thelia/Model/om/BaseAttributeAvI18n.php
new file mode 100644
index 000000000..8e8c655db
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseAttributeAvI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseAttributeAvI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return AttributeAvI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = AttributeAvI18nPeer::ID;
+ }
+
+ if ($this->aAttributeAv !== null && $this->aAttributeAv->getId() !== $v) {
+ $this->aAttributeAv = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return AttributeAvI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = AttributeAvI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return AttributeAvI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = AttributeAvI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return AttributeAvI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = AttributeAvI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return AttributeAvI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = AttributeAvI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return AttributeAvI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = AttributeAvI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = AttributeAvI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating AttributeAvI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aAttributeAv !== null && $this->id !== $this->aAttributeAv->getId()) {
+ $this->aAttributeAv = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = AttributeAvI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aAttributeAv = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = AttributeAvI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ AttributeAvI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aAttributeAv !== null) {
+ if ($this->aAttributeAv->isModified() || $this->aAttributeAv->isNew()) {
+ $affectedRows += $this->aAttributeAv->save($con);
+ }
+ $this->setAttributeAv($this->aAttributeAv);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(AttributeAvI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(AttributeAvI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(AttributeAvI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(AttributeAvI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(AttributeAvI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(AttributeAvI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `attribute_av_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aAttributeAv !== null) {
+ if (!$this->aAttributeAv->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aAttributeAv->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = AttributeAvI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = AttributeAvI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['AttributeAvI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['AttributeAvI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = AttributeAvI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aAttributeAv) {
+ $result['AttributeAv'] = $this->aAttributeAv->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = AttributeAvI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = AttributeAvI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(AttributeAvI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(AttributeAvI18nPeer::ID)) $criteria->add(AttributeAvI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(AttributeAvI18nPeer::LOCALE)) $criteria->add(AttributeAvI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(AttributeAvI18nPeer::TITLE)) $criteria->add(AttributeAvI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(AttributeAvI18nPeer::DESCRIPTION)) $criteria->add(AttributeAvI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(AttributeAvI18nPeer::CHAPO)) $criteria->add(AttributeAvI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(AttributeAvI18nPeer::POSTSCRIPTUM)) $criteria->add(AttributeAvI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(AttributeAvI18nPeer::DATABASE_NAME);
+ $criteria->add(AttributeAvI18nPeer::ID, $this->id);
+ $criteria->add(AttributeAvI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of AttributeAvI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return AttributeAvI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return AttributeAvI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new AttributeAvI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a AttributeAv object.
+ *
+ * @param AttributeAv $v
+ * @return AttributeAvI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setAttributeAv(AttributeAv $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aAttributeAv = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the AttributeAv object, it will not be re-added.
+ if ($v !== null) {
+ $v->addAttributeAvI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated AttributeAv object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return AttributeAv The associated AttributeAv object.
+ * @throws PropelException
+ */
+ public function getAttributeAv(PropelPDO $con = null)
+ {
+ if ($this->aAttributeAv === null && ($this->id !== null)) {
+ $this->aAttributeAv = AttributeAvQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aAttributeAv->addAttributeAvI18ns($this);
+ */
+ }
+
+ return $this->aAttributeAv;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aAttributeAv = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(AttributeAvI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseAttributeAvI18nPeer.php b/core/lib/Thelia/Model/om/BaseAttributeAvI18nPeer.php
new file mode 100644
index 000000000..f3bfb4faf
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseAttributeAvI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (AttributeAvI18nPeer::ID, AttributeAvI18nPeer::LOCALE, AttributeAvI18nPeer::TITLE, AttributeAvI18nPeer::DESCRIPTION, AttributeAvI18nPeer::CHAPO, AttributeAvI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. AttributeAvI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (AttributeAvI18nPeer::ID => 0, AttributeAvI18nPeer::LOCALE => 1, AttributeAvI18nPeer::TITLE => 2, AttributeAvI18nPeer::DESCRIPTION => 3, AttributeAvI18nPeer::CHAPO => 4, AttributeAvI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = AttributeAvI18nPeer::getFieldNames($toType);
+ $key = isset(AttributeAvI18nPeer::$fieldKeys[$fromType][$name]) ? AttributeAvI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(AttributeAvI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, AttributeAvI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return AttributeAvI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. AttributeAvI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(AttributeAvI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(AttributeAvI18nPeer::ID);
+ $criteria->addSelectColumn(AttributeAvI18nPeer::LOCALE);
+ $criteria->addSelectColumn(AttributeAvI18nPeer::TITLE);
+ $criteria->addSelectColumn(AttributeAvI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(AttributeAvI18nPeer::CHAPO);
+ $criteria->addSelectColumn(AttributeAvI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(AttributeAvI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ AttributeAvI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(AttributeAvI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return AttributeAvI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = AttributeAvI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return AttributeAvI18nPeer::populateObjects(AttributeAvI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ AttributeAvI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(AttributeAvI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param AttributeAvI18n $obj A AttributeAvI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ AttributeAvI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A AttributeAvI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof AttributeAvI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or AttributeAvI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(AttributeAvI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return AttributeAvI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(AttributeAvI18nPeer::$instances[$key])) {
+ return AttributeAvI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ AttributeAvI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to attribute_av_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = AttributeAvI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = AttributeAvI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = AttributeAvI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ AttributeAvI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (AttributeAvI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = AttributeAvI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = AttributeAvI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + AttributeAvI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = AttributeAvI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ AttributeAvI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related AttributeAv table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAttributeAv(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(AttributeAvI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ AttributeAvI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(AttributeAvI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(AttributeAvI18nPeer::ID, AttributeAvPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of AttributeAvI18n objects pre-filled with their AttributeAv objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of AttributeAvI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAttributeAv(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(AttributeAvI18nPeer::DATABASE_NAME);
+ }
+
+ AttributeAvI18nPeer::addSelectColumns($criteria);
+ $startcol = AttributeAvI18nPeer::NUM_HYDRATE_COLUMNS;
+ AttributeAvPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(AttributeAvI18nPeer::ID, AttributeAvPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = AttributeAvI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = AttributeAvI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = AttributeAvI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ AttributeAvI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = AttributeAvPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = AttributeAvPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = AttributeAvPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ AttributeAvPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (AttributeAvI18n) to $obj2 (AttributeAv)
+ $obj2->addAttributeAvI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(AttributeAvI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ AttributeAvI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(AttributeAvI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(AttributeAvI18nPeer::ID, AttributeAvPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of AttributeAvI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of AttributeAvI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(AttributeAvI18nPeer::DATABASE_NAME);
+ }
+
+ AttributeAvI18nPeer::addSelectColumns($criteria);
+ $startcol2 = AttributeAvI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ AttributeAvPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + AttributeAvPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(AttributeAvI18nPeer::ID, AttributeAvPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = AttributeAvI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = AttributeAvI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = AttributeAvI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ AttributeAvI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined AttributeAv rows
+
+ $key2 = AttributeAvPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = AttributeAvPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = AttributeAvPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ AttributeAvPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (AttributeAvI18n) to the collection in $obj2 (AttributeAv)
+ $obj2->addAttributeAvI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(AttributeAvI18nPeer::DATABASE_NAME)->getTable(AttributeAvI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseAttributeAvI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseAttributeAvI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new AttributeAvI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return AttributeAvI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a AttributeAvI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or AttributeAvI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from AttributeAvI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(AttributeAvI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a AttributeAvI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or AttributeAvI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(AttributeAvI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(AttributeAvI18nPeer::ID);
+ $value = $criteria->remove(AttributeAvI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(AttributeAvI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(AttributeAvI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(AttributeAvI18nPeer::LOCALE);
+ $value = $criteria->remove(AttributeAvI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(AttributeAvI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(AttributeAvI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is AttributeAvI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(AttributeAvI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the attribute_av_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(AttributeAvI18nPeer::TABLE_NAME, $con, AttributeAvI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ AttributeAvI18nPeer::clearInstancePool();
+ AttributeAvI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a AttributeAvI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or AttributeAvI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ AttributeAvI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof AttributeAvI18n) { // it's a model object
+ // invalidate the cache for this single object
+ AttributeAvI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(AttributeAvI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(AttributeAvI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(AttributeAvI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ AttributeAvI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(AttributeAvI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ AttributeAvI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given AttributeAvI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param AttributeAvI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(AttributeAvI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(AttributeAvI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(AttributeAvI18nPeer::DATABASE_NAME, AttributeAvI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return AttributeAvI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = AttributeAvI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(AttributeAvI18nPeer::DATABASE_NAME);
+ $criteria->add(AttributeAvI18nPeer::ID, $id);
+ $criteria->add(AttributeAvI18nPeer::LOCALE, $locale);
+ $v = AttributeAvI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseAttributeAvI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseAttributeAvI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseAttributeAvI18nQuery.php b/core/lib/Thelia/Model/om/BaseAttributeAvI18nQuery.php
new file mode 100644
index 000000000..3fc4679c0
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseAttributeAvI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return AttributeAvI18n|AttributeAvI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = AttributeAvI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return AttributeAvI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `attribute_av_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new AttributeAvI18n();
+ $obj->hydrate($row);
+ AttributeAvI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return AttributeAvI18n|AttributeAvI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|AttributeAvI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return AttributeAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(AttributeAvI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(AttributeAvI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return AttributeAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(AttributeAvI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(AttributeAvI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByAttributeAv()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeAvI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(AttributeAvI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeAvI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeAvI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeAvI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeAvI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeAvI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related AttributeAv object
+ *
+ * @param AttributeAv|PropelObjectCollection $attributeAv The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeAvI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByAttributeAv($attributeAv, $comparison = null)
+ {
+ if ($attributeAv instanceof AttributeAv) {
+ return $this
+ ->addUsingAlias(AttributeAvI18nPeer::ID, $attributeAv->getId(), $comparison);
+ } elseif ($attributeAv instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(AttributeAvI18nPeer::ID, $attributeAv->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByAttributeAv() only accepts arguments of type AttributeAv or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the AttributeAv relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return AttributeAvI18nQuery The current query, for fluid interface
+ */
+ public function joinAttributeAv($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('AttributeAv');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'AttributeAv');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the AttributeAv relation AttributeAv object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\AttributeAvQuery A secondary query class using the current class as primary query
+ */
+ public function useAttributeAvQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinAttributeAv($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'AttributeAv', '\Thelia\Model\AttributeAvQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param AttributeAvI18n $attributeAvI18n Object to remove from the list of results
+ *
+ * @return AttributeAvI18nQuery The current query, for fluid interface
+ */
+ public function prune($attributeAvI18n = null)
+ {
+ if ($attributeAvI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(AttributeAvI18nPeer::ID), $attributeAvI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(AttributeAvI18nPeer::LOCALE), $attributeAvI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseAttributeAvPeer.php b/core/lib/Thelia/Model/om/BaseAttributeAvPeer.php
index 188d12186..d0e40073d 100644
--- a/core/lib/Thelia/Model/om/BaseAttributeAvPeer.php
+++ b/core/lib/Thelia/Model/om/BaseAttributeAvPeer.php
@@ -10,7 +10,7 @@ use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\AttributeAv;
-use Thelia\Model\AttributeAvDescPeer;
+use Thelia\Model\AttributeAvI18nPeer;
use Thelia\Model\AttributeAvPeer;
use Thelia\Model\AttributeCombinationPeer;
use Thelia\Model\AttributePeer;
@@ -74,6 +74,13 @@ abstract class BaseAttributeAvPeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -385,12 +392,12 @@ abstract class BaseAttributeAvPeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in AttributeAvDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- AttributeAvDescPeer::clearInstancePool();
// Invalidate objects in AttributeCombinationPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeCombinationPeer::clearInstancePool();
+ // Invalidate objects in AttributeAvI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ AttributeAvI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseAttributeAvQuery.php b/core/lib/Thelia/Model/om/BaseAttributeAvQuery.php
index 2da19dc3e..418d0a718 100644
--- a/core/lib/Thelia/Model/om/BaseAttributeAvQuery.php
+++ b/core/lib/Thelia/Model/om/BaseAttributeAvQuery.php
@@ -14,7 +14,7 @@ use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Attribute;
use Thelia\Model\AttributeAv;
-use Thelia\Model\AttributeAvDesc;
+use Thelia\Model\AttributeAvI18n;
use Thelia\Model\AttributeAvPeer;
use Thelia\Model\AttributeAvQuery;
use Thelia\Model\AttributeCombination;
@@ -44,14 +44,14 @@ use Thelia\Model\AttributeCombination;
* @method AttributeAvQuery rightJoinAttribute($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Attribute relation
* @method AttributeAvQuery innerJoinAttribute($relationAlias = null) Adds a INNER JOIN clause to the query using the Attribute relation
*
- * @method AttributeAvQuery leftJoinAttributeAvDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeAvDesc relation
- * @method AttributeAvQuery rightJoinAttributeAvDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeAvDesc relation
- * @method AttributeAvQuery innerJoinAttributeAvDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeAvDesc relation
- *
* @method AttributeAvQuery leftJoinAttributeCombination($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeCombination relation
* @method AttributeAvQuery rightJoinAttributeCombination($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCombination relation
* @method AttributeAvQuery innerJoinAttributeCombination($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCombination relation
*
+ * @method AttributeAvQuery leftJoinAttributeAvI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeAvI18n relation
+ * @method AttributeAvQuery rightJoinAttributeAvI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeAvI18n relation
+ * @method AttributeAvQuery innerJoinAttributeAvI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeAvI18n relation
+ *
* @method AttributeAv findOne(PropelPDO $con = null) Return the first AttributeAv matching the query
* @method AttributeAv findOneOrCreate(PropelPDO $con = null) Return the first AttributeAv matching the query, or a new AttributeAv object populated from the query conditions when no match is found
*
@@ -517,80 +517,6 @@ abstract class BaseAttributeAvQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
}
- /**
- * Filter the query by a related AttributeAvDesc object
- *
- * @param AttributeAvDesc|PropelObjectCollection $attributeAvDesc the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return AttributeAvQuery The current query, for fluid interface
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByAttributeAvDesc($attributeAvDesc, $comparison = null)
- {
- if ($attributeAvDesc instanceof AttributeAvDesc) {
- return $this
- ->addUsingAlias(AttributeAvPeer::ID, $attributeAvDesc->getAttributeAvId(), $comparison);
- } elseif ($attributeAvDesc instanceof PropelObjectCollection) {
- return $this
- ->useAttributeAvDescQuery()
- ->filterByPrimaryKeys($attributeAvDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByAttributeAvDesc() only accepts arguments of type AttributeAvDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the AttributeAvDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return AttributeAvQuery The current query, for fluid interface
- */
- public function joinAttributeAvDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('AttributeAvDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'AttributeAvDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the AttributeAvDesc relation AttributeAvDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\AttributeAvDescQuery A secondary query class using the current class as primary query
- */
- public function useAttributeAvDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinAttributeAvDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'AttributeAvDesc', '\Thelia\Model\AttributeAvDescQuery');
- }
-
/**
* Filter the query by a related AttributeCombination object
*
@@ -665,6 +591,80 @@ abstract class BaseAttributeAvQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'AttributeCombination', '\Thelia\Model\AttributeCombinationQuery');
}
+ /**
+ * Filter the query by a related AttributeAvI18n object
+ *
+ * @param AttributeAvI18n|PropelObjectCollection $attributeAvI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeAvQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByAttributeAvI18n($attributeAvI18n, $comparison = null)
+ {
+ if ($attributeAvI18n instanceof AttributeAvI18n) {
+ return $this
+ ->addUsingAlias(AttributeAvPeer::ID, $attributeAvI18n->getId(), $comparison);
+ } elseif ($attributeAvI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useAttributeAvI18nQuery()
+ ->filterByPrimaryKeys($attributeAvI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByAttributeAvI18n() only accepts arguments of type AttributeAvI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the AttributeAvI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return AttributeAvQuery The current query, for fluid interface
+ */
+ public function joinAttributeAvI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('AttributeAvI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'AttributeAvI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the AttributeAvI18n relation AttributeAvI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\AttributeAvI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useAttributeAvI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinAttributeAvI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'AttributeAvI18n', '\Thelia\Model\AttributeAvI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -746,4 +746,61 @@ abstract class BaseAttributeAvQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(AttributeAvPeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return AttributeAvQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'AttributeAvI18n';
+
+ return $this
+ ->joinAttributeAvI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return AttributeAvQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('AttributeAvI18n');
+ $this->with['AttributeAvI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return AttributeAvI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'AttributeAvI18n', 'Thelia\Model\AttributeAvI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseAttributeI18n.php b/core/lib/Thelia/Model/om/BaseAttributeI18n.php
new file mode 100644
index 000000000..b6b1e4396
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseAttributeI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseAttributeI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return AttributeI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = AttributeI18nPeer::ID;
+ }
+
+ if ($this->aAttribute !== null && $this->aAttribute->getId() !== $v) {
+ $this->aAttribute = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return AttributeI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = AttributeI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return AttributeI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = AttributeI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return AttributeI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = AttributeI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return AttributeI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = AttributeI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return AttributeI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = AttributeI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = AttributeI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating AttributeI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aAttribute !== null && $this->id !== $this->aAttribute->getId()) {
+ $this->aAttribute = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = AttributeI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aAttribute = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = AttributeI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ AttributeI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aAttribute !== null) {
+ if ($this->aAttribute->isModified() || $this->aAttribute->isNew()) {
+ $affectedRows += $this->aAttribute->save($con);
+ }
+ $this->setAttribute($this->aAttribute);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(AttributeI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(AttributeI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(AttributeI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(AttributeI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(AttributeI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(AttributeI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `attribute_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aAttribute !== null) {
+ if (!$this->aAttribute->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aAttribute->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = AttributeI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = AttributeI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['AttributeI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['AttributeI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = AttributeI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aAttribute) {
+ $result['Attribute'] = $this->aAttribute->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = AttributeI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = AttributeI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(AttributeI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(AttributeI18nPeer::ID)) $criteria->add(AttributeI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(AttributeI18nPeer::LOCALE)) $criteria->add(AttributeI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(AttributeI18nPeer::TITLE)) $criteria->add(AttributeI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(AttributeI18nPeer::DESCRIPTION)) $criteria->add(AttributeI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(AttributeI18nPeer::CHAPO)) $criteria->add(AttributeI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(AttributeI18nPeer::POSTSCRIPTUM)) $criteria->add(AttributeI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(AttributeI18nPeer::DATABASE_NAME);
+ $criteria->add(AttributeI18nPeer::ID, $this->id);
+ $criteria->add(AttributeI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of AttributeI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return AttributeI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return AttributeI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new AttributeI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Attribute object.
+ *
+ * @param Attribute $v
+ * @return AttributeI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setAttribute(Attribute $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aAttribute = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Attribute object, it will not be re-added.
+ if ($v !== null) {
+ $v->addAttributeI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Attribute object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Attribute The associated Attribute object.
+ * @throws PropelException
+ */
+ public function getAttribute(PropelPDO $con = null)
+ {
+ if ($this->aAttribute === null && ($this->id !== null)) {
+ $this->aAttribute = AttributeQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aAttribute->addAttributeI18ns($this);
+ */
+ }
+
+ return $this->aAttribute;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aAttribute = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(AttributeI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseAttributeI18nPeer.php b/core/lib/Thelia/Model/om/BaseAttributeI18nPeer.php
new file mode 100644
index 000000000..d2f0b9da7
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseAttributeI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (AttributeI18nPeer::ID, AttributeI18nPeer::LOCALE, AttributeI18nPeer::TITLE, AttributeI18nPeer::DESCRIPTION, AttributeI18nPeer::CHAPO, AttributeI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. AttributeI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (AttributeI18nPeer::ID => 0, AttributeI18nPeer::LOCALE => 1, AttributeI18nPeer::TITLE => 2, AttributeI18nPeer::DESCRIPTION => 3, AttributeI18nPeer::CHAPO => 4, AttributeI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = AttributeI18nPeer::getFieldNames($toType);
+ $key = isset(AttributeI18nPeer::$fieldKeys[$fromType][$name]) ? AttributeI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(AttributeI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, AttributeI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return AttributeI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. AttributeI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(AttributeI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(AttributeI18nPeer::ID);
+ $criteria->addSelectColumn(AttributeI18nPeer::LOCALE);
+ $criteria->addSelectColumn(AttributeI18nPeer::TITLE);
+ $criteria->addSelectColumn(AttributeI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(AttributeI18nPeer::CHAPO);
+ $criteria->addSelectColumn(AttributeI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(AttributeI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ AttributeI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(AttributeI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return AttributeI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = AttributeI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return AttributeI18nPeer::populateObjects(AttributeI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ AttributeI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(AttributeI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param AttributeI18n $obj A AttributeI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ AttributeI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A AttributeI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof AttributeI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or AttributeI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(AttributeI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return AttributeI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(AttributeI18nPeer::$instances[$key])) {
+ return AttributeI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ AttributeI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to attribute_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = AttributeI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = AttributeI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = AttributeI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ AttributeI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (AttributeI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = AttributeI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = AttributeI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + AttributeI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = AttributeI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ AttributeI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Attribute table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAttribute(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(AttributeI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ AttributeI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(AttributeI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(AttributeI18nPeer::ID, AttributePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of AttributeI18n objects pre-filled with their Attribute objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of AttributeI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAttribute(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(AttributeI18nPeer::DATABASE_NAME);
+ }
+
+ AttributeI18nPeer::addSelectColumns($criteria);
+ $startcol = AttributeI18nPeer::NUM_HYDRATE_COLUMNS;
+ AttributePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(AttributeI18nPeer::ID, AttributePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = AttributeI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = AttributeI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = AttributeI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ AttributeI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = AttributePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = AttributePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = AttributePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ AttributePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (AttributeI18n) to $obj2 (Attribute)
+ $obj2->addAttributeI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(AttributeI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ AttributeI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(AttributeI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(AttributeI18nPeer::ID, AttributePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of AttributeI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of AttributeI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(AttributeI18nPeer::DATABASE_NAME);
+ }
+
+ AttributeI18nPeer::addSelectColumns($criteria);
+ $startcol2 = AttributeI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ AttributePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + AttributePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(AttributeI18nPeer::ID, AttributePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = AttributeI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = AttributeI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = AttributeI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ AttributeI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Attribute rows
+
+ $key2 = AttributePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = AttributePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = AttributePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ AttributePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (AttributeI18n) to the collection in $obj2 (Attribute)
+ $obj2->addAttributeI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(AttributeI18nPeer::DATABASE_NAME)->getTable(AttributeI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseAttributeI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseAttributeI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new AttributeI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return AttributeI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a AttributeI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or AttributeI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from AttributeI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(AttributeI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a AttributeI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or AttributeI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(AttributeI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(AttributeI18nPeer::ID);
+ $value = $criteria->remove(AttributeI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(AttributeI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(AttributeI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(AttributeI18nPeer::LOCALE);
+ $value = $criteria->remove(AttributeI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(AttributeI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(AttributeI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is AttributeI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(AttributeI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the attribute_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(AttributeI18nPeer::TABLE_NAME, $con, AttributeI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ AttributeI18nPeer::clearInstancePool();
+ AttributeI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a AttributeI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or AttributeI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ AttributeI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof AttributeI18n) { // it's a model object
+ // invalidate the cache for this single object
+ AttributeI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(AttributeI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(AttributeI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(AttributeI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ AttributeI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(AttributeI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ AttributeI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given AttributeI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param AttributeI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(AttributeI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(AttributeI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(AttributeI18nPeer::DATABASE_NAME, AttributeI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return AttributeI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = AttributeI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(AttributeI18nPeer::DATABASE_NAME);
+ $criteria->add(AttributeI18nPeer::ID, $id);
+ $criteria->add(AttributeI18nPeer::LOCALE, $locale);
+ $v = AttributeI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseAttributeI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseAttributeI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseAttributeI18nQuery.php b/core/lib/Thelia/Model/om/BaseAttributeI18nQuery.php
new file mode 100644
index 000000000..3681f91f1
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseAttributeI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return AttributeI18n|AttributeI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = AttributeI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(AttributeI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return AttributeI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `attribute_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new AttributeI18n();
+ $obj->hydrate($row);
+ AttributeI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return AttributeI18n|AttributeI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|AttributeI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return AttributeI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(AttributeI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(AttributeI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return AttributeI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(AttributeI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(AttributeI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByAttribute()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(AttributeI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(AttributeI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Attribute object
+ *
+ * @param Attribute|PropelObjectCollection $attribute The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return AttributeI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByAttribute($attribute, $comparison = null)
+ {
+ if ($attribute instanceof Attribute) {
+ return $this
+ ->addUsingAlias(AttributeI18nPeer::ID, $attribute->getId(), $comparison);
+ } elseif ($attribute instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(AttributeI18nPeer::ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByAttribute() only accepts arguments of type Attribute or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Attribute relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return AttributeI18nQuery The current query, for fluid interface
+ */
+ public function joinAttribute($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Attribute');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Attribute');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Attribute relation Attribute object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\AttributeQuery A secondary query class using the current class as primary query
+ */
+ public function useAttributeQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinAttribute($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param AttributeI18n $attributeI18n Object to remove from the list of results
+ *
+ * @return AttributeI18nQuery The current query, for fluid interface
+ */
+ public function prune($attributeI18n = null)
+ {
+ if ($attributeI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(AttributeI18nPeer::ID), $attributeI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(AttributeI18nPeer::LOCALE), $attributeI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseAttributePeer.php b/core/lib/Thelia/Model/om/BaseAttributePeer.php
index 77bab2049..994d40bcc 100644
--- a/core/lib/Thelia/Model/om/BaseAttributePeer.php
+++ b/core/lib/Thelia/Model/om/BaseAttributePeer.php
@@ -13,7 +13,7 @@ use Thelia\Model\Attribute;
use Thelia\Model\AttributeAvPeer;
use Thelia\Model\AttributeCategoryPeer;
use Thelia\Model\AttributeCombinationPeer;
-use Thelia\Model\AttributeDescPeer;
+use Thelia\Model\AttributeI18nPeer;
use Thelia\Model\AttributePeer;
use Thelia\Model\map\AttributeTableMap;
@@ -72,6 +72,13 @@ abstract class BaseAttributePeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -381,9 +388,6 @@ abstract class BaseAttributePeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in AttributeDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- AttributeDescPeer::clearInstancePool();
// Invalidate objects in AttributeAvPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeAvPeer::clearInstancePool();
@@ -393,6 +397,9 @@ abstract class BaseAttributePeer
// Invalidate objects in AttributeCategoryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AttributeCategoryPeer::clearInstancePool();
+ // Invalidate objects in AttributeI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ AttributeI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseAttributeQuery.php b/core/lib/Thelia/Model/om/BaseAttributeQuery.php
index 59746ca5a..13b1f9a59 100644
--- a/core/lib/Thelia/Model/om/BaseAttributeQuery.php
+++ b/core/lib/Thelia/Model/om/BaseAttributeQuery.php
@@ -16,7 +16,7 @@ use Thelia\Model\Attribute;
use Thelia\Model\AttributeAv;
use Thelia\Model\AttributeCategory;
use Thelia\Model\AttributeCombination;
-use Thelia\Model\AttributeDesc;
+use Thelia\Model\AttributeI18n;
use Thelia\Model\AttributePeer;
use Thelia\Model\AttributeQuery;
@@ -39,10 +39,6 @@ use Thelia\Model\AttributeQuery;
* @method AttributeQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method AttributeQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method AttributeQuery leftJoinAttributeDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeDesc relation
- * @method AttributeQuery rightJoinAttributeDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeDesc relation
- * @method AttributeQuery innerJoinAttributeDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeDesc relation
- *
* @method AttributeQuery leftJoinAttributeAv($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeAv relation
* @method AttributeQuery rightJoinAttributeAv($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeAv relation
* @method AttributeQuery innerJoinAttributeAv($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeAv relation
@@ -55,6 +51,10 @@ use Thelia\Model\AttributeQuery;
* @method AttributeQuery rightJoinAttributeCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeCategory relation
* @method AttributeQuery innerJoinAttributeCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeCategory relation
*
+ * @method AttributeQuery leftJoinAttributeI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the AttributeI18n relation
+ * @method AttributeQuery rightJoinAttributeI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AttributeI18n relation
+ * @method AttributeQuery innerJoinAttributeI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the AttributeI18n relation
+ *
* @method Attribute findOne(PropelPDO $con = null) Return the first Attribute matching the query
* @method Attribute findOneOrCreate(PropelPDO $con = null) Return the first Attribute matching the query, or a new Attribute object populated from the query conditions when no match is found
*
@@ -399,80 +399,6 @@ abstract class BaseAttributeQuery extends ModelCriteria
return $this->addUsingAlias(AttributePeer::UPDATED_AT, $updatedAt, $comparison);
}
- /**
- * Filter the query by a related AttributeDesc object
- *
- * @param AttributeDesc|PropelObjectCollection $attributeDesc 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
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByAttributeDesc($attributeDesc, $comparison = null)
- {
- if ($attributeDesc instanceof AttributeDesc) {
- return $this
- ->addUsingAlias(AttributePeer::ID, $attributeDesc->getAttributeId(), $comparison);
- } elseif ($attributeDesc instanceof PropelObjectCollection) {
- return $this
- ->useAttributeDescQuery()
- ->filterByPrimaryKeys($attributeDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByAttributeDesc() only accepts arguments of type AttributeDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the AttributeDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return AttributeQuery The current query, for fluid interface
- */
- public function joinAttributeDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('AttributeDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'AttributeDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the AttributeDesc relation AttributeDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\AttributeDescQuery A secondary query class using the current class as primary query
- */
- public function useAttributeDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinAttributeDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'AttributeDesc', '\Thelia\Model\AttributeDescQuery');
- }
-
/**
* Filter the query by a related AttributeAv object
*
@@ -695,6 +621,80 @@ abstract class BaseAttributeQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'AttributeCategory', '\Thelia\Model\AttributeCategoryQuery');
}
+ /**
+ * Filter the query by a related AttributeI18n object
+ *
+ * @param AttributeI18n|PropelObjectCollection $attributeI18n 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByAttributeI18n($attributeI18n, $comparison = null)
+ {
+ if ($attributeI18n instanceof AttributeI18n) {
+ return $this
+ ->addUsingAlias(AttributePeer::ID, $attributeI18n->getId(), $comparison);
+ } elseif ($attributeI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useAttributeI18nQuery()
+ ->filterByPrimaryKeys($attributeI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByAttributeI18n() only accepts arguments of type AttributeI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the AttributeI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return AttributeQuery The current query, for fluid interface
+ */
+ public function joinAttributeI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('AttributeI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'AttributeI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the AttributeI18n relation AttributeI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\AttributeI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useAttributeI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinAttributeI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'AttributeI18n', '\Thelia\Model\AttributeI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -776,4 +776,61 @@ abstract class BaseAttributeQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(AttributePeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return AttributeQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'AttributeI18n';
+
+ return $this
+ ->joinAttributeI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return AttributeQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('AttributeI18n');
+ $this->with['AttributeI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return AttributeI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'AttributeI18n', 'Thelia\Model\AttributeI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseCategory.php b/core/lib/Thelia/Model/om/BaseCategory.php
index f91f0b645..8c71be9a5 100644
--- a/core/lib/Thelia/Model/om/BaseCategory.php
+++ b/core/lib/Thelia/Model/om/BaseCategory.php
@@ -18,8 +18,8 @@ use \PropelPDO;
use Thelia\Model\AttributeCategory;
use Thelia\Model\AttributeCategoryQuery;
use Thelia\Model\Category;
-use Thelia\Model\CategoryDesc;
-use Thelia\Model\CategoryDescQuery;
+use Thelia\Model\CategoryI18n;
+use Thelia\Model\CategoryI18nQuery;
use Thelia\Model\CategoryPeer;
use Thelia\Model\CategoryQuery;
use Thelia\Model\ContentAssoc;
@@ -105,12 +105,6 @@ abstract class BaseCategory extends BaseObject implements Persistent
*/
protected $updated_at;
- /**
- * @var PropelObjectCollection|CategoryDesc[] Collection to store aggregation of CategoryDesc objects.
- */
- protected $collCategoryDescs;
- protected $collCategoryDescsPartial;
-
/**
* @var PropelObjectCollection|ProductCategory[] Collection to store aggregation of ProductCategory objects.
*/
@@ -153,6 +147,12 @@ abstract class BaseCategory extends BaseObject implements Persistent
protected $collRewritings;
protected $collRewritingsPartial;
+ /**
+ * @var PropelObjectCollection|CategoryI18n[] Collection to store aggregation of CategoryI18n objects.
+ */
+ protected $collCategoryI18ns;
+ protected $collCategoryI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -167,11 +167,19 @@ abstract class BaseCategory extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $categoryDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[CategoryI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -215,6 +223,12 @@ abstract class BaseCategory extends BaseObject implements Persistent
*/
protected $rewritingsScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $categoryI18nsScheduledForDeletion = null;
+
/**
* Get the [id] column value.
*
@@ -599,8 +613,6 @@ abstract class BaseCategory extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
- $this->collCategoryDescs = null;
-
$this->collProductCategorys = null;
$this->collFeatureCategorys = null;
@@ -615,6 +627,8 @@ abstract class BaseCategory extends BaseObject implements Persistent
$this->collRewritings = null;
+ $this->collCategoryI18ns = null;
+
} // if (deep)
}
@@ -750,23 +764,6 @@ abstract class BaseCategory extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->categoryDescsScheduledForDeletion !== null) {
- if (!$this->categoryDescsScheduledForDeletion->isEmpty()) {
- CategoryDescQuery::create()
- ->filterByPrimaryKeys($this->categoryDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->categoryDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collCategoryDescs !== null) {
- foreach ($this->collCategoryDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->productCategorysScheduledForDeletion !== null) {
if (!$this->productCategorysScheduledForDeletion->isEmpty()) {
ProductCategoryQuery::create()
@@ -890,6 +887,23 @@ abstract class BaseCategory extends BaseObject implements Persistent
}
}
+ if ($this->categoryI18nsScheduledForDeletion !== null) {
+ if (!$this->categoryI18nsScheduledForDeletion->isEmpty()) {
+ CategoryI18nQuery::create()
+ ->filterByPrimaryKeys($this->categoryI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->categoryI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCategoryI18ns !== null) {
+ foreach ($this->collCategoryI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -1068,14 +1082,6 @@ abstract class BaseCategory extends BaseObject implements Persistent
}
- if ($this->collCategoryDescs !== null) {
- foreach ($this->collCategoryDescs as $referrerFK) {
- if (!$referrerFK->validate($columns)) {
- $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
- }
- }
- }
-
if ($this->collProductCategorys !== null) {
foreach ($this->collProductCategorys as $referrerFK) {
if (!$referrerFK->validate($columns)) {
@@ -1132,6 +1138,14 @@ abstract class BaseCategory extends BaseObject implements Persistent
}
}
+ if ($this->collCategoryI18ns !== null) {
+ foreach ($this->collCategoryI18ns as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
$this->alreadyInValidation = false;
}
@@ -1226,9 +1240,6 @@ abstract class BaseCategory extends BaseObject implements Persistent
$keys[6] => $this->getUpdatedAt(),
);
if ($includeForeignObjects) {
- if (null !== $this->collCategoryDescs) {
- $result['CategoryDescs'] = $this->collCategoryDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collProductCategorys) {
$result['ProductCategorys'] = $this->collProductCategorys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1250,6 +1261,9 @@ abstract class BaseCategory extends BaseObject implements Persistent
if (null !== $this->collRewritings) {
$result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collCategoryI18ns) {
+ $result['CategoryI18ns'] = $this->collCategoryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1431,12 +1445,6 @@ abstract class BaseCategory extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getCategoryDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCategoryDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getProductCategorys() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addProductCategory($relObj->copy($deepCopy));
@@ -1479,6 +1487,12 @@ abstract class BaseCategory extends BaseObject implements Persistent
}
}
+ foreach ($this->getCategoryI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCategoryI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1540,9 +1554,6 @@ abstract class BaseCategory extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('CategoryDesc' == $relationName) {
- $this->initCategoryDescs();
- }
if ('ProductCategory' == $relationName) {
$this->initProductCategorys();
}
@@ -1564,212 +1575,8 @@ abstract class BaseCategory extends BaseObject implements Persistent
if ('Rewriting' == $relationName) {
$this->initRewritings();
}
- }
-
- /**
- * Clears out the collCategoryDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addCategoryDescs()
- */
- public function clearCategoryDescs()
- {
- $this->collCategoryDescs = null; // important to set this to null since that means it is uninitialized
- $this->collCategoryDescsPartial = null;
- }
-
- /**
- * reset is the collCategoryDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialCategoryDescs($v = true)
- {
- $this->collCategoryDescsPartial = $v;
- }
-
- /**
- * Initializes the collCategoryDescs collection.
- *
- * By default this just sets the collCategoryDescs collection to an empty array (like clearcollCategoryDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initCategoryDescs($overrideExisting = true)
- {
- if (null !== $this->collCategoryDescs && !$overrideExisting) {
- return;
- }
- $this->collCategoryDescs = new PropelObjectCollection();
- $this->collCategoryDescs->setModel('CategoryDesc');
- }
-
- /**
- * Gets an array of CategoryDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * 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 Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|CategoryDesc[] List of CategoryDesc objects
- * @throws PropelException
- */
- public function getCategoryDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collCategoryDescsPartial && !$this->isNew();
- if (null === $this->collCategoryDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collCategoryDescs) {
- // return empty collection
- $this->initCategoryDescs();
- } else {
- $collCategoryDescs = CategoryDescQuery::create(null, $criteria)
- ->filterByCategory($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collCategoryDescsPartial && count($collCategoryDescs)) {
- $this->initCategoryDescs(false);
-
- foreach($collCategoryDescs as $obj) {
- if (false == $this->collCategoryDescs->contains($obj)) {
- $this->collCategoryDescs->append($obj);
- }
- }
-
- $this->collCategoryDescsPartial = true;
- }
-
- return $collCategoryDescs;
- }
-
- if($partial && $this->collCategoryDescs) {
- foreach($this->collCategoryDescs as $obj) {
- if($obj->isNew()) {
- $collCategoryDescs[] = $obj;
- }
- }
- }
-
- $this->collCategoryDescs = $collCategoryDescs;
- $this->collCategoryDescsPartial = false;
- }
- }
-
- return $this->collCategoryDescs;
- }
-
- /**
- * Sets a collection of CategoryDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $categoryDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setCategoryDescs(PropelCollection $categoryDescs, PropelPDO $con = null)
- {
- $this->categoryDescsScheduledForDeletion = $this->getCategoryDescs(new Criteria(), $con)->diff($categoryDescs);
-
- foreach ($this->categoryDescsScheduledForDeletion as $categoryDescRemoved) {
- $categoryDescRemoved->setCategory(null);
- }
-
- $this->collCategoryDescs = null;
- foreach ($categoryDescs as $categoryDesc) {
- $this->addCategoryDesc($categoryDesc);
- }
-
- $this->collCategoryDescs = $categoryDescs;
- $this->collCategoryDescsPartial = false;
- }
-
- /**
- * Returns the number of related CategoryDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CategoryDesc objects.
- * @throws PropelException
- */
- public function countCategoryDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collCategoryDescsPartial && !$this->isNew();
- if (null === $this->collCategoryDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collCategoryDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getCategoryDescs());
- }
- $query = CategoryDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByCategory($this)
- ->count($con);
- }
- } else {
- return count($this->collCategoryDescs);
- }
- }
-
- /**
- * Method called to associate a CategoryDesc object to this object
- * through the CategoryDesc foreign key attribute.
- *
- * @param CategoryDesc $l CategoryDesc
- * @return Category The current object (for fluent API support)
- */
- public function addCategoryDesc(CategoryDesc $l)
- {
- if ($this->collCategoryDescs === null) {
- $this->initCategoryDescs();
- $this->collCategoryDescsPartial = true;
- }
- if (!$this->collCategoryDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddCategoryDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param CategoryDesc $categoryDesc The categoryDesc object to add.
- */
- protected function doAddCategoryDesc($categoryDesc)
- {
- $this->collCategoryDescs[]= $categoryDesc;
- $categoryDesc->setCategory($this);
- }
-
- /**
- * @param CategoryDesc $categoryDesc The categoryDesc object to remove.
- */
- public function removeCategoryDesc($categoryDesc)
- {
- if ($this->getCategoryDescs()->contains($categoryDesc)) {
- $this->collCategoryDescs->remove($this->collCategoryDescs->search($categoryDesc));
- if (null === $this->categoryDescsScheduledForDeletion) {
- $this->categoryDescsScheduledForDeletion = clone $this->collCategoryDescs;
- $this->categoryDescsScheduledForDeletion->clear();
- }
- $this->categoryDescsScheduledForDeletion[]= $categoryDesc;
- $categoryDesc->setCategory(null);
+ if ('CategoryI18n' == $relationName) {
+ $this->initCategoryI18ns();
}
}
@@ -3572,6 +3379,217 @@ abstract class BaseCategory extends BaseObject implements Persistent
return $this->getRewritings($query, $con);
}
+ /**
+ * Clears out the collCategoryI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addCategoryI18ns()
+ */
+ public function clearCategoryI18ns()
+ {
+ $this->collCategoryI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collCategoryI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collCategoryI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCategoryI18ns($v = true)
+ {
+ $this->collCategoryI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collCategoryI18ns collection.
+ *
+ * By default this just sets the collCategoryI18ns collection to an empty array (like clearcollCategoryI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCategoryI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collCategoryI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collCategoryI18ns = new PropelObjectCollection();
+ $this->collCategoryI18ns->setModel('CategoryI18n');
+ }
+
+ /**
+ * Gets an array of CategoryI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * 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 Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|CategoryI18n[] List of CategoryI18n objects
+ * @throws PropelException
+ */
+ public function getCategoryI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCategoryI18nsPartial && !$this->isNew();
+ if (null === $this->collCategoryI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCategoryI18ns) {
+ // return empty collection
+ $this->initCategoryI18ns();
+ } else {
+ $collCategoryI18ns = CategoryI18nQuery::create(null, $criteria)
+ ->filterByCategory($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCategoryI18nsPartial && count($collCategoryI18ns)) {
+ $this->initCategoryI18ns(false);
+
+ foreach($collCategoryI18ns as $obj) {
+ if (false == $this->collCategoryI18ns->contains($obj)) {
+ $this->collCategoryI18ns->append($obj);
+ }
+ }
+
+ $this->collCategoryI18nsPartial = true;
+ }
+
+ return $collCategoryI18ns;
+ }
+
+ if($partial && $this->collCategoryI18ns) {
+ foreach($this->collCategoryI18ns as $obj) {
+ if($obj->isNew()) {
+ $collCategoryI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collCategoryI18ns = $collCategoryI18ns;
+ $this->collCategoryI18nsPartial = false;
+ }
+ }
+
+ return $this->collCategoryI18ns;
+ }
+
+ /**
+ * Sets a collection of CategoryI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $categoryI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setCategoryI18ns(PropelCollection $categoryI18ns, PropelPDO $con = null)
+ {
+ $this->categoryI18nsScheduledForDeletion = $this->getCategoryI18ns(new Criteria(), $con)->diff($categoryI18ns);
+
+ foreach ($this->categoryI18nsScheduledForDeletion as $categoryI18nRemoved) {
+ $categoryI18nRemoved->setCategory(null);
+ }
+
+ $this->collCategoryI18ns = null;
+ foreach ($categoryI18ns as $categoryI18n) {
+ $this->addCategoryI18n($categoryI18n);
+ }
+
+ $this->collCategoryI18ns = $categoryI18ns;
+ $this->collCategoryI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related CategoryI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CategoryI18n objects.
+ * @throws PropelException
+ */
+ public function countCategoryI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCategoryI18nsPartial && !$this->isNew();
+ if (null === $this->collCategoryI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCategoryI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getCategoryI18ns());
+ }
+ $query = CategoryI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCategory($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCategoryI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a CategoryI18n object to this object
+ * through the CategoryI18n foreign key attribute.
+ *
+ * @param CategoryI18n $l CategoryI18n
+ * @return Category The current object (for fluent API support)
+ */
+ public function addCategoryI18n(CategoryI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collCategoryI18ns === null) {
+ $this->initCategoryI18ns();
+ $this->collCategoryI18nsPartial = true;
+ }
+ if (!$this->collCategoryI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddCategoryI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CategoryI18n $categoryI18n The categoryI18n object to add.
+ */
+ protected function doAddCategoryI18n($categoryI18n)
+ {
+ $this->collCategoryI18ns[]= $categoryI18n;
+ $categoryI18n->setCategory($this);
+ }
+
+ /**
+ * @param CategoryI18n $categoryI18n The categoryI18n object to remove.
+ */
+ public function removeCategoryI18n($categoryI18n)
+ {
+ if ($this->getCategoryI18ns()->contains($categoryI18n)) {
+ $this->collCategoryI18ns->remove($this->collCategoryI18ns->search($categoryI18n));
+ if (null === $this->categoryI18nsScheduledForDeletion) {
+ $this->categoryI18nsScheduledForDeletion = clone $this->collCategoryI18ns;
+ $this->categoryI18nsScheduledForDeletion->clear();
+ }
+ $this->categoryI18nsScheduledForDeletion[]= $categoryI18n;
+ $categoryI18n->setCategory(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -3604,11 +3622,6 @@ abstract class BaseCategory extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collCategoryDescs) {
- foreach ($this->collCategoryDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collProductCategorys) {
foreach ($this->collProductCategorys as $o) {
$o->clearAllReferences($deep);
@@ -3644,12 +3657,17 @@ abstract class BaseCategory extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
+ if ($this->collCategoryI18ns) {
+ foreach ($this->collCategoryI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collCategoryDescs instanceof PropelCollection) {
- $this->collCategoryDescs->clearIterator();
- }
- $this->collCategoryDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collProductCategorys instanceof PropelCollection) {
$this->collProductCategorys->clearIterator();
}
@@ -3678,6 +3696,10 @@ abstract class BaseCategory extends BaseObject implements Persistent
$this->collRewritings->clearIterator();
}
$this->collRewritings = null;
+ if ($this->collCategoryI18ns instanceof PropelCollection) {
+ $this->collCategoryI18ns->clearIterator();
+ }
+ $this->collCategoryI18ns = null;
}
/**
@@ -3714,4 +3736,199 @@ abstract class BaseCategory extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Category The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CategoryI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collCategoryI18ns) {
+ foreach ($this->collCategoryI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new CategoryI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = CategoryI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addCategoryI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Category The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ CategoryI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collCategoryI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collCategoryI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CategoryI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return CategoryI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return CategoryI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return CategoryI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return CategoryI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseCategoryI18n.php b/core/lib/Thelia/Model/om/BaseCategoryI18n.php
new file mode 100644
index 000000000..cbf1434b6
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseCategoryI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseCategoryI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CategoryI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CategoryI18nPeer::ID;
+ }
+
+ if ($this->aCategory !== null && $this->aCategory->getId() !== $v) {
+ $this->aCategory = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return CategoryI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = CategoryI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return CategoryI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = CategoryI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return CategoryI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = CategoryI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return CategoryI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = CategoryI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return CategoryI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = CategoryI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = CategoryI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CategoryI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aCategory !== null && $this->id !== $this->aCategory->getId()) {
+ $this->aCategory = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CategoryI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aCategory = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CategoryI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CategoryI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCategory !== null) {
+ if ($this->aCategory->isModified() || $this->aCategory->isNew()) {
+ $affectedRows += $this->aCategory->save($con);
+ }
+ $this->setCategory($this->aCategory);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CategoryI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(CategoryI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(CategoryI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(CategoryI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(CategoryI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(CategoryI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `category_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCategory !== null) {
+ if (!$this->aCategory->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCategory->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CategoryI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CategoryI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CategoryI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CategoryI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = CategoryI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aCategory) {
+ $result['Category'] = $this->aCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CategoryI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CategoryI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CategoryI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CategoryI18nPeer::ID)) $criteria->add(CategoryI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(CategoryI18nPeer::LOCALE)) $criteria->add(CategoryI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(CategoryI18nPeer::TITLE)) $criteria->add(CategoryI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(CategoryI18nPeer::DESCRIPTION)) $criteria->add(CategoryI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(CategoryI18nPeer::CHAPO)) $criteria->add(CategoryI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(CategoryI18nPeer::POSTSCRIPTUM)) $criteria->add(CategoryI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CategoryI18nPeer::DATABASE_NAME);
+ $criteria->add(CategoryI18nPeer::ID, $this->id);
+ $criteria->add(CategoryI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CategoryI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CategoryI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CategoryI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CategoryI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Category object.
+ *
+ * @param Category $v
+ * @return CategoryI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCategory(Category $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aCategory = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Category object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCategoryI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Category object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Category The associated Category object.
+ * @throws PropelException
+ */
+ public function getCategory(PropelPDO $con = null)
+ {
+ if ($this->aCategory === null && ($this->id !== null)) {
+ $this->aCategory = CategoryQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCategory->addCategoryI18ns($this);
+ */
+ }
+
+ return $this->aCategory;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aCategory = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CategoryI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseCategoryI18nPeer.php b/core/lib/Thelia/Model/om/BaseCategoryI18nPeer.php
new file mode 100644
index 000000000..e3e7ff29b
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseCategoryI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (CategoryI18nPeer::ID, CategoryI18nPeer::LOCALE, CategoryI18nPeer::TITLE, CategoryI18nPeer::DESCRIPTION, CategoryI18nPeer::CHAPO, CategoryI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. CategoryI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (CategoryI18nPeer::ID => 0, CategoryI18nPeer::LOCALE => 1, CategoryI18nPeer::TITLE => 2, CategoryI18nPeer::DESCRIPTION => 3, CategoryI18nPeer::CHAPO => 4, CategoryI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CategoryI18nPeer::getFieldNames($toType);
+ $key = isset(CategoryI18nPeer::$fieldKeys[$fromType][$name]) ? CategoryI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CategoryI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CategoryI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return CategoryI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CategoryI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CategoryI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CategoryI18nPeer::ID);
+ $criteria->addSelectColumn(CategoryI18nPeer::LOCALE);
+ $criteria->addSelectColumn(CategoryI18nPeer::TITLE);
+ $criteria->addSelectColumn(CategoryI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(CategoryI18nPeer::CHAPO);
+ $criteria->addSelectColumn(CategoryI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CategoryI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CategoryI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CategoryI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CategoryI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CategoryI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CategoryI18nPeer::populateObjects(CategoryI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CategoryI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CategoryI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CategoryI18n $obj A CategoryI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ CategoryI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CategoryI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CategoryI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CategoryI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CategoryI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CategoryI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(CategoryI18nPeer::$instances[$key])) {
+ return CategoryI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ CategoryI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to category_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CategoryI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CategoryI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CategoryI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CategoryI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CategoryI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CategoryI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CategoryI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CategoryI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CategoryI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CategoryI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Category table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCategory(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CategoryI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CategoryI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CategoryI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CategoryI18nPeer::ID, CategoryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CategoryI18n objects pre-filled with their Category objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CategoryI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCategory(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(CategoryI18nPeer::DATABASE_NAME);
+ }
+
+ CategoryI18nPeer::addSelectColumns($criteria);
+ $startcol = CategoryI18nPeer::NUM_HYDRATE_COLUMNS;
+ CategoryPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CategoryI18nPeer::ID, CategoryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CategoryI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CategoryI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CategoryI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CategoryI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CategoryPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CategoryPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CategoryPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CategoryI18n) to $obj2 (Category)
+ $obj2->addCategoryI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CategoryI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CategoryI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CategoryI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CategoryI18nPeer::ID, CategoryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of CategoryI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CategoryI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(CategoryI18nPeer::DATABASE_NAME);
+ }
+
+ CategoryI18nPeer::addSelectColumns($criteria);
+ $startcol2 = CategoryI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ CategoryPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CategoryPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CategoryI18nPeer::ID, CategoryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CategoryI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CategoryI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CategoryI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CategoryI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Category rows
+
+ $key2 = CategoryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CategoryPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CategoryPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CategoryPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CategoryI18n) to the collection in $obj2 (Category)
+ $obj2->addCategoryI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(CategoryI18nPeer::DATABASE_NAME)->getTable(CategoryI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCategoryI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCategoryI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new CategoryI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return CategoryI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CategoryI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or CategoryI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CategoryI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CategoryI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CategoryI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or CategoryI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CategoryI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CategoryI18nPeer::ID);
+ $value = $criteria->remove(CategoryI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CategoryI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CategoryI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(CategoryI18nPeer::LOCALE);
+ $value = $criteria->remove(CategoryI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(CategoryI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CategoryI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CategoryI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CategoryI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the category_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CategoryI18nPeer::TABLE_NAME, $con, CategoryI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CategoryI18nPeer::clearInstancePool();
+ CategoryI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CategoryI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CategoryI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CategoryI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CategoryI18n) { // it's a model object
+ // invalidate the cache for this single object
+ CategoryI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(CategoryI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(CategoryI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(CategoryI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ CategoryI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CategoryI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CategoryI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CategoryI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CategoryI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CategoryI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CategoryI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CategoryI18nPeer::DATABASE_NAME, CategoryI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return CategoryI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = CategoryI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(CategoryI18nPeer::DATABASE_NAME);
+ $criteria->add(CategoryI18nPeer::ID, $id);
+ $criteria->add(CategoryI18nPeer::LOCALE, $locale);
+ $v = CategoryI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseCategoryI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCategoryI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseCategoryI18nQuery.php b/core/lib/Thelia/Model/om/BaseCategoryI18nQuery.php
new file mode 100644
index 000000000..e6c732075
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseCategoryI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CategoryI18n|CategoryI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CategoryI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CategoryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CategoryI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `category_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CategoryI18n();
+ $obj->hydrate($row);
+ CategoryI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CategoryI18n|CategoryI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|CategoryI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CategoryI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(CategoryI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(CategoryI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CategoryI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(CategoryI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(CategoryI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByCategory()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CategoryI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(CategoryI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CategoryI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CategoryI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CategoryI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CategoryI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CategoryI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CategoryI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CategoryI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CategoryI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CategoryI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CategoryI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Category object
+ *
+ * @param Category|PropelObjectCollection $category The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CategoryI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCategory($category, $comparison = null)
+ {
+ if ($category instanceof Category) {
+ return $this
+ ->addUsingAlias(CategoryI18nPeer::ID, $category->getId(), $comparison);
+ } elseif ($category instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CategoryI18nPeer::ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByCategory() only accepts arguments of type Category or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Category relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CategoryI18nQuery The current query, for fluid interface
+ */
+ public function joinCategory($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Category');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Category');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Category relation Category object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\CategoryQuery A secondary query class using the current class as primary query
+ */
+ public function useCategoryQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinCategory($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CategoryI18n $categoryI18n Object to remove from the list of results
+ *
+ * @return CategoryI18nQuery The current query, for fluid interface
+ */
+ public function prune($categoryI18n = null)
+ {
+ if ($categoryI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(CategoryI18nPeer::ID), $categoryI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(CategoryI18nPeer::LOCALE), $categoryI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseCategoryPeer.php b/core/lib/Thelia/Model/om/BaseCategoryPeer.php
index 024425bf7..f5be9a382 100644
--- a/core/lib/Thelia/Model/om/BaseCategoryPeer.php
+++ b/core/lib/Thelia/Model/om/BaseCategoryPeer.php
@@ -11,7 +11,7 @@ use \PropelException;
use \PropelPDO;
use Thelia\Model\AttributeCategoryPeer;
use Thelia\Model\Category;
-use Thelia\Model\CategoryDescPeer;
+use Thelia\Model\CategoryI18nPeer;
use Thelia\Model\CategoryPeer;
use Thelia\Model\ContentAssocPeer;
use Thelia\Model\DocumentPeer;
@@ -85,6 +85,13 @@ abstract class BaseCategoryPeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -400,9 +407,6 @@ abstract class BaseCategoryPeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in CategoryDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CategoryDescPeer::clearInstancePool();
// Invalidate objects in ProductCategoryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ProductCategoryPeer::clearInstancePool();
@@ -424,6 +428,9 @@ abstract class BaseCategoryPeer
// Invalidate objects in RewritingPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
RewritingPeer::clearInstancePool();
+ // Invalidate objects in CategoryI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CategoryI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseCategoryQuery.php b/core/lib/Thelia/Model/om/BaseCategoryQuery.php
index ecd750e09..c1f2703b1 100644
--- a/core/lib/Thelia/Model/om/BaseCategoryQuery.php
+++ b/core/lib/Thelia/Model/om/BaseCategoryQuery.php
@@ -14,7 +14,7 @@ use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\AttributeCategory;
use Thelia\Model\Category;
-use Thelia\Model\CategoryDesc;
+use Thelia\Model\CategoryI18n;
use Thelia\Model\CategoryPeer;
use Thelia\Model\CategoryQuery;
use Thelia\Model\ContentAssoc;
@@ -49,10 +49,6 @@ use Thelia\Model\Rewriting;
* @method CategoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CategoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method CategoryQuery leftJoinCategoryDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryDesc relation
- * @method CategoryQuery rightJoinCategoryDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryDesc relation
- * @method CategoryQuery innerJoinCategoryDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryDesc relation
- *
* @method CategoryQuery leftJoinProductCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductCategory relation
* @method CategoryQuery rightJoinProductCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductCategory relation
* @method CategoryQuery innerJoinProductCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductCategory relation
@@ -81,6 +77,10 @@ use Thelia\Model\Rewriting;
* @method CategoryQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation
* @method CategoryQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation
*
+ * @method CategoryQuery leftJoinCategoryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryI18n relation
+ * @method CategoryQuery rightJoinCategoryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryI18n relation
+ * @method CategoryQuery innerJoinCategoryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryI18n relation
+ *
* @method Category findOne(PropelPDO $con = null) Return the first Category matching the query
* @method Category findOneOrCreate(PropelPDO $con = null) Return the first Category matching the query, or a new Category object populated from the query conditions when no match is found
*
@@ -542,80 +542,6 @@ abstract class BaseCategoryQuery extends ModelCriteria
return $this->addUsingAlias(CategoryPeer::UPDATED_AT, $updatedAt, $comparison);
}
- /**
- * Filter the query by a related CategoryDesc object
- *
- * @param CategoryDesc|PropelObjectCollection $categoryDesc 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
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByCategoryDesc($categoryDesc, $comparison = null)
- {
- if ($categoryDesc instanceof CategoryDesc) {
- return $this
- ->addUsingAlias(CategoryPeer::ID, $categoryDesc->getCategoryId(), $comparison);
- } elseif ($categoryDesc instanceof PropelObjectCollection) {
- return $this
- ->useCategoryDescQuery()
- ->filterByPrimaryKeys($categoryDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByCategoryDesc() only accepts arguments of type CategoryDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the CategoryDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CategoryQuery The current query, for fluid interface
- */
- public function joinCategoryDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CategoryDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'CategoryDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the CategoryDesc relation CategoryDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\CategoryDescQuery A secondary query class using the current class as primary query
- */
- public function useCategoryDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCategoryDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CategoryDesc', '\Thelia\Model\CategoryDescQuery');
- }
-
/**
* Filter the query by a related ProductCategory object
*
@@ -1134,6 +1060,80 @@ abstract class BaseCategoryQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery');
}
+ /**
+ * Filter the query by a related CategoryI18n object
+ *
+ * @param CategoryI18n|PropelObjectCollection $categoryI18n 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCategoryI18n($categoryI18n, $comparison = null)
+ {
+ if ($categoryI18n instanceof CategoryI18n) {
+ return $this
+ ->addUsingAlias(CategoryPeer::ID, $categoryI18n->getId(), $comparison);
+ } elseif ($categoryI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useCategoryI18nQuery()
+ ->filterByPrimaryKeys($categoryI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCategoryI18n() only accepts arguments of type CategoryI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CategoryI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CategoryQuery The current query, for fluid interface
+ */
+ public function joinCategoryI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CategoryI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CategoryI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CategoryI18n relation CategoryI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\CategoryI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useCategoryI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinCategoryI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CategoryI18n', '\Thelia\Model\CategoryI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -1215,4 +1215,61 @@ abstract class BaseCategoryQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(CategoryPeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return CategoryQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'CategoryI18n';
+
+ return $this
+ ->joinCategoryI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return CategoryQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('CategoryI18n');
+ $this->with['CategoryI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return CategoryI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CategoryI18n', 'Thelia\Model\CategoryI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseConfig.php b/core/lib/Thelia/Model/om/BaseConfig.php
index e3b0471c4..f096247eb 100644
--- a/core/lib/Thelia/Model/om/BaseConfig.php
+++ b/core/lib/Thelia/Model/om/BaseConfig.php
@@ -16,8 +16,8 @@ use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Config;
-use Thelia\Model\ConfigDesc;
-use Thelia\Model\ConfigDescQuery;
+use Thelia\Model\ConfigI18n;
+use Thelia\Model\ConfigI18nQuery;
use Thelia\Model\ConfigPeer;
use Thelia\Model\ConfigQuery;
@@ -94,10 +94,10 @@ abstract class BaseConfig extends BaseObject implements Persistent
protected $updated_at;
/**
- * @var PropelObjectCollection|ConfigDesc[] Collection to store aggregation of ConfigDesc objects.
+ * @var PropelObjectCollection|ConfigI18n[] Collection to store aggregation of ConfigI18n objects.
*/
- protected $collConfigDescs;
- protected $collConfigDescsPartial;
+ protected $collConfigI18ns;
+ protected $collConfigI18nsPartial;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -113,11 +113,25 @@ abstract class BaseConfig extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
+ /**
+ * Current locale
+ * @var string
+ */
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[ConfigI18n]
+ */
+ protected $currentTranslations;
+
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
- protected $configDescsScheduledForDeletion = null;
+ protected $configI18nsScheduledForDeletion = null;
/**
* Applies default values to this object.
@@ -533,7 +547,7 @@ abstract class BaseConfig extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
- $this->collConfigDescs = null;
+ $this->collConfigI18ns = null;
} // if (deep)
}
@@ -670,17 +684,17 @@ abstract class BaseConfig extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->configDescsScheduledForDeletion !== null) {
- if (!$this->configDescsScheduledForDeletion->isEmpty()) {
- ConfigDescQuery::create()
- ->filterByPrimaryKeys($this->configDescsScheduledForDeletion->getPrimaryKeys(false))
+ if ($this->configI18nsScheduledForDeletion !== null) {
+ if (!$this->configI18nsScheduledForDeletion->isEmpty()) {
+ ConfigI18nQuery::create()
+ ->filterByPrimaryKeys($this->configI18nsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
- $this->configDescsScheduledForDeletion = null;
+ $this->configI18nsScheduledForDeletion = null;
}
}
- if ($this->collConfigDescs !== null) {
- foreach ($this->collConfigDescs as $referrerFK) {
+ if ($this->collConfigI18ns !== null) {
+ foreach ($this->collConfigI18ns as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
@@ -865,8 +879,8 @@ abstract class BaseConfig extends BaseObject implements Persistent
}
- if ($this->collConfigDescs !== null) {
- foreach ($this->collConfigDescs as $referrerFK) {
+ if ($this->collConfigI18ns !== null) {
+ foreach ($this->collConfigI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -967,8 +981,8 @@ abstract class BaseConfig extends BaseObject implements Persistent
$keys[6] => $this->getUpdatedAt(),
);
if ($includeForeignObjects) {
- if (null !== $this->collConfigDescs) {
- $result['ConfigDescs'] = $this->collConfigDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ if (null !== $this->collConfigI18ns) {
+ $result['ConfigI18ns'] = $this->collConfigI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
@@ -1151,9 +1165,9 @@ abstract class BaseConfig extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getConfigDescs() as $relObj) {
+ foreach ($this->getConfigI18ns() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addConfigDesc($relObj->copy($deepCopy));
+ $copyObj->addConfigI18n($relObj->copy($deepCopy));
}
}
@@ -1218,40 +1232,40 @@ abstract class BaseConfig extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('ConfigDesc' == $relationName) {
- $this->initConfigDescs();
+ if ('ConfigI18n' == $relationName) {
+ $this->initConfigI18ns();
}
}
/**
- * Clears out the collConfigDescs collection
+ * Clears out the collConfigI18ns collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
- * @see addConfigDescs()
+ * @see addConfigI18ns()
*/
- public function clearConfigDescs()
+ public function clearConfigI18ns()
{
- $this->collConfigDescs = null; // important to set this to null since that means it is uninitialized
- $this->collConfigDescsPartial = null;
+ $this->collConfigI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collConfigI18nsPartial = null;
}
/**
- * reset is the collConfigDescs collection loaded partially
+ * reset is the collConfigI18ns collection loaded partially
*
* @return void
*/
- public function resetPartialConfigDescs($v = true)
+ public function resetPartialConfigI18ns($v = true)
{
- $this->collConfigDescsPartial = $v;
+ $this->collConfigI18nsPartial = $v;
}
/**
- * Initializes the collConfigDescs collection.
+ * Initializes the collConfigI18ns collection.
*
- * By default this just sets the collConfigDescs collection to an empty array (like clearcollConfigDescs());
+ * By default this just sets the collConfigI18ns collection to an empty array (like clearcollConfigI18ns());
* 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.
*
@@ -1260,17 +1274,17 @@ abstract class BaseConfig extends BaseObject implements Persistent
*
* @return void
*/
- public function initConfigDescs($overrideExisting = true)
+ public function initConfigI18ns($overrideExisting = true)
{
- if (null !== $this->collConfigDescs && !$overrideExisting) {
+ if (null !== $this->collConfigI18ns && !$overrideExisting) {
return;
}
- $this->collConfigDescs = new PropelObjectCollection();
- $this->collConfigDescs->setModel('ConfigDesc');
+ $this->collConfigI18ns = new PropelObjectCollection();
+ $this->collConfigI18ns->setModel('ConfigI18n');
}
/**
- * Gets an array of ConfigDesc objects which contain a foreign key that references this object.
+ * Gets an array of ConfigI18n objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
@@ -1280,98 +1294,98 @@ abstract class BaseConfig extends BaseObject implements Persistent
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|ConfigDesc[] List of ConfigDesc objects
+ * @return PropelObjectCollection|ConfigI18n[] List of ConfigI18n objects
* @throws PropelException
*/
- public function getConfigDescs($criteria = null, PropelPDO $con = null)
+ public function getConfigI18ns($criteria = null, PropelPDO $con = null)
{
- $partial = $this->collConfigDescsPartial && !$this->isNew();
- if (null === $this->collConfigDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collConfigDescs) {
+ $partial = $this->collConfigI18nsPartial && !$this->isNew();
+ if (null === $this->collConfigI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collConfigI18ns) {
// return empty collection
- $this->initConfigDescs();
+ $this->initConfigI18ns();
} else {
- $collConfigDescs = ConfigDescQuery::create(null, $criteria)
+ $collConfigI18ns = ConfigI18nQuery::create(null, $criteria)
->filterByConfig($this)
->find($con);
if (null !== $criteria) {
- if (false !== $this->collConfigDescsPartial && count($collConfigDescs)) {
- $this->initConfigDescs(false);
+ if (false !== $this->collConfigI18nsPartial && count($collConfigI18ns)) {
+ $this->initConfigI18ns(false);
- foreach($collConfigDescs as $obj) {
- if (false == $this->collConfigDescs->contains($obj)) {
- $this->collConfigDescs->append($obj);
+ foreach($collConfigI18ns as $obj) {
+ if (false == $this->collConfigI18ns->contains($obj)) {
+ $this->collConfigI18ns->append($obj);
}
}
- $this->collConfigDescsPartial = true;
+ $this->collConfigI18nsPartial = true;
}
- return $collConfigDescs;
+ return $collConfigI18ns;
}
- if($partial && $this->collConfigDescs) {
- foreach($this->collConfigDescs as $obj) {
+ if($partial && $this->collConfigI18ns) {
+ foreach($this->collConfigI18ns as $obj) {
if($obj->isNew()) {
- $collConfigDescs[] = $obj;
+ $collConfigI18ns[] = $obj;
}
}
}
- $this->collConfigDescs = $collConfigDescs;
- $this->collConfigDescsPartial = false;
+ $this->collConfigI18ns = $collConfigI18ns;
+ $this->collConfigI18nsPartial = false;
}
}
- return $this->collConfigDescs;
+ return $this->collConfigI18ns;
}
/**
- * Sets a collection of ConfigDesc objects related by a one-to-many relationship
+ * Sets a collection of ConfigI18n objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
- * @param PropelCollection $configDescs A Propel collection.
+ * @param PropelCollection $configI18ns A Propel collection.
* @param PropelPDO $con Optional connection object
*/
- public function setConfigDescs(PropelCollection $configDescs, PropelPDO $con = null)
+ public function setConfigI18ns(PropelCollection $configI18ns, PropelPDO $con = null)
{
- $this->configDescsScheduledForDeletion = $this->getConfigDescs(new Criteria(), $con)->diff($configDescs);
+ $this->configI18nsScheduledForDeletion = $this->getConfigI18ns(new Criteria(), $con)->diff($configI18ns);
- foreach ($this->configDescsScheduledForDeletion as $configDescRemoved) {
- $configDescRemoved->setConfig(null);
+ foreach ($this->configI18nsScheduledForDeletion as $configI18nRemoved) {
+ $configI18nRemoved->setConfig(null);
}
- $this->collConfigDescs = null;
- foreach ($configDescs as $configDesc) {
- $this->addConfigDesc($configDesc);
+ $this->collConfigI18ns = null;
+ foreach ($configI18ns as $configI18n) {
+ $this->addConfigI18n($configI18n);
}
- $this->collConfigDescs = $configDescs;
- $this->collConfigDescsPartial = false;
+ $this->collConfigI18ns = $configI18ns;
+ $this->collConfigI18nsPartial = false;
}
/**
- * Returns the number of related ConfigDesc objects.
+ * Returns the number of related ConfigI18n objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
- * @return int Count of related ConfigDesc objects.
+ * @return int Count of related ConfigI18n objects.
* @throws PropelException
*/
- public function countConfigDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ public function countConfigI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
- $partial = $this->collConfigDescsPartial && !$this->isNew();
- if (null === $this->collConfigDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collConfigDescs) {
+ $partial = $this->collConfigI18nsPartial && !$this->isNew();
+ if (null === $this->collConfigI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collConfigI18ns) {
return 0;
} else {
if($partial && !$criteria) {
- return count($this->getConfigDescs());
+ return count($this->getConfigI18ns());
}
- $query = ConfigDescQuery::create(null, $criteria);
+ $query = ConfigI18nQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -1381,52 +1395,56 @@ abstract class BaseConfig extends BaseObject implements Persistent
->count($con);
}
} else {
- return count($this->collConfigDescs);
+ return count($this->collConfigI18ns);
}
}
/**
- * Method called to associate a ConfigDesc object to this object
- * through the ConfigDesc foreign key attribute.
+ * Method called to associate a ConfigI18n object to this object
+ * through the ConfigI18n foreign key attribute.
*
- * @param ConfigDesc $l ConfigDesc
+ * @param ConfigI18n $l ConfigI18n
* @return Config The current object (for fluent API support)
*/
- public function addConfigDesc(ConfigDesc $l)
+ public function addConfigI18n(ConfigI18n $l)
{
- if ($this->collConfigDescs === null) {
- $this->initConfigDescs();
- $this->collConfigDescsPartial = true;
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
}
- if (!$this->collConfigDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddConfigDesc($l);
+ if ($this->collConfigI18ns === null) {
+ $this->initConfigI18ns();
+ $this->collConfigI18nsPartial = true;
+ }
+ if (!$this->collConfigI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddConfigI18n($l);
}
return $this;
}
/**
- * @param ConfigDesc $configDesc The configDesc object to add.
+ * @param ConfigI18n $configI18n The configI18n object to add.
*/
- protected function doAddConfigDesc($configDesc)
+ protected function doAddConfigI18n($configI18n)
{
- $this->collConfigDescs[]= $configDesc;
- $configDesc->setConfig($this);
+ $this->collConfigI18ns[]= $configI18n;
+ $configI18n->setConfig($this);
}
/**
- * @param ConfigDesc $configDesc The configDesc object to remove.
+ * @param ConfigI18n $configI18n The configI18n object to remove.
*/
- public function removeConfigDesc($configDesc)
+ public function removeConfigI18n($configI18n)
{
- if ($this->getConfigDescs()->contains($configDesc)) {
- $this->collConfigDescs->remove($this->collConfigDescs->search($configDesc));
- if (null === $this->configDescsScheduledForDeletion) {
- $this->configDescsScheduledForDeletion = clone $this->collConfigDescs;
- $this->configDescsScheduledForDeletion->clear();
+ if ($this->getConfigI18ns()->contains($configI18n)) {
+ $this->collConfigI18ns->remove($this->collConfigI18ns->search($configI18n));
+ if (null === $this->configI18nsScheduledForDeletion) {
+ $this->configI18nsScheduledForDeletion = clone $this->collConfigI18ns;
+ $this->configI18nsScheduledForDeletion->clear();
}
- $this->configDescsScheduledForDeletion[]= $configDesc;
- $configDesc->setConfig(null);
+ $this->configI18nsScheduledForDeletion[]= $configI18n;
+ $configI18n->setConfig(null);
}
}
@@ -1463,17 +1481,21 @@ abstract class BaseConfig extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collConfigDescs) {
- foreach ($this->collConfigDescs as $o) {
+ if ($this->collConfigI18ns) {
+ foreach ($this->collConfigI18ns as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep)
- if ($this->collConfigDescs instanceof PropelCollection) {
- $this->collConfigDescs->clearIterator();
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
+ if ($this->collConfigI18ns instanceof PropelCollection) {
+ $this->collConfigI18ns->clearIterator();
}
- $this->collConfigDescs = null;
+ $this->collConfigI18ns = null;
}
/**
@@ -1510,4 +1532,199 @@ abstract class BaseConfig extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Config The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ConfigI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collConfigI18ns) {
+ foreach ($this->collConfigI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new ConfigI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = ConfigI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addConfigI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Config The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ ConfigI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collConfigI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collConfigI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ConfigI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return ConfigI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return ConfigI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return ConfigI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return ConfigI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseConfigI18n.php b/core/lib/Thelia/Model/om/BaseConfigI18n.php
new file mode 100644
index 000000000..52461ff38
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseConfigI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseConfigI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return ConfigI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = ConfigI18nPeer::ID;
+ }
+
+ if ($this->aConfig !== null && $this->aConfig->getId() !== $v) {
+ $this->aConfig = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return ConfigI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = ConfigI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return ConfigI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = ConfigI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return ConfigI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = ConfigI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return ConfigI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = ConfigI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return ConfigI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = ConfigI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = ConfigI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating ConfigI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aConfig !== null && $this->id !== $this->aConfig->getId()) {
+ $this->aConfig = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = ConfigI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aConfig = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ConfigI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ ConfigI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aConfig !== null) {
+ if ($this->aConfig->isModified() || $this->aConfig->isNew()) {
+ $affectedRows += $this->aConfig->save($con);
+ }
+ $this->setConfig($this->aConfig);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ConfigI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(ConfigI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(ConfigI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(ConfigI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(ConfigI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(ConfigI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `config_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aConfig !== null) {
+ if (!$this->aConfig->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aConfig->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = ConfigI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ConfigI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['ConfigI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ConfigI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = ConfigI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aConfig) {
+ $result['Config'] = $this->aConfig->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ConfigI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = ConfigI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(ConfigI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(ConfigI18nPeer::ID)) $criteria->add(ConfigI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(ConfigI18nPeer::LOCALE)) $criteria->add(ConfigI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(ConfigI18nPeer::TITLE)) $criteria->add(ConfigI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(ConfigI18nPeer::DESCRIPTION)) $criteria->add(ConfigI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(ConfigI18nPeer::CHAPO)) $criteria->add(ConfigI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(ConfigI18nPeer::POSTSCRIPTUM)) $criteria->add(ConfigI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(ConfigI18nPeer::DATABASE_NAME);
+ $criteria->add(ConfigI18nPeer::ID, $this->id);
+ $criteria->add(ConfigI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of ConfigI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return ConfigI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return ConfigI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new ConfigI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Config object.
+ *
+ * @param Config $v
+ * @return ConfigI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setConfig(Config $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aConfig = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Config object, it will not be re-added.
+ if ($v !== null) {
+ $v->addConfigI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Config object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Config The associated Config object.
+ * @throws PropelException
+ */
+ public function getConfig(PropelPDO $con = null)
+ {
+ if ($this->aConfig === null && ($this->id !== null)) {
+ $this->aConfig = ConfigQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aConfig->addConfigI18ns($this);
+ */
+ }
+
+ return $this->aConfig;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aConfig = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ConfigI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseConfigI18nPeer.php b/core/lib/Thelia/Model/om/BaseConfigI18nPeer.php
new file mode 100644
index 000000000..60ab73730
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseConfigI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (ConfigI18nPeer::ID, ConfigI18nPeer::LOCALE, ConfigI18nPeer::TITLE, ConfigI18nPeer::DESCRIPTION, ConfigI18nPeer::CHAPO, ConfigI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. ConfigI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (ConfigI18nPeer::ID => 0, ConfigI18nPeer::LOCALE => 1, ConfigI18nPeer::TITLE => 2, ConfigI18nPeer::DESCRIPTION => 3, ConfigI18nPeer::CHAPO => 4, ConfigI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = ConfigI18nPeer::getFieldNames($toType);
+ $key = isset(ConfigI18nPeer::$fieldKeys[$fromType][$name]) ? ConfigI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ConfigI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, ConfigI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return ConfigI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. ConfigI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(ConfigI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(ConfigI18nPeer::ID);
+ $criteria->addSelectColumn(ConfigI18nPeer::LOCALE);
+ $criteria->addSelectColumn(ConfigI18nPeer::TITLE);
+ $criteria->addSelectColumn(ConfigI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(ConfigI18nPeer::CHAPO);
+ $criteria->addSelectColumn(ConfigI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ConfigI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ConfigI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(ConfigI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return ConfigI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = ConfigI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return ConfigI18nPeer::populateObjects(ConfigI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ ConfigI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ConfigI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param ConfigI18n $obj A ConfigI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ ConfigI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A ConfigI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof ConfigI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ConfigI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(ConfigI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return ConfigI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(ConfigI18nPeer::$instances[$key])) {
+ return ConfigI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ ConfigI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to config_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = ConfigI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = ConfigI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = ConfigI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ ConfigI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (ConfigI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = ConfigI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = ConfigI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + ConfigI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ConfigI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ ConfigI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Config table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinConfig(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ConfigI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ConfigI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ConfigI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ConfigI18nPeer::ID, ConfigPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of ConfigI18n objects pre-filled with their Config objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ConfigI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinConfig(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ConfigI18nPeer::DATABASE_NAME);
+ }
+
+ ConfigI18nPeer::addSelectColumns($criteria);
+ $startcol = ConfigI18nPeer::NUM_HYDRATE_COLUMNS;
+ ConfigPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(ConfigI18nPeer::ID, ConfigPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ConfigI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ConfigI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = ConfigI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ConfigI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = ConfigPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = ConfigPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = ConfigPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ ConfigPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (ConfigI18n) to $obj2 (Config)
+ $obj2->addConfigI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ConfigI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ConfigI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ConfigI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ConfigI18nPeer::ID, ConfigPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of ConfigI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ConfigI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ConfigI18nPeer::DATABASE_NAME);
+ }
+
+ ConfigI18nPeer::addSelectColumns($criteria);
+ $startcol2 = ConfigI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ ConfigPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + ConfigPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(ConfigI18nPeer::ID, ConfigPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ConfigI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ConfigI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = ConfigI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ConfigI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Config rows
+
+ $key2 = ConfigPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = ConfigPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = ConfigPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ ConfigPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (ConfigI18n) to the collection in $obj2 (Config)
+ $obj2->addConfigI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(ConfigI18nPeer::DATABASE_NAME)->getTable(ConfigI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseConfigI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseConfigI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new ConfigI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return ConfigI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ConfigI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or ConfigI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from ConfigI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(ConfigI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a ConfigI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or ConfigI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(ConfigI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(ConfigI18nPeer::ID);
+ $value = $criteria->remove(ConfigI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(ConfigI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ConfigI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(ConfigI18nPeer::LOCALE);
+ $value = $criteria->remove(ConfigI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(ConfigI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ConfigI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is ConfigI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(ConfigI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the config_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(ConfigI18nPeer::TABLE_NAME, $con, ConfigI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ ConfigI18nPeer::clearInstancePool();
+ ConfigI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ConfigI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ConfigI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ ConfigI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof ConfigI18n) { // it's a model object
+ // invalidate the cache for this single object
+ ConfigI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(ConfigI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(ConfigI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(ConfigI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ ConfigI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ConfigI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ ConfigI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given ConfigI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param ConfigI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(ConfigI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(ConfigI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(ConfigI18nPeer::DATABASE_NAME, ConfigI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return ConfigI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = ConfigI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(ConfigI18nPeer::DATABASE_NAME);
+ $criteria->add(ConfigI18nPeer::ID, $id);
+ $criteria->add(ConfigI18nPeer::LOCALE, $locale);
+ $v = ConfigI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseConfigI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseConfigI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseConfigI18nQuery.php b/core/lib/Thelia/Model/om/BaseConfigI18nQuery.php
new file mode 100644
index 000000000..4d61c7189
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseConfigI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ConfigI18n|ConfigI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ConfigI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(ConfigI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ConfigI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `config_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new ConfigI18n();
+ $obj->hydrate($row);
+ ConfigI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ConfigI18n|ConfigI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|ConfigI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ConfigI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(ConfigI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(ConfigI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ConfigI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(ConfigI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(ConfigI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByConfig()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ConfigI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(ConfigI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ConfigI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ConfigI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ConfigI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ConfigI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ConfigI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ConfigI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ConfigI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ConfigI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ConfigI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ConfigI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Config object
+ *
+ * @param Config|PropelObjectCollection $config The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ConfigI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByConfig($config, $comparison = null)
+ {
+ if ($config instanceof Config) {
+ return $this
+ ->addUsingAlias(ConfigI18nPeer::ID, $config->getId(), $comparison);
+ } elseif ($config instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ConfigI18nPeer::ID, $config->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByConfig() only accepts arguments of type Config or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Config relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ConfigI18nQuery The current query, for fluid interface
+ */
+ public function joinConfig($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Config');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Config');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Config relation Config object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\ConfigQuery A secondary query class using the current class as primary query
+ */
+ public function useConfigQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinConfig($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Config', '\Thelia\Model\ConfigQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ConfigI18n $configI18n Object to remove from the list of results
+ *
+ * @return ConfigI18nQuery The current query, for fluid interface
+ */
+ public function prune($configI18n = null)
+ {
+ if ($configI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(ConfigI18nPeer::ID), $configI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(ConfigI18nPeer::LOCALE), $configI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseConfigPeer.php b/core/lib/Thelia/Model/om/BaseConfigPeer.php
index d2f78624a..7fe75b370 100644
--- a/core/lib/Thelia/Model/om/BaseConfigPeer.php
+++ b/core/lib/Thelia/Model/om/BaseConfigPeer.php
@@ -10,7 +10,7 @@ use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\Config;
-use Thelia\Model\ConfigDescPeer;
+use Thelia\Model\ConfigI18nPeer;
use Thelia\Model\ConfigPeer;
use Thelia\Model\map\ConfigTableMap;
@@ -78,6 +78,13 @@ abstract class BaseConfigPeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -393,9 +400,9 @@ abstract class BaseConfigPeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in ConfigDescPeer instance pool,
+ // Invalidate objects in ConfigI18nPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- ConfigDescPeer::clearInstancePool();
+ ConfigI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseConfigQuery.php b/core/lib/Thelia/Model/om/BaseConfigQuery.php
index 6a34c3ba5..a39b03dcb 100644
--- a/core/lib/Thelia/Model/om/BaseConfigQuery.php
+++ b/core/lib/Thelia/Model/om/BaseConfigQuery.php
@@ -13,7 +13,7 @@ use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Config;
-use Thelia\Model\ConfigDesc;
+use Thelia\Model\ConfigI18n;
use Thelia\Model\ConfigPeer;
use Thelia\Model\ConfigQuery;
@@ -42,9 +42,9 @@ use Thelia\Model\ConfigQuery;
* @method ConfigQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ConfigQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method ConfigQuery leftJoinConfigDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ConfigDesc relation
- * @method ConfigQuery rightJoinConfigDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ConfigDesc relation
- * @method ConfigQuery innerJoinConfigDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the ConfigDesc relation
+ * @method ConfigQuery leftJoinConfigI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ConfigI18n relation
+ * @method ConfigQuery rightJoinConfigI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ConfigI18n relation
+ * @method ConfigQuery innerJoinConfigI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ConfigI18n relation
*
* @method Config findOne(PropelPDO $con = null) Return the first Config matching the query
* @method Config findOneOrCreate(PropelPDO $con = null) Return the first Config matching the query, or a new Config object populated from the query conditions when no match is found
@@ -496,41 +496,41 @@ abstract class BaseConfigQuery extends ModelCriteria
}
/**
- * Filter the query by a related ConfigDesc object
+ * Filter the query by a related ConfigI18n object
*
- * @param ConfigDesc|PropelObjectCollection $configDesc the related object to use as filter
+ * @param ConfigI18n|PropelObjectCollection $configI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ConfigQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
- public function filterByConfigDesc($configDesc, $comparison = null)
+ public function filterByConfigI18n($configI18n, $comparison = null)
{
- if ($configDesc instanceof ConfigDesc) {
+ if ($configI18n instanceof ConfigI18n) {
return $this
- ->addUsingAlias(ConfigPeer::ID, $configDesc->getConfigId(), $comparison);
- } elseif ($configDesc instanceof PropelObjectCollection) {
+ ->addUsingAlias(ConfigPeer::ID, $configI18n->getId(), $comparison);
+ } elseif ($configI18n instanceof PropelObjectCollection) {
return $this
- ->useConfigDescQuery()
- ->filterByPrimaryKeys($configDesc->getPrimaryKeys())
+ ->useConfigI18nQuery()
+ ->filterByPrimaryKeys($configI18n->getPrimaryKeys())
->endUse();
} else {
- throw new PropelException('filterByConfigDesc() only accepts arguments of type ConfigDesc or PropelCollection');
+ throw new PropelException('filterByConfigI18n() only accepts arguments of type ConfigI18n or PropelCollection');
}
}
/**
- * Adds a JOIN clause to the query using the ConfigDesc relation
+ * Adds a JOIN clause to the query using the ConfigI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ConfigQuery The current query, for fluid interface
*/
- public function joinConfigDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function joinConfigI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('ConfigDesc');
+ $relationMap = $tableMap->getRelation('ConfigI18n');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -545,14 +545,14 @@ abstract class BaseConfigQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
- $this->addJoinObject($join, 'ConfigDesc');
+ $this->addJoinObject($join, 'ConfigI18n');
}
return $this;
}
/**
- * Use the ConfigDesc relation ConfigDesc object
+ * Use the ConfigI18n relation ConfigI18n object
*
* @see useQuery()
*
@@ -560,13 +560,13 @@ abstract class BaseConfigQuery extends ModelCriteria
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
- * @return \Thelia\Model\ConfigDescQuery A secondary query class using the current class as primary query
+ * @return \Thelia\Model\ConfigI18nQuery A secondary query class using the current class as primary query
*/
- public function useConfigDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function useConfigI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
- ->joinConfigDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'ConfigDesc', '\Thelia\Model\ConfigDescQuery');
+ ->joinConfigI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ConfigI18n', '\Thelia\Model\ConfigI18nQuery');
}
/**
@@ -650,4 +650,61 @@ abstract class BaseConfigQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(ConfigPeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ConfigQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'ConfigI18n';
+
+ return $this
+ ->joinConfigI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ConfigQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('ConfigI18n');
+ $this->with['ConfigI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ConfigI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ConfigI18n', 'Thelia\Model\ConfigI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseContent.php b/core/lib/Thelia/Model/om/BaseContent.php
index efe3e5177..fd45d585f 100644
--- a/core/lib/Thelia/Model/om/BaseContent.php
+++ b/core/lib/Thelia/Model/om/BaseContent.php
@@ -18,10 +18,10 @@ use \PropelPDO;
use Thelia\Model\Content;
use Thelia\Model\ContentAssoc;
use Thelia\Model\ContentAssocQuery;
-use Thelia\Model\ContentDesc;
-use Thelia\Model\ContentDescQuery;
use Thelia\Model\ContentFolder;
use Thelia\Model\ContentFolderQuery;
+use Thelia\Model\ContentI18n;
+use Thelia\Model\ContentI18nQuery;
use Thelia\Model\ContentPeer;
use Thelia\Model\ContentQuery;
use Thelia\Model\Document;
@@ -89,12 +89,6 @@ abstract class BaseContent extends BaseObject implements Persistent
*/
protected $updated_at;
- /**
- * @var PropelObjectCollection|ContentDesc[] Collection to store aggregation of ContentDesc objects.
- */
- protected $collContentDescs;
- protected $collContentDescsPartial;
-
/**
* @var PropelObjectCollection|ContentAssoc[] Collection to store aggregation of ContentAssoc objects.
*/
@@ -125,6 +119,12 @@ abstract class BaseContent extends BaseObject implements Persistent
protected $collContentFolders;
protected $collContentFoldersPartial;
+ /**
+ * @var PropelObjectCollection|ContentI18n[] Collection to store aggregation of ContentI18n objects.
+ */
+ protected $collContentI18ns;
+ protected $collContentI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -139,11 +139,19 @@ abstract class BaseContent extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $contentDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[ContentI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -175,6 +183,12 @@ abstract class BaseContent extends BaseObject implements Persistent
*/
protected $contentFoldersScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $contentI18nsScheduledForDeletion = null;
+
/**
* Get the [id] column value.
*
@@ -495,8 +509,6 @@ abstract class BaseContent extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
- $this->collContentDescs = null;
-
$this->collContentAssocs = null;
$this->collImages = null;
@@ -507,6 +519,8 @@ abstract class BaseContent extends BaseObject implements Persistent
$this->collContentFolders = null;
+ $this->collContentI18ns = null;
+
} // if (deep)
}
@@ -642,23 +656,6 @@ abstract class BaseContent extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->contentDescsScheduledForDeletion !== null) {
- if (!$this->contentDescsScheduledForDeletion->isEmpty()) {
- ContentDescQuery::create()
- ->filterByPrimaryKeys($this->contentDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->contentDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collContentDescs !== null) {
- foreach ($this->collContentDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->contentAssocsScheduledForDeletion !== null) {
if (!$this->contentAssocsScheduledForDeletion->isEmpty()) {
foreach ($this->contentAssocsScheduledForDeletion as $contentAssoc) {
@@ -748,6 +745,23 @@ abstract class BaseContent extends BaseObject implements Persistent
}
}
+ if ($this->contentI18nsScheduledForDeletion !== null) {
+ if (!$this->contentI18nsScheduledForDeletion->isEmpty()) {
+ ContentI18nQuery::create()
+ ->filterByPrimaryKeys($this->contentI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->contentI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collContentI18ns !== null) {
+ foreach ($this->collContentI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -914,14 +928,6 @@ abstract class BaseContent extends BaseObject implements Persistent
}
- if ($this->collContentDescs !== null) {
- foreach ($this->collContentDescs as $referrerFK) {
- if (!$referrerFK->validate($columns)) {
- $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
- }
- }
- }
-
if ($this->collContentAssocs !== null) {
foreach ($this->collContentAssocs as $referrerFK) {
if (!$referrerFK->validate($columns)) {
@@ -962,6 +968,14 @@ abstract class BaseContent extends BaseObject implements Persistent
}
}
+ if ($this->collContentI18ns !== null) {
+ foreach ($this->collContentI18ns as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
$this->alreadyInValidation = false;
}
@@ -1048,9 +1062,6 @@ abstract class BaseContent extends BaseObject implements Persistent
$keys[4] => $this->getUpdatedAt(),
);
if ($includeForeignObjects) {
- if (null !== $this->collContentDescs) {
- $result['ContentDescs'] = $this->collContentDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collContentAssocs) {
$result['ContentAssocs'] = $this->collContentAssocs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1066,6 +1077,9 @@ abstract class BaseContent extends BaseObject implements Persistent
if (null !== $this->collContentFolders) {
$result['ContentFolders'] = $this->collContentFolders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collContentI18ns) {
+ $result['ContentI18ns'] = $this->collContentI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1235,12 +1249,6 @@ abstract class BaseContent extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getContentDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addContentDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getContentAssocs() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addContentAssoc($relObj->copy($deepCopy));
@@ -1271,6 +1279,12 @@ abstract class BaseContent extends BaseObject implements Persistent
}
}
+ foreach ($this->getContentI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addContentI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1332,9 +1346,6 @@ abstract class BaseContent extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('ContentDesc' == $relationName) {
- $this->initContentDescs();
- }
if ('ContentAssoc' == $relationName) {
$this->initContentAssocs();
}
@@ -1350,212 +1361,8 @@ abstract class BaseContent extends BaseObject implements Persistent
if ('ContentFolder' == $relationName) {
$this->initContentFolders();
}
- }
-
- /**
- * Clears out the collContentDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addContentDescs()
- */
- public function clearContentDescs()
- {
- $this->collContentDescs = null; // important to set this to null since that means it is uninitialized
- $this->collContentDescsPartial = null;
- }
-
- /**
- * reset is the collContentDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialContentDescs($v = true)
- {
- $this->collContentDescsPartial = $v;
- }
-
- /**
- * Initializes the collContentDescs collection.
- *
- * By default this just sets the collContentDescs collection to an empty array (like clearcollContentDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initContentDescs($overrideExisting = true)
- {
- if (null !== $this->collContentDescs && !$overrideExisting) {
- return;
- }
- $this->collContentDescs = new PropelObjectCollection();
- $this->collContentDescs->setModel('ContentDesc');
- }
-
- /**
- * Gets an array of ContentDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * 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 Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|ContentDesc[] List of ContentDesc objects
- * @throws PropelException
- */
- public function getContentDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collContentDescsPartial && !$this->isNew();
- if (null === $this->collContentDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collContentDescs) {
- // return empty collection
- $this->initContentDescs();
- } else {
- $collContentDescs = ContentDescQuery::create(null, $criteria)
- ->filterByContent($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collContentDescsPartial && count($collContentDescs)) {
- $this->initContentDescs(false);
-
- foreach($collContentDescs as $obj) {
- if (false == $this->collContentDescs->contains($obj)) {
- $this->collContentDescs->append($obj);
- }
- }
-
- $this->collContentDescsPartial = true;
- }
-
- return $collContentDescs;
- }
-
- if($partial && $this->collContentDescs) {
- foreach($this->collContentDescs as $obj) {
- if($obj->isNew()) {
- $collContentDescs[] = $obj;
- }
- }
- }
-
- $this->collContentDescs = $collContentDescs;
- $this->collContentDescsPartial = false;
- }
- }
-
- return $this->collContentDescs;
- }
-
- /**
- * Sets a collection of ContentDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $contentDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setContentDescs(PropelCollection $contentDescs, PropelPDO $con = null)
- {
- $this->contentDescsScheduledForDeletion = $this->getContentDescs(new Criteria(), $con)->diff($contentDescs);
-
- foreach ($this->contentDescsScheduledForDeletion as $contentDescRemoved) {
- $contentDescRemoved->setContent(null);
- }
-
- $this->collContentDescs = null;
- foreach ($contentDescs as $contentDesc) {
- $this->addContentDesc($contentDesc);
- }
-
- $this->collContentDescs = $contentDescs;
- $this->collContentDescsPartial = false;
- }
-
- /**
- * Returns the number of related ContentDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related ContentDesc objects.
- * @throws PropelException
- */
- public function countContentDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collContentDescsPartial && !$this->isNew();
- if (null === $this->collContentDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collContentDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getContentDescs());
- }
- $query = ContentDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByContent($this)
- ->count($con);
- }
- } else {
- return count($this->collContentDescs);
- }
- }
-
- /**
- * Method called to associate a ContentDesc object to this object
- * through the ContentDesc foreign key attribute.
- *
- * @param ContentDesc $l ContentDesc
- * @return Content The current object (for fluent API support)
- */
- public function addContentDesc(ContentDesc $l)
- {
- if ($this->collContentDescs === null) {
- $this->initContentDescs();
- $this->collContentDescsPartial = true;
- }
- if (!$this->collContentDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddContentDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param ContentDesc $contentDesc The contentDesc object to add.
- */
- protected function doAddContentDesc($contentDesc)
- {
- $this->collContentDescs[]= $contentDesc;
- $contentDesc->setContent($this);
- }
-
- /**
- * @param ContentDesc $contentDesc The contentDesc object to remove.
- */
- public function removeContentDesc($contentDesc)
- {
- if ($this->getContentDescs()->contains($contentDesc)) {
- $this->collContentDescs->remove($this->collContentDescs->search($contentDesc));
- if (null === $this->contentDescsScheduledForDeletion) {
- $this->contentDescsScheduledForDeletion = clone $this->collContentDescs;
- $this->contentDescsScheduledForDeletion->clear();
- }
- $this->contentDescsScheduledForDeletion[]= $contentDesc;
- $contentDesc->setContent(null);
+ if ('ContentI18n' == $relationName) {
+ $this->initContentI18ns();
}
}
@@ -2894,6 +2701,217 @@ abstract class BaseContent extends BaseObject implements Persistent
return $this->getContentFolders($query, $con);
}
+ /**
+ * Clears out the collContentI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addContentI18ns()
+ */
+ public function clearContentI18ns()
+ {
+ $this->collContentI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collContentI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collContentI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialContentI18ns($v = true)
+ {
+ $this->collContentI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collContentI18ns collection.
+ *
+ * By default this just sets the collContentI18ns collection to an empty array (like clearcollContentI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initContentI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collContentI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collContentI18ns = new PropelObjectCollection();
+ $this->collContentI18ns->setModel('ContentI18n');
+ }
+
+ /**
+ * Gets an array of ContentI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * 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 Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|ContentI18n[] List of ContentI18n objects
+ * @throws PropelException
+ */
+ public function getContentI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collContentI18nsPartial && !$this->isNew();
+ if (null === $this->collContentI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collContentI18ns) {
+ // return empty collection
+ $this->initContentI18ns();
+ } else {
+ $collContentI18ns = ContentI18nQuery::create(null, $criteria)
+ ->filterByContent($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collContentI18nsPartial && count($collContentI18ns)) {
+ $this->initContentI18ns(false);
+
+ foreach($collContentI18ns as $obj) {
+ if (false == $this->collContentI18ns->contains($obj)) {
+ $this->collContentI18ns->append($obj);
+ }
+ }
+
+ $this->collContentI18nsPartial = true;
+ }
+
+ return $collContentI18ns;
+ }
+
+ if($partial && $this->collContentI18ns) {
+ foreach($this->collContentI18ns as $obj) {
+ if($obj->isNew()) {
+ $collContentI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collContentI18ns = $collContentI18ns;
+ $this->collContentI18nsPartial = false;
+ }
+ }
+
+ return $this->collContentI18ns;
+ }
+
+ /**
+ * Sets a collection of ContentI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $contentI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setContentI18ns(PropelCollection $contentI18ns, PropelPDO $con = null)
+ {
+ $this->contentI18nsScheduledForDeletion = $this->getContentI18ns(new Criteria(), $con)->diff($contentI18ns);
+
+ foreach ($this->contentI18nsScheduledForDeletion as $contentI18nRemoved) {
+ $contentI18nRemoved->setContent(null);
+ }
+
+ $this->collContentI18ns = null;
+ foreach ($contentI18ns as $contentI18n) {
+ $this->addContentI18n($contentI18n);
+ }
+
+ $this->collContentI18ns = $contentI18ns;
+ $this->collContentI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related ContentI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related ContentI18n objects.
+ * @throws PropelException
+ */
+ public function countContentI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collContentI18nsPartial && !$this->isNew();
+ if (null === $this->collContentI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collContentI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getContentI18ns());
+ }
+ $query = ContentI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByContent($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collContentI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a ContentI18n object to this object
+ * through the ContentI18n foreign key attribute.
+ *
+ * @param ContentI18n $l ContentI18n
+ * @return Content The current object (for fluent API support)
+ */
+ public function addContentI18n(ContentI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collContentI18ns === null) {
+ $this->initContentI18ns();
+ $this->collContentI18nsPartial = true;
+ }
+ if (!$this->collContentI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddContentI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param ContentI18n $contentI18n The contentI18n object to add.
+ */
+ protected function doAddContentI18n($contentI18n)
+ {
+ $this->collContentI18ns[]= $contentI18n;
+ $contentI18n->setContent($this);
+ }
+
+ /**
+ * @param ContentI18n $contentI18n The contentI18n object to remove.
+ */
+ public function removeContentI18n($contentI18n)
+ {
+ if ($this->getContentI18ns()->contains($contentI18n)) {
+ $this->collContentI18ns->remove($this->collContentI18ns->search($contentI18n));
+ if (null === $this->contentI18nsScheduledForDeletion) {
+ $this->contentI18nsScheduledForDeletion = clone $this->collContentI18ns;
+ $this->contentI18nsScheduledForDeletion->clear();
+ }
+ $this->contentI18nsScheduledForDeletion[]= $contentI18n;
+ $contentI18n->setContent(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -2924,11 +2942,6 @@ abstract class BaseContent extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collContentDescs) {
- foreach ($this->collContentDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collContentAssocs) {
foreach ($this->collContentAssocs as $o) {
$o->clearAllReferences($deep);
@@ -2954,12 +2967,17 @@ abstract class BaseContent extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
+ if ($this->collContentI18ns) {
+ foreach ($this->collContentI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collContentDescs instanceof PropelCollection) {
- $this->collContentDescs->clearIterator();
- }
- $this->collContentDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collContentAssocs instanceof PropelCollection) {
$this->collContentAssocs->clearIterator();
}
@@ -2980,6 +2998,10 @@ abstract class BaseContent extends BaseObject implements Persistent
$this->collContentFolders->clearIterator();
}
$this->collContentFolders = null;
+ if ($this->collContentI18ns instanceof PropelCollection) {
+ $this->collContentI18ns->clearIterator();
+ }
+ $this->collContentI18ns = null;
}
/**
@@ -3016,4 +3038,199 @@ abstract class BaseContent extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Content The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ContentI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collContentI18ns) {
+ foreach ($this->collContentI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new ContentI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = ContentI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addContentI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Content The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ ContentI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collContentI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collContentI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ContentI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return ContentI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return ContentI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return ContentI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return ContentI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseContentI18n.php b/core/lib/Thelia/Model/om/BaseContentI18n.php
new file mode 100644
index 000000000..3e7404598
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseContentI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseContentI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return ContentI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = ContentI18nPeer::ID;
+ }
+
+ if ($this->aContent !== null && $this->aContent->getId() !== $v) {
+ $this->aContent = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return ContentI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = ContentI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return ContentI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = ContentI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return ContentI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = ContentI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return ContentI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = ContentI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return ContentI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = ContentI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = ContentI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating ContentI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aContent !== null && $this->id !== $this->aContent->getId()) {
+ $this->aContent = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = ContentI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aContent = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ContentI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ ContentI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aContent !== null) {
+ if ($this->aContent->isModified() || $this->aContent->isNew()) {
+ $affectedRows += $this->aContent->save($con);
+ }
+ $this->setContent($this->aContent);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ContentI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(ContentI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(ContentI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(ContentI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(ContentI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(ContentI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `content_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aContent !== null) {
+ if (!$this->aContent->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aContent->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = ContentI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ContentI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['ContentI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ContentI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = ContentI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aContent) {
+ $result['Content'] = $this->aContent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ContentI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = ContentI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(ContentI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(ContentI18nPeer::ID)) $criteria->add(ContentI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(ContentI18nPeer::LOCALE)) $criteria->add(ContentI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(ContentI18nPeer::TITLE)) $criteria->add(ContentI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(ContentI18nPeer::DESCRIPTION)) $criteria->add(ContentI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(ContentI18nPeer::CHAPO)) $criteria->add(ContentI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(ContentI18nPeer::POSTSCRIPTUM)) $criteria->add(ContentI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(ContentI18nPeer::DATABASE_NAME);
+ $criteria->add(ContentI18nPeer::ID, $this->id);
+ $criteria->add(ContentI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of ContentI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return ContentI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return ContentI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new ContentI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Content object.
+ *
+ * @param Content $v
+ * @return ContentI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setContent(Content $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aContent = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Content object, it will not be re-added.
+ if ($v !== null) {
+ $v->addContentI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Content object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Content The associated Content object.
+ * @throws PropelException
+ */
+ public function getContent(PropelPDO $con = null)
+ {
+ if ($this->aContent === null && ($this->id !== null)) {
+ $this->aContent = ContentQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aContent->addContentI18ns($this);
+ */
+ }
+
+ return $this->aContent;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aContent = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ContentI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseContentI18nPeer.php b/core/lib/Thelia/Model/om/BaseContentI18nPeer.php
new file mode 100644
index 000000000..0e7937255
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseContentI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (ContentI18nPeer::ID, ContentI18nPeer::LOCALE, ContentI18nPeer::TITLE, ContentI18nPeer::DESCRIPTION, ContentI18nPeer::CHAPO, ContentI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. ContentI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (ContentI18nPeer::ID => 0, ContentI18nPeer::LOCALE => 1, ContentI18nPeer::TITLE => 2, ContentI18nPeer::DESCRIPTION => 3, ContentI18nPeer::CHAPO => 4, ContentI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = ContentI18nPeer::getFieldNames($toType);
+ $key = isset(ContentI18nPeer::$fieldKeys[$fromType][$name]) ? ContentI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ContentI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, ContentI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return ContentI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. ContentI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(ContentI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(ContentI18nPeer::ID);
+ $criteria->addSelectColumn(ContentI18nPeer::LOCALE);
+ $criteria->addSelectColumn(ContentI18nPeer::TITLE);
+ $criteria->addSelectColumn(ContentI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(ContentI18nPeer::CHAPO);
+ $criteria->addSelectColumn(ContentI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ContentI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ContentI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(ContentI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return ContentI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = ContentI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return ContentI18nPeer::populateObjects(ContentI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ ContentI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ContentI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param ContentI18n $obj A ContentI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ ContentI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A ContentI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof ContentI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ContentI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(ContentI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return ContentI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(ContentI18nPeer::$instances[$key])) {
+ return ContentI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ ContentI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to content_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = ContentI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = ContentI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = ContentI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ ContentI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (ContentI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = ContentI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = ContentI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + ContentI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ContentI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ ContentI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Content table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinContent(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ContentI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ContentI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ContentI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ContentI18nPeer::ID, ContentPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of ContentI18n objects pre-filled with their Content objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ContentI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinContent(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ContentI18nPeer::DATABASE_NAME);
+ }
+
+ ContentI18nPeer::addSelectColumns($criteria);
+ $startcol = ContentI18nPeer::NUM_HYDRATE_COLUMNS;
+ ContentPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(ContentI18nPeer::ID, ContentPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ContentI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ContentI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = ContentI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ContentI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = ContentPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = ContentPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ ContentPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (ContentI18n) to $obj2 (Content)
+ $obj2->addContentI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ContentI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ContentI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ContentI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ContentI18nPeer::ID, ContentPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of ContentI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ContentI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ContentI18nPeer::DATABASE_NAME);
+ }
+
+ ContentI18nPeer::addSelectColumns($criteria);
+ $startcol2 = ContentI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ ContentPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + ContentPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(ContentI18nPeer::ID, ContentPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ContentI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ContentI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = ContentI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ContentI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Content rows
+
+ $key2 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = ContentPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = ContentPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ ContentPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (ContentI18n) to the collection in $obj2 (Content)
+ $obj2->addContentI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(ContentI18nPeer::DATABASE_NAME)->getTable(ContentI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseContentI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseContentI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new ContentI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return ContentI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ContentI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or ContentI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from ContentI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(ContentI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a ContentI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or ContentI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(ContentI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(ContentI18nPeer::ID);
+ $value = $criteria->remove(ContentI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(ContentI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ContentI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(ContentI18nPeer::LOCALE);
+ $value = $criteria->remove(ContentI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(ContentI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ContentI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is ContentI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(ContentI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the content_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(ContentI18nPeer::TABLE_NAME, $con, ContentI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ ContentI18nPeer::clearInstancePool();
+ ContentI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ContentI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ContentI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ ContentI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof ContentI18n) { // it's a model object
+ // invalidate the cache for this single object
+ ContentI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(ContentI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(ContentI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(ContentI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ ContentI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ContentI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ ContentI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given ContentI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param ContentI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(ContentI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(ContentI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(ContentI18nPeer::DATABASE_NAME, ContentI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return ContentI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = ContentI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(ContentI18nPeer::DATABASE_NAME);
+ $criteria->add(ContentI18nPeer::ID, $id);
+ $criteria->add(ContentI18nPeer::LOCALE, $locale);
+ $v = ContentI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseContentI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseContentI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseContentI18nQuery.php b/core/lib/Thelia/Model/om/BaseContentI18nQuery.php
new file mode 100644
index 000000000..e55a2c086
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseContentI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ContentI18n|ContentI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ContentI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(ContentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ContentI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `content_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new ContentI18n();
+ $obj->hydrate($row);
+ ContentI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ContentI18n|ContentI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|ContentI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ContentI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(ContentI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(ContentI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ContentI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(ContentI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(ContentI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByContent()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ContentI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(ContentI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ContentI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ContentI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ContentI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ContentI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ContentI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ContentI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ContentI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ContentI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ContentI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ContentI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Content object
+ *
+ * @param Content|PropelObjectCollection $content The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ContentI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByContent($content, $comparison = null)
+ {
+ if ($content instanceof Content) {
+ return $this
+ ->addUsingAlias(ContentI18nPeer::ID, $content->getId(), $comparison);
+ } elseif ($content instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ContentI18nPeer::ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByContent() only accepts arguments of type Content or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Content relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ContentI18nQuery The current query, for fluid interface
+ */
+ public function joinContent($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Content');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Content');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Content relation Content object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query
+ */
+ public function useContentQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinContent($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ContentI18n $contentI18n Object to remove from the list of results
+ *
+ * @return ContentI18nQuery The current query, for fluid interface
+ */
+ public function prune($contentI18n = null)
+ {
+ if ($contentI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(ContentI18nPeer::ID), $contentI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(ContentI18nPeer::LOCALE), $contentI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseContentPeer.php b/core/lib/Thelia/Model/om/BaseContentPeer.php
index e2e823bc6..1cd086b3d 100644
--- a/core/lib/Thelia/Model/om/BaseContentPeer.php
+++ b/core/lib/Thelia/Model/om/BaseContentPeer.php
@@ -11,8 +11,8 @@ use \PropelException;
use \PropelPDO;
use Thelia\Model\Content;
use Thelia\Model\ContentAssocPeer;
-use Thelia\Model\ContentDescPeer;
use Thelia\Model\ContentFolderPeer;
+use Thelia\Model\ContentI18nPeer;
use Thelia\Model\ContentPeer;
use Thelia\Model\DocumentPeer;
use Thelia\Model\ImagePeer;
@@ -77,6 +77,13 @@ abstract class BaseContentPeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -388,9 +395,6 @@ abstract class BaseContentPeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in ContentDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- ContentDescPeer::clearInstancePool();
// Invalidate objects in ContentAssocPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ContentAssocPeer::clearInstancePool();
@@ -406,6 +410,9 @@ abstract class BaseContentPeer
// Invalidate objects in ContentFolderPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ContentFolderPeer::clearInstancePool();
+ // Invalidate objects in ContentI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ ContentI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseContentQuery.php b/core/lib/Thelia/Model/om/BaseContentQuery.php
index 5108d053d..abe322ca8 100644
--- a/core/lib/Thelia/Model/om/BaseContentQuery.php
+++ b/core/lib/Thelia/Model/om/BaseContentQuery.php
@@ -14,8 +14,8 @@ use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Content;
use Thelia\Model\ContentAssoc;
-use Thelia\Model\ContentDesc;
use Thelia\Model\ContentFolder;
+use Thelia\Model\ContentI18n;
use Thelia\Model\ContentPeer;
use Thelia\Model\ContentQuery;
use Thelia\Model\Document;
@@ -43,10 +43,6 @@ use Thelia\Model\Rewriting;
* @method ContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ContentQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method ContentQuery leftJoinContentDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentDesc relation
- * @method ContentQuery rightJoinContentDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentDesc relation
- * @method ContentQuery innerJoinContentDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentDesc relation
- *
* @method ContentQuery leftJoinContentAssoc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentAssoc relation
* @method ContentQuery rightJoinContentAssoc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentAssoc relation
* @method ContentQuery innerJoinContentAssoc($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentAssoc relation
@@ -67,6 +63,10 @@ use Thelia\Model\Rewriting;
* @method ContentQuery rightJoinContentFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentFolder relation
* @method ContentQuery innerJoinContentFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentFolder relation
*
+ * @method ContentQuery leftJoinContentI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentI18n relation
+ * @method ContentQuery rightJoinContentI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentI18n relation
+ * @method ContentQuery innerJoinContentI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentI18n relation
+ *
* @method Content findOne(PropelPDO $con = null) Return the first Content matching the query
* @method Content findOneOrCreate(PropelPDO $con = null) Return the first Content matching the query, or a new Content object populated from the query conditions when no match is found
*
@@ -454,80 +454,6 @@ abstract class BaseContentQuery extends ModelCriteria
return $this->addUsingAlias(ContentPeer::UPDATED_AT, $updatedAt, $comparison);
}
- /**
- * Filter the query by a related ContentDesc object
- *
- * @param ContentDesc|PropelObjectCollection $contentDesc 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
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByContentDesc($contentDesc, $comparison = null)
- {
- if ($contentDesc instanceof ContentDesc) {
- return $this
- ->addUsingAlias(ContentPeer::ID, $contentDesc->getContentId(), $comparison);
- } elseif ($contentDesc instanceof PropelObjectCollection) {
- return $this
- ->useContentDescQuery()
- ->filterByPrimaryKeys($contentDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByContentDesc() only accepts arguments of type ContentDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the ContentDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return ContentQuery The current query, for fluid interface
- */
- public function joinContentDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('ContentDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'ContentDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the ContentDesc relation ContentDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\ContentDescQuery A secondary query class using the current class as primary query
- */
- public function useContentDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinContentDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'ContentDesc', '\Thelia\Model\ContentDescQuery');
- }
-
/**
* Filter the query by a related ContentAssoc object
*
@@ -898,6 +824,80 @@ abstract class BaseContentQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'ContentFolder', '\Thelia\Model\ContentFolderQuery');
}
+ /**
+ * Filter the query by a related ContentI18n object
+ *
+ * @param ContentI18n|PropelObjectCollection $contentI18n 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByContentI18n($contentI18n, $comparison = null)
+ {
+ if ($contentI18n instanceof ContentI18n) {
+ return $this
+ ->addUsingAlias(ContentPeer::ID, $contentI18n->getId(), $comparison);
+ } elseif ($contentI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useContentI18nQuery()
+ ->filterByPrimaryKeys($contentI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByContentI18n() only accepts arguments of type ContentI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the ContentI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ContentQuery The current query, for fluid interface
+ */
+ public function joinContentI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('ContentI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'ContentI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the ContentI18n relation ContentI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\ContentI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useContentI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinContentI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ContentI18n', '\Thelia\Model\ContentI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -979,4 +979,61 @@ abstract class BaseContentQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(ContentPeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ContentQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'ContentI18n';
+
+ return $this
+ ->joinContentI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ContentQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('ContentI18n');
+ $this->with['ContentI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ContentI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ContentI18n', 'Thelia\Model\ContentI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseCountry.php b/core/lib/Thelia/Model/om/BaseCountry.php
index 81592ea5e..018d56813 100644
--- a/core/lib/Thelia/Model/om/BaseCountry.php
+++ b/core/lib/Thelia/Model/om/BaseCountry.php
@@ -18,8 +18,8 @@ use \PropelPDO;
use Thelia\Model\Area;
use Thelia\Model\AreaQuery;
use Thelia\Model\Country;
-use Thelia\Model\CountryDesc;
-use Thelia\Model\CountryDescQuery;
+use Thelia\Model\CountryI18n;
+use Thelia\Model\CountryI18nQuery;
use Thelia\Model\CountryPeer;
use Thelia\Model\CountryQuery;
use Thelia\Model\TaxRuleCountry;
@@ -100,18 +100,18 @@ abstract class BaseCountry extends BaseObject implements Persistent
*/
protected $aArea;
- /**
- * @var PropelObjectCollection|CountryDesc[] Collection to store aggregation of CountryDesc objects.
- */
- protected $collCountryDescs;
- protected $collCountryDescsPartial;
-
/**
* @var PropelObjectCollection|TaxRuleCountry[] Collection to store aggregation of TaxRuleCountry objects.
*/
protected $collTaxRuleCountrys;
protected $collTaxRuleCountrysPartial;
+ /**
+ * @var PropelObjectCollection|CountryI18n[] Collection to store aggregation of CountryI18n objects.
+ */
+ protected $collCountryI18ns;
+ protected $collCountryI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -126,11 +126,19 @@ abstract class BaseCountry extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $countryDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[CountryI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -138,6 +146,12 @@ abstract class BaseCountry extends BaseObject implements Persistent
*/
protected $taxRuleCountrysScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $countryI18nsScheduledForDeletion = null;
+
/**
* Get the [id] column value.
*
@@ -530,10 +544,10 @@ abstract class BaseCountry extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
$this->aArea = null;
- $this->collCountryDescs = null;
-
$this->collTaxRuleCountrys = null;
+ $this->collCountryI18ns = null;
+
} // if (deep)
}
@@ -681,23 +695,6 @@ abstract class BaseCountry extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->countryDescsScheduledForDeletion !== null) {
- if (!$this->countryDescsScheduledForDeletion->isEmpty()) {
- CountryDescQuery::create()
- ->filterByPrimaryKeys($this->countryDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->countryDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collCountryDescs !== null) {
- foreach ($this->collCountryDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->taxRuleCountrysScheduledForDeletion !== null) {
if (!$this->taxRuleCountrysScheduledForDeletion->isEmpty()) {
foreach ($this->taxRuleCountrysScheduledForDeletion as $taxRuleCountry) {
@@ -716,6 +713,23 @@ abstract class BaseCountry extends BaseObject implements Persistent
}
}
+ if ($this->countryI18nsScheduledForDeletion !== null) {
+ if (!$this->countryI18nsScheduledForDeletion->isEmpty()) {
+ CountryI18nQuery::create()
+ ->filterByPrimaryKeys($this->countryI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->countryI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collCountryI18ns !== null) {
+ foreach ($this->collCountryI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -895,16 +909,16 @@ abstract class BaseCountry extends BaseObject implements Persistent
}
- if ($this->collCountryDescs !== null) {
- foreach ($this->collCountryDescs as $referrerFK) {
+ if ($this->collTaxRuleCountrys !== null) {
+ foreach ($this->collTaxRuleCountrys as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
- if ($this->collTaxRuleCountrys !== null) {
- foreach ($this->collTaxRuleCountrys as $referrerFK) {
+ if ($this->collCountryI18ns !== null) {
+ foreach ($this->collCountryI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -1008,12 +1022,12 @@ abstract class BaseCountry extends BaseObject implements Persistent
if (null !== $this->aArea) {
$result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
- if (null !== $this->collCountryDescs) {
- $result['CountryDescs'] = $this->collCountryDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collTaxRuleCountrys) {
$result['TaxRuleCountrys'] = $this->collTaxRuleCountrys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collCountryI18ns) {
+ $result['CountryI18ns'] = $this->collCountryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1195,18 +1209,18 @@ abstract class BaseCountry extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getCountryDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCountryDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getTaxRuleCountrys() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addTaxRuleCountry($relObj->copy($deepCopy));
}
}
+ foreach ($this->getCountryI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addCountryI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1319,218 +1333,11 @@ abstract class BaseCountry extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('CountryDesc' == $relationName) {
- $this->initCountryDescs();
- }
if ('TaxRuleCountry' == $relationName) {
$this->initTaxRuleCountrys();
}
- }
-
- /**
- * Clears out the collCountryDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addCountryDescs()
- */
- public function clearCountryDescs()
- {
- $this->collCountryDescs = null; // important to set this to null since that means it is uninitialized
- $this->collCountryDescsPartial = null;
- }
-
- /**
- * reset is the collCountryDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialCountryDescs($v = true)
- {
- $this->collCountryDescsPartial = $v;
- }
-
- /**
- * Initializes the collCountryDescs collection.
- *
- * By default this just sets the collCountryDescs collection to an empty array (like clearcollCountryDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initCountryDescs($overrideExisting = true)
- {
- if (null !== $this->collCountryDescs && !$overrideExisting) {
- return;
- }
- $this->collCountryDescs = new PropelObjectCollection();
- $this->collCountryDescs->setModel('CountryDesc');
- }
-
- /**
- * Gets an array of CountryDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * Next time the same method is called without $criteria, the cached collection is returned.
- * If this Country is new, it will return
- * an empty collection or the current collection; the criteria is ignored on a new object.
- *
- * @param Criteria $criteria optional Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|CountryDesc[] List of CountryDesc objects
- * @throws PropelException
- */
- public function getCountryDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collCountryDescsPartial && !$this->isNew();
- if (null === $this->collCountryDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collCountryDescs) {
- // return empty collection
- $this->initCountryDescs();
- } else {
- $collCountryDescs = CountryDescQuery::create(null, $criteria)
- ->filterByCountry($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collCountryDescsPartial && count($collCountryDescs)) {
- $this->initCountryDescs(false);
-
- foreach($collCountryDescs as $obj) {
- if (false == $this->collCountryDescs->contains($obj)) {
- $this->collCountryDescs->append($obj);
- }
- }
-
- $this->collCountryDescsPartial = true;
- }
-
- return $collCountryDescs;
- }
-
- if($partial && $this->collCountryDescs) {
- foreach($this->collCountryDescs as $obj) {
- if($obj->isNew()) {
- $collCountryDescs[] = $obj;
- }
- }
- }
-
- $this->collCountryDescs = $collCountryDescs;
- $this->collCountryDescsPartial = false;
- }
- }
-
- return $this->collCountryDescs;
- }
-
- /**
- * Sets a collection of CountryDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $countryDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setCountryDescs(PropelCollection $countryDescs, PropelPDO $con = null)
- {
- $this->countryDescsScheduledForDeletion = $this->getCountryDescs(new Criteria(), $con)->diff($countryDescs);
-
- foreach ($this->countryDescsScheduledForDeletion as $countryDescRemoved) {
- $countryDescRemoved->setCountry(null);
- }
-
- $this->collCountryDescs = null;
- foreach ($countryDescs as $countryDesc) {
- $this->addCountryDesc($countryDesc);
- }
-
- $this->collCountryDescs = $countryDescs;
- $this->collCountryDescsPartial = false;
- }
-
- /**
- * Returns the number of related CountryDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related CountryDesc objects.
- * @throws PropelException
- */
- public function countCountryDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collCountryDescsPartial && !$this->isNew();
- if (null === $this->collCountryDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collCountryDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getCountryDescs());
- }
- $query = CountryDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByCountry($this)
- ->count($con);
- }
- } else {
- return count($this->collCountryDescs);
- }
- }
-
- /**
- * Method called to associate a CountryDesc object to this object
- * through the CountryDesc foreign key attribute.
- *
- * @param CountryDesc $l CountryDesc
- * @return Country The current object (for fluent API support)
- */
- public function addCountryDesc(CountryDesc $l)
- {
- if ($this->collCountryDescs === null) {
- $this->initCountryDescs();
- $this->collCountryDescsPartial = true;
- }
- if (!$this->collCountryDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddCountryDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param CountryDesc $countryDesc The countryDesc object to add.
- */
- protected function doAddCountryDesc($countryDesc)
- {
- $this->collCountryDescs[]= $countryDesc;
- $countryDesc->setCountry($this);
- }
-
- /**
- * @param CountryDesc $countryDesc The countryDesc object to remove.
- */
- public function removeCountryDesc($countryDesc)
- {
- if ($this->getCountryDescs()->contains($countryDesc)) {
- $this->collCountryDescs->remove($this->collCountryDescs->search($countryDesc));
- if (null === $this->countryDescsScheduledForDeletion) {
- $this->countryDescsScheduledForDeletion = clone $this->collCountryDescs;
- $this->countryDescsScheduledForDeletion->clear();
- }
- $this->countryDescsScheduledForDeletion[]= $countryDesc;
- $countryDesc->setCountry(null);
+ if ('CountryI18n' == $relationName) {
+ $this->initCountryI18ns();
}
}
@@ -1791,6 +1598,217 @@ abstract class BaseCountry extends BaseObject implements Persistent
return $this->getTaxRuleCountrys($query, $con);
}
+ /**
+ * Clears out the collCountryI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addCountryI18ns()
+ */
+ public function clearCountryI18ns()
+ {
+ $this->collCountryI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collCountryI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collCountryI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialCountryI18ns($v = true)
+ {
+ $this->collCountryI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collCountryI18ns collection.
+ *
+ * By default this just sets the collCountryI18ns collection to an empty array (like clearcollCountryI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initCountryI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collCountryI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collCountryI18ns = new PropelObjectCollection();
+ $this->collCountryI18ns->setModel('CountryI18n');
+ }
+
+ /**
+ * Gets an array of CountryI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this Country is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|CountryI18n[] List of CountryI18n objects
+ * @throws PropelException
+ */
+ public function getCountryI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collCountryI18nsPartial && !$this->isNew();
+ if (null === $this->collCountryI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCountryI18ns) {
+ // return empty collection
+ $this->initCountryI18ns();
+ } else {
+ $collCountryI18ns = CountryI18nQuery::create(null, $criteria)
+ ->filterByCountry($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collCountryI18nsPartial && count($collCountryI18ns)) {
+ $this->initCountryI18ns(false);
+
+ foreach($collCountryI18ns as $obj) {
+ if (false == $this->collCountryI18ns->contains($obj)) {
+ $this->collCountryI18ns->append($obj);
+ }
+ }
+
+ $this->collCountryI18nsPartial = true;
+ }
+
+ return $collCountryI18ns;
+ }
+
+ if($partial && $this->collCountryI18ns) {
+ foreach($this->collCountryI18ns as $obj) {
+ if($obj->isNew()) {
+ $collCountryI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collCountryI18ns = $collCountryI18ns;
+ $this->collCountryI18nsPartial = false;
+ }
+ }
+
+ return $this->collCountryI18ns;
+ }
+
+ /**
+ * Sets a collection of CountryI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $countryI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setCountryI18ns(PropelCollection $countryI18ns, PropelPDO $con = null)
+ {
+ $this->countryI18nsScheduledForDeletion = $this->getCountryI18ns(new Criteria(), $con)->diff($countryI18ns);
+
+ foreach ($this->countryI18nsScheduledForDeletion as $countryI18nRemoved) {
+ $countryI18nRemoved->setCountry(null);
+ }
+
+ $this->collCountryI18ns = null;
+ foreach ($countryI18ns as $countryI18n) {
+ $this->addCountryI18n($countryI18n);
+ }
+
+ $this->collCountryI18ns = $countryI18ns;
+ $this->collCountryI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related CountryI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related CountryI18n objects.
+ * @throws PropelException
+ */
+ public function countCountryI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collCountryI18nsPartial && !$this->isNew();
+ if (null === $this->collCountryI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCountryI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getCountryI18ns());
+ }
+ $query = CountryI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByCountry($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collCountryI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a CountryI18n object to this object
+ * through the CountryI18n foreign key attribute.
+ *
+ * @param CountryI18n $l CountryI18n
+ * @return Country The current object (for fluent API support)
+ */
+ public function addCountryI18n(CountryI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collCountryI18ns === null) {
+ $this->initCountryI18ns();
+ $this->collCountryI18nsPartial = true;
+ }
+ if (!$this->collCountryI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddCountryI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param CountryI18n $countryI18n The countryI18n object to add.
+ */
+ protected function doAddCountryI18n($countryI18n)
+ {
+ $this->collCountryI18ns[]= $countryI18n;
+ $countryI18n->setCountry($this);
+ }
+
+ /**
+ * @param CountryI18n $countryI18n The countryI18n object to remove.
+ */
+ public function removeCountryI18n($countryI18n)
+ {
+ if ($this->getCountryI18ns()->contains($countryI18n)) {
+ $this->collCountryI18ns->remove($this->collCountryI18ns->search($countryI18n));
+ if (null === $this->countryI18nsScheduledForDeletion) {
+ $this->countryI18nsScheduledForDeletion = clone $this->collCountryI18ns;
+ $this->countryI18nsScheduledForDeletion->clear();
+ }
+ $this->countryI18nsScheduledForDeletion[]= $countryI18n;
+ $countryI18n->setCountry(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -1823,26 +1841,30 @@ abstract class BaseCountry extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collCountryDescs) {
- foreach ($this->collCountryDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collTaxRuleCountrys) {
foreach ($this->collTaxRuleCountrys as $o) {
$o->clearAllReferences($deep);
}
}
+ if ($this->collCountryI18ns) {
+ foreach ($this->collCountryI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collCountryDescs instanceof PropelCollection) {
- $this->collCountryDescs->clearIterator();
- }
- $this->collCountryDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collTaxRuleCountrys instanceof PropelCollection) {
$this->collTaxRuleCountrys->clearIterator();
}
$this->collTaxRuleCountrys = null;
+ if ($this->collCountryI18ns instanceof PropelCollection) {
+ $this->collCountryI18ns->clearIterator();
+ }
+ $this->collCountryI18ns = null;
$this->aArea = null;
}
@@ -1880,4 +1902,199 @@ abstract class BaseCountry extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Country The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CountryI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collCountryI18ns) {
+ foreach ($this->collCountryI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new CountryI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = CountryI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addCountryI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Country The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ CountryI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collCountryI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collCountryI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CountryI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return CountryI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return CountryI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return CountryI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return CountryI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseCountryI18n.php b/core/lib/Thelia/Model/om/BaseCountryI18n.php
new file mode 100644
index 000000000..5e5395710
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseCountryI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseCountryI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CountryI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CountryI18nPeer::ID;
+ }
+
+ if ($this->aCountry !== null && $this->aCountry->getId() !== $v) {
+ $this->aCountry = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return CountryI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = CountryI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return CountryI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = CountryI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return CountryI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = CountryI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return CountryI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = CountryI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return CountryI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = CountryI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = CountryI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CountryI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aCountry !== null && $this->id !== $this->aCountry->getId()) {
+ $this->aCountry = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CountryI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aCountry = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CountryI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CountryI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCountry !== null) {
+ if ($this->aCountry->isModified() || $this->aCountry->isNew()) {
+ $affectedRows += $this->aCountry->save($con);
+ }
+ $this->setCountry($this->aCountry);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CountryI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(CountryI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(CountryI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(CountryI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(CountryI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(CountryI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `country_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCountry !== null) {
+ if (!$this->aCountry->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCountry->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CountryI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CountryI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CountryI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CountryI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = CountryI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aCountry) {
+ $result['Country'] = $this->aCountry->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CountryI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CountryI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CountryI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CountryI18nPeer::ID)) $criteria->add(CountryI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(CountryI18nPeer::LOCALE)) $criteria->add(CountryI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(CountryI18nPeer::TITLE)) $criteria->add(CountryI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(CountryI18nPeer::DESCRIPTION)) $criteria->add(CountryI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(CountryI18nPeer::CHAPO)) $criteria->add(CountryI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(CountryI18nPeer::POSTSCRIPTUM)) $criteria->add(CountryI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CountryI18nPeer::DATABASE_NAME);
+ $criteria->add(CountryI18nPeer::ID, $this->id);
+ $criteria->add(CountryI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CountryI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CountryI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CountryI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CountryI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Country object.
+ *
+ * @param Country $v
+ * @return CountryI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCountry(Country $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aCountry = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Country object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCountryI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Country object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Country The associated Country object.
+ * @throws PropelException
+ */
+ public function getCountry(PropelPDO $con = null)
+ {
+ if ($this->aCountry === null && ($this->id !== null)) {
+ $this->aCountry = CountryQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCountry->addCountryI18ns($this);
+ */
+ }
+
+ return $this->aCountry;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aCountry = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CountryI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseCountryI18nPeer.php b/core/lib/Thelia/Model/om/BaseCountryI18nPeer.php
new file mode 100644
index 000000000..15604ceba
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseCountryI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (CountryI18nPeer::ID, CountryI18nPeer::LOCALE, CountryI18nPeer::TITLE, CountryI18nPeer::DESCRIPTION, CountryI18nPeer::CHAPO, CountryI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. CountryI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (CountryI18nPeer::ID => 0, CountryI18nPeer::LOCALE => 1, CountryI18nPeer::TITLE => 2, CountryI18nPeer::DESCRIPTION => 3, CountryI18nPeer::CHAPO => 4, CountryI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CountryI18nPeer::getFieldNames($toType);
+ $key = isset(CountryI18nPeer::$fieldKeys[$fromType][$name]) ? CountryI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CountryI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CountryI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return CountryI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CountryI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CountryI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CountryI18nPeer::ID);
+ $criteria->addSelectColumn(CountryI18nPeer::LOCALE);
+ $criteria->addSelectColumn(CountryI18nPeer::TITLE);
+ $criteria->addSelectColumn(CountryI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(CountryI18nPeer::CHAPO);
+ $criteria->addSelectColumn(CountryI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CountryI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CountryI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CountryI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CountryI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CountryI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CountryI18nPeer::populateObjects(CountryI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CountryI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CountryI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CountryI18n $obj A CountryI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ CountryI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CountryI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CountryI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CountryI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CountryI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CountryI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(CountryI18nPeer::$instances[$key])) {
+ return CountryI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ CountryI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to country_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CountryI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CountryI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CountryI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CountryI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CountryI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CountryI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CountryI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CountryI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CountryI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CountryI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Country table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCountry(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CountryI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CountryI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CountryI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CountryI18nPeer::ID, CountryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CountryI18n objects pre-filled with their Country objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CountryI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCountry(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(CountryI18nPeer::DATABASE_NAME);
+ }
+
+ CountryI18nPeer::addSelectColumns($criteria);
+ $startcol = CountryI18nPeer::NUM_HYDRATE_COLUMNS;
+ CountryPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CountryI18nPeer::ID, CountryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CountryI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CountryI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CountryI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CountryI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CountryPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CountryPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CountryPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CountryI18n) to $obj2 (Country)
+ $obj2->addCountryI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CountryI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CountryI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CountryI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CountryI18nPeer::ID, CountryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of CountryI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CountryI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(CountryI18nPeer::DATABASE_NAME);
+ }
+
+ CountryI18nPeer::addSelectColumns($criteria);
+ $startcol2 = CountryI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ CountryPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CountryPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CountryI18nPeer::ID, CountryPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CountryI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CountryI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CountryI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CountryI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Country rows
+
+ $key2 = CountryPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CountryPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CountryPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CountryPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CountryI18n) to the collection in $obj2 (Country)
+ $obj2->addCountryI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(CountryI18nPeer::DATABASE_NAME)->getTable(CountryI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCountryI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCountryI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new CountryI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return CountryI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CountryI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or CountryI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CountryI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CountryI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CountryI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or CountryI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CountryI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CountryI18nPeer::ID);
+ $value = $criteria->remove(CountryI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CountryI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CountryI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(CountryI18nPeer::LOCALE);
+ $value = $criteria->remove(CountryI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(CountryI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CountryI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CountryI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CountryI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the country_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CountryI18nPeer::TABLE_NAME, $con, CountryI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CountryI18nPeer::clearInstancePool();
+ CountryI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CountryI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CountryI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CountryI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CountryI18n) { // it's a model object
+ // invalidate the cache for this single object
+ CountryI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(CountryI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(CountryI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(CountryI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ CountryI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CountryI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CountryI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CountryI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CountryI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CountryI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CountryI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CountryI18nPeer::DATABASE_NAME, CountryI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return CountryI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = CountryI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(CountryI18nPeer::DATABASE_NAME);
+ $criteria->add(CountryI18nPeer::ID, $id);
+ $criteria->add(CountryI18nPeer::LOCALE, $locale);
+ $v = CountryI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseCountryI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCountryI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseCountryI18nQuery.php b/core/lib/Thelia/Model/om/BaseCountryI18nQuery.php
new file mode 100644
index 000000000..d9d421852
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseCountryI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CountryI18n|CountryI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CountryI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CountryI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CountryI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `country_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CountryI18n();
+ $obj->hydrate($row);
+ CountryI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CountryI18n|CountryI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|CountryI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CountryI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(CountryI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(CountryI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CountryI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(CountryI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(CountryI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByCountry()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CountryI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(CountryI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CountryI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CountryI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CountryI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CountryI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CountryI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CountryI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CountryI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CountryI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CountryI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CountryI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Country object
+ *
+ * @param Country|PropelObjectCollection $country The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CountryI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCountry($country, $comparison = null)
+ {
+ if ($country instanceof Country) {
+ return $this
+ ->addUsingAlias(CountryI18nPeer::ID, $country->getId(), $comparison);
+ } elseif ($country instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CountryI18nPeer::ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByCountry() only accepts arguments of type Country or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Country relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CountryI18nQuery The current query, for fluid interface
+ */
+ public function joinCountry($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Country');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Country');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Country relation Country object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\CountryQuery A secondary query class using the current class as primary query
+ */
+ public function useCountryQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinCountry($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Country', '\Thelia\Model\CountryQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CountryI18n $countryI18n Object to remove from the list of results
+ *
+ * @return CountryI18nQuery The current query, for fluid interface
+ */
+ public function prune($countryI18n = null)
+ {
+ if ($countryI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(CountryI18nPeer::ID), $countryI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(CountryI18nPeer::LOCALE), $countryI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseCountryPeer.php b/core/lib/Thelia/Model/om/BaseCountryPeer.php
index 9566871ba..c4f3d1ccf 100644
--- a/core/lib/Thelia/Model/om/BaseCountryPeer.php
+++ b/core/lib/Thelia/Model/om/BaseCountryPeer.php
@@ -11,7 +11,7 @@ use \PropelException;
use \PropelPDO;
use Thelia\Model\AreaPeer;
use Thelia\Model\Country;
-use Thelia\Model\CountryDescPeer;
+use Thelia\Model\CountryI18nPeer;
use Thelia\Model\CountryPeer;
use Thelia\Model\TaxRuleCountryPeer;
use Thelia\Model\map\CountryTableMap;
@@ -80,6 +80,13 @@ abstract class BaseCountryPeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -395,12 +402,12 @@ abstract class BaseCountryPeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in CountryDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CountryDescPeer::clearInstancePool();
// Invalidate objects in TaxRuleCountryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
TaxRuleCountryPeer::clearInstancePool();
+ // Invalidate objects in CountryI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ CountryI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseCountryQuery.php b/core/lib/Thelia/Model/om/BaseCountryQuery.php
index dc04359d0..67523456f 100644
--- a/core/lib/Thelia/Model/om/BaseCountryQuery.php
+++ b/core/lib/Thelia/Model/om/BaseCountryQuery.php
@@ -14,7 +14,7 @@ use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Area;
use Thelia\Model\Country;
-use Thelia\Model\CountryDesc;
+use Thelia\Model\CountryI18n;
use Thelia\Model\CountryPeer;
use Thelia\Model\CountryQuery;
use Thelia\Model\TaxRuleCountry;
@@ -48,14 +48,14 @@ use Thelia\Model\TaxRuleCountry;
* @method CountryQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
* @method CountryQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
*
- * @method CountryQuery leftJoinCountryDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the CountryDesc relation
- * @method CountryQuery rightJoinCountryDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CountryDesc relation
- * @method CountryQuery innerJoinCountryDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the CountryDesc relation
- *
* @method CountryQuery leftJoinTaxRuleCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the TaxRuleCountry relation
* @method CountryQuery rightJoinTaxRuleCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRuleCountry relation
* @method CountryQuery innerJoinTaxRuleCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRuleCountry relation
*
+ * @method CountryQuery leftJoinCountryI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CountryI18n relation
+ * @method CountryQuery rightJoinCountryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CountryI18n relation
+ * @method CountryQuery innerJoinCountryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CountryI18n relation
+ *
* @method Country findOne(PropelPDO $con = null) Return the first Country matching the query
* @method Country findOneOrCreate(PropelPDO $con = null) Return the first Country matching the query, or a new Country object populated from the query conditions when no match is found
*
@@ -571,80 +571,6 @@ abstract class BaseCountryQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'Area', '\Thelia\Model\AreaQuery');
}
- /**
- * Filter the query by a related CountryDesc object
- *
- * @param CountryDesc|PropelObjectCollection $countryDesc the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return CountryQuery The current query, for fluid interface
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByCountryDesc($countryDesc, $comparison = null)
- {
- if ($countryDesc instanceof CountryDesc) {
- return $this
- ->addUsingAlias(CountryPeer::ID, $countryDesc->getCountryId(), $comparison);
- } elseif ($countryDesc instanceof PropelObjectCollection) {
- return $this
- ->useCountryDescQuery()
- ->filterByPrimaryKeys($countryDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByCountryDesc() only accepts arguments of type CountryDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the CountryDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return CountryQuery The current query, for fluid interface
- */
- public function joinCountryDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CountryDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'CountryDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the CountryDesc relation CountryDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\CountryDescQuery A secondary query class using the current class as primary query
- */
- public function useCountryDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinCountryDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CountryDesc', '\Thelia\Model\CountryDescQuery');
- }
-
/**
* Filter the query by a related TaxRuleCountry object
*
@@ -719,6 +645,80 @@ abstract class BaseCountryQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'TaxRuleCountry', '\Thelia\Model\TaxRuleCountryQuery');
}
+ /**
+ * Filter the query by a related CountryI18n object
+ *
+ * @param CountryI18n|PropelObjectCollection $countryI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CountryQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCountryI18n($countryI18n, $comparison = null)
+ {
+ if ($countryI18n instanceof CountryI18n) {
+ return $this
+ ->addUsingAlias(CountryPeer::ID, $countryI18n->getId(), $comparison);
+ } elseif ($countryI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useCountryI18nQuery()
+ ->filterByPrimaryKeys($countryI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByCountryI18n() only accepts arguments of type CountryI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CountryI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CountryQuery The current query, for fluid interface
+ */
+ public function joinCountryI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CountryI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CountryI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CountryI18n relation CountryI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\CountryI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useCountryI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinCountryI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CountryI18n', '\Thelia\Model\CountryI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -800,4 +800,61 @@ abstract class BaseCountryQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(CountryPeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return CountryQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'CountryI18n';
+
+ return $this
+ ->joinCountryI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return CountryQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('CountryI18n');
+ $this->with['CountryI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return CountryI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CountryI18n', 'Thelia\Model\CountryI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseCustomerTitle.php b/core/lib/Thelia/Model/om/BaseCustomerTitle.php
index d6eafbb8f..228982fcd 100644
--- a/core/lib/Thelia/Model/om/BaseCustomerTitle.php
+++ b/core/lib/Thelia/Model/om/BaseCustomerTitle.php
@@ -20,8 +20,8 @@ use Thelia\Model\AddressQuery;
use Thelia\Model\Customer;
use Thelia\Model\CustomerQuery;
use Thelia\Model\CustomerTitle;
-use Thelia\Model\CustomerTitleDesc;
-use Thelia\Model\CustomerTitleDescQuery;
+use Thelia\Model\CustomerTitleI18n;
+use Thelia\Model\CustomerTitleI18nQuery;
use Thelia\Model\CustomerTitlePeer;
use Thelia\Model\CustomerTitleQuery;
@@ -97,10 +97,10 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
protected $collAddresssPartial;
/**
- * @var PropelObjectCollection|CustomerTitleDesc[] Collection to store aggregation of CustomerTitleDesc objects.
+ * @var PropelObjectCollection|CustomerTitleI18n[] Collection to store aggregation of CustomerTitleI18n objects.
*/
- protected $collCustomerTitleDescs;
- protected $collCustomerTitleDescsPartial;
+ protected $collCustomerTitleI18ns;
+ protected $collCustomerTitleI18nsPartial;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -116,6 +116,20 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
+ /**
+ * Current locale
+ * @var string
+ */
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[CustomerTitleI18n]
+ */
+ protected $currentTranslations;
+
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
@@ -132,7 +146,7 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
- protected $customerTitleDescsScheduledForDeletion = null;
+ protected $customerTitleI18nsScheduledForDeletion = null;
/**
* Applies default values to this object.
@@ -483,7 +497,7 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
$this->collAddresss = null;
- $this->collCustomerTitleDescs = null;
+ $this->collCustomerTitleI18ns = null;
} // if (deep)
}
@@ -656,17 +670,17 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
}
}
- if ($this->customerTitleDescsScheduledForDeletion !== null) {
- if (!$this->customerTitleDescsScheduledForDeletion->isEmpty()) {
- CustomerTitleDescQuery::create()
- ->filterByPrimaryKeys($this->customerTitleDescsScheduledForDeletion->getPrimaryKeys(false))
+ if ($this->customerTitleI18nsScheduledForDeletion !== null) {
+ if (!$this->customerTitleI18nsScheduledForDeletion->isEmpty()) {
+ CustomerTitleI18nQuery::create()
+ ->filterByPrimaryKeys($this->customerTitleI18nsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
- $this->customerTitleDescsScheduledForDeletion = null;
+ $this->customerTitleI18nsScheduledForDeletion = null;
}
}
- if ($this->collCustomerTitleDescs !== null) {
- foreach ($this->collCustomerTitleDescs as $referrerFK) {
+ if ($this->collCustomerTitleI18ns !== null) {
+ foreach ($this->collCustomerTitleI18ns as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
@@ -855,8 +869,8 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
}
}
- if ($this->collCustomerTitleDescs !== null) {
- foreach ($this->collCustomerTitleDescs as $referrerFK) {
+ if ($this->collCustomerTitleI18ns !== null) {
+ foreach ($this->collCustomerTitleI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -955,8 +969,8 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
if (null !== $this->collAddresss) {
$result['Addresss'] = $this->collAddresss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
- if (null !== $this->collCustomerTitleDescs) {
- $result['CustomerTitleDescs'] = $this->collCustomerTitleDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ if (null !== $this->collCustomerTitleI18ns) {
+ $result['CustomerTitleI18ns'] = $this->collCustomerTitleI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
@@ -1139,9 +1153,9 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
}
}
- foreach ($this->getCustomerTitleDescs() as $relObj) {
+ foreach ($this->getCustomerTitleI18ns() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addCustomerTitleDesc($relObj->copy($deepCopy));
+ $copyObj->addCustomerTitleI18n($relObj->copy($deepCopy));
}
}
@@ -1212,8 +1226,8 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
if ('Address' == $relationName) {
$this->initAddresss();
}
- if ('CustomerTitleDesc' == $relationName) {
- $this->initCustomerTitleDescs();
+ if ('CustomerTitleI18n' == $relationName) {
+ $this->initCustomerTitleI18ns();
}
}
@@ -1657,34 +1671,34 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
}
/**
- * Clears out the collCustomerTitleDescs collection
+ * Clears out the collCustomerTitleI18ns collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
- * @see addCustomerTitleDescs()
+ * @see addCustomerTitleI18ns()
*/
- public function clearCustomerTitleDescs()
+ public function clearCustomerTitleI18ns()
{
- $this->collCustomerTitleDescs = null; // important to set this to null since that means it is uninitialized
- $this->collCustomerTitleDescsPartial = null;
+ $this->collCustomerTitleI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collCustomerTitleI18nsPartial = null;
}
/**
- * reset is the collCustomerTitleDescs collection loaded partially
+ * reset is the collCustomerTitleI18ns collection loaded partially
*
* @return void
*/
- public function resetPartialCustomerTitleDescs($v = true)
+ public function resetPartialCustomerTitleI18ns($v = true)
{
- $this->collCustomerTitleDescsPartial = $v;
+ $this->collCustomerTitleI18nsPartial = $v;
}
/**
- * Initializes the collCustomerTitleDescs collection.
+ * Initializes the collCustomerTitleI18ns collection.
*
- * By default this just sets the collCustomerTitleDescs collection to an empty array (like clearcollCustomerTitleDescs());
+ * By default this just sets the collCustomerTitleI18ns collection to an empty array (like clearcollCustomerTitleI18ns());
* 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.
*
@@ -1693,17 +1707,17 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
*
* @return void
*/
- public function initCustomerTitleDescs($overrideExisting = true)
+ public function initCustomerTitleI18ns($overrideExisting = true)
{
- if (null !== $this->collCustomerTitleDescs && !$overrideExisting) {
+ if (null !== $this->collCustomerTitleI18ns && !$overrideExisting) {
return;
}
- $this->collCustomerTitleDescs = new PropelObjectCollection();
- $this->collCustomerTitleDescs->setModel('CustomerTitleDesc');
+ $this->collCustomerTitleI18ns = new PropelObjectCollection();
+ $this->collCustomerTitleI18ns->setModel('CustomerTitleI18n');
}
/**
- * Gets an array of CustomerTitleDesc objects which contain a foreign key that references this object.
+ * Gets an array of CustomerTitleI18n objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
@@ -1713,98 +1727,98 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|CustomerTitleDesc[] List of CustomerTitleDesc objects
+ * @return PropelObjectCollection|CustomerTitleI18n[] List of CustomerTitleI18n objects
* @throws PropelException
*/
- public function getCustomerTitleDescs($criteria = null, PropelPDO $con = null)
+ public function getCustomerTitleI18ns($criteria = null, PropelPDO $con = null)
{
- $partial = $this->collCustomerTitleDescsPartial && !$this->isNew();
- if (null === $this->collCustomerTitleDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collCustomerTitleDescs) {
+ $partial = $this->collCustomerTitleI18nsPartial && !$this->isNew();
+ if (null === $this->collCustomerTitleI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCustomerTitleI18ns) {
// return empty collection
- $this->initCustomerTitleDescs();
+ $this->initCustomerTitleI18ns();
} else {
- $collCustomerTitleDescs = CustomerTitleDescQuery::create(null, $criteria)
+ $collCustomerTitleI18ns = CustomerTitleI18nQuery::create(null, $criteria)
->filterByCustomerTitle($this)
->find($con);
if (null !== $criteria) {
- if (false !== $this->collCustomerTitleDescsPartial && count($collCustomerTitleDescs)) {
- $this->initCustomerTitleDescs(false);
+ if (false !== $this->collCustomerTitleI18nsPartial && count($collCustomerTitleI18ns)) {
+ $this->initCustomerTitleI18ns(false);
- foreach($collCustomerTitleDescs as $obj) {
- if (false == $this->collCustomerTitleDescs->contains($obj)) {
- $this->collCustomerTitleDescs->append($obj);
+ foreach($collCustomerTitleI18ns as $obj) {
+ if (false == $this->collCustomerTitleI18ns->contains($obj)) {
+ $this->collCustomerTitleI18ns->append($obj);
}
}
- $this->collCustomerTitleDescsPartial = true;
+ $this->collCustomerTitleI18nsPartial = true;
}
- return $collCustomerTitleDescs;
+ return $collCustomerTitleI18ns;
}
- if($partial && $this->collCustomerTitleDescs) {
- foreach($this->collCustomerTitleDescs as $obj) {
+ if($partial && $this->collCustomerTitleI18ns) {
+ foreach($this->collCustomerTitleI18ns as $obj) {
if($obj->isNew()) {
- $collCustomerTitleDescs[] = $obj;
+ $collCustomerTitleI18ns[] = $obj;
}
}
}
- $this->collCustomerTitleDescs = $collCustomerTitleDescs;
- $this->collCustomerTitleDescsPartial = false;
+ $this->collCustomerTitleI18ns = $collCustomerTitleI18ns;
+ $this->collCustomerTitleI18nsPartial = false;
}
}
- return $this->collCustomerTitleDescs;
+ return $this->collCustomerTitleI18ns;
}
/**
- * Sets a collection of CustomerTitleDesc objects related by a one-to-many relationship
+ * Sets a collection of CustomerTitleI18n objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
- * @param PropelCollection $customerTitleDescs A Propel collection.
+ * @param PropelCollection $customerTitleI18ns A Propel collection.
* @param PropelPDO $con Optional connection object
*/
- public function setCustomerTitleDescs(PropelCollection $customerTitleDescs, PropelPDO $con = null)
+ public function setCustomerTitleI18ns(PropelCollection $customerTitleI18ns, PropelPDO $con = null)
{
- $this->customerTitleDescsScheduledForDeletion = $this->getCustomerTitleDescs(new Criteria(), $con)->diff($customerTitleDescs);
+ $this->customerTitleI18nsScheduledForDeletion = $this->getCustomerTitleI18ns(new Criteria(), $con)->diff($customerTitleI18ns);
- foreach ($this->customerTitleDescsScheduledForDeletion as $customerTitleDescRemoved) {
- $customerTitleDescRemoved->setCustomerTitle(null);
+ foreach ($this->customerTitleI18nsScheduledForDeletion as $customerTitleI18nRemoved) {
+ $customerTitleI18nRemoved->setCustomerTitle(null);
}
- $this->collCustomerTitleDescs = null;
- foreach ($customerTitleDescs as $customerTitleDesc) {
- $this->addCustomerTitleDesc($customerTitleDesc);
+ $this->collCustomerTitleI18ns = null;
+ foreach ($customerTitleI18ns as $customerTitleI18n) {
+ $this->addCustomerTitleI18n($customerTitleI18n);
}
- $this->collCustomerTitleDescs = $customerTitleDescs;
- $this->collCustomerTitleDescsPartial = false;
+ $this->collCustomerTitleI18ns = $customerTitleI18ns;
+ $this->collCustomerTitleI18nsPartial = false;
}
/**
- * Returns the number of related CustomerTitleDesc objects.
+ * Returns the number of related CustomerTitleI18n objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
- * @return int Count of related CustomerTitleDesc objects.
+ * @return int Count of related CustomerTitleI18n objects.
* @throws PropelException
*/
- public function countCustomerTitleDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ public function countCustomerTitleI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
- $partial = $this->collCustomerTitleDescsPartial && !$this->isNew();
- if (null === $this->collCustomerTitleDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collCustomerTitleDescs) {
+ $partial = $this->collCustomerTitleI18nsPartial && !$this->isNew();
+ if (null === $this->collCustomerTitleI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collCustomerTitleI18ns) {
return 0;
} else {
if($partial && !$criteria) {
- return count($this->getCustomerTitleDescs());
+ return count($this->getCustomerTitleI18ns());
}
- $query = CustomerTitleDescQuery::create(null, $criteria);
+ $query = CustomerTitleI18nQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -1814,52 +1828,56 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
->count($con);
}
} else {
- return count($this->collCustomerTitleDescs);
+ return count($this->collCustomerTitleI18ns);
}
}
/**
- * Method called to associate a CustomerTitleDesc object to this object
- * through the CustomerTitleDesc foreign key attribute.
+ * Method called to associate a CustomerTitleI18n object to this object
+ * through the CustomerTitleI18n foreign key attribute.
*
- * @param CustomerTitleDesc $l CustomerTitleDesc
+ * @param CustomerTitleI18n $l CustomerTitleI18n
* @return CustomerTitle The current object (for fluent API support)
*/
- public function addCustomerTitleDesc(CustomerTitleDesc $l)
+ public function addCustomerTitleI18n(CustomerTitleI18n $l)
{
- if ($this->collCustomerTitleDescs === null) {
- $this->initCustomerTitleDescs();
- $this->collCustomerTitleDescsPartial = true;
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
}
- if (!$this->collCustomerTitleDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddCustomerTitleDesc($l);
+ if ($this->collCustomerTitleI18ns === null) {
+ $this->initCustomerTitleI18ns();
+ $this->collCustomerTitleI18nsPartial = true;
+ }
+ if (!$this->collCustomerTitleI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddCustomerTitleI18n($l);
}
return $this;
}
/**
- * @param CustomerTitleDesc $customerTitleDesc The customerTitleDesc object to add.
+ * @param CustomerTitleI18n $customerTitleI18n The customerTitleI18n object to add.
*/
- protected function doAddCustomerTitleDesc($customerTitleDesc)
+ protected function doAddCustomerTitleI18n($customerTitleI18n)
{
- $this->collCustomerTitleDescs[]= $customerTitleDesc;
- $customerTitleDesc->setCustomerTitle($this);
+ $this->collCustomerTitleI18ns[]= $customerTitleI18n;
+ $customerTitleI18n->setCustomerTitle($this);
}
/**
- * @param CustomerTitleDesc $customerTitleDesc The customerTitleDesc object to remove.
+ * @param CustomerTitleI18n $customerTitleI18n The customerTitleI18n object to remove.
*/
- public function removeCustomerTitleDesc($customerTitleDesc)
+ public function removeCustomerTitleI18n($customerTitleI18n)
{
- if ($this->getCustomerTitleDescs()->contains($customerTitleDesc)) {
- $this->collCustomerTitleDescs->remove($this->collCustomerTitleDescs->search($customerTitleDesc));
- if (null === $this->customerTitleDescsScheduledForDeletion) {
- $this->customerTitleDescsScheduledForDeletion = clone $this->collCustomerTitleDescs;
- $this->customerTitleDescsScheduledForDeletion->clear();
+ if ($this->getCustomerTitleI18ns()->contains($customerTitleI18n)) {
+ $this->collCustomerTitleI18ns->remove($this->collCustomerTitleI18ns->search($customerTitleI18n));
+ if (null === $this->customerTitleI18nsScheduledForDeletion) {
+ $this->customerTitleI18nsScheduledForDeletion = clone $this->collCustomerTitleI18ns;
+ $this->customerTitleI18nsScheduledForDeletion->clear();
}
- $this->customerTitleDescsScheduledForDeletion[]= $customerTitleDesc;
- $customerTitleDesc->setCustomerTitle(null);
+ $this->customerTitleI18nsScheduledForDeletion[]= $customerTitleI18n;
+ $customerTitleI18n->setCustomerTitle(null);
}
}
@@ -1904,13 +1922,17 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
- if ($this->collCustomerTitleDescs) {
- foreach ($this->collCustomerTitleDescs as $o) {
+ if ($this->collCustomerTitleI18ns) {
+ foreach ($this->collCustomerTitleI18ns as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep)
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collCustomers instanceof PropelCollection) {
$this->collCustomers->clearIterator();
}
@@ -1919,10 +1941,10 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
$this->collAddresss->clearIterator();
}
$this->collAddresss = null;
- if ($this->collCustomerTitleDescs instanceof PropelCollection) {
- $this->collCustomerTitleDescs->clearIterator();
+ if ($this->collCustomerTitleI18ns instanceof PropelCollection) {
+ $this->collCustomerTitleI18ns->clearIterator();
}
- $this->collCustomerTitleDescs = null;
+ $this->collCustomerTitleI18ns = null;
}
/**
@@ -1959,4 +1981,151 @@ abstract class BaseCustomerTitle extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return CustomerTitle The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CustomerTitleI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collCustomerTitleI18ns) {
+ foreach ($this->collCustomerTitleI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new CustomerTitleI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = CustomerTitleI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addCustomerTitleI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CustomerTitle The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ CustomerTitleI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collCustomerTitleI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collCustomerTitleI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CustomerTitleI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [short] column value.
+ *
+ * @return string
+ */
+ public function getShort()
+ {
+ return $this->getCurrentTranslation()->getShort();
+ }
+
+
+ /**
+ * Set the value of [short] column.
+ *
+ * @param string $v new value
+ * @return CustomerTitleI18n The current object (for fluent API support)
+ */
+ public function setShort($v)
+ { $this->getCurrentTranslation()->setShort($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [long] column value.
+ *
+ * @return string
+ */
+ public function getLong()
+ {
+ return $this->getCurrentTranslation()->getLong();
+ }
+
+
+ /**
+ * Set the value of [long] column.
+ *
+ * @param string $v new value
+ * @return CustomerTitleI18n The current object (for fluent API support)
+ */
+ public function setLong($v)
+ { $this->getCurrentTranslation()->setLong($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseCustomerTitleI18n.php b/core/lib/Thelia/Model/om/BaseCustomerTitleI18n.php
new file mode 100644
index 000000000..9300900b0
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseCustomerTitleI18n.php
@@ -0,0 +1,1063 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseCustomerTitleI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [short] column value.
+ *
+ * @return string
+ */
+ public function getShort()
+ {
+ return $this->short;
+ }
+
+ /**
+ * Get the [long] column value.
+ *
+ * @return string
+ */
+ public function getLong()
+ {
+ return $this->long;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return CustomerTitleI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = CustomerTitleI18nPeer::ID;
+ }
+
+ if ($this->aCustomerTitle !== null && $this->aCustomerTitle->getId() !== $v) {
+ $this->aCustomerTitle = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return CustomerTitleI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = CustomerTitleI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [short] column.
+ *
+ * @param string $v new value
+ * @return CustomerTitleI18n The current object (for fluent API support)
+ */
+ public function setShort($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->short !== $v) {
+ $this->short = $v;
+ $this->modifiedColumns[] = CustomerTitleI18nPeer::SHORT;
+ }
+
+
+ return $this;
+ } // setShort()
+
+ /**
+ * Set the value of [long] column.
+ *
+ * @param string $v new value
+ * @return CustomerTitleI18n The current object (for fluent API support)
+ */
+ public function setLong($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->long !== $v) {
+ $this->long = $v;
+ $this->modifiedColumns[] = CustomerTitleI18nPeer::LONG;
+ }
+
+
+ return $this;
+ } // setLong()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->short = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->long = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 4; // 4 = CustomerTitleI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating CustomerTitleI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aCustomerTitle !== null && $this->id !== $this->aCustomerTitle->getId()) {
+ $this->aCustomerTitle = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = CustomerTitleI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aCustomerTitle = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = CustomerTitleI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ CustomerTitleI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCustomerTitle !== null) {
+ if ($this->aCustomerTitle->isModified() || $this->aCustomerTitle->isNew()) {
+ $affectedRows += $this->aCustomerTitle->save($con);
+ }
+ $this->setCustomerTitle($this->aCustomerTitle);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(CustomerTitleI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(CustomerTitleI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(CustomerTitleI18nPeer::SHORT)) {
+ $modifiedColumns[':p' . $index++] = '`SHORT`';
+ }
+ if ($this->isColumnModified(CustomerTitleI18nPeer::LONG)) {
+ $modifiedColumns[':p' . $index++] = '`LONG`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `customer_title_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`SHORT`':
+ $stmt->bindValue($identifier, $this->short, PDO::PARAM_STR);
+ break;
+ case '`LONG`':
+ $stmt->bindValue($identifier, $this->long, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aCustomerTitle !== null) {
+ if (!$this->aCustomerTitle->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aCustomerTitle->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = CustomerTitleI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CustomerTitleI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getShort();
+ break;
+ case 3:
+ return $this->getLong();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['CustomerTitleI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['CustomerTitleI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = CustomerTitleI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getShort(),
+ $keys[3] => $this->getLong(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aCustomerTitle) {
+ $result['CustomerTitle'] = $this->aCustomerTitle->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = CustomerTitleI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setShort($value);
+ break;
+ case 3:
+ $this->setLong($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = CustomerTitleI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setShort($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setLong($arr[$keys[3]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(CustomerTitleI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(CustomerTitleI18nPeer::ID)) $criteria->add(CustomerTitleI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(CustomerTitleI18nPeer::LOCALE)) $criteria->add(CustomerTitleI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(CustomerTitleI18nPeer::SHORT)) $criteria->add(CustomerTitleI18nPeer::SHORT, $this->short);
+ if ($this->isColumnModified(CustomerTitleI18nPeer::LONG)) $criteria->add(CustomerTitleI18nPeer::LONG, $this->long);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(CustomerTitleI18nPeer::DATABASE_NAME);
+ $criteria->add(CustomerTitleI18nPeer::ID, $this->id);
+ $criteria->add(CustomerTitleI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of CustomerTitleI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setShort($this->getShort());
+ $copyObj->setLong($this->getLong());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return CustomerTitleI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return CustomerTitleI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new CustomerTitleI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a CustomerTitle object.
+ *
+ * @param CustomerTitle $v
+ * @return CustomerTitleI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setCustomerTitle(CustomerTitle $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aCustomerTitle = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the CustomerTitle object, it will not be re-added.
+ if ($v !== null) {
+ $v->addCustomerTitleI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated CustomerTitle object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return CustomerTitle The associated CustomerTitle object.
+ * @throws PropelException
+ */
+ public function getCustomerTitle(PropelPDO $con = null)
+ {
+ if ($this->aCustomerTitle === null && ($this->id !== null)) {
+ $this->aCustomerTitle = CustomerTitleQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aCustomerTitle->addCustomerTitleI18ns($this);
+ */
+ }
+
+ return $this->aCustomerTitle;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->short = null;
+ $this->long = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aCustomerTitle = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(CustomerTitleI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseCustomerTitleI18nPeer.php b/core/lib/Thelia/Model/om/BaseCustomerTitleI18nPeer.php
new file mode 100644
index 000000000..b41d8d2c7
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseCustomerTitleI18nPeer.php
@@ -0,0 +1,999 @@
+ array ('Id', 'Locale', 'Short', 'Long', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'short', 'long', ),
+ BasePeer::TYPE_COLNAME => array (CustomerTitleI18nPeer::ID, CustomerTitleI18nPeer::LOCALE, CustomerTitleI18nPeer::SHORT, CustomerTitleI18nPeer::LONG, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'SHORT', 'LONG', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'short', 'long', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. CustomerTitleI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Short' => 2, 'Long' => 3, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'short' => 2, 'long' => 3, ),
+ BasePeer::TYPE_COLNAME => array (CustomerTitleI18nPeer::ID => 0, CustomerTitleI18nPeer::LOCALE => 1, CustomerTitleI18nPeer::SHORT => 2, CustomerTitleI18nPeer::LONG => 3, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'SHORT' => 2, 'LONG' => 3, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'short' => 2, 'long' => 3, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = CustomerTitleI18nPeer::getFieldNames($toType);
+ $key = isset(CustomerTitleI18nPeer::$fieldKeys[$fromType][$name]) ? CustomerTitleI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(CustomerTitleI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, CustomerTitleI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return CustomerTitleI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. CustomerTitleI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(CustomerTitleI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(CustomerTitleI18nPeer::ID);
+ $criteria->addSelectColumn(CustomerTitleI18nPeer::LOCALE);
+ $criteria->addSelectColumn(CustomerTitleI18nPeer::SHORT);
+ $criteria->addSelectColumn(CustomerTitleI18nPeer::LONG);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.SHORT');
+ $criteria->addSelectColumn($alias . '.LONG');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CustomerTitleI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CustomerTitleI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(CustomerTitleI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return CustomerTitleI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = CustomerTitleI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return CustomerTitleI18nPeer::populateObjects(CustomerTitleI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ CustomerTitleI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CustomerTitleI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param CustomerTitleI18n $obj A CustomerTitleI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ CustomerTitleI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A CustomerTitleI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof CustomerTitleI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CustomerTitleI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(CustomerTitleI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return CustomerTitleI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(CustomerTitleI18nPeer::$instances[$key])) {
+ return CustomerTitleI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ CustomerTitleI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to customer_title_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = CustomerTitleI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = CustomerTitleI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = CustomerTitleI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ CustomerTitleI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (CustomerTitleI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = CustomerTitleI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = CustomerTitleI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + CustomerTitleI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = CustomerTitleI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ CustomerTitleI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related CustomerTitle table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinCustomerTitle(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CustomerTitleI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CustomerTitleI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CustomerTitleI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CustomerTitleI18nPeer::ID, CustomerTitlePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of CustomerTitleI18n objects pre-filled with their CustomerTitle objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CustomerTitleI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinCustomerTitle(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(CustomerTitleI18nPeer::DATABASE_NAME);
+ }
+
+ CustomerTitleI18nPeer::addSelectColumns($criteria);
+ $startcol = CustomerTitleI18nPeer::NUM_HYDRATE_COLUMNS;
+ CustomerTitlePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(CustomerTitleI18nPeer::ID, CustomerTitlePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CustomerTitleI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CustomerTitleI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = CustomerTitleI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CustomerTitleI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = CustomerTitlePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = CustomerTitlePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CustomerTitlePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ CustomerTitlePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (CustomerTitleI18n) to $obj2 (CustomerTitle)
+ $obj2->addCustomerTitleI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(CustomerTitleI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ CustomerTitleI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(CustomerTitleI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(CustomerTitleI18nPeer::ID, CustomerTitlePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of CustomerTitleI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of CustomerTitleI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(CustomerTitleI18nPeer::DATABASE_NAME);
+ }
+
+ CustomerTitleI18nPeer::addSelectColumns($criteria);
+ $startcol2 = CustomerTitleI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ CustomerTitlePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + CustomerTitlePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(CustomerTitleI18nPeer::ID, CustomerTitlePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = CustomerTitleI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = CustomerTitleI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = CustomerTitleI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ CustomerTitleI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined CustomerTitle rows
+
+ $key2 = CustomerTitlePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = CustomerTitlePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = CustomerTitlePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ CustomerTitlePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (CustomerTitleI18n) to the collection in $obj2 (CustomerTitle)
+ $obj2->addCustomerTitleI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(CustomerTitleI18nPeer::DATABASE_NAME)->getTable(CustomerTitleI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseCustomerTitleI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseCustomerTitleI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new CustomerTitleI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return CustomerTitleI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a CustomerTitleI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or CustomerTitleI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from CustomerTitleI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(CustomerTitleI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a CustomerTitleI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or CustomerTitleI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(CustomerTitleI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(CustomerTitleI18nPeer::ID);
+ $value = $criteria->remove(CustomerTitleI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(CustomerTitleI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CustomerTitleI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(CustomerTitleI18nPeer::LOCALE);
+ $value = $criteria->remove(CustomerTitleI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(CustomerTitleI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(CustomerTitleI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is CustomerTitleI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(CustomerTitleI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the customer_title_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(CustomerTitleI18nPeer::TABLE_NAME, $con, CustomerTitleI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ CustomerTitleI18nPeer::clearInstancePool();
+ CustomerTitleI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a CustomerTitleI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or CustomerTitleI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ CustomerTitleI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof CustomerTitleI18n) { // it's a model object
+ // invalidate the cache for this single object
+ CustomerTitleI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(CustomerTitleI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(CustomerTitleI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(CustomerTitleI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ CustomerTitleI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(CustomerTitleI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ CustomerTitleI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given CustomerTitleI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param CustomerTitleI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(CustomerTitleI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(CustomerTitleI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(CustomerTitleI18nPeer::DATABASE_NAME, CustomerTitleI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return CustomerTitleI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = CustomerTitleI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(CustomerTitleI18nPeer::DATABASE_NAME);
+ $criteria->add(CustomerTitleI18nPeer::ID, $id);
+ $criteria->add(CustomerTitleI18nPeer::LOCALE, $locale);
+ $v = CustomerTitleI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseCustomerTitleI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseCustomerTitleI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseCustomerTitleI18nQuery.php b/core/lib/Thelia/Model/om/BaseCustomerTitleI18nQuery.php
new file mode 100644
index 000000000..cf667572f
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseCustomerTitleI18nQuery.php
@@ -0,0 +1,456 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return CustomerTitleI18n|CustomerTitleI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = CustomerTitleI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(CustomerTitleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CustomerTitleI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `SHORT`, `LONG` FROM `customer_title_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new CustomerTitleI18n();
+ $obj->hydrate($row);
+ CustomerTitleI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return CustomerTitleI18n|CustomerTitleI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|CustomerTitleI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return CustomerTitleI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(CustomerTitleI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(CustomerTitleI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return CustomerTitleI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(CustomerTitleI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(CustomerTitleI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByCustomerTitle()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CustomerTitleI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(CustomerTitleI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CustomerTitleI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CustomerTitleI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the short column
+ *
+ * Example usage:
+ *
+ * $query->filterByShort('fooValue'); // WHERE short = 'fooValue'
+ * $query->filterByShort('%fooValue%'); // WHERE short LIKE '%fooValue%'
+ *
+ *
+ * @param string $short The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CustomerTitleI18nQuery The current query, for fluid interface
+ */
+ public function filterByShort($short = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($short)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $short)) {
+ $short = str_replace('*', '%', $short);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CustomerTitleI18nPeer::SHORT, $short, $comparison);
+ }
+
+ /**
+ * Filter the query on the long column
+ *
+ * Example usage:
+ *
+ * $query->filterByLong('fooValue'); // WHERE long = 'fooValue'
+ * $query->filterByLong('%fooValue%'); // WHERE long LIKE '%fooValue%'
+ *
+ *
+ * @param string $long The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CustomerTitleI18nQuery The current query, for fluid interface
+ */
+ public function filterByLong($long = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($long)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $long)) {
+ $long = str_replace('*', '%', $long);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(CustomerTitleI18nPeer::LONG, $long, $comparison);
+ }
+
+ /**
+ * Filter the query by a related CustomerTitle object
+ *
+ * @param CustomerTitle|PropelObjectCollection $customerTitle The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return CustomerTitleI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByCustomerTitle($customerTitle, $comparison = null)
+ {
+ if ($customerTitle instanceof CustomerTitle) {
+ return $this
+ ->addUsingAlias(CustomerTitleI18nPeer::ID, $customerTitle->getId(), $comparison);
+ } elseif ($customerTitle instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(CustomerTitleI18nPeer::ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByCustomerTitle() only accepts arguments of type CustomerTitle or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the CustomerTitle relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return CustomerTitleI18nQuery The current query, for fluid interface
+ */
+ public function joinCustomerTitle($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('CustomerTitle');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'CustomerTitle');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the CustomerTitle relation CustomerTitle object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\CustomerTitleQuery A secondary query class using the current class as primary query
+ */
+ public function useCustomerTitleQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinCustomerTitle($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CustomerTitle', '\Thelia\Model\CustomerTitleQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param CustomerTitleI18n $customerTitleI18n Object to remove from the list of results
+ *
+ * @return CustomerTitleI18nQuery The current query, for fluid interface
+ */
+ public function prune($customerTitleI18n = null)
+ {
+ if ($customerTitleI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(CustomerTitleI18nPeer::ID), $customerTitleI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(CustomerTitleI18nPeer::LOCALE), $customerTitleI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseCustomerTitlePeer.php b/core/lib/Thelia/Model/om/BaseCustomerTitlePeer.php
index afd255021..cf125cf8d 100644
--- a/core/lib/Thelia/Model/om/BaseCustomerTitlePeer.php
+++ b/core/lib/Thelia/Model/om/BaseCustomerTitlePeer.php
@@ -11,7 +11,7 @@ use \PropelException;
use \PropelPDO;
use Thelia\Model\CustomerPeer;
use Thelia\Model\CustomerTitle;
-use Thelia\Model\CustomerTitleDescPeer;
+use Thelia\Model\CustomerTitleI18nPeer;
use Thelia\Model\CustomerTitlePeer;
use Thelia\Model\map\CustomerTitleTableMap;
@@ -73,6 +73,13 @@ abstract class BaseCustomerTitlePeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -387,9 +394,9 @@ abstract class BaseCustomerTitlePeer
// Invalidate objects in CustomerPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CustomerPeer::clearInstancePool();
- // Invalidate objects in CustomerTitleDescPeer instance pool,
+ // Invalidate objects in CustomerTitleI18nPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- CustomerTitleDescPeer::clearInstancePool();
+ CustomerTitleI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseCustomerTitleQuery.php b/core/lib/Thelia/Model/om/BaseCustomerTitleQuery.php
index 9d962cbe2..a55adc984 100644
--- a/core/lib/Thelia/Model/om/BaseCustomerTitleQuery.php
+++ b/core/lib/Thelia/Model/om/BaseCustomerTitleQuery.php
@@ -15,7 +15,7 @@ use \PropelPDO;
use Thelia\Model\Address;
use Thelia\Model\Customer;
use Thelia\Model\CustomerTitle;
-use Thelia\Model\CustomerTitleDesc;
+use Thelia\Model\CustomerTitleI18n;
use Thelia\Model\CustomerTitlePeer;
use Thelia\Model\CustomerTitleQuery;
@@ -48,9 +48,9 @@ use Thelia\Model\CustomerTitleQuery;
* @method CustomerTitleQuery rightJoinAddress($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Address relation
* @method CustomerTitleQuery innerJoinAddress($relationAlias = null) Adds a INNER JOIN clause to the query using the Address relation
*
- * @method CustomerTitleQuery leftJoinCustomerTitleDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the CustomerTitleDesc relation
- * @method CustomerTitleQuery rightJoinCustomerTitleDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CustomerTitleDesc relation
- * @method CustomerTitleQuery innerJoinCustomerTitleDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the CustomerTitleDesc relation
+ * @method CustomerTitleQuery leftJoinCustomerTitleI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the CustomerTitleI18n relation
+ * @method CustomerTitleQuery rightJoinCustomerTitleI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CustomerTitleI18n relation
+ * @method CustomerTitleQuery innerJoinCustomerTitleI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CustomerTitleI18n relation
*
* @method CustomerTitle findOne(PropelPDO $con = null) Return the first CustomerTitle matching the query
* @method CustomerTitle findOneOrCreate(PropelPDO $con = null) Return the first CustomerTitle matching the query, or a new CustomerTitle object populated from the query conditions when no match is found
@@ -576,41 +576,41 @@ abstract class BaseCustomerTitleQuery extends ModelCriteria
}
/**
- * Filter the query by a related CustomerTitleDesc object
+ * Filter the query by a related CustomerTitleI18n object
*
- * @param CustomerTitleDesc|PropelObjectCollection $customerTitleDesc the related object to use as filter
+ * @param CustomerTitleI18n|PropelObjectCollection $customerTitleI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CustomerTitleQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
- public function filterByCustomerTitleDesc($customerTitleDesc, $comparison = null)
+ public function filterByCustomerTitleI18n($customerTitleI18n, $comparison = null)
{
- if ($customerTitleDesc instanceof CustomerTitleDesc) {
+ if ($customerTitleI18n instanceof CustomerTitleI18n) {
return $this
- ->addUsingAlias(CustomerTitlePeer::ID, $customerTitleDesc->getCustomerTitleId(), $comparison);
- } elseif ($customerTitleDesc instanceof PropelObjectCollection) {
+ ->addUsingAlias(CustomerTitlePeer::ID, $customerTitleI18n->getId(), $comparison);
+ } elseif ($customerTitleI18n instanceof PropelObjectCollection) {
return $this
- ->useCustomerTitleDescQuery()
- ->filterByPrimaryKeys($customerTitleDesc->getPrimaryKeys())
+ ->useCustomerTitleI18nQuery()
+ ->filterByPrimaryKeys($customerTitleI18n->getPrimaryKeys())
->endUse();
} else {
- throw new PropelException('filterByCustomerTitleDesc() only accepts arguments of type CustomerTitleDesc or PropelCollection');
+ throw new PropelException('filterByCustomerTitleI18n() only accepts arguments of type CustomerTitleI18n or PropelCollection');
}
}
/**
- * Adds a JOIN clause to the query using the CustomerTitleDesc relation
+ * Adds a JOIN clause to the query using the CustomerTitleI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CustomerTitleQuery The current query, for fluid interface
*/
- public function joinCustomerTitleDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function joinCustomerTitleI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('CustomerTitleDesc');
+ $relationMap = $tableMap->getRelation('CustomerTitleI18n');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -625,14 +625,14 @@ abstract class BaseCustomerTitleQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
- $this->addJoinObject($join, 'CustomerTitleDesc');
+ $this->addJoinObject($join, 'CustomerTitleI18n');
}
return $this;
}
/**
- * Use the CustomerTitleDesc relation CustomerTitleDesc object
+ * Use the CustomerTitleI18n relation CustomerTitleI18n object
*
* @see useQuery()
*
@@ -640,13 +640,13 @@ abstract class BaseCustomerTitleQuery extends ModelCriteria
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
- * @return \Thelia\Model\CustomerTitleDescQuery A secondary query class using the current class as primary query
+ * @return \Thelia\Model\CustomerTitleI18nQuery A secondary query class using the current class as primary query
*/
- public function useCustomerTitleDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function useCustomerTitleI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
- ->joinCustomerTitleDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'CustomerTitleDesc', '\Thelia\Model\CustomerTitleDescQuery');
+ ->joinCustomerTitleI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CustomerTitleI18n', '\Thelia\Model\CustomerTitleI18nQuery');
}
/**
@@ -730,4 +730,61 @@ abstract class BaseCustomerTitleQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(CustomerTitlePeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return CustomerTitleQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'CustomerTitleI18n';
+
+ return $this
+ ->joinCustomerTitleI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return CustomerTitleQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('CustomerTitleI18n');
+ $this->with['CustomerTitleI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return CustomerTitleI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'CustomerTitleI18n', 'Thelia\Model\CustomerTitleI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseDocument.php b/core/lib/Thelia/Model/om/BaseDocument.php
index 31b9c94fd..4c29f793a 100644
--- a/core/lib/Thelia/Model/om/BaseDocument.php
+++ b/core/lib/Thelia/Model/om/BaseDocument.php
@@ -20,8 +20,8 @@ use Thelia\Model\CategoryQuery;
use Thelia\Model\Content;
use Thelia\Model\ContentQuery;
use Thelia\Model\Document;
-use Thelia\Model\DocumentDesc;
-use Thelia\Model\DocumentDescQuery;
+use Thelia\Model\DocumentI18n;
+use Thelia\Model\DocumentI18nQuery;
use Thelia\Model\DocumentPeer;
use Thelia\Model\DocumentQuery;
use Thelia\Model\Folder;
@@ -132,10 +132,10 @@ abstract class BaseDocument extends BaseObject implements Persistent
protected $aFolder;
/**
- * @var PropelObjectCollection|DocumentDesc[] Collection to store aggregation of DocumentDesc objects.
+ * @var PropelObjectCollection|DocumentI18n[] Collection to store aggregation of DocumentI18n objects.
*/
- protected $collDocumentDescs;
- protected $collDocumentDescsPartial;
+ protected $collDocumentI18ns;
+ protected $collDocumentI18nsPartial;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -151,11 +151,25 @@ abstract class BaseDocument extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
+ /**
+ * Current locale
+ * @var string
+ */
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[DocumentI18n]
+ */
+ protected $currentTranslations;
+
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
- protected $documentDescsScheduledForDeletion = null;
+ protected $documentI18nsScheduledForDeletion = null;
/**
* Get the [id] column value.
@@ -637,7 +651,7 @@ abstract class BaseDocument extends BaseObject implements Persistent
$this->aCategory = null;
$this->aContent = null;
$this->aFolder = null;
- $this->collDocumentDescs = null;
+ $this->collDocumentI18ns = null;
} // if (deep)
}
@@ -807,17 +821,17 @@ abstract class BaseDocument extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->documentDescsScheduledForDeletion !== null) {
- if (!$this->documentDescsScheduledForDeletion->isEmpty()) {
- DocumentDescQuery::create()
- ->filterByPrimaryKeys($this->documentDescsScheduledForDeletion->getPrimaryKeys(false))
+ if ($this->documentI18nsScheduledForDeletion !== null) {
+ if (!$this->documentI18nsScheduledForDeletion->isEmpty()) {
+ DocumentI18nQuery::create()
+ ->filterByPrimaryKeys($this->documentI18nsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
- $this->documentDescsScheduledForDeletion = null;
+ $this->documentI18nsScheduledForDeletion = null;
}
}
- if ($this->collDocumentDescs !== null) {
- foreach ($this->collDocumentDescs as $referrerFK) {
+ if ($this->collDocumentI18ns !== null) {
+ foreach ($this->collDocumentI18ns as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
@@ -1044,8 +1058,8 @@ abstract class BaseDocument extends BaseObject implements Persistent
}
- if ($this->collDocumentDescs !== null) {
- foreach ($this->collDocumentDescs as $referrerFK) {
+ if ($this->collDocumentI18ns !== null) {
+ foreach ($this->collDocumentI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -1166,8 +1180,8 @@ abstract class BaseDocument extends BaseObject implements Persistent
if (null !== $this->aFolder) {
$result['Folder'] = $this->aFolder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
- if (null !== $this->collDocumentDescs) {
- $result['DocumentDescs'] = $this->collDocumentDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ if (null !== $this->collDocumentI18ns) {
+ $result['DocumentI18ns'] = $this->collDocumentI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
@@ -1362,9 +1376,9 @@ abstract class BaseDocument extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getDocumentDescs() as $relObj) {
+ foreach ($this->getDocumentI18ns() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addDocumentDesc($relObj->copy($deepCopy));
+ $copyObj->addDocumentI18n($relObj->copy($deepCopy));
}
}
@@ -1633,40 +1647,40 @@ abstract class BaseDocument extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('DocumentDesc' == $relationName) {
- $this->initDocumentDescs();
+ if ('DocumentI18n' == $relationName) {
+ $this->initDocumentI18ns();
}
}
/**
- * Clears out the collDocumentDescs collection
+ * Clears out the collDocumentI18ns collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
- * @see addDocumentDescs()
+ * @see addDocumentI18ns()
*/
- public function clearDocumentDescs()
+ public function clearDocumentI18ns()
{
- $this->collDocumentDescs = null; // important to set this to null since that means it is uninitialized
- $this->collDocumentDescsPartial = null;
+ $this->collDocumentI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collDocumentI18nsPartial = null;
}
/**
- * reset is the collDocumentDescs collection loaded partially
+ * reset is the collDocumentI18ns collection loaded partially
*
* @return void
*/
- public function resetPartialDocumentDescs($v = true)
+ public function resetPartialDocumentI18ns($v = true)
{
- $this->collDocumentDescsPartial = $v;
+ $this->collDocumentI18nsPartial = $v;
}
/**
- * Initializes the collDocumentDescs collection.
+ * Initializes the collDocumentI18ns collection.
*
- * By default this just sets the collDocumentDescs collection to an empty array (like clearcollDocumentDescs());
+ * By default this just sets the collDocumentI18ns collection to an empty array (like clearcollDocumentI18ns());
* 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.
*
@@ -1675,17 +1689,17 @@ abstract class BaseDocument extends BaseObject implements Persistent
*
* @return void
*/
- public function initDocumentDescs($overrideExisting = true)
+ public function initDocumentI18ns($overrideExisting = true)
{
- if (null !== $this->collDocumentDescs && !$overrideExisting) {
+ if (null !== $this->collDocumentI18ns && !$overrideExisting) {
return;
}
- $this->collDocumentDescs = new PropelObjectCollection();
- $this->collDocumentDescs->setModel('DocumentDesc');
+ $this->collDocumentI18ns = new PropelObjectCollection();
+ $this->collDocumentI18ns->setModel('DocumentI18n');
}
/**
- * Gets an array of DocumentDesc objects which contain a foreign key that references this object.
+ * Gets an array of DocumentI18n objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
@@ -1695,98 +1709,98 @@ abstract class BaseDocument extends BaseObject implements Persistent
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|DocumentDesc[] List of DocumentDesc objects
+ * @return PropelObjectCollection|DocumentI18n[] List of DocumentI18n objects
* @throws PropelException
*/
- public function getDocumentDescs($criteria = null, PropelPDO $con = null)
+ public function getDocumentI18ns($criteria = null, PropelPDO $con = null)
{
- $partial = $this->collDocumentDescsPartial && !$this->isNew();
- if (null === $this->collDocumentDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collDocumentDescs) {
+ $partial = $this->collDocumentI18nsPartial && !$this->isNew();
+ if (null === $this->collDocumentI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collDocumentI18ns) {
// return empty collection
- $this->initDocumentDescs();
+ $this->initDocumentI18ns();
} else {
- $collDocumentDescs = DocumentDescQuery::create(null, $criteria)
+ $collDocumentI18ns = DocumentI18nQuery::create(null, $criteria)
->filterByDocument($this)
->find($con);
if (null !== $criteria) {
- if (false !== $this->collDocumentDescsPartial && count($collDocumentDescs)) {
- $this->initDocumentDescs(false);
+ if (false !== $this->collDocumentI18nsPartial && count($collDocumentI18ns)) {
+ $this->initDocumentI18ns(false);
- foreach($collDocumentDescs as $obj) {
- if (false == $this->collDocumentDescs->contains($obj)) {
- $this->collDocumentDescs->append($obj);
+ foreach($collDocumentI18ns as $obj) {
+ if (false == $this->collDocumentI18ns->contains($obj)) {
+ $this->collDocumentI18ns->append($obj);
}
}
- $this->collDocumentDescsPartial = true;
+ $this->collDocumentI18nsPartial = true;
}
- return $collDocumentDescs;
+ return $collDocumentI18ns;
}
- if($partial && $this->collDocumentDescs) {
- foreach($this->collDocumentDescs as $obj) {
+ if($partial && $this->collDocumentI18ns) {
+ foreach($this->collDocumentI18ns as $obj) {
if($obj->isNew()) {
- $collDocumentDescs[] = $obj;
+ $collDocumentI18ns[] = $obj;
}
}
}
- $this->collDocumentDescs = $collDocumentDescs;
- $this->collDocumentDescsPartial = false;
+ $this->collDocumentI18ns = $collDocumentI18ns;
+ $this->collDocumentI18nsPartial = false;
}
}
- return $this->collDocumentDescs;
+ return $this->collDocumentI18ns;
}
/**
- * Sets a collection of DocumentDesc objects related by a one-to-many relationship
+ * Sets a collection of DocumentI18n objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
- * @param PropelCollection $documentDescs A Propel collection.
+ * @param PropelCollection $documentI18ns A Propel collection.
* @param PropelPDO $con Optional connection object
*/
- public function setDocumentDescs(PropelCollection $documentDescs, PropelPDO $con = null)
+ public function setDocumentI18ns(PropelCollection $documentI18ns, PropelPDO $con = null)
{
- $this->documentDescsScheduledForDeletion = $this->getDocumentDescs(new Criteria(), $con)->diff($documentDescs);
+ $this->documentI18nsScheduledForDeletion = $this->getDocumentI18ns(new Criteria(), $con)->diff($documentI18ns);
- foreach ($this->documentDescsScheduledForDeletion as $documentDescRemoved) {
- $documentDescRemoved->setDocument(null);
+ foreach ($this->documentI18nsScheduledForDeletion as $documentI18nRemoved) {
+ $documentI18nRemoved->setDocument(null);
}
- $this->collDocumentDescs = null;
- foreach ($documentDescs as $documentDesc) {
- $this->addDocumentDesc($documentDesc);
+ $this->collDocumentI18ns = null;
+ foreach ($documentI18ns as $documentI18n) {
+ $this->addDocumentI18n($documentI18n);
}
- $this->collDocumentDescs = $documentDescs;
- $this->collDocumentDescsPartial = false;
+ $this->collDocumentI18ns = $documentI18ns;
+ $this->collDocumentI18nsPartial = false;
}
/**
- * Returns the number of related DocumentDesc objects.
+ * Returns the number of related DocumentI18n objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
- * @return int Count of related DocumentDesc objects.
+ * @return int Count of related DocumentI18n objects.
* @throws PropelException
*/
- public function countDocumentDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ public function countDocumentI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
- $partial = $this->collDocumentDescsPartial && !$this->isNew();
- if (null === $this->collDocumentDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collDocumentDescs) {
+ $partial = $this->collDocumentI18nsPartial && !$this->isNew();
+ if (null === $this->collDocumentI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collDocumentI18ns) {
return 0;
} else {
if($partial && !$criteria) {
- return count($this->getDocumentDescs());
+ return count($this->getDocumentI18ns());
}
- $query = DocumentDescQuery::create(null, $criteria);
+ $query = DocumentI18nQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -1796,52 +1810,56 @@ abstract class BaseDocument extends BaseObject implements Persistent
->count($con);
}
} else {
- return count($this->collDocumentDescs);
+ return count($this->collDocumentI18ns);
}
}
/**
- * Method called to associate a DocumentDesc object to this object
- * through the DocumentDesc foreign key attribute.
+ * Method called to associate a DocumentI18n object to this object
+ * through the DocumentI18n foreign key attribute.
*
- * @param DocumentDesc $l DocumentDesc
+ * @param DocumentI18n $l DocumentI18n
* @return Document The current object (for fluent API support)
*/
- public function addDocumentDesc(DocumentDesc $l)
+ public function addDocumentI18n(DocumentI18n $l)
{
- if ($this->collDocumentDescs === null) {
- $this->initDocumentDescs();
- $this->collDocumentDescsPartial = true;
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
}
- if (!$this->collDocumentDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddDocumentDesc($l);
+ if ($this->collDocumentI18ns === null) {
+ $this->initDocumentI18ns();
+ $this->collDocumentI18nsPartial = true;
+ }
+ if (!$this->collDocumentI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddDocumentI18n($l);
}
return $this;
}
/**
- * @param DocumentDesc $documentDesc The documentDesc object to add.
+ * @param DocumentI18n $documentI18n The documentI18n object to add.
*/
- protected function doAddDocumentDesc($documentDesc)
+ protected function doAddDocumentI18n($documentI18n)
{
- $this->collDocumentDescs[]= $documentDesc;
- $documentDesc->setDocument($this);
+ $this->collDocumentI18ns[]= $documentI18n;
+ $documentI18n->setDocument($this);
}
/**
- * @param DocumentDesc $documentDesc The documentDesc object to remove.
+ * @param DocumentI18n $documentI18n The documentI18n object to remove.
*/
- public function removeDocumentDesc($documentDesc)
+ public function removeDocumentI18n($documentI18n)
{
- if ($this->getDocumentDescs()->contains($documentDesc)) {
- $this->collDocumentDescs->remove($this->collDocumentDescs->search($documentDesc));
- if (null === $this->documentDescsScheduledForDeletion) {
- $this->documentDescsScheduledForDeletion = clone $this->collDocumentDescs;
- $this->documentDescsScheduledForDeletion->clear();
+ if ($this->getDocumentI18ns()->contains($documentI18n)) {
+ $this->collDocumentI18ns->remove($this->collDocumentI18ns->search($documentI18n));
+ if (null === $this->documentI18nsScheduledForDeletion) {
+ $this->documentI18nsScheduledForDeletion = clone $this->collDocumentI18ns;
+ $this->documentI18nsScheduledForDeletion->clear();
}
- $this->documentDescsScheduledForDeletion[]= $documentDesc;
- $documentDesc->setDocument(null);
+ $this->documentI18nsScheduledForDeletion[]= $documentI18n;
+ $documentI18n->setDocument(null);
}
}
@@ -1879,17 +1897,21 @@ abstract class BaseDocument extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collDocumentDescs) {
- foreach ($this->collDocumentDescs as $o) {
+ if ($this->collDocumentI18ns) {
+ foreach ($this->collDocumentI18ns as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep)
- if ($this->collDocumentDescs instanceof PropelCollection) {
- $this->collDocumentDescs->clearIterator();
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
+ if ($this->collDocumentI18ns instanceof PropelCollection) {
+ $this->collDocumentI18ns->clearIterator();
}
- $this->collDocumentDescs = null;
+ $this->collDocumentI18ns = null;
$this->aProduct = null;
$this->aCategory = null;
$this->aContent = null;
@@ -1930,4 +1952,199 @@ abstract class BaseDocument extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Document The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return DocumentI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collDocumentI18ns) {
+ foreach ($this->collDocumentI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new DocumentI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = DocumentI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addDocumentI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Document The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ DocumentI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collDocumentI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collDocumentI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return DocumentI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return DocumentI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return DocumentI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return DocumentI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return DocumentI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseDocumentI18n.php b/core/lib/Thelia/Model/om/BaseDocumentI18n.php
new file mode 100644
index 000000000..5b13d65c3
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseDocumentI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseDocumentI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return DocumentI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = DocumentI18nPeer::ID;
+ }
+
+ if ($this->aDocument !== null && $this->aDocument->getId() !== $v) {
+ $this->aDocument = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return DocumentI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = DocumentI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return DocumentI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = DocumentI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return DocumentI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = DocumentI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return DocumentI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = DocumentI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return DocumentI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = DocumentI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = DocumentI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating DocumentI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aDocument !== null && $this->id !== $this->aDocument->getId()) {
+ $this->aDocument = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = DocumentI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aDocument = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = DocumentI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ DocumentI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aDocument !== null) {
+ if ($this->aDocument->isModified() || $this->aDocument->isNew()) {
+ $affectedRows += $this->aDocument->save($con);
+ }
+ $this->setDocument($this->aDocument);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(DocumentI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(DocumentI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(DocumentI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(DocumentI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(DocumentI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(DocumentI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `document_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aDocument !== null) {
+ if (!$this->aDocument->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aDocument->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = DocumentI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = DocumentI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['DocumentI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['DocumentI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = DocumentI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aDocument) {
+ $result['Document'] = $this->aDocument->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = DocumentI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = DocumentI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(DocumentI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(DocumentI18nPeer::ID)) $criteria->add(DocumentI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(DocumentI18nPeer::LOCALE)) $criteria->add(DocumentI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(DocumentI18nPeer::TITLE)) $criteria->add(DocumentI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(DocumentI18nPeer::DESCRIPTION)) $criteria->add(DocumentI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(DocumentI18nPeer::CHAPO)) $criteria->add(DocumentI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(DocumentI18nPeer::POSTSCRIPTUM)) $criteria->add(DocumentI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(DocumentI18nPeer::DATABASE_NAME);
+ $criteria->add(DocumentI18nPeer::ID, $this->id);
+ $criteria->add(DocumentI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of DocumentI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return DocumentI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return DocumentI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new DocumentI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Document object.
+ *
+ * @param Document $v
+ * @return DocumentI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setDocument(Document $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aDocument = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Document object, it will not be re-added.
+ if ($v !== null) {
+ $v->addDocumentI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Document object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Document The associated Document object.
+ * @throws PropelException
+ */
+ public function getDocument(PropelPDO $con = null)
+ {
+ if ($this->aDocument === null && ($this->id !== null)) {
+ $this->aDocument = DocumentQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aDocument->addDocumentI18ns($this);
+ */
+ }
+
+ return $this->aDocument;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aDocument = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(DocumentI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseDocumentI18nPeer.php b/core/lib/Thelia/Model/om/BaseDocumentI18nPeer.php
new file mode 100644
index 000000000..0b5dbaad9
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseDocumentI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (DocumentI18nPeer::ID, DocumentI18nPeer::LOCALE, DocumentI18nPeer::TITLE, DocumentI18nPeer::DESCRIPTION, DocumentI18nPeer::CHAPO, DocumentI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. DocumentI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (DocumentI18nPeer::ID => 0, DocumentI18nPeer::LOCALE => 1, DocumentI18nPeer::TITLE => 2, DocumentI18nPeer::DESCRIPTION => 3, DocumentI18nPeer::CHAPO => 4, DocumentI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = DocumentI18nPeer::getFieldNames($toType);
+ $key = isset(DocumentI18nPeer::$fieldKeys[$fromType][$name]) ? DocumentI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(DocumentI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, DocumentI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return DocumentI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. DocumentI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(DocumentI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(DocumentI18nPeer::ID);
+ $criteria->addSelectColumn(DocumentI18nPeer::LOCALE);
+ $criteria->addSelectColumn(DocumentI18nPeer::TITLE);
+ $criteria->addSelectColumn(DocumentI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(DocumentI18nPeer::CHAPO);
+ $criteria->addSelectColumn(DocumentI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(DocumentI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ DocumentI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(DocumentI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return DocumentI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = DocumentI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return DocumentI18nPeer::populateObjects(DocumentI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ DocumentI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(DocumentI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param DocumentI18n $obj A DocumentI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ DocumentI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A DocumentI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof DocumentI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or DocumentI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(DocumentI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return DocumentI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(DocumentI18nPeer::$instances[$key])) {
+ return DocumentI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ DocumentI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to document_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = DocumentI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = DocumentI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = DocumentI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ DocumentI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (DocumentI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = DocumentI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = DocumentI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + DocumentI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = DocumentI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ DocumentI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Document table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinDocument(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(DocumentI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ DocumentI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(DocumentI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(DocumentI18nPeer::ID, DocumentPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of DocumentI18n objects pre-filled with their Document objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of DocumentI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinDocument(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(DocumentI18nPeer::DATABASE_NAME);
+ }
+
+ DocumentI18nPeer::addSelectColumns($criteria);
+ $startcol = DocumentI18nPeer::NUM_HYDRATE_COLUMNS;
+ DocumentPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(DocumentI18nPeer::ID, DocumentPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = DocumentI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = DocumentI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = DocumentI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ DocumentI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = DocumentPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = DocumentPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = DocumentPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ DocumentPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (DocumentI18n) to $obj2 (Document)
+ $obj2->addDocumentI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(DocumentI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ DocumentI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(DocumentI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(DocumentI18nPeer::ID, DocumentPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of DocumentI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of DocumentI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(DocumentI18nPeer::DATABASE_NAME);
+ }
+
+ DocumentI18nPeer::addSelectColumns($criteria);
+ $startcol2 = DocumentI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ DocumentPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + DocumentPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(DocumentI18nPeer::ID, DocumentPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = DocumentI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = DocumentI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = DocumentI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ DocumentI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Document rows
+
+ $key2 = DocumentPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = DocumentPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = DocumentPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ DocumentPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (DocumentI18n) to the collection in $obj2 (Document)
+ $obj2->addDocumentI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(DocumentI18nPeer::DATABASE_NAME)->getTable(DocumentI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseDocumentI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseDocumentI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new DocumentI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return DocumentI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a DocumentI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or DocumentI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from DocumentI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(DocumentI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a DocumentI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or DocumentI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(DocumentI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(DocumentI18nPeer::ID);
+ $value = $criteria->remove(DocumentI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(DocumentI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(DocumentI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(DocumentI18nPeer::LOCALE);
+ $value = $criteria->remove(DocumentI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(DocumentI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(DocumentI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is DocumentI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(DocumentI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the document_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(DocumentI18nPeer::TABLE_NAME, $con, DocumentI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ DocumentI18nPeer::clearInstancePool();
+ DocumentI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a DocumentI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or DocumentI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ DocumentI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof DocumentI18n) { // it's a model object
+ // invalidate the cache for this single object
+ DocumentI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(DocumentI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(DocumentI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(DocumentI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ DocumentI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(DocumentI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ DocumentI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given DocumentI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param DocumentI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(DocumentI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(DocumentI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(DocumentI18nPeer::DATABASE_NAME, DocumentI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return DocumentI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = DocumentI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(DocumentI18nPeer::DATABASE_NAME);
+ $criteria->add(DocumentI18nPeer::ID, $id);
+ $criteria->add(DocumentI18nPeer::LOCALE, $locale);
+ $v = DocumentI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseDocumentI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseDocumentI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseDocumentI18nQuery.php b/core/lib/Thelia/Model/om/BaseDocumentI18nQuery.php
new file mode 100644
index 000000000..489474b02
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseDocumentI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return DocumentI18n|DocumentI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = DocumentI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(DocumentI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return DocumentI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `document_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new DocumentI18n();
+ $obj->hydrate($row);
+ DocumentI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return DocumentI18n|DocumentI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|DocumentI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return DocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(DocumentI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(DocumentI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return DocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(DocumentI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(DocumentI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByDocument()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return DocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(DocumentI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return DocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(DocumentI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return DocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(DocumentI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return DocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(DocumentI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return DocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(DocumentI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return DocumentI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(DocumentI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Document object
+ *
+ * @param Document|PropelObjectCollection $document The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return DocumentI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByDocument($document, $comparison = null)
+ {
+ if ($document instanceof Document) {
+ return $this
+ ->addUsingAlias(DocumentI18nPeer::ID, $document->getId(), $comparison);
+ } elseif ($document instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(DocumentI18nPeer::ID, $document->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByDocument() only accepts arguments of type Document or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Document relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return DocumentI18nQuery The current query, for fluid interface
+ */
+ public function joinDocument($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Document');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Document');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Document relation Document object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\DocumentQuery A secondary query class using the current class as primary query
+ */
+ public function useDocumentQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinDocument($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Document', '\Thelia\Model\DocumentQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param DocumentI18n $documentI18n Object to remove from the list of results
+ *
+ * @return DocumentI18nQuery The current query, for fluid interface
+ */
+ public function prune($documentI18n = null)
+ {
+ if ($documentI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(DocumentI18nPeer::ID), $documentI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(DocumentI18nPeer::LOCALE), $documentI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseDocumentPeer.php b/core/lib/Thelia/Model/om/BaseDocumentPeer.php
index 0f8da5499..c3d4ab54d 100644
--- a/core/lib/Thelia/Model/om/BaseDocumentPeer.php
+++ b/core/lib/Thelia/Model/om/BaseDocumentPeer.php
@@ -12,7 +12,7 @@ use \PropelPDO;
use Thelia\Model\CategoryPeer;
use Thelia\Model\ContentPeer;
use Thelia\Model\Document;
-use Thelia\Model\DocumentDescPeer;
+use Thelia\Model\DocumentI18nPeer;
use Thelia\Model\DocumentPeer;
use Thelia\Model\FolderPeer;
use Thelia\Model\ProductPeer;
@@ -88,6 +88,13 @@ abstract class BaseDocumentPeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -407,9 +414,9 @@ abstract class BaseDocumentPeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in DocumentDescPeer instance pool,
+ // Invalidate objects in DocumentI18nPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- DocumentDescPeer::clearInstancePool();
+ DocumentI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseDocumentQuery.php b/core/lib/Thelia/Model/om/BaseDocumentQuery.php
index 0afccfc7f..da5ed9889 100644
--- a/core/lib/Thelia/Model/om/BaseDocumentQuery.php
+++ b/core/lib/Thelia/Model/om/BaseDocumentQuery.php
@@ -15,7 +15,7 @@ use \PropelPDO;
use Thelia\Model\Category;
use Thelia\Model\Content;
use Thelia\Model\Document;
-use Thelia\Model\DocumentDesc;
+use Thelia\Model\DocumentI18n;
use Thelia\Model\DocumentPeer;
use Thelia\Model\DocumentQuery;
use Thelia\Model\Folder;
@@ -66,9 +66,9 @@ use Thelia\Model\Product;
* @method DocumentQuery rightJoinFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Folder relation
* @method DocumentQuery innerJoinFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the Folder relation
*
- * @method DocumentQuery leftJoinDocumentDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the DocumentDesc relation
- * @method DocumentQuery rightJoinDocumentDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the DocumentDesc relation
- * @method DocumentQuery innerJoinDocumentDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the DocumentDesc relation
+ * @method DocumentQuery leftJoinDocumentI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the DocumentI18n relation
+ * @method DocumentQuery rightJoinDocumentI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the DocumentI18n relation
+ * @method DocumentQuery innerJoinDocumentI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the DocumentI18n relation
*
* @method Document findOne(PropelPDO $con = null) Return the first Document matching the query
* @method Document findOneOrCreate(PropelPDO $con = null) Return the first Document matching the query, or a new Document object populated from the query conditions when no match is found
@@ -930,41 +930,41 @@ abstract class BaseDocumentQuery extends ModelCriteria
}
/**
- * Filter the query by a related DocumentDesc object
+ * Filter the query by a related DocumentI18n object
*
- * @param DocumentDesc|PropelObjectCollection $documentDesc the related object to use as filter
+ * @param DocumentI18n|PropelObjectCollection $documentI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return DocumentQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
- public function filterByDocumentDesc($documentDesc, $comparison = null)
+ public function filterByDocumentI18n($documentI18n, $comparison = null)
{
- if ($documentDesc instanceof DocumentDesc) {
+ if ($documentI18n instanceof DocumentI18n) {
return $this
- ->addUsingAlias(DocumentPeer::ID, $documentDesc->getDocumentId(), $comparison);
- } elseif ($documentDesc instanceof PropelObjectCollection) {
+ ->addUsingAlias(DocumentPeer::ID, $documentI18n->getId(), $comparison);
+ } elseif ($documentI18n instanceof PropelObjectCollection) {
return $this
- ->useDocumentDescQuery()
- ->filterByPrimaryKeys($documentDesc->getPrimaryKeys())
+ ->useDocumentI18nQuery()
+ ->filterByPrimaryKeys($documentI18n->getPrimaryKeys())
->endUse();
} else {
- throw new PropelException('filterByDocumentDesc() only accepts arguments of type DocumentDesc or PropelCollection');
+ throw new PropelException('filterByDocumentI18n() only accepts arguments of type DocumentI18n or PropelCollection');
}
}
/**
- * Adds a JOIN clause to the query using the DocumentDesc relation
+ * Adds a JOIN clause to the query using the DocumentI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return DocumentQuery The current query, for fluid interface
*/
- public function joinDocumentDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function joinDocumentI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('DocumentDesc');
+ $relationMap = $tableMap->getRelation('DocumentI18n');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -979,14 +979,14 @@ abstract class BaseDocumentQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
- $this->addJoinObject($join, 'DocumentDesc');
+ $this->addJoinObject($join, 'DocumentI18n');
}
return $this;
}
/**
- * Use the DocumentDesc relation DocumentDesc object
+ * Use the DocumentI18n relation DocumentI18n object
*
* @see useQuery()
*
@@ -994,13 +994,13 @@ abstract class BaseDocumentQuery extends ModelCriteria
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
- * @return \Thelia\Model\DocumentDescQuery A secondary query class using the current class as primary query
+ * @return \Thelia\Model\DocumentI18nQuery A secondary query class using the current class as primary query
*/
- public function useDocumentDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function useDocumentI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
- ->joinDocumentDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'DocumentDesc', '\Thelia\Model\DocumentDescQuery');
+ ->joinDocumentI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'DocumentI18n', '\Thelia\Model\DocumentI18nQuery');
}
/**
@@ -1084,4 +1084,61 @@ abstract class BaseDocumentQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(DocumentPeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return DocumentQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'DocumentI18n';
+
+ return $this
+ ->joinDocumentI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return DocumentQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('DocumentI18n');
+ $this->with['DocumentI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return DocumentI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'DocumentI18n', 'Thelia\Model\DocumentI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseFeature.php b/core/lib/Thelia/Model/om/BaseFeature.php
index 347f24e25..df0ca3bae 100644
--- a/core/lib/Thelia/Model/om/BaseFeature.php
+++ b/core/lib/Thelia/Model/om/BaseFeature.php
@@ -20,8 +20,8 @@ use Thelia\Model\FeatureAv;
use Thelia\Model\FeatureAvQuery;
use Thelia\Model\FeatureCategory;
use Thelia\Model\FeatureCategoryQuery;
-use Thelia\Model\FeatureDesc;
-use Thelia\Model\FeatureDescQuery;
+use Thelia\Model\FeatureI18n;
+use Thelia\Model\FeatureI18nQuery;
use Thelia\Model\FeaturePeer;
use Thelia\Model\FeatureProd;
use Thelia\Model\FeatureProdQuery;
@@ -86,12 +86,6 @@ abstract class BaseFeature extends BaseObject implements Persistent
*/
protected $updated_at;
- /**
- * @var PropelObjectCollection|FeatureDesc[] Collection to store aggregation of FeatureDesc objects.
- */
- protected $collFeatureDescs;
- protected $collFeatureDescsPartial;
-
/**
* @var PropelObjectCollection|FeatureAv[] Collection to store aggregation of FeatureAv objects.
*/
@@ -110,6 +104,12 @@ abstract class BaseFeature extends BaseObject implements Persistent
protected $collFeatureCategorys;
protected $collFeatureCategorysPartial;
+ /**
+ * @var PropelObjectCollection|FeatureI18n[] Collection to store aggregation of FeatureI18n objects.
+ */
+ protected $collFeatureI18ns;
+ protected $collFeatureI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -124,11 +124,19 @@ abstract class BaseFeature extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $featureDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[FeatureI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -148,6 +156,12 @@ abstract class BaseFeature extends BaseObject implements Persistent
*/
protected $featureCategorysScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $featureI18nsScheduledForDeletion = null;
+
/**
* Applies default values to this object.
* This method should be called from the object's constructor (or
@@ -493,14 +507,14 @@ abstract class BaseFeature extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
- $this->collFeatureDescs = null;
-
$this->collFeatureAvs = null;
$this->collFeatureProds = null;
$this->collFeatureCategorys = null;
+ $this->collFeatureI18ns = null;
+
} // if (deep)
}
@@ -636,23 +650,6 @@ abstract class BaseFeature extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->featureDescsScheduledForDeletion !== null) {
- if (!$this->featureDescsScheduledForDeletion->isEmpty()) {
- FeatureDescQuery::create()
- ->filterByPrimaryKeys($this->featureDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->featureDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collFeatureDescs !== null) {
- foreach ($this->collFeatureDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->featureAvsScheduledForDeletion !== null) {
if (!$this->featureAvsScheduledForDeletion->isEmpty()) {
FeatureAvQuery::create()
@@ -704,6 +701,23 @@ abstract class BaseFeature extends BaseObject implements Persistent
}
}
+ if ($this->featureI18nsScheduledForDeletion !== null) {
+ if (!$this->featureI18nsScheduledForDeletion->isEmpty()) {
+ FeatureI18nQuery::create()
+ ->filterByPrimaryKeys($this->featureI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->featureI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collFeatureI18ns !== null) {
+ foreach ($this->collFeatureI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -870,14 +884,6 @@ abstract class BaseFeature extends BaseObject implements Persistent
}
- if ($this->collFeatureDescs !== null) {
- foreach ($this->collFeatureDescs as $referrerFK) {
- if (!$referrerFK->validate($columns)) {
- $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
- }
- }
- }
-
if ($this->collFeatureAvs !== null) {
foreach ($this->collFeatureAvs as $referrerFK) {
if (!$referrerFK->validate($columns)) {
@@ -902,6 +908,14 @@ abstract class BaseFeature extends BaseObject implements Persistent
}
}
+ if ($this->collFeatureI18ns !== null) {
+ foreach ($this->collFeatureI18ns as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
$this->alreadyInValidation = false;
}
@@ -988,9 +1002,6 @@ abstract class BaseFeature extends BaseObject implements Persistent
$keys[4] => $this->getUpdatedAt(),
);
if ($includeForeignObjects) {
- if (null !== $this->collFeatureDescs) {
- $result['FeatureDescs'] = $this->collFeatureDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collFeatureAvs) {
$result['FeatureAvs'] = $this->collFeatureAvs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1000,6 +1011,9 @@ abstract class BaseFeature extends BaseObject implements Persistent
if (null !== $this->collFeatureCategorys) {
$result['FeatureCategorys'] = $this->collFeatureCategorys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collFeatureI18ns) {
+ $result['FeatureI18ns'] = $this->collFeatureI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1169,12 +1183,6 @@ abstract class BaseFeature extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getFeatureDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addFeatureDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getFeatureAvs() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addFeatureAv($relObj->copy($deepCopy));
@@ -1193,6 +1201,12 @@ abstract class BaseFeature extends BaseObject implements Persistent
}
}
+ foreach ($this->getFeatureI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addFeatureI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1254,9 +1268,6 @@ abstract class BaseFeature extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('FeatureDesc' == $relationName) {
- $this->initFeatureDescs();
- }
if ('FeatureAv' == $relationName) {
$this->initFeatureAvs();
}
@@ -1266,212 +1277,8 @@ abstract class BaseFeature extends BaseObject implements Persistent
if ('FeatureCategory' == $relationName) {
$this->initFeatureCategorys();
}
- }
-
- /**
- * Clears out the collFeatureDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addFeatureDescs()
- */
- public function clearFeatureDescs()
- {
- $this->collFeatureDescs = null; // important to set this to null since that means it is uninitialized
- $this->collFeatureDescsPartial = null;
- }
-
- /**
- * reset is the collFeatureDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialFeatureDescs($v = true)
- {
- $this->collFeatureDescsPartial = $v;
- }
-
- /**
- * Initializes the collFeatureDescs collection.
- *
- * By default this just sets the collFeatureDescs collection to an empty array (like clearcollFeatureDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initFeatureDescs($overrideExisting = true)
- {
- if (null !== $this->collFeatureDescs && !$overrideExisting) {
- return;
- }
- $this->collFeatureDescs = new PropelObjectCollection();
- $this->collFeatureDescs->setModel('FeatureDesc');
- }
-
- /**
- * Gets an array of FeatureDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * 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 Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|FeatureDesc[] List of FeatureDesc objects
- * @throws PropelException
- */
- public function getFeatureDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collFeatureDescsPartial && !$this->isNew();
- if (null === $this->collFeatureDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collFeatureDescs) {
- // return empty collection
- $this->initFeatureDescs();
- } else {
- $collFeatureDescs = FeatureDescQuery::create(null, $criteria)
- ->filterByFeature($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collFeatureDescsPartial && count($collFeatureDescs)) {
- $this->initFeatureDescs(false);
-
- foreach($collFeatureDescs as $obj) {
- if (false == $this->collFeatureDescs->contains($obj)) {
- $this->collFeatureDescs->append($obj);
- }
- }
-
- $this->collFeatureDescsPartial = true;
- }
-
- return $collFeatureDescs;
- }
-
- if($partial && $this->collFeatureDescs) {
- foreach($this->collFeatureDescs as $obj) {
- if($obj->isNew()) {
- $collFeatureDescs[] = $obj;
- }
- }
- }
-
- $this->collFeatureDescs = $collFeatureDescs;
- $this->collFeatureDescsPartial = false;
- }
- }
-
- return $this->collFeatureDescs;
- }
-
- /**
- * Sets a collection of FeatureDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $featureDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setFeatureDescs(PropelCollection $featureDescs, PropelPDO $con = null)
- {
- $this->featureDescsScheduledForDeletion = $this->getFeatureDescs(new Criteria(), $con)->diff($featureDescs);
-
- foreach ($this->featureDescsScheduledForDeletion as $featureDescRemoved) {
- $featureDescRemoved->setFeature(null);
- }
-
- $this->collFeatureDescs = null;
- foreach ($featureDescs as $featureDesc) {
- $this->addFeatureDesc($featureDesc);
- }
-
- $this->collFeatureDescs = $featureDescs;
- $this->collFeatureDescsPartial = false;
- }
-
- /**
- * Returns the number of related FeatureDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related FeatureDesc objects.
- * @throws PropelException
- */
- public function countFeatureDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collFeatureDescsPartial && !$this->isNew();
- if (null === $this->collFeatureDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collFeatureDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getFeatureDescs());
- }
- $query = FeatureDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByFeature($this)
- ->count($con);
- }
- } else {
- return count($this->collFeatureDescs);
- }
- }
-
- /**
- * Method called to associate a FeatureDesc object to this object
- * through the FeatureDesc foreign key attribute.
- *
- * @param FeatureDesc $l FeatureDesc
- * @return Feature The current object (for fluent API support)
- */
- public function addFeatureDesc(FeatureDesc $l)
- {
- if ($this->collFeatureDescs === null) {
- $this->initFeatureDescs();
- $this->collFeatureDescsPartial = true;
- }
- if (!$this->collFeatureDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddFeatureDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param FeatureDesc $featureDesc The featureDesc object to add.
- */
- protected function doAddFeatureDesc($featureDesc)
- {
- $this->collFeatureDescs[]= $featureDesc;
- $featureDesc->setFeature($this);
- }
-
- /**
- * @param FeatureDesc $featureDesc The featureDesc object to remove.
- */
- public function removeFeatureDesc($featureDesc)
- {
- if ($this->getFeatureDescs()->contains($featureDesc)) {
- $this->collFeatureDescs->remove($this->collFeatureDescs->search($featureDesc));
- if (null === $this->featureDescsScheduledForDeletion) {
- $this->featureDescsScheduledForDeletion = clone $this->collFeatureDescs;
- $this->featureDescsScheduledForDeletion->clear();
- }
- $this->featureDescsScheduledForDeletion[]= $featureDesc;
- $featureDesc->setFeature(null);
+ if ('FeatureI18n' == $relationName) {
+ $this->initFeatureI18ns();
}
}
@@ -2171,6 +1978,217 @@ abstract class BaseFeature extends BaseObject implements Persistent
return $this->getFeatureCategorys($query, $con);
}
+ /**
+ * Clears out the collFeatureI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addFeatureI18ns()
+ */
+ public function clearFeatureI18ns()
+ {
+ $this->collFeatureI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collFeatureI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collFeatureI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialFeatureI18ns($v = true)
+ {
+ $this->collFeatureI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collFeatureI18ns collection.
+ *
+ * By default this just sets the collFeatureI18ns collection to an empty array (like clearcollFeatureI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initFeatureI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collFeatureI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collFeatureI18ns = new PropelObjectCollection();
+ $this->collFeatureI18ns->setModel('FeatureI18n');
+ }
+
+ /**
+ * Gets an array of FeatureI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * 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 Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|FeatureI18n[] List of FeatureI18n objects
+ * @throws PropelException
+ */
+ public function getFeatureI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collFeatureI18nsPartial && !$this->isNew();
+ if (null === $this->collFeatureI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collFeatureI18ns) {
+ // return empty collection
+ $this->initFeatureI18ns();
+ } else {
+ $collFeatureI18ns = FeatureI18nQuery::create(null, $criteria)
+ ->filterByFeature($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collFeatureI18nsPartial && count($collFeatureI18ns)) {
+ $this->initFeatureI18ns(false);
+
+ foreach($collFeatureI18ns as $obj) {
+ if (false == $this->collFeatureI18ns->contains($obj)) {
+ $this->collFeatureI18ns->append($obj);
+ }
+ }
+
+ $this->collFeatureI18nsPartial = true;
+ }
+
+ return $collFeatureI18ns;
+ }
+
+ if($partial && $this->collFeatureI18ns) {
+ foreach($this->collFeatureI18ns as $obj) {
+ if($obj->isNew()) {
+ $collFeatureI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collFeatureI18ns = $collFeatureI18ns;
+ $this->collFeatureI18nsPartial = false;
+ }
+ }
+
+ return $this->collFeatureI18ns;
+ }
+
+ /**
+ * Sets a collection of FeatureI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $featureI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setFeatureI18ns(PropelCollection $featureI18ns, PropelPDO $con = null)
+ {
+ $this->featureI18nsScheduledForDeletion = $this->getFeatureI18ns(new Criteria(), $con)->diff($featureI18ns);
+
+ foreach ($this->featureI18nsScheduledForDeletion as $featureI18nRemoved) {
+ $featureI18nRemoved->setFeature(null);
+ }
+
+ $this->collFeatureI18ns = null;
+ foreach ($featureI18ns as $featureI18n) {
+ $this->addFeatureI18n($featureI18n);
+ }
+
+ $this->collFeatureI18ns = $featureI18ns;
+ $this->collFeatureI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related FeatureI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related FeatureI18n objects.
+ * @throws PropelException
+ */
+ public function countFeatureI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collFeatureI18nsPartial && !$this->isNew();
+ if (null === $this->collFeatureI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collFeatureI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getFeatureI18ns());
+ }
+ $query = FeatureI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByFeature($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collFeatureI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a FeatureI18n object to this object
+ * through the FeatureI18n foreign key attribute.
+ *
+ * @param FeatureI18n $l FeatureI18n
+ * @return Feature The current object (for fluent API support)
+ */
+ public function addFeatureI18n(FeatureI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collFeatureI18ns === null) {
+ $this->initFeatureI18ns();
+ $this->collFeatureI18nsPartial = true;
+ }
+ if (!$this->collFeatureI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddFeatureI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param FeatureI18n $featureI18n The featureI18n object to add.
+ */
+ protected function doAddFeatureI18n($featureI18n)
+ {
+ $this->collFeatureI18ns[]= $featureI18n;
+ $featureI18n->setFeature($this);
+ }
+
+ /**
+ * @param FeatureI18n $featureI18n The featureI18n object to remove.
+ */
+ public function removeFeatureI18n($featureI18n)
+ {
+ if ($this->getFeatureI18ns()->contains($featureI18n)) {
+ $this->collFeatureI18ns->remove($this->collFeatureI18ns->search($featureI18n));
+ if (null === $this->featureI18nsScheduledForDeletion) {
+ $this->featureI18nsScheduledForDeletion = clone $this->collFeatureI18ns;
+ $this->featureI18nsScheduledForDeletion->clear();
+ }
+ $this->featureI18nsScheduledForDeletion[]= $featureI18n;
+ $featureI18n->setFeature(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -2202,11 +2220,6 @@ abstract class BaseFeature extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collFeatureDescs) {
- foreach ($this->collFeatureDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collFeatureAvs) {
foreach ($this->collFeatureAvs as $o) {
$o->clearAllReferences($deep);
@@ -2222,12 +2235,17 @@ abstract class BaseFeature extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
+ if ($this->collFeatureI18ns) {
+ foreach ($this->collFeatureI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collFeatureDescs instanceof PropelCollection) {
- $this->collFeatureDescs->clearIterator();
- }
- $this->collFeatureDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collFeatureAvs instanceof PropelCollection) {
$this->collFeatureAvs->clearIterator();
}
@@ -2240,6 +2258,10 @@ abstract class BaseFeature extends BaseObject implements Persistent
$this->collFeatureCategorys->clearIterator();
}
$this->collFeatureCategorys = null;
+ if ($this->collFeatureI18ns instanceof PropelCollection) {
+ $this->collFeatureI18ns->clearIterator();
+ }
+ $this->collFeatureI18ns = null;
}
/**
@@ -2276,4 +2298,199 @@ abstract class BaseFeature extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Feature The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return FeatureI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collFeatureI18ns) {
+ foreach ($this->collFeatureI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new FeatureI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = FeatureI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addFeatureI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Feature The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ FeatureI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collFeatureI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collFeatureI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return FeatureI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return FeatureI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return FeatureI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return FeatureI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return FeatureI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseFeatureAv.php b/core/lib/Thelia/Model/om/BaseFeatureAv.php
index 933dd398d..878301627 100644
--- a/core/lib/Thelia/Model/om/BaseFeatureAv.php
+++ b/core/lib/Thelia/Model/om/BaseFeatureAv.php
@@ -17,8 +17,8 @@ use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Feature;
use Thelia\Model\FeatureAv;
-use Thelia\Model\FeatureAvDesc;
-use Thelia\Model\FeatureAvDescQuery;
+use Thelia\Model\FeatureAvI18n;
+use Thelia\Model\FeatureAvI18nQuery;
use Thelia\Model\FeatureAvPeer;
use Thelia\Model\FeatureAvQuery;
use Thelia\Model\FeatureProd;
@@ -82,18 +82,18 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
*/
protected $aFeature;
- /**
- * @var PropelObjectCollection|FeatureAvDesc[] Collection to store aggregation of FeatureAvDesc objects.
- */
- protected $collFeatureAvDescs;
- protected $collFeatureAvDescsPartial;
-
/**
* @var PropelObjectCollection|FeatureProd[] Collection to store aggregation of FeatureProd objects.
*/
protected $collFeatureProds;
protected $collFeatureProdsPartial;
+ /**
+ * @var PropelObjectCollection|FeatureAvI18n[] Collection to store aggregation of FeatureAvI18n objects.
+ */
+ protected $collFeatureAvI18ns;
+ protected $collFeatureAvI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -108,11 +108,19 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $featureAvDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[FeatureAvI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -120,6 +128,12 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
*/
protected $featureProdsScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $featureAvI18nsScheduledForDeletion = null;
+
/**
* Get the [id] column value.
*
@@ -416,10 +430,10 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
$this->aFeature = null;
- $this->collFeatureAvDescs = null;
-
$this->collFeatureProds = null;
+ $this->collFeatureAvI18ns = null;
+
} // if (deep)
}
@@ -567,23 +581,6 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->featureAvDescsScheduledForDeletion !== null) {
- if (!$this->featureAvDescsScheduledForDeletion->isEmpty()) {
- FeatureAvDescQuery::create()
- ->filterByPrimaryKeys($this->featureAvDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->featureAvDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collFeatureAvDescs !== null) {
- foreach ($this->collFeatureAvDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->featureProdsScheduledForDeletion !== null) {
if (!$this->featureProdsScheduledForDeletion->isEmpty()) {
foreach ($this->featureProdsScheduledForDeletion as $featureProd) {
@@ -602,6 +599,23 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
}
}
+ if ($this->featureAvI18nsScheduledForDeletion !== null) {
+ if (!$this->featureAvI18nsScheduledForDeletion->isEmpty()) {
+ FeatureAvI18nQuery::create()
+ ->filterByPrimaryKeys($this->featureAvI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->featureAvI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collFeatureAvI18ns !== null) {
+ foreach ($this->collFeatureAvI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -774,16 +788,16 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
}
- if ($this->collFeatureAvDescs !== null) {
- foreach ($this->collFeatureAvDescs as $referrerFK) {
+ if ($this->collFeatureProds !== null) {
+ foreach ($this->collFeatureProds as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
- if ($this->collFeatureProds !== null) {
- foreach ($this->collFeatureProds as $referrerFK) {
+ if ($this->collFeatureAvI18ns !== null) {
+ foreach ($this->collFeatureAvI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -875,12 +889,12 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
if (null !== $this->aFeature) {
$result['Feature'] = $this->aFeature->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
- if (null !== $this->collFeatureAvDescs) {
- $result['FeatureAvDescs'] = $this->collFeatureAvDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collFeatureProds) {
$result['FeatureProds'] = $this->collFeatureProds->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collFeatureAvI18ns) {
+ $result['FeatureAvI18ns'] = $this->collFeatureAvI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1044,18 +1058,18 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getFeatureAvDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addFeatureAvDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getFeatureProds() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addFeatureProd($relObj->copy($deepCopy));
}
}
+ foreach ($this->getFeatureAvI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addFeatureAvI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1168,218 +1182,11 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('FeatureAvDesc' == $relationName) {
- $this->initFeatureAvDescs();
- }
if ('FeatureProd' == $relationName) {
$this->initFeatureProds();
}
- }
-
- /**
- * Clears out the collFeatureAvDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addFeatureAvDescs()
- */
- public function clearFeatureAvDescs()
- {
- $this->collFeatureAvDescs = null; // important to set this to null since that means it is uninitialized
- $this->collFeatureAvDescsPartial = null;
- }
-
- /**
- * reset is the collFeatureAvDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialFeatureAvDescs($v = true)
- {
- $this->collFeatureAvDescsPartial = $v;
- }
-
- /**
- * Initializes the collFeatureAvDescs collection.
- *
- * By default this just sets the collFeatureAvDescs collection to an empty array (like clearcollFeatureAvDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initFeatureAvDescs($overrideExisting = true)
- {
- if (null !== $this->collFeatureAvDescs && !$overrideExisting) {
- return;
- }
- $this->collFeatureAvDescs = new PropelObjectCollection();
- $this->collFeatureAvDescs->setModel('FeatureAvDesc');
- }
-
- /**
- * Gets an array of FeatureAvDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * Next time the same method is called without $criteria, the cached collection is returned.
- * If this FeatureAv is new, it will return
- * an empty collection or the current collection; the criteria is ignored on a new object.
- *
- * @param Criteria $criteria optional Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|FeatureAvDesc[] List of FeatureAvDesc objects
- * @throws PropelException
- */
- public function getFeatureAvDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collFeatureAvDescsPartial && !$this->isNew();
- if (null === $this->collFeatureAvDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collFeatureAvDescs) {
- // return empty collection
- $this->initFeatureAvDescs();
- } else {
- $collFeatureAvDescs = FeatureAvDescQuery::create(null, $criteria)
- ->filterByFeatureAv($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collFeatureAvDescsPartial && count($collFeatureAvDescs)) {
- $this->initFeatureAvDescs(false);
-
- foreach($collFeatureAvDescs as $obj) {
- if (false == $this->collFeatureAvDescs->contains($obj)) {
- $this->collFeatureAvDescs->append($obj);
- }
- }
-
- $this->collFeatureAvDescsPartial = true;
- }
-
- return $collFeatureAvDescs;
- }
-
- if($partial && $this->collFeatureAvDescs) {
- foreach($this->collFeatureAvDescs as $obj) {
- if($obj->isNew()) {
- $collFeatureAvDescs[] = $obj;
- }
- }
- }
-
- $this->collFeatureAvDescs = $collFeatureAvDescs;
- $this->collFeatureAvDescsPartial = false;
- }
- }
-
- return $this->collFeatureAvDescs;
- }
-
- /**
- * Sets a collection of FeatureAvDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $featureAvDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setFeatureAvDescs(PropelCollection $featureAvDescs, PropelPDO $con = null)
- {
- $this->featureAvDescsScheduledForDeletion = $this->getFeatureAvDescs(new Criteria(), $con)->diff($featureAvDescs);
-
- foreach ($this->featureAvDescsScheduledForDeletion as $featureAvDescRemoved) {
- $featureAvDescRemoved->setFeatureAv(null);
- }
-
- $this->collFeatureAvDescs = null;
- foreach ($featureAvDescs as $featureAvDesc) {
- $this->addFeatureAvDesc($featureAvDesc);
- }
-
- $this->collFeatureAvDescs = $featureAvDescs;
- $this->collFeatureAvDescsPartial = false;
- }
-
- /**
- * Returns the number of related FeatureAvDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related FeatureAvDesc objects.
- * @throws PropelException
- */
- public function countFeatureAvDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collFeatureAvDescsPartial && !$this->isNew();
- if (null === $this->collFeatureAvDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collFeatureAvDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getFeatureAvDescs());
- }
- $query = FeatureAvDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByFeatureAv($this)
- ->count($con);
- }
- } else {
- return count($this->collFeatureAvDescs);
- }
- }
-
- /**
- * Method called to associate a FeatureAvDesc object to this object
- * through the FeatureAvDesc foreign key attribute.
- *
- * @param FeatureAvDesc $l FeatureAvDesc
- * @return FeatureAv The current object (for fluent API support)
- */
- public function addFeatureAvDesc(FeatureAvDesc $l)
- {
- if ($this->collFeatureAvDescs === null) {
- $this->initFeatureAvDescs();
- $this->collFeatureAvDescsPartial = true;
- }
- if (!$this->collFeatureAvDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddFeatureAvDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param FeatureAvDesc $featureAvDesc The featureAvDesc object to add.
- */
- protected function doAddFeatureAvDesc($featureAvDesc)
- {
- $this->collFeatureAvDescs[]= $featureAvDesc;
- $featureAvDesc->setFeatureAv($this);
- }
-
- /**
- * @param FeatureAvDesc $featureAvDesc The featureAvDesc object to remove.
- */
- public function removeFeatureAvDesc($featureAvDesc)
- {
- if ($this->getFeatureAvDescs()->contains($featureAvDesc)) {
- $this->collFeatureAvDescs->remove($this->collFeatureAvDescs->search($featureAvDesc));
- if (null === $this->featureAvDescsScheduledForDeletion) {
- $this->featureAvDescsScheduledForDeletion = clone $this->collFeatureAvDescs;
- $this->featureAvDescsScheduledForDeletion->clear();
- }
- $this->featureAvDescsScheduledForDeletion[]= $featureAvDesc;
- $featureAvDesc->setFeatureAv(null);
+ if ('FeatureAvI18n' == $relationName) {
+ $this->initFeatureAvI18ns();
}
}
@@ -1640,6 +1447,217 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
return $this->getFeatureProds($query, $con);
}
+ /**
+ * Clears out the collFeatureAvI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addFeatureAvI18ns()
+ */
+ public function clearFeatureAvI18ns()
+ {
+ $this->collFeatureAvI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collFeatureAvI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collFeatureAvI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialFeatureAvI18ns($v = true)
+ {
+ $this->collFeatureAvI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collFeatureAvI18ns collection.
+ *
+ * By default this just sets the collFeatureAvI18ns collection to an empty array (like clearcollFeatureAvI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initFeatureAvI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collFeatureAvI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collFeatureAvI18ns = new PropelObjectCollection();
+ $this->collFeatureAvI18ns->setModel('FeatureAvI18n');
+ }
+
+ /**
+ * Gets an array of FeatureAvI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this FeatureAv is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|FeatureAvI18n[] List of FeatureAvI18n objects
+ * @throws PropelException
+ */
+ public function getFeatureAvI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collFeatureAvI18nsPartial && !$this->isNew();
+ if (null === $this->collFeatureAvI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collFeatureAvI18ns) {
+ // return empty collection
+ $this->initFeatureAvI18ns();
+ } else {
+ $collFeatureAvI18ns = FeatureAvI18nQuery::create(null, $criteria)
+ ->filterByFeatureAv($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collFeatureAvI18nsPartial && count($collFeatureAvI18ns)) {
+ $this->initFeatureAvI18ns(false);
+
+ foreach($collFeatureAvI18ns as $obj) {
+ if (false == $this->collFeatureAvI18ns->contains($obj)) {
+ $this->collFeatureAvI18ns->append($obj);
+ }
+ }
+
+ $this->collFeatureAvI18nsPartial = true;
+ }
+
+ return $collFeatureAvI18ns;
+ }
+
+ if($partial && $this->collFeatureAvI18ns) {
+ foreach($this->collFeatureAvI18ns as $obj) {
+ if($obj->isNew()) {
+ $collFeatureAvI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collFeatureAvI18ns = $collFeatureAvI18ns;
+ $this->collFeatureAvI18nsPartial = false;
+ }
+ }
+
+ return $this->collFeatureAvI18ns;
+ }
+
+ /**
+ * Sets a collection of FeatureAvI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $featureAvI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setFeatureAvI18ns(PropelCollection $featureAvI18ns, PropelPDO $con = null)
+ {
+ $this->featureAvI18nsScheduledForDeletion = $this->getFeatureAvI18ns(new Criteria(), $con)->diff($featureAvI18ns);
+
+ foreach ($this->featureAvI18nsScheduledForDeletion as $featureAvI18nRemoved) {
+ $featureAvI18nRemoved->setFeatureAv(null);
+ }
+
+ $this->collFeatureAvI18ns = null;
+ foreach ($featureAvI18ns as $featureAvI18n) {
+ $this->addFeatureAvI18n($featureAvI18n);
+ }
+
+ $this->collFeatureAvI18ns = $featureAvI18ns;
+ $this->collFeatureAvI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related FeatureAvI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related FeatureAvI18n objects.
+ * @throws PropelException
+ */
+ public function countFeatureAvI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collFeatureAvI18nsPartial && !$this->isNew();
+ if (null === $this->collFeatureAvI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collFeatureAvI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getFeatureAvI18ns());
+ }
+ $query = FeatureAvI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByFeatureAv($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collFeatureAvI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a FeatureAvI18n object to this object
+ * through the FeatureAvI18n foreign key attribute.
+ *
+ * @param FeatureAvI18n $l FeatureAvI18n
+ * @return FeatureAv The current object (for fluent API support)
+ */
+ public function addFeatureAvI18n(FeatureAvI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collFeatureAvI18ns === null) {
+ $this->initFeatureAvI18ns();
+ $this->collFeatureAvI18nsPartial = true;
+ }
+ if (!$this->collFeatureAvI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddFeatureAvI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param FeatureAvI18n $featureAvI18n The featureAvI18n object to add.
+ */
+ protected function doAddFeatureAvI18n($featureAvI18n)
+ {
+ $this->collFeatureAvI18ns[]= $featureAvI18n;
+ $featureAvI18n->setFeatureAv($this);
+ }
+
+ /**
+ * @param FeatureAvI18n $featureAvI18n The featureAvI18n object to remove.
+ */
+ public function removeFeatureAvI18n($featureAvI18n)
+ {
+ if ($this->getFeatureAvI18ns()->contains($featureAvI18n)) {
+ $this->collFeatureAvI18ns->remove($this->collFeatureAvI18ns->search($featureAvI18n));
+ if (null === $this->featureAvI18nsScheduledForDeletion) {
+ $this->featureAvI18nsScheduledForDeletion = clone $this->collFeatureAvI18ns;
+ $this->featureAvI18nsScheduledForDeletion->clear();
+ }
+ $this->featureAvI18nsScheduledForDeletion[]= $featureAvI18n;
+ $featureAvI18n->setFeatureAv(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -1669,26 +1687,30 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collFeatureAvDescs) {
- foreach ($this->collFeatureAvDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collFeatureProds) {
foreach ($this->collFeatureProds as $o) {
$o->clearAllReferences($deep);
}
}
+ if ($this->collFeatureAvI18ns) {
+ foreach ($this->collFeatureAvI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collFeatureAvDescs instanceof PropelCollection) {
- $this->collFeatureAvDescs->clearIterator();
- }
- $this->collFeatureAvDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collFeatureProds instanceof PropelCollection) {
$this->collFeatureProds->clearIterator();
}
$this->collFeatureProds = null;
+ if ($this->collFeatureAvI18ns instanceof PropelCollection) {
+ $this->collFeatureAvI18ns->clearIterator();
+ }
+ $this->collFeatureAvI18ns = null;
$this->aFeature = null;
}
@@ -1726,4 +1748,199 @@ abstract class BaseFeatureAv extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return FeatureAv The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return FeatureAvI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collFeatureAvI18ns) {
+ foreach ($this->collFeatureAvI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new FeatureAvI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = FeatureAvI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addFeatureAvI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return FeatureAv The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ FeatureAvI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collFeatureAvI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collFeatureAvI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return FeatureAvI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return FeatureAvI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return FeatureAvI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return FeatureAvI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return FeatureAvI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseFeatureAvI18n.php b/core/lib/Thelia/Model/om/BaseFeatureAvI18n.php
new file mode 100644
index 000000000..95e6c2c57
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseFeatureAvI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseFeatureAvI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return FeatureAvI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = FeatureAvI18nPeer::ID;
+ }
+
+ if ($this->aFeatureAv !== null && $this->aFeatureAv->getId() !== $v) {
+ $this->aFeatureAv = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return FeatureAvI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = FeatureAvI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return FeatureAvI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = FeatureAvI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return FeatureAvI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = FeatureAvI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return FeatureAvI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = FeatureAvI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return FeatureAvI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = FeatureAvI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = FeatureAvI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating FeatureAvI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aFeatureAv !== null && $this->id !== $this->aFeatureAv->getId()) {
+ $this->aFeatureAv = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = FeatureAvI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aFeatureAv = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = FeatureAvI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ FeatureAvI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aFeatureAv !== null) {
+ if ($this->aFeatureAv->isModified() || $this->aFeatureAv->isNew()) {
+ $affectedRows += $this->aFeatureAv->save($con);
+ }
+ $this->setFeatureAv($this->aFeatureAv);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(FeatureAvI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(FeatureAvI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(FeatureAvI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(FeatureAvI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(FeatureAvI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(FeatureAvI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `feature_av_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aFeatureAv !== null) {
+ if (!$this->aFeatureAv->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aFeatureAv->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = FeatureAvI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = FeatureAvI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['FeatureAvI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['FeatureAvI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = FeatureAvI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aFeatureAv) {
+ $result['FeatureAv'] = $this->aFeatureAv->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = FeatureAvI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = FeatureAvI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(FeatureAvI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(FeatureAvI18nPeer::ID)) $criteria->add(FeatureAvI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(FeatureAvI18nPeer::LOCALE)) $criteria->add(FeatureAvI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(FeatureAvI18nPeer::TITLE)) $criteria->add(FeatureAvI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(FeatureAvI18nPeer::DESCRIPTION)) $criteria->add(FeatureAvI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(FeatureAvI18nPeer::CHAPO)) $criteria->add(FeatureAvI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(FeatureAvI18nPeer::POSTSCRIPTUM)) $criteria->add(FeatureAvI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(FeatureAvI18nPeer::DATABASE_NAME);
+ $criteria->add(FeatureAvI18nPeer::ID, $this->id);
+ $criteria->add(FeatureAvI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of FeatureAvI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return FeatureAvI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return FeatureAvI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new FeatureAvI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a FeatureAv object.
+ *
+ * @param FeatureAv $v
+ * @return FeatureAvI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setFeatureAv(FeatureAv $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aFeatureAv = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the FeatureAv object, it will not be re-added.
+ if ($v !== null) {
+ $v->addFeatureAvI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated FeatureAv object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return FeatureAv The associated FeatureAv object.
+ * @throws PropelException
+ */
+ public function getFeatureAv(PropelPDO $con = null)
+ {
+ if ($this->aFeatureAv === null && ($this->id !== null)) {
+ $this->aFeatureAv = FeatureAvQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aFeatureAv->addFeatureAvI18ns($this);
+ */
+ }
+
+ return $this->aFeatureAv;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aFeatureAv = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(FeatureAvI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseFeatureAvI18nPeer.php b/core/lib/Thelia/Model/om/BaseFeatureAvI18nPeer.php
new file mode 100644
index 000000000..64413df0f
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseFeatureAvI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (FeatureAvI18nPeer::ID, FeatureAvI18nPeer::LOCALE, FeatureAvI18nPeer::TITLE, FeatureAvI18nPeer::DESCRIPTION, FeatureAvI18nPeer::CHAPO, FeatureAvI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. FeatureAvI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (FeatureAvI18nPeer::ID => 0, FeatureAvI18nPeer::LOCALE => 1, FeatureAvI18nPeer::TITLE => 2, FeatureAvI18nPeer::DESCRIPTION => 3, FeatureAvI18nPeer::CHAPO => 4, FeatureAvI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = FeatureAvI18nPeer::getFieldNames($toType);
+ $key = isset(FeatureAvI18nPeer::$fieldKeys[$fromType][$name]) ? FeatureAvI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(FeatureAvI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, FeatureAvI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return FeatureAvI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. FeatureAvI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(FeatureAvI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(FeatureAvI18nPeer::ID);
+ $criteria->addSelectColumn(FeatureAvI18nPeer::LOCALE);
+ $criteria->addSelectColumn(FeatureAvI18nPeer::TITLE);
+ $criteria->addSelectColumn(FeatureAvI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(FeatureAvI18nPeer::CHAPO);
+ $criteria->addSelectColumn(FeatureAvI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(FeatureAvI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ FeatureAvI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(FeatureAvI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return FeatureAvI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = FeatureAvI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return FeatureAvI18nPeer::populateObjects(FeatureAvI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ FeatureAvI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(FeatureAvI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param FeatureAvI18n $obj A FeatureAvI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ FeatureAvI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A FeatureAvI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof FeatureAvI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or FeatureAvI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(FeatureAvI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return FeatureAvI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(FeatureAvI18nPeer::$instances[$key])) {
+ return FeatureAvI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ FeatureAvI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to feature_av_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = FeatureAvI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = FeatureAvI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = FeatureAvI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ FeatureAvI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (FeatureAvI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = FeatureAvI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = FeatureAvI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + FeatureAvI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = FeatureAvI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ FeatureAvI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related FeatureAv table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinFeatureAv(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(FeatureAvI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ FeatureAvI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(FeatureAvI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(FeatureAvI18nPeer::ID, FeatureAvPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of FeatureAvI18n objects pre-filled with their FeatureAv objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of FeatureAvI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinFeatureAv(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(FeatureAvI18nPeer::DATABASE_NAME);
+ }
+
+ FeatureAvI18nPeer::addSelectColumns($criteria);
+ $startcol = FeatureAvI18nPeer::NUM_HYDRATE_COLUMNS;
+ FeatureAvPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(FeatureAvI18nPeer::ID, FeatureAvPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = FeatureAvI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = FeatureAvI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = FeatureAvI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ FeatureAvI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = FeatureAvPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = FeatureAvPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ FeatureAvPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (FeatureAvI18n) to $obj2 (FeatureAv)
+ $obj2->addFeatureAvI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(FeatureAvI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ FeatureAvI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(FeatureAvI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(FeatureAvI18nPeer::ID, FeatureAvPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of FeatureAvI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of FeatureAvI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(FeatureAvI18nPeer::DATABASE_NAME);
+ }
+
+ FeatureAvI18nPeer::addSelectColumns($criteria);
+ $startcol2 = FeatureAvI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ FeatureAvPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + FeatureAvPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(FeatureAvI18nPeer::ID, FeatureAvPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = FeatureAvI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = FeatureAvI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = FeatureAvI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ FeatureAvI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined FeatureAv rows
+
+ $key2 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = FeatureAvPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = FeatureAvPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ FeatureAvPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (FeatureAvI18n) to the collection in $obj2 (FeatureAv)
+ $obj2->addFeatureAvI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(FeatureAvI18nPeer::DATABASE_NAME)->getTable(FeatureAvI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseFeatureAvI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseFeatureAvI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new FeatureAvI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return FeatureAvI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a FeatureAvI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or FeatureAvI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from FeatureAvI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(FeatureAvI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a FeatureAvI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or FeatureAvI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(FeatureAvI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(FeatureAvI18nPeer::ID);
+ $value = $criteria->remove(FeatureAvI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(FeatureAvI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(FeatureAvI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(FeatureAvI18nPeer::LOCALE);
+ $value = $criteria->remove(FeatureAvI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(FeatureAvI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(FeatureAvI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is FeatureAvI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(FeatureAvI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the feature_av_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(FeatureAvI18nPeer::TABLE_NAME, $con, FeatureAvI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ FeatureAvI18nPeer::clearInstancePool();
+ FeatureAvI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a FeatureAvI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or FeatureAvI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ FeatureAvI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof FeatureAvI18n) { // it's a model object
+ // invalidate the cache for this single object
+ FeatureAvI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(FeatureAvI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(FeatureAvI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(FeatureAvI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ FeatureAvI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(FeatureAvI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ FeatureAvI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given FeatureAvI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param FeatureAvI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(FeatureAvI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(FeatureAvI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(FeatureAvI18nPeer::DATABASE_NAME, FeatureAvI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return FeatureAvI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = FeatureAvI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(FeatureAvI18nPeer::DATABASE_NAME);
+ $criteria->add(FeatureAvI18nPeer::ID, $id);
+ $criteria->add(FeatureAvI18nPeer::LOCALE, $locale);
+ $v = FeatureAvI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseFeatureAvI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseFeatureAvI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseFeatureAvI18nQuery.php b/core/lib/Thelia/Model/om/BaseFeatureAvI18nQuery.php
new file mode 100644
index 000000000..63c706961
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseFeatureAvI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return FeatureAvI18n|FeatureAvI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = FeatureAvI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureAvI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return FeatureAvI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `feature_av_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new FeatureAvI18n();
+ $obj->hydrate($row);
+ FeatureAvI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return FeatureAvI18n|FeatureAvI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|FeatureAvI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return FeatureAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(FeatureAvI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(FeatureAvI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return FeatureAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(FeatureAvI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(FeatureAvI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByFeatureAv()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureAvI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(FeatureAvI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureAvI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureAvI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureAvI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureAvI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureAvI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureAvI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related FeatureAv object
+ *
+ * @param FeatureAv|PropelObjectCollection $featureAv The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureAvI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByFeatureAv($featureAv, $comparison = null)
+ {
+ if ($featureAv instanceof FeatureAv) {
+ return $this
+ ->addUsingAlias(FeatureAvI18nPeer::ID, $featureAv->getId(), $comparison);
+ } elseif ($featureAv instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(FeatureAvI18nPeer::ID, $featureAv->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByFeatureAv() only accepts arguments of type FeatureAv or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the FeatureAv relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return FeatureAvI18nQuery The current query, for fluid interface
+ */
+ public function joinFeatureAv($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('FeatureAv');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'FeatureAv');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the FeatureAv relation FeatureAv object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\FeatureAvQuery A secondary query class using the current class as primary query
+ */
+ public function useFeatureAvQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinFeatureAv($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'FeatureAv', '\Thelia\Model\FeatureAvQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param FeatureAvI18n $featureAvI18n Object to remove from the list of results
+ *
+ * @return FeatureAvI18nQuery The current query, for fluid interface
+ */
+ public function prune($featureAvI18n = null)
+ {
+ if ($featureAvI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(FeatureAvI18nPeer::ID), $featureAvI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(FeatureAvI18nPeer::LOCALE), $featureAvI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseFeatureAvPeer.php b/core/lib/Thelia/Model/om/BaseFeatureAvPeer.php
index e8e9232dd..0c3deb687 100644
--- a/core/lib/Thelia/Model/om/BaseFeatureAvPeer.php
+++ b/core/lib/Thelia/Model/om/BaseFeatureAvPeer.php
@@ -10,7 +10,7 @@ use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\FeatureAv;
-use Thelia\Model\FeatureAvDescPeer;
+use Thelia\Model\FeatureAvI18nPeer;
use Thelia\Model\FeatureAvPeer;
use Thelia\Model\FeaturePeer;
use Thelia\Model\FeatureProdPeer;
@@ -71,6 +71,13 @@ abstract class BaseFeatureAvPeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -380,12 +387,12 @@ abstract class BaseFeatureAvPeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in FeatureAvDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- FeatureAvDescPeer::clearInstancePool();
// Invalidate objects in FeatureProdPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
FeatureProdPeer::clearInstancePool();
+ // Invalidate objects in FeatureAvI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ FeatureAvI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseFeatureAvQuery.php b/core/lib/Thelia/Model/om/BaseFeatureAvQuery.php
index b1f962a02..8824bc418 100644
--- a/core/lib/Thelia/Model/om/BaseFeatureAvQuery.php
+++ b/core/lib/Thelia/Model/om/BaseFeatureAvQuery.php
@@ -14,7 +14,7 @@ use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Feature;
use Thelia\Model\FeatureAv;
-use Thelia\Model\FeatureAvDesc;
+use Thelia\Model\FeatureAvI18n;
use Thelia\Model\FeatureAvPeer;
use Thelia\Model\FeatureAvQuery;
use Thelia\Model\FeatureProd;
@@ -42,14 +42,14 @@ use Thelia\Model\FeatureProd;
* @method FeatureAvQuery rightJoinFeature($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Feature relation
* @method FeatureAvQuery innerJoinFeature($relationAlias = null) Adds a INNER JOIN clause to the query using the Feature relation
*
- * @method FeatureAvQuery leftJoinFeatureAvDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureAvDesc relation
- * @method FeatureAvQuery rightJoinFeatureAvDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureAvDesc relation
- * @method FeatureAvQuery innerJoinFeatureAvDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureAvDesc relation
- *
* @method FeatureAvQuery leftJoinFeatureProd($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureProd relation
* @method FeatureAvQuery rightJoinFeatureProd($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureProd relation
* @method FeatureAvQuery innerJoinFeatureProd($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureProd relation
*
+ * @method FeatureAvQuery leftJoinFeatureAvI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureAvI18n relation
+ * @method FeatureAvQuery rightJoinFeatureAvI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureAvI18n relation
+ * @method FeatureAvQuery innerJoinFeatureAvI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureAvI18n relation
+ *
* @method FeatureAv findOne(PropelPDO $con = null) Return the first FeatureAv matching the query
* @method FeatureAv findOneOrCreate(PropelPDO $con = null) Return the first FeatureAv matching the query, or a new FeatureAv object populated from the query conditions when no match is found
*
@@ -472,80 +472,6 @@ abstract class BaseFeatureAvQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'Feature', '\Thelia\Model\FeatureQuery');
}
- /**
- * Filter the query by a related FeatureAvDesc object
- *
- * @param FeatureAvDesc|PropelObjectCollection $featureAvDesc the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return FeatureAvQuery The current query, for fluid interface
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByFeatureAvDesc($featureAvDesc, $comparison = null)
- {
- if ($featureAvDesc instanceof FeatureAvDesc) {
- return $this
- ->addUsingAlias(FeatureAvPeer::ID, $featureAvDesc->getFeatureAvId(), $comparison);
- } elseif ($featureAvDesc instanceof PropelObjectCollection) {
- return $this
- ->useFeatureAvDescQuery()
- ->filterByPrimaryKeys($featureAvDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByFeatureAvDesc() only accepts arguments of type FeatureAvDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the FeatureAvDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return FeatureAvQuery The current query, for fluid interface
- */
- public function joinFeatureAvDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('FeatureAvDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'FeatureAvDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the FeatureAvDesc relation FeatureAvDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\FeatureAvDescQuery A secondary query class using the current class as primary query
- */
- public function useFeatureAvDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinFeatureAvDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'FeatureAvDesc', '\Thelia\Model\FeatureAvDescQuery');
- }
-
/**
* Filter the query by a related FeatureProd object
*
@@ -620,6 +546,80 @@ abstract class BaseFeatureAvQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'FeatureProd', '\Thelia\Model\FeatureProdQuery');
}
+ /**
+ * Filter the query by a related FeatureAvI18n object
+ *
+ * @param FeatureAvI18n|PropelObjectCollection $featureAvI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureAvQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByFeatureAvI18n($featureAvI18n, $comparison = null)
+ {
+ if ($featureAvI18n instanceof FeatureAvI18n) {
+ return $this
+ ->addUsingAlias(FeatureAvPeer::ID, $featureAvI18n->getId(), $comparison);
+ } elseif ($featureAvI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useFeatureAvI18nQuery()
+ ->filterByPrimaryKeys($featureAvI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByFeatureAvI18n() only accepts arguments of type FeatureAvI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the FeatureAvI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return FeatureAvQuery The current query, for fluid interface
+ */
+ public function joinFeatureAvI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('FeatureAvI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'FeatureAvI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the FeatureAvI18n relation FeatureAvI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\FeatureAvI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useFeatureAvI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinFeatureAvI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'FeatureAvI18n', '\Thelia\Model\FeatureAvI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -701,4 +701,61 @@ abstract class BaseFeatureAvQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(FeatureAvPeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return FeatureAvQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'FeatureAvI18n';
+
+ return $this
+ ->joinFeatureAvI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return FeatureAvQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('FeatureAvI18n');
+ $this->with['FeatureAvI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return FeatureAvI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'FeatureAvI18n', 'Thelia\Model\FeatureAvI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseFeatureI18n.php b/core/lib/Thelia/Model/om/BaseFeatureI18n.php
new file mode 100644
index 000000000..1fed9873f
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseFeatureI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseFeatureI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return FeatureI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = FeatureI18nPeer::ID;
+ }
+
+ if ($this->aFeature !== null && $this->aFeature->getId() !== $v) {
+ $this->aFeature = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return FeatureI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = FeatureI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return FeatureI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = FeatureI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return FeatureI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = FeatureI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return FeatureI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = FeatureI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return FeatureI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = FeatureI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = FeatureI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating FeatureI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aFeature !== null && $this->id !== $this->aFeature->getId()) {
+ $this->aFeature = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = FeatureI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aFeature = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = FeatureI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ FeatureI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aFeature !== null) {
+ if ($this->aFeature->isModified() || $this->aFeature->isNew()) {
+ $affectedRows += $this->aFeature->save($con);
+ }
+ $this->setFeature($this->aFeature);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(FeatureI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(FeatureI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(FeatureI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(FeatureI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(FeatureI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(FeatureI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `feature_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aFeature !== null) {
+ if (!$this->aFeature->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aFeature->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = FeatureI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = FeatureI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['FeatureI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['FeatureI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = FeatureI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aFeature) {
+ $result['Feature'] = $this->aFeature->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = FeatureI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = FeatureI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(FeatureI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(FeatureI18nPeer::ID)) $criteria->add(FeatureI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(FeatureI18nPeer::LOCALE)) $criteria->add(FeatureI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(FeatureI18nPeer::TITLE)) $criteria->add(FeatureI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(FeatureI18nPeer::DESCRIPTION)) $criteria->add(FeatureI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(FeatureI18nPeer::CHAPO)) $criteria->add(FeatureI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(FeatureI18nPeer::POSTSCRIPTUM)) $criteria->add(FeatureI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(FeatureI18nPeer::DATABASE_NAME);
+ $criteria->add(FeatureI18nPeer::ID, $this->id);
+ $criteria->add(FeatureI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of FeatureI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return FeatureI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return FeatureI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new FeatureI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Feature object.
+ *
+ * @param Feature $v
+ * @return FeatureI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setFeature(Feature $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aFeature = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Feature object, it will not be re-added.
+ if ($v !== null) {
+ $v->addFeatureI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Feature object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Feature The associated Feature object.
+ * @throws PropelException
+ */
+ public function getFeature(PropelPDO $con = null)
+ {
+ if ($this->aFeature === null && ($this->id !== null)) {
+ $this->aFeature = FeatureQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aFeature->addFeatureI18ns($this);
+ */
+ }
+
+ return $this->aFeature;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aFeature = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(FeatureI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseFeatureI18nPeer.php b/core/lib/Thelia/Model/om/BaseFeatureI18nPeer.php
new file mode 100644
index 000000000..d83a5cc56
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseFeatureI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (FeatureI18nPeer::ID, FeatureI18nPeer::LOCALE, FeatureI18nPeer::TITLE, FeatureI18nPeer::DESCRIPTION, FeatureI18nPeer::CHAPO, FeatureI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. FeatureI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (FeatureI18nPeer::ID => 0, FeatureI18nPeer::LOCALE => 1, FeatureI18nPeer::TITLE => 2, FeatureI18nPeer::DESCRIPTION => 3, FeatureI18nPeer::CHAPO => 4, FeatureI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = FeatureI18nPeer::getFieldNames($toType);
+ $key = isset(FeatureI18nPeer::$fieldKeys[$fromType][$name]) ? FeatureI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(FeatureI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, FeatureI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return FeatureI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. FeatureI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(FeatureI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(FeatureI18nPeer::ID);
+ $criteria->addSelectColumn(FeatureI18nPeer::LOCALE);
+ $criteria->addSelectColumn(FeatureI18nPeer::TITLE);
+ $criteria->addSelectColumn(FeatureI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(FeatureI18nPeer::CHAPO);
+ $criteria->addSelectColumn(FeatureI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(FeatureI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ FeatureI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(FeatureI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return FeatureI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = FeatureI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return FeatureI18nPeer::populateObjects(FeatureI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ FeatureI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(FeatureI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param FeatureI18n $obj A FeatureI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ FeatureI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A FeatureI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof FeatureI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or FeatureI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(FeatureI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return FeatureI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(FeatureI18nPeer::$instances[$key])) {
+ return FeatureI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ FeatureI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to feature_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = FeatureI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = FeatureI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = FeatureI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ FeatureI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (FeatureI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = FeatureI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = FeatureI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + FeatureI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = FeatureI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ FeatureI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Feature table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinFeature(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(FeatureI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ FeatureI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(FeatureI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(FeatureI18nPeer::ID, FeaturePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of FeatureI18n objects pre-filled with their Feature objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of FeatureI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinFeature(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(FeatureI18nPeer::DATABASE_NAME);
+ }
+
+ FeatureI18nPeer::addSelectColumns($criteria);
+ $startcol = FeatureI18nPeer::NUM_HYDRATE_COLUMNS;
+ FeaturePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(FeatureI18nPeer::ID, FeaturePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = FeatureI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = FeatureI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = FeatureI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ FeatureI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = FeaturePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = FeaturePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ FeaturePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (FeatureI18n) to $obj2 (Feature)
+ $obj2->addFeatureI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(FeatureI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ FeatureI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(FeatureI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(FeatureI18nPeer::ID, FeaturePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of FeatureI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of FeatureI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(FeatureI18nPeer::DATABASE_NAME);
+ }
+
+ FeatureI18nPeer::addSelectColumns($criteria);
+ $startcol2 = FeatureI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ FeaturePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + FeaturePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(FeatureI18nPeer::ID, FeaturePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = FeatureI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = FeatureI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = FeatureI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ FeatureI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Feature rows
+
+ $key2 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = FeaturePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = FeaturePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ FeaturePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (FeatureI18n) to the collection in $obj2 (Feature)
+ $obj2->addFeatureI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(FeatureI18nPeer::DATABASE_NAME)->getTable(FeatureI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseFeatureI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseFeatureI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new FeatureI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return FeatureI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a FeatureI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or FeatureI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from FeatureI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(FeatureI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a FeatureI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or FeatureI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(FeatureI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(FeatureI18nPeer::ID);
+ $value = $criteria->remove(FeatureI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(FeatureI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(FeatureI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(FeatureI18nPeer::LOCALE);
+ $value = $criteria->remove(FeatureI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(FeatureI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(FeatureI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is FeatureI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(FeatureI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the feature_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(FeatureI18nPeer::TABLE_NAME, $con, FeatureI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ FeatureI18nPeer::clearInstancePool();
+ FeatureI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a FeatureI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or FeatureI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ FeatureI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof FeatureI18n) { // it's a model object
+ // invalidate the cache for this single object
+ FeatureI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(FeatureI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(FeatureI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(FeatureI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ FeatureI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(FeatureI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ FeatureI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given FeatureI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param FeatureI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(FeatureI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(FeatureI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(FeatureI18nPeer::DATABASE_NAME, FeatureI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return FeatureI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = FeatureI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(FeatureI18nPeer::DATABASE_NAME);
+ $criteria->add(FeatureI18nPeer::ID, $id);
+ $criteria->add(FeatureI18nPeer::LOCALE, $locale);
+ $v = FeatureI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseFeatureI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseFeatureI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseFeatureI18nQuery.php b/core/lib/Thelia/Model/om/BaseFeatureI18nQuery.php
new file mode 100644
index 000000000..af5b6385e
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseFeatureI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return FeatureI18n|FeatureI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = FeatureI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(FeatureI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return FeatureI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `feature_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new FeatureI18n();
+ $obj->hydrate($row);
+ FeatureI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return FeatureI18n|FeatureI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|FeatureI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return FeatureI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(FeatureI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(FeatureI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return FeatureI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(FeatureI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(FeatureI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByFeature()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(FeatureI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FeatureI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Feature object
+ *
+ * @param Feature|PropelObjectCollection $feature The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FeatureI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByFeature($feature, $comparison = null)
+ {
+ if ($feature instanceof Feature) {
+ return $this
+ ->addUsingAlias(FeatureI18nPeer::ID, $feature->getId(), $comparison);
+ } elseif ($feature instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(FeatureI18nPeer::ID, $feature->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByFeature() only accepts arguments of type Feature or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Feature relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return FeatureI18nQuery The current query, for fluid interface
+ */
+ public function joinFeature($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Feature');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Feature');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Feature relation Feature object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\FeatureQuery A secondary query class using the current class as primary query
+ */
+ public function useFeatureQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinFeature($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Feature', '\Thelia\Model\FeatureQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param FeatureI18n $featureI18n Object to remove from the list of results
+ *
+ * @return FeatureI18nQuery The current query, for fluid interface
+ */
+ public function prune($featureI18n = null)
+ {
+ if ($featureI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(FeatureI18nPeer::ID), $featureI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(FeatureI18nPeer::LOCALE), $featureI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseFeaturePeer.php b/core/lib/Thelia/Model/om/BaseFeaturePeer.php
index a12e4c26b..07435699f 100644
--- a/core/lib/Thelia/Model/om/BaseFeaturePeer.php
+++ b/core/lib/Thelia/Model/om/BaseFeaturePeer.php
@@ -12,7 +12,7 @@ use \PropelPDO;
use Thelia\Model\Feature;
use Thelia\Model\FeatureAvPeer;
use Thelia\Model\FeatureCategoryPeer;
-use Thelia\Model\FeatureDescPeer;
+use Thelia\Model\FeatureI18nPeer;
use Thelia\Model\FeaturePeer;
use Thelia\Model\FeatureProdPeer;
use Thelia\Model\map\FeatureTableMap;
@@ -75,6 +75,13 @@ abstract class BaseFeaturePeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -386,9 +393,6 @@ abstract class BaseFeaturePeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in FeatureDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- FeatureDescPeer::clearInstancePool();
// Invalidate objects in FeatureAvPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
FeatureAvPeer::clearInstancePool();
@@ -398,6 +402,9 @@ abstract class BaseFeaturePeer
// Invalidate objects in FeatureCategoryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
FeatureCategoryPeer::clearInstancePool();
+ // Invalidate objects in FeatureI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ FeatureI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseFeatureQuery.php b/core/lib/Thelia/Model/om/BaseFeatureQuery.php
index edb1625c7..af50d2c1d 100644
--- a/core/lib/Thelia/Model/om/BaseFeatureQuery.php
+++ b/core/lib/Thelia/Model/om/BaseFeatureQuery.php
@@ -15,7 +15,7 @@ use \PropelPDO;
use Thelia\Model\Feature;
use Thelia\Model\FeatureAv;
use Thelia\Model\FeatureCategory;
-use Thelia\Model\FeatureDesc;
+use Thelia\Model\FeatureI18n;
use Thelia\Model\FeaturePeer;
use Thelia\Model\FeatureProd;
use Thelia\Model\FeatureQuery;
@@ -41,10 +41,6 @@ use Thelia\Model\FeatureQuery;
* @method FeatureQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method FeatureQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method FeatureQuery leftJoinFeatureDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureDesc relation
- * @method FeatureQuery rightJoinFeatureDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureDesc relation
- * @method FeatureQuery innerJoinFeatureDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureDesc relation
- *
* @method FeatureQuery leftJoinFeatureAv($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureAv relation
* @method FeatureQuery rightJoinFeatureAv($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureAv relation
* @method FeatureQuery innerJoinFeatureAv($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureAv relation
@@ -57,6 +53,10 @@ use Thelia\Model\FeatureQuery;
* @method FeatureQuery rightJoinFeatureCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureCategory relation
* @method FeatureQuery innerJoinFeatureCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureCategory relation
*
+ * @method FeatureQuery leftJoinFeatureI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the FeatureI18n relation
+ * @method FeatureQuery rightJoinFeatureI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FeatureI18n relation
+ * @method FeatureQuery innerJoinFeatureI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the FeatureI18n relation
+ *
* @method Feature findOne(PropelPDO $con = null) Return the first Feature matching the query
* @method Feature findOneOrCreate(PropelPDO $con = null) Return the first Feature matching the query, or a new Feature object populated from the query conditions when no match is found
*
@@ -444,80 +444,6 @@ abstract class BaseFeatureQuery extends ModelCriteria
return $this->addUsingAlias(FeaturePeer::UPDATED_AT, $updatedAt, $comparison);
}
- /**
- * Filter the query by a related FeatureDesc object
- *
- * @param FeatureDesc|PropelObjectCollection $featureDesc 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
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByFeatureDesc($featureDesc, $comparison = null)
- {
- if ($featureDesc instanceof FeatureDesc) {
- return $this
- ->addUsingAlias(FeaturePeer::ID, $featureDesc->getFeatureId(), $comparison);
- } elseif ($featureDesc instanceof PropelObjectCollection) {
- return $this
- ->useFeatureDescQuery()
- ->filterByPrimaryKeys($featureDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByFeatureDesc() only accepts arguments of type FeatureDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the FeatureDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return FeatureQuery The current query, for fluid interface
- */
- public function joinFeatureDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('FeatureDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'FeatureDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the FeatureDesc relation FeatureDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\FeatureDescQuery A secondary query class using the current class as primary query
- */
- public function useFeatureDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinFeatureDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'FeatureDesc', '\Thelia\Model\FeatureDescQuery');
- }
-
/**
* Filter the query by a related FeatureAv object
*
@@ -740,6 +666,80 @@ abstract class BaseFeatureQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'FeatureCategory', '\Thelia\Model\FeatureCategoryQuery');
}
+ /**
+ * Filter the query by a related FeatureI18n object
+ *
+ * @param FeatureI18n|PropelObjectCollection $featureI18n 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByFeatureI18n($featureI18n, $comparison = null)
+ {
+ if ($featureI18n instanceof FeatureI18n) {
+ return $this
+ ->addUsingAlias(FeaturePeer::ID, $featureI18n->getId(), $comparison);
+ } elseif ($featureI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useFeatureI18nQuery()
+ ->filterByPrimaryKeys($featureI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByFeatureI18n() only accepts arguments of type FeatureI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the FeatureI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return FeatureQuery The current query, for fluid interface
+ */
+ public function joinFeatureI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('FeatureI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'FeatureI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the FeatureI18n relation FeatureI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\FeatureI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useFeatureI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinFeatureI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'FeatureI18n', '\Thelia\Model\FeatureI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -821,4 +821,61 @@ abstract class BaseFeatureQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(FeaturePeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return FeatureQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'FeatureI18n';
+
+ return $this
+ ->joinFeatureI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return FeatureQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('FeatureI18n');
+ $this->with['FeatureI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return FeatureI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'FeatureI18n', 'Thelia\Model\FeatureI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseFolder.php b/core/lib/Thelia/Model/om/BaseFolder.php
index f2f77ba1e..3824c8973 100644
--- a/core/lib/Thelia/Model/om/BaseFolder.php
+++ b/core/lib/Thelia/Model/om/BaseFolder.php
@@ -20,8 +20,8 @@ use Thelia\Model\ContentFolderQuery;
use Thelia\Model\Document;
use Thelia\Model\DocumentQuery;
use Thelia\Model\Folder;
-use Thelia\Model\FolderDesc;
-use Thelia\Model\FolderDescQuery;
+use Thelia\Model\FolderI18n;
+use Thelia\Model\FolderI18nQuery;
use Thelia\Model\FolderPeer;
use Thelia\Model\FolderQuery;
use Thelia\Model\Image;
@@ -99,12 +99,6 @@ abstract class BaseFolder extends BaseObject implements Persistent
*/
protected $updated_at;
- /**
- * @var PropelObjectCollection|FolderDesc[] Collection to store aggregation of FolderDesc objects.
- */
- protected $collFolderDescs;
- protected $collFolderDescsPartial;
-
/**
* @var PropelObjectCollection|Image[] Collection to store aggregation of Image objects.
*/
@@ -129,6 +123,12 @@ abstract class BaseFolder extends BaseObject implements Persistent
protected $collContentFolders;
protected $collContentFoldersPartial;
+ /**
+ * @var PropelObjectCollection|FolderI18n[] Collection to store aggregation of FolderI18n objects.
+ */
+ protected $collFolderI18ns;
+ protected $collFolderI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -143,11 +143,19 @@ abstract class BaseFolder extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $folderDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[FolderI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -173,6 +181,12 @@ abstract class BaseFolder extends BaseObject implements Persistent
*/
protected $contentFoldersScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $folderI18nsScheduledForDeletion = null;
+
/**
* Get the [id] column value.
*
@@ -557,8 +571,6 @@ abstract class BaseFolder extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
- $this->collFolderDescs = null;
-
$this->collImages = null;
$this->collDocuments = null;
@@ -567,6 +579,8 @@ abstract class BaseFolder extends BaseObject implements Persistent
$this->collContentFolders = null;
+ $this->collFolderI18ns = null;
+
} // if (deep)
}
@@ -702,23 +716,6 @@ abstract class BaseFolder extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->folderDescsScheduledForDeletion !== null) {
- if (!$this->folderDescsScheduledForDeletion->isEmpty()) {
- FolderDescQuery::create()
- ->filterByPrimaryKeys($this->folderDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->folderDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collFolderDescs !== null) {
- foreach ($this->collFolderDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->imagesScheduledForDeletion !== null) {
if (!$this->imagesScheduledForDeletion->isEmpty()) {
foreach ($this->imagesScheduledForDeletion as $image) {
@@ -790,6 +787,23 @@ abstract class BaseFolder extends BaseObject implements Persistent
}
}
+ if ($this->folderI18nsScheduledForDeletion !== null) {
+ if (!$this->folderI18nsScheduledForDeletion->isEmpty()) {
+ FolderI18nQuery::create()
+ ->filterByPrimaryKeys($this->folderI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->folderI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collFolderI18ns !== null) {
+ foreach ($this->collFolderI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -968,14 +982,6 @@ abstract class BaseFolder extends BaseObject implements Persistent
}
- if ($this->collFolderDescs !== null) {
- foreach ($this->collFolderDescs as $referrerFK) {
- if (!$referrerFK->validate($columns)) {
- $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
- }
- }
- }
-
if ($this->collImages !== null) {
foreach ($this->collImages as $referrerFK) {
if (!$referrerFK->validate($columns)) {
@@ -1008,6 +1014,14 @@ abstract class BaseFolder extends BaseObject implements Persistent
}
}
+ if ($this->collFolderI18ns !== null) {
+ foreach ($this->collFolderI18ns as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
$this->alreadyInValidation = false;
}
@@ -1102,9 +1116,6 @@ abstract class BaseFolder extends BaseObject implements Persistent
$keys[6] => $this->getUpdatedAt(),
);
if ($includeForeignObjects) {
- if (null !== $this->collFolderDescs) {
- $result['FolderDescs'] = $this->collFolderDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collImages) {
$result['Images'] = $this->collImages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1117,6 +1128,9 @@ abstract class BaseFolder extends BaseObject implements Persistent
if (null !== $this->collContentFolders) {
$result['ContentFolders'] = $this->collContentFolders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collFolderI18ns) {
+ $result['FolderI18ns'] = $this->collFolderI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1298,12 +1312,6 @@ abstract class BaseFolder extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getFolderDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addFolderDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getImages() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addImage($relObj->copy($deepCopy));
@@ -1328,6 +1336,12 @@ abstract class BaseFolder extends BaseObject implements Persistent
}
}
+ foreach ($this->getFolderI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addFolderI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1389,9 +1403,6 @@ abstract class BaseFolder extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('FolderDesc' == $relationName) {
- $this->initFolderDescs();
- }
if ('Image' == $relationName) {
$this->initImages();
}
@@ -1404,212 +1415,8 @@ abstract class BaseFolder extends BaseObject implements Persistent
if ('ContentFolder' == $relationName) {
$this->initContentFolders();
}
- }
-
- /**
- * Clears out the collFolderDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addFolderDescs()
- */
- public function clearFolderDescs()
- {
- $this->collFolderDescs = null; // important to set this to null since that means it is uninitialized
- $this->collFolderDescsPartial = null;
- }
-
- /**
- * reset is the collFolderDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialFolderDescs($v = true)
- {
- $this->collFolderDescsPartial = $v;
- }
-
- /**
- * Initializes the collFolderDescs collection.
- *
- * By default this just sets the collFolderDescs collection to an empty array (like clearcollFolderDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initFolderDescs($overrideExisting = true)
- {
- if (null !== $this->collFolderDescs && !$overrideExisting) {
- return;
- }
- $this->collFolderDescs = new PropelObjectCollection();
- $this->collFolderDescs->setModel('FolderDesc');
- }
-
- /**
- * Gets an array of FolderDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * 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 Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|FolderDesc[] List of FolderDesc objects
- * @throws PropelException
- */
- public function getFolderDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collFolderDescsPartial && !$this->isNew();
- if (null === $this->collFolderDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collFolderDescs) {
- // return empty collection
- $this->initFolderDescs();
- } else {
- $collFolderDescs = FolderDescQuery::create(null, $criteria)
- ->filterByFolder($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collFolderDescsPartial && count($collFolderDescs)) {
- $this->initFolderDescs(false);
-
- foreach($collFolderDescs as $obj) {
- if (false == $this->collFolderDescs->contains($obj)) {
- $this->collFolderDescs->append($obj);
- }
- }
-
- $this->collFolderDescsPartial = true;
- }
-
- return $collFolderDescs;
- }
-
- if($partial && $this->collFolderDescs) {
- foreach($this->collFolderDescs as $obj) {
- if($obj->isNew()) {
- $collFolderDescs[] = $obj;
- }
- }
- }
-
- $this->collFolderDescs = $collFolderDescs;
- $this->collFolderDescsPartial = false;
- }
- }
-
- return $this->collFolderDescs;
- }
-
- /**
- * Sets a collection of FolderDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $folderDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setFolderDescs(PropelCollection $folderDescs, PropelPDO $con = null)
- {
- $this->folderDescsScheduledForDeletion = $this->getFolderDescs(new Criteria(), $con)->diff($folderDescs);
-
- foreach ($this->folderDescsScheduledForDeletion as $folderDescRemoved) {
- $folderDescRemoved->setFolder(null);
- }
-
- $this->collFolderDescs = null;
- foreach ($folderDescs as $folderDesc) {
- $this->addFolderDesc($folderDesc);
- }
-
- $this->collFolderDescs = $folderDescs;
- $this->collFolderDescsPartial = false;
- }
-
- /**
- * Returns the number of related FolderDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related FolderDesc objects.
- * @throws PropelException
- */
- public function countFolderDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collFolderDescsPartial && !$this->isNew();
- if (null === $this->collFolderDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collFolderDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getFolderDescs());
- }
- $query = FolderDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByFolder($this)
- ->count($con);
- }
- } else {
- return count($this->collFolderDescs);
- }
- }
-
- /**
- * Method called to associate a FolderDesc object to this object
- * through the FolderDesc foreign key attribute.
- *
- * @param FolderDesc $l FolderDesc
- * @return Folder The current object (for fluent API support)
- */
- public function addFolderDesc(FolderDesc $l)
- {
- if ($this->collFolderDescs === null) {
- $this->initFolderDescs();
- $this->collFolderDescsPartial = true;
- }
- if (!$this->collFolderDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddFolderDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param FolderDesc $folderDesc The folderDesc object to add.
- */
- protected function doAddFolderDesc($folderDesc)
- {
- $this->collFolderDescs[]= $folderDesc;
- $folderDesc->setFolder($this);
- }
-
- /**
- * @param FolderDesc $folderDesc The folderDesc object to remove.
- */
- public function removeFolderDesc($folderDesc)
- {
- if ($this->getFolderDescs()->contains($folderDesc)) {
- $this->collFolderDescs->remove($this->collFolderDescs->search($folderDesc));
- if (null === $this->folderDescsScheduledForDeletion) {
- $this->folderDescsScheduledForDeletion = clone $this->collFolderDescs;
- $this->folderDescsScheduledForDeletion->clear();
- }
- $this->folderDescsScheduledForDeletion[]= $folderDesc;
- $folderDesc->setFolder(null);
+ if ('FolderI18n' == $relationName) {
+ $this->initFolderI18ns();
}
}
@@ -2691,6 +2498,217 @@ abstract class BaseFolder extends BaseObject implements Persistent
return $this->getContentFolders($query, $con);
}
+ /**
+ * Clears out the collFolderI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addFolderI18ns()
+ */
+ public function clearFolderI18ns()
+ {
+ $this->collFolderI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collFolderI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collFolderI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialFolderI18ns($v = true)
+ {
+ $this->collFolderI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collFolderI18ns collection.
+ *
+ * By default this just sets the collFolderI18ns collection to an empty array (like clearcollFolderI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initFolderI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collFolderI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collFolderI18ns = new PropelObjectCollection();
+ $this->collFolderI18ns->setModel('FolderI18n');
+ }
+
+ /**
+ * Gets an array of FolderI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * 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 Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|FolderI18n[] List of FolderI18n objects
+ * @throws PropelException
+ */
+ public function getFolderI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collFolderI18nsPartial && !$this->isNew();
+ if (null === $this->collFolderI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collFolderI18ns) {
+ // return empty collection
+ $this->initFolderI18ns();
+ } else {
+ $collFolderI18ns = FolderI18nQuery::create(null, $criteria)
+ ->filterByFolder($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collFolderI18nsPartial && count($collFolderI18ns)) {
+ $this->initFolderI18ns(false);
+
+ foreach($collFolderI18ns as $obj) {
+ if (false == $this->collFolderI18ns->contains($obj)) {
+ $this->collFolderI18ns->append($obj);
+ }
+ }
+
+ $this->collFolderI18nsPartial = true;
+ }
+
+ return $collFolderI18ns;
+ }
+
+ if($partial && $this->collFolderI18ns) {
+ foreach($this->collFolderI18ns as $obj) {
+ if($obj->isNew()) {
+ $collFolderI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collFolderI18ns = $collFolderI18ns;
+ $this->collFolderI18nsPartial = false;
+ }
+ }
+
+ return $this->collFolderI18ns;
+ }
+
+ /**
+ * Sets a collection of FolderI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $folderI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setFolderI18ns(PropelCollection $folderI18ns, PropelPDO $con = null)
+ {
+ $this->folderI18nsScheduledForDeletion = $this->getFolderI18ns(new Criteria(), $con)->diff($folderI18ns);
+
+ foreach ($this->folderI18nsScheduledForDeletion as $folderI18nRemoved) {
+ $folderI18nRemoved->setFolder(null);
+ }
+
+ $this->collFolderI18ns = null;
+ foreach ($folderI18ns as $folderI18n) {
+ $this->addFolderI18n($folderI18n);
+ }
+
+ $this->collFolderI18ns = $folderI18ns;
+ $this->collFolderI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related FolderI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related FolderI18n objects.
+ * @throws PropelException
+ */
+ public function countFolderI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collFolderI18nsPartial && !$this->isNew();
+ if (null === $this->collFolderI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collFolderI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getFolderI18ns());
+ }
+ $query = FolderI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByFolder($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collFolderI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a FolderI18n object to this object
+ * through the FolderI18n foreign key attribute.
+ *
+ * @param FolderI18n $l FolderI18n
+ * @return Folder The current object (for fluent API support)
+ */
+ public function addFolderI18n(FolderI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collFolderI18ns === null) {
+ $this->initFolderI18ns();
+ $this->collFolderI18nsPartial = true;
+ }
+ if (!$this->collFolderI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddFolderI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param FolderI18n $folderI18n The folderI18n object to add.
+ */
+ protected function doAddFolderI18n($folderI18n)
+ {
+ $this->collFolderI18ns[]= $folderI18n;
+ $folderI18n->setFolder($this);
+ }
+
+ /**
+ * @param FolderI18n $folderI18n The folderI18n object to remove.
+ */
+ public function removeFolderI18n($folderI18n)
+ {
+ if ($this->getFolderI18ns()->contains($folderI18n)) {
+ $this->collFolderI18ns->remove($this->collFolderI18ns->search($folderI18n));
+ if (null === $this->folderI18nsScheduledForDeletion) {
+ $this->folderI18nsScheduledForDeletion = clone $this->collFolderI18ns;
+ $this->folderI18nsScheduledForDeletion->clear();
+ }
+ $this->folderI18nsScheduledForDeletion[]= $folderI18n;
+ $folderI18n->setFolder(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -2723,11 +2741,6 @@ abstract class BaseFolder extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collFolderDescs) {
- foreach ($this->collFolderDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collImages) {
foreach ($this->collImages as $o) {
$o->clearAllReferences($deep);
@@ -2748,12 +2761,17 @@ abstract class BaseFolder extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
+ if ($this->collFolderI18ns) {
+ foreach ($this->collFolderI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collFolderDescs instanceof PropelCollection) {
- $this->collFolderDescs->clearIterator();
- }
- $this->collFolderDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collImages instanceof PropelCollection) {
$this->collImages->clearIterator();
}
@@ -2770,6 +2788,10 @@ abstract class BaseFolder extends BaseObject implements Persistent
$this->collContentFolders->clearIterator();
}
$this->collContentFolders = null;
+ if ($this->collFolderI18ns instanceof PropelCollection) {
+ $this->collFolderI18ns->clearIterator();
+ }
+ $this->collFolderI18ns = null;
}
/**
@@ -2806,4 +2828,199 @@ abstract class BaseFolder extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Folder The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return FolderI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collFolderI18ns) {
+ foreach ($this->collFolderI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new FolderI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = FolderI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addFolderI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Folder The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ FolderI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collFolderI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collFolderI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return FolderI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return FolderI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return FolderI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return FolderI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return FolderI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseFolderI18n.php b/core/lib/Thelia/Model/om/BaseFolderI18n.php
new file mode 100644
index 000000000..c55901626
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseFolderI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseFolderI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return FolderI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = FolderI18nPeer::ID;
+ }
+
+ if ($this->aFolder !== null && $this->aFolder->getId() !== $v) {
+ $this->aFolder = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return FolderI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = FolderI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return FolderI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = FolderI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return FolderI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = FolderI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return FolderI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = FolderI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return FolderI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = FolderI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = FolderI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating FolderI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aFolder !== null && $this->id !== $this->aFolder->getId()) {
+ $this->aFolder = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = FolderI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aFolder = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = FolderI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ FolderI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aFolder !== null) {
+ if ($this->aFolder->isModified() || $this->aFolder->isNew()) {
+ $affectedRows += $this->aFolder->save($con);
+ }
+ $this->setFolder($this->aFolder);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(FolderI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(FolderI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(FolderI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(FolderI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(FolderI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(FolderI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `folder_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aFolder !== null) {
+ if (!$this->aFolder->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aFolder->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = FolderI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = FolderI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['FolderI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['FolderI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = FolderI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aFolder) {
+ $result['Folder'] = $this->aFolder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = FolderI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = FolderI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(FolderI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(FolderI18nPeer::ID)) $criteria->add(FolderI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(FolderI18nPeer::LOCALE)) $criteria->add(FolderI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(FolderI18nPeer::TITLE)) $criteria->add(FolderI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(FolderI18nPeer::DESCRIPTION)) $criteria->add(FolderI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(FolderI18nPeer::CHAPO)) $criteria->add(FolderI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(FolderI18nPeer::POSTSCRIPTUM)) $criteria->add(FolderI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(FolderI18nPeer::DATABASE_NAME);
+ $criteria->add(FolderI18nPeer::ID, $this->id);
+ $criteria->add(FolderI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of FolderI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return FolderI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return FolderI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new FolderI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Folder object.
+ *
+ * @param Folder $v
+ * @return FolderI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setFolder(Folder $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aFolder = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Folder object, it will not be re-added.
+ if ($v !== null) {
+ $v->addFolderI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Folder object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Folder The associated Folder object.
+ * @throws PropelException
+ */
+ public function getFolder(PropelPDO $con = null)
+ {
+ if ($this->aFolder === null && ($this->id !== null)) {
+ $this->aFolder = FolderQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aFolder->addFolderI18ns($this);
+ */
+ }
+
+ return $this->aFolder;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aFolder = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(FolderI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseFolderI18nPeer.php b/core/lib/Thelia/Model/om/BaseFolderI18nPeer.php
new file mode 100644
index 000000000..713476163
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseFolderI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (FolderI18nPeer::ID, FolderI18nPeer::LOCALE, FolderI18nPeer::TITLE, FolderI18nPeer::DESCRIPTION, FolderI18nPeer::CHAPO, FolderI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. FolderI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (FolderI18nPeer::ID => 0, FolderI18nPeer::LOCALE => 1, FolderI18nPeer::TITLE => 2, FolderI18nPeer::DESCRIPTION => 3, FolderI18nPeer::CHAPO => 4, FolderI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = FolderI18nPeer::getFieldNames($toType);
+ $key = isset(FolderI18nPeer::$fieldKeys[$fromType][$name]) ? FolderI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(FolderI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, FolderI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return FolderI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. FolderI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(FolderI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(FolderI18nPeer::ID);
+ $criteria->addSelectColumn(FolderI18nPeer::LOCALE);
+ $criteria->addSelectColumn(FolderI18nPeer::TITLE);
+ $criteria->addSelectColumn(FolderI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(FolderI18nPeer::CHAPO);
+ $criteria->addSelectColumn(FolderI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(FolderI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ FolderI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(FolderI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return FolderI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = FolderI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return FolderI18nPeer::populateObjects(FolderI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ FolderI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(FolderI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param FolderI18n $obj A FolderI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ FolderI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A FolderI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof FolderI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or FolderI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(FolderI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return FolderI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(FolderI18nPeer::$instances[$key])) {
+ return FolderI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ FolderI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to folder_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = FolderI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = FolderI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = FolderI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ FolderI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (FolderI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = FolderI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = FolderI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + FolderI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = FolderI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ FolderI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Folder table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinFolder(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(FolderI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ FolderI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(FolderI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(FolderI18nPeer::ID, FolderPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of FolderI18n objects pre-filled with their Folder objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of FolderI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinFolder(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(FolderI18nPeer::DATABASE_NAME);
+ }
+
+ FolderI18nPeer::addSelectColumns($criteria);
+ $startcol = FolderI18nPeer::NUM_HYDRATE_COLUMNS;
+ FolderPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(FolderI18nPeer::ID, FolderPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = FolderI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = FolderI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = FolderI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ FolderI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = FolderPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = FolderPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = FolderPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ FolderPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (FolderI18n) to $obj2 (Folder)
+ $obj2->addFolderI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(FolderI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ FolderI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(FolderI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(FolderI18nPeer::ID, FolderPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of FolderI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of FolderI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(FolderI18nPeer::DATABASE_NAME);
+ }
+
+ FolderI18nPeer::addSelectColumns($criteria);
+ $startcol2 = FolderI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ FolderPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + FolderPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(FolderI18nPeer::ID, FolderPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = FolderI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = FolderI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = FolderI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ FolderI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Folder rows
+
+ $key2 = FolderPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = FolderPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = FolderPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ FolderPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (FolderI18n) to the collection in $obj2 (Folder)
+ $obj2->addFolderI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(FolderI18nPeer::DATABASE_NAME)->getTable(FolderI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseFolderI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseFolderI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new FolderI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return FolderI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a FolderI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or FolderI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from FolderI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(FolderI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a FolderI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or FolderI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(FolderI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(FolderI18nPeer::ID);
+ $value = $criteria->remove(FolderI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(FolderI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(FolderI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(FolderI18nPeer::LOCALE);
+ $value = $criteria->remove(FolderI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(FolderI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(FolderI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is FolderI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(FolderI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the folder_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(FolderI18nPeer::TABLE_NAME, $con, FolderI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ FolderI18nPeer::clearInstancePool();
+ FolderI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a FolderI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or FolderI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ FolderI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof FolderI18n) { // it's a model object
+ // invalidate the cache for this single object
+ FolderI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(FolderI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(FolderI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(FolderI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ FolderI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(FolderI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ FolderI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given FolderI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param FolderI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(FolderI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(FolderI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(FolderI18nPeer::DATABASE_NAME, FolderI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return FolderI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = FolderI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(FolderI18nPeer::DATABASE_NAME);
+ $criteria->add(FolderI18nPeer::ID, $id);
+ $criteria->add(FolderI18nPeer::LOCALE, $locale);
+ $v = FolderI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseFolderI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseFolderI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseFolderI18nQuery.php b/core/lib/Thelia/Model/om/BaseFolderI18nQuery.php
new file mode 100644
index 000000000..cbe1734c3
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseFolderI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return FolderI18n|FolderI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = FolderI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(FolderI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return FolderI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `folder_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new FolderI18n();
+ $obj->hydrate($row);
+ FolderI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return FolderI18n|FolderI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|FolderI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return FolderI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(FolderI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(FolderI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return FolderI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(FolderI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(FolderI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByFolder()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FolderI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(FolderI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FolderI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FolderI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FolderI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FolderI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FolderI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FolderI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FolderI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FolderI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FolderI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(FolderI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Folder object
+ *
+ * @param Folder|PropelObjectCollection $folder The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return FolderI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByFolder($folder, $comparison = null)
+ {
+ if ($folder instanceof Folder) {
+ return $this
+ ->addUsingAlias(FolderI18nPeer::ID, $folder->getId(), $comparison);
+ } elseif ($folder instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(FolderI18nPeer::ID, $folder->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByFolder() only accepts arguments of type Folder or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Folder relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return FolderI18nQuery The current query, for fluid interface
+ */
+ public function joinFolder($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Folder');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Folder');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Folder relation Folder object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\FolderQuery A secondary query class using the current class as primary query
+ */
+ public function useFolderQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinFolder($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Folder', '\Thelia\Model\FolderQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param FolderI18n $folderI18n Object to remove from the list of results
+ *
+ * @return FolderI18nQuery The current query, for fluid interface
+ */
+ public function prune($folderI18n = null)
+ {
+ if ($folderI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(FolderI18nPeer::ID), $folderI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(FolderI18nPeer::LOCALE), $folderI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseFolderPeer.php b/core/lib/Thelia/Model/om/BaseFolderPeer.php
index 78f7cb4bd..6eea02ea4 100644
--- a/core/lib/Thelia/Model/om/BaseFolderPeer.php
+++ b/core/lib/Thelia/Model/om/BaseFolderPeer.php
@@ -12,7 +12,7 @@ use \PropelPDO;
use Thelia\Model\ContentFolderPeer;
use Thelia\Model\DocumentPeer;
use Thelia\Model\Folder;
-use Thelia\Model\FolderDescPeer;
+use Thelia\Model\FolderI18nPeer;
use Thelia\Model\FolderPeer;
use Thelia\Model\ImagePeer;
use Thelia\Model\RewritingPeer;
@@ -82,6 +82,13 @@ abstract class BaseFolderPeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -397,9 +404,6 @@ abstract class BaseFolderPeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in FolderDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- FolderDescPeer::clearInstancePool();
// Invalidate objects in ImagePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ImagePeer::clearInstancePool();
@@ -412,6 +416,9 @@ abstract class BaseFolderPeer
// Invalidate objects in ContentFolderPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ContentFolderPeer::clearInstancePool();
+ // Invalidate objects in FolderI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ FolderI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseFolderQuery.php b/core/lib/Thelia/Model/om/BaseFolderQuery.php
index 75b3fc50b..6d0dae283 100644
--- a/core/lib/Thelia/Model/om/BaseFolderQuery.php
+++ b/core/lib/Thelia/Model/om/BaseFolderQuery.php
@@ -15,7 +15,7 @@ use \PropelPDO;
use Thelia\Model\ContentFolder;
use Thelia\Model\Document;
use Thelia\Model\Folder;
-use Thelia\Model\FolderDesc;
+use Thelia\Model\FolderI18n;
use Thelia\Model\FolderPeer;
use Thelia\Model\FolderQuery;
use Thelia\Model\Image;
@@ -46,10 +46,6 @@ use Thelia\Model\Rewriting;
* @method FolderQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method FolderQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method FolderQuery leftJoinFolderDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the FolderDesc relation
- * @method FolderQuery rightJoinFolderDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FolderDesc relation
- * @method FolderQuery innerJoinFolderDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the FolderDesc relation
- *
* @method FolderQuery leftJoinImage($relationAlias = null) Adds a LEFT JOIN clause to the query using the Image relation
* @method FolderQuery rightJoinImage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Image relation
* @method FolderQuery innerJoinImage($relationAlias = null) Adds a INNER JOIN clause to the query using the Image relation
@@ -66,6 +62,10 @@ use Thelia\Model\Rewriting;
* @method FolderQuery rightJoinContentFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentFolder relation
* @method FolderQuery innerJoinContentFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentFolder relation
*
+ * @method FolderQuery leftJoinFolderI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the FolderI18n relation
+ * @method FolderQuery rightJoinFolderI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FolderI18n relation
+ * @method FolderQuery innerJoinFolderI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the FolderI18n relation
+ *
* @method Folder findOne(PropelPDO $con = null) Return the first Folder matching the query
* @method Folder findOneOrCreate(PropelPDO $con = null) Return the first Folder matching the query, or a new Folder object populated from the query conditions when no match is found
*
@@ -527,80 +527,6 @@ abstract class BaseFolderQuery extends ModelCriteria
return $this->addUsingAlias(FolderPeer::UPDATED_AT, $updatedAt, $comparison);
}
- /**
- * Filter the query by a related FolderDesc object
- *
- * @param FolderDesc|PropelObjectCollection $folderDesc 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
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByFolderDesc($folderDesc, $comparison = null)
- {
- if ($folderDesc instanceof FolderDesc) {
- return $this
- ->addUsingAlias(FolderPeer::ID, $folderDesc->getFolderId(), $comparison);
- } elseif ($folderDesc instanceof PropelObjectCollection) {
- return $this
- ->useFolderDescQuery()
- ->filterByPrimaryKeys($folderDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByFolderDesc() only accepts arguments of type FolderDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the FolderDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return FolderQuery The current query, for fluid interface
- */
- public function joinFolderDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('FolderDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'FolderDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the FolderDesc relation FolderDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\FolderDescQuery A secondary query class using the current class as primary query
- */
- public function useFolderDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinFolderDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'FolderDesc', '\Thelia\Model\FolderDescQuery');
- }
-
/**
* Filter the query by a related Image object
*
@@ -897,6 +823,80 @@ abstract class BaseFolderQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'ContentFolder', '\Thelia\Model\ContentFolderQuery');
}
+ /**
+ * Filter the query by a related FolderI18n object
+ *
+ * @param FolderI18n|PropelObjectCollection $folderI18n 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
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByFolderI18n($folderI18n, $comparison = null)
+ {
+ if ($folderI18n instanceof FolderI18n) {
+ return $this
+ ->addUsingAlias(FolderPeer::ID, $folderI18n->getId(), $comparison);
+ } elseif ($folderI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useFolderI18nQuery()
+ ->filterByPrimaryKeys($folderI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByFolderI18n() only accepts arguments of type FolderI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the FolderI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return FolderQuery The current query, for fluid interface
+ */
+ public function joinFolderI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('FolderI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'FolderI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the FolderI18n relation FolderI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\FolderI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useFolderI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinFolderI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'FolderI18n', '\Thelia\Model\FolderI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -978,4 +978,61 @@ abstract class BaseFolderQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(FolderPeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return FolderQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'FolderI18n';
+
+ return $this
+ ->joinFolderI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return FolderQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('FolderI18n');
+ $this->with['FolderI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return FolderI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'FolderI18n', 'Thelia\Model\FolderI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseGroup.php b/core/lib/Thelia/Model/om/BaseGroup.php
index c0b23863b..785698a99 100644
--- a/core/lib/Thelia/Model/om/BaseGroup.php
+++ b/core/lib/Thelia/Model/om/BaseGroup.php
@@ -18,8 +18,8 @@ use \PropelPDO;
use Thelia\Model\AdminGroup;
use Thelia\Model\AdminGroupQuery;
use Thelia\Model\Group;
-use Thelia\Model\GroupDesc;
-use Thelia\Model\GroupDescQuery;
+use Thelia\Model\GroupI18n;
+use Thelia\Model\GroupI18nQuery;
use Thelia\Model\GroupModule;
use Thelia\Model\GroupModuleQuery;
use Thelia\Model\GroupPeer;
@@ -79,12 +79,6 @@ abstract class BaseGroup extends BaseObject implements Persistent
*/
protected $updated_at;
- /**
- * @var PropelObjectCollection|GroupDesc[] Collection to store aggregation of GroupDesc objects.
- */
- protected $collGroupDescs;
- protected $collGroupDescsPartial;
-
/**
* @var PropelObjectCollection|AdminGroup[] Collection to store aggregation of AdminGroup objects.
*/
@@ -103,6 +97,12 @@ abstract class BaseGroup extends BaseObject implements Persistent
protected $collGroupModules;
protected $collGroupModulesPartial;
+ /**
+ * @var PropelObjectCollection|GroupI18n[] Collection to store aggregation of GroupI18n objects.
+ */
+ protected $collGroupI18ns;
+ protected $collGroupI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -117,11 +117,19 @@ abstract class BaseGroup extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $groupDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[GroupI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -141,6 +149,12 @@ abstract class BaseGroup extends BaseObject implements Persistent
*/
protected $groupModulesScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $groupI18nsScheduledForDeletion = null;
+
/**
* Get the [id] column value.
*
@@ -429,14 +443,14 @@ abstract class BaseGroup extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
- $this->collGroupDescs = null;
-
$this->collAdminGroups = null;
$this->collGroupResources = null;
$this->collGroupModules = null;
+ $this->collGroupI18ns = null;
+
} // if (deep)
}
@@ -572,23 +586,6 @@ abstract class BaseGroup extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->groupDescsScheduledForDeletion !== null) {
- if (!$this->groupDescsScheduledForDeletion->isEmpty()) {
- GroupDescQuery::create()
- ->filterByPrimaryKeys($this->groupDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->groupDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collGroupDescs !== null) {
- foreach ($this->collGroupDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->adminGroupsScheduledForDeletion !== null) {
if (!$this->adminGroupsScheduledForDeletion->isEmpty()) {
foreach ($this->adminGroupsScheduledForDeletion as $adminGroup) {
@@ -641,6 +638,23 @@ abstract class BaseGroup extends BaseObject implements Persistent
}
}
+ if ($this->groupI18nsScheduledForDeletion !== null) {
+ if (!$this->groupI18nsScheduledForDeletion->isEmpty()) {
+ GroupI18nQuery::create()
+ ->filterByPrimaryKeys($this->groupI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->groupI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collGroupI18ns !== null) {
+ foreach ($this->collGroupI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -801,14 +815,6 @@ abstract class BaseGroup extends BaseObject implements Persistent
}
- if ($this->collGroupDescs !== null) {
- foreach ($this->collGroupDescs as $referrerFK) {
- if (!$referrerFK->validate($columns)) {
- $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
- }
- }
- }
-
if ($this->collAdminGroups !== null) {
foreach ($this->collAdminGroups as $referrerFK) {
if (!$referrerFK->validate($columns)) {
@@ -833,6 +839,14 @@ abstract class BaseGroup extends BaseObject implements Persistent
}
}
+ if ($this->collGroupI18ns !== null) {
+ foreach ($this->collGroupI18ns as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
$this->alreadyInValidation = false;
}
@@ -915,9 +929,6 @@ abstract class BaseGroup extends BaseObject implements Persistent
$keys[3] => $this->getUpdatedAt(),
);
if ($includeForeignObjects) {
- if (null !== $this->collGroupDescs) {
- $result['GroupDescs'] = $this->collGroupDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collAdminGroups) {
$result['AdminGroups'] = $this->collAdminGroups->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -927,6 +938,9 @@ abstract class BaseGroup extends BaseObject implements Persistent
if (null !== $this->collGroupModules) {
$result['GroupModules'] = $this->collGroupModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collGroupI18ns) {
+ $result['GroupI18ns'] = $this->collGroupI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1090,12 +1104,6 @@ abstract class BaseGroup extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getGroupDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addGroupDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getAdminGroups() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addAdminGroup($relObj->copy($deepCopy));
@@ -1114,6 +1122,12 @@ abstract class BaseGroup extends BaseObject implements Persistent
}
}
+ foreach ($this->getGroupI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addGroupI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1175,9 +1189,6 @@ abstract class BaseGroup extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('GroupDesc' == $relationName) {
- $this->initGroupDescs();
- }
if ('AdminGroup' == $relationName) {
$this->initAdminGroups();
}
@@ -1187,212 +1198,8 @@ abstract class BaseGroup extends BaseObject implements Persistent
if ('GroupModule' == $relationName) {
$this->initGroupModules();
}
- }
-
- /**
- * Clears out the collGroupDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addGroupDescs()
- */
- public function clearGroupDescs()
- {
- $this->collGroupDescs = null; // important to set this to null since that means it is uninitialized
- $this->collGroupDescsPartial = null;
- }
-
- /**
- * reset is the collGroupDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialGroupDescs($v = true)
- {
- $this->collGroupDescsPartial = $v;
- }
-
- /**
- * Initializes the collGroupDescs collection.
- *
- * By default this just sets the collGroupDescs collection to an empty array (like clearcollGroupDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initGroupDescs($overrideExisting = true)
- {
- if (null !== $this->collGroupDescs && !$overrideExisting) {
- return;
- }
- $this->collGroupDescs = new PropelObjectCollection();
- $this->collGroupDescs->setModel('GroupDesc');
- }
-
- /**
- * Gets an array of GroupDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * Next time the same method is called without $criteria, the cached collection is returned.
- * If this Group is new, it will return
- * an empty collection or the current collection; the criteria is ignored on a new object.
- *
- * @param Criteria $criteria optional Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|GroupDesc[] List of GroupDesc objects
- * @throws PropelException
- */
- public function getGroupDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collGroupDescsPartial && !$this->isNew();
- if (null === $this->collGroupDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collGroupDescs) {
- // return empty collection
- $this->initGroupDescs();
- } else {
- $collGroupDescs = GroupDescQuery::create(null, $criteria)
- ->filterByGroup($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collGroupDescsPartial && count($collGroupDescs)) {
- $this->initGroupDescs(false);
-
- foreach($collGroupDescs as $obj) {
- if (false == $this->collGroupDescs->contains($obj)) {
- $this->collGroupDescs->append($obj);
- }
- }
-
- $this->collGroupDescsPartial = true;
- }
-
- return $collGroupDescs;
- }
-
- if($partial && $this->collGroupDescs) {
- foreach($this->collGroupDescs as $obj) {
- if($obj->isNew()) {
- $collGroupDescs[] = $obj;
- }
- }
- }
-
- $this->collGroupDescs = $collGroupDescs;
- $this->collGroupDescsPartial = false;
- }
- }
-
- return $this->collGroupDescs;
- }
-
- /**
- * Sets a collection of GroupDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $groupDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setGroupDescs(PropelCollection $groupDescs, PropelPDO $con = null)
- {
- $this->groupDescsScheduledForDeletion = $this->getGroupDescs(new Criteria(), $con)->diff($groupDescs);
-
- foreach ($this->groupDescsScheduledForDeletion as $groupDescRemoved) {
- $groupDescRemoved->setGroup(null);
- }
-
- $this->collGroupDescs = null;
- foreach ($groupDescs as $groupDesc) {
- $this->addGroupDesc($groupDesc);
- }
-
- $this->collGroupDescs = $groupDescs;
- $this->collGroupDescsPartial = false;
- }
-
- /**
- * Returns the number of related GroupDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related GroupDesc objects.
- * @throws PropelException
- */
- public function countGroupDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collGroupDescsPartial && !$this->isNew();
- if (null === $this->collGroupDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collGroupDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getGroupDescs());
- }
- $query = GroupDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByGroup($this)
- ->count($con);
- }
- } else {
- return count($this->collGroupDescs);
- }
- }
-
- /**
- * Method called to associate a GroupDesc object to this object
- * through the GroupDesc foreign key attribute.
- *
- * @param GroupDesc $l GroupDesc
- * @return Group The current object (for fluent API support)
- */
- public function addGroupDesc(GroupDesc $l)
- {
- if ($this->collGroupDescs === null) {
- $this->initGroupDescs();
- $this->collGroupDescsPartial = true;
- }
- if (!$this->collGroupDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddGroupDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param GroupDesc $groupDesc The groupDesc object to add.
- */
- protected function doAddGroupDesc($groupDesc)
- {
- $this->collGroupDescs[]= $groupDesc;
- $groupDesc->setGroup($this);
- }
-
- /**
- * @param GroupDesc $groupDesc The groupDesc object to remove.
- */
- public function removeGroupDesc($groupDesc)
- {
- if ($this->getGroupDescs()->contains($groupDesc)) {
- $this->collGroupDescs->remove($this->collGroupDescs->search($groupDesc));
- if (null === $this->groupDescsScheduledForDeletion) {
- $this->groupDescsScheduledForDeletion = clone $this->collGroupDescs;
- $this->groupDescsScheduledForDeletion->clear();
- }
- $this->groupDescsScheduledForDeletion[]= $groupDesc;
- $groupDesc->setGroup(null);
+ if ('GroupI18n' == $relationName) {
+ $this->initGroupI18ns();
}
}
@@ -2092,6 +1899,217 @@ abstract class BaseGroup extends BaseObject implements Persistent
return $this->getGroupModules($query, $con);
}
+ /**
+ * Clears out the collGroupI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addGroupI18ns()
+ */
+ public function clearGroupI18ns()
+ {
+ $this->collGroupI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collGroupI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collGroupI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialGroupI18ns($v = true)
+ {
+ $this->collGroupI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collGroupI18ns collection.
+ *
+ * By default this just sets the collGroupI18ns collection to an empty array (like clearcollGroupI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initGroupI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collGroupI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collGroupI18ns = new PropelObjectCollection();
+ $this->collGroupI18ns->setModel('GroupI18n');
+ }
+
+ /**
+ * Gets an array of GroupI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this Group is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|GroupI18n[] List of GroupI18n objects
+ * @throws PropelException
+ */
+ public function getGroupI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collGroupI18nsPartial && !$this->isNew();
+ if (null === $this->collGroupI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collGroupI18ns) {
+ // return empty collection
+ $this->initGroupI18ns();
+ } else {
+ $collGroupI18ns = GroupI18nQuery::create(null, $criteria)
+ ->filterByGroup($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collGroupI18nsPartial && count($collGroupI18ns)) {
+ $this->initGroupI18ns(false);
+
+ foreach($collGroupI18ns as $obj) {
+ if (false == $this->collGroupI18ns->contains($obj)) {
+ $this->collGroupI18ns->append($obj);
+ }
+ }
+
+ $this->collGroupI18nsPartial = true;
+ }
+
+ return $collGroupI18ns;
+ }
+
+ if($partial && $this->collGroupI18ns) {
+ foreach($this->collGroupI18ns as $obj) {
+ if($obj->isNew()) {
+ $collGroupI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collGroupI18ns = $collGroupI18ns;
+ $this->collGroupI18nsPartial = false;
+ }
+ }
+
+ return $this->collGroupI18ns;
+ }
+
+ /**
+ * Sets a collection of GroupI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $groupI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setGroupI18ns(PropelCollection $groupI18ns, PropelPDO $con = null)
+ {
+ $this->groupI18nsScheduledForDeletion = $this->getGroupI18ns(new Criteria(), $con)->diff($groupI18ns);
+
+ foreach ($this->groupI18nsScheduledForDeletion as $groupI18nRemoved) {
+ $groupI18nRemoved->setGroup(null);
+ }
+
+ $this->collGroupI18ns = null;
+ foreach ($groupI18ns as $groupI18n) {
+ $this->addGroupI18n($groupI18n);
+ }
+
+ $this->collGroupI18ns = $groupI18ns;
+ $this->collGroupI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related GroupI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related GroupI18n objects.
+ * @throws PropelException
+ */
+ public function countGroupI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collGroupI18nsPartial && !$this->isNew();
+ if (null === $this->collGroupI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collGroupI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getGroupI18ns());
+ }
+ $query = GroupI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByGroup($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collGroupI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a GroupI18n object to this object
+ * through the GroupI18n foreign key attribute.
+ *
+ * @param GroupI18n $l GroupI18n
+ * @return Group The current object (for fluent API support)
+ */
+ public function addGroupI18n(GroupI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collGroupI18ns === null) {
+ $this->initGroupI18ns();
+ $this->collGroupI18nsPartial = true;
+ }
+ if (!$this->collGroupI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddGroupI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param GroupI18n $groupI18n The groupI18n object to add.
+ */
+ protected function doAddGroupI18n($groupI18n)
+ {
+ $this->collGroupI18ns[]= $groupI18n;
+ $groupI18n->setGroup($this);
+ }
+
+ /**
+ * @param GroupI18n $groupI18n The groupI18n object to remove.
+ */
+ public function removeGroupI18n($groupI18n)
+ {
+ if ($this->getGroupI18ns()->contains($groupI18n)) {
+ $this->collGroupI18ns->remove($this->collGroupI18ns->search($groupI18n));
+ if (null === $this->groupI18nsScheduledForDeletion) {
+ $this->groupI18nsScheduledForDeletion = clone $this->collGroupI18ns;
+ $this->groupI18nsScheduledForDeletion->clear();
+ }
+ $this->groupI18nsScheduledForDeletion[]= $groupI18n;
+ $groupI18n->setGroup(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -2121,11 +2139,6 @@ abstract class BaseGroup extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collGroupDescs) {
- foreach ($this->collGroupDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collAdminGroups) {
foreach ($this->collAdminGroups as $o) {
$o->clearAllReferences($deep);
@@ -2141,12 +2154,17 @@ abstract class BaseGroup extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
+ if ($this->collGroupI18ns) {
+ foreach ($this->collGroupI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collGroupDescs instanceof PropelCollection) {
- $this->collGroupDescs->clearIterator();
- }
- $this->collGroupDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collAdminGroups instanceof PropelCollection) {
$this->collAdminGroups->clearIterator();
}
@@ -2159,6 +2177,10 @@ abstract class BaseGroup extends BaseObject implements Persistent
$this->collGroupModules->clearIterator();
}
$this->collGroupModules = null;
+ if ($this->collGroupI18ns instanceof PropelCollection) {
+ $this->collGroupI18ns->clearIterator();
+ }
+ $this->collGroupI18ns = null;
}
/**
@@ -2195,4 +2217,199 @@ abstract class BaseGroup extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Group The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return GroupI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collGroupI18ns) {
+ foreach ($this->collGroupI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new GroupI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = GroupI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addGroupI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Group The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ GroupI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collGroupI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collGroupI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return GroupI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return GroupI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return GroupI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return GroupI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return GroupI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseGroupI18n.php b/core/lib/Thelia/Model/om/BaseGroupI18n.php
new file mode 100644
index 000000000..89ddead03
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseGroupI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseGroupI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return GroupI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = GroupI18nPeer::ID;
+ }
+
+ if ($this->aGroup !== null && $this->aGroup->getId() !== $v) {
+ $this->aGroup = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return GroupI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = GroupI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return GroupI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = GroupI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return GroupI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = GroupI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return GroupI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = GroupI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return GroupI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = GroupI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = GroupI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating GroupI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aGroup !== null && $this->id !== $this->aGroup->getId()) {
+ $this->aGroup = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = GroupI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aGroup = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = GroupI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ GroupI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aGroup !== null) {
+ if ($this->aGroup->isModified() || $this->aGroup->isNew()) {
+ $affectedRows += $this->aGroup->save($con);
+ }
+ $this->setGroup($this->aGroup);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(GroupI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(GroupI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(GroupI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(GroupI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(GroupI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(GroupI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `group_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aGroup !== null) {
+ if (!$this->aGroup->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aGroup->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = GroupI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = GroupI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['GroupI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['GroupI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = GroupI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aGroup) {
+ $result['Group'] = $this->aGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = GroupI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = GroupI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(GroupI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(GroupI18nPeer::ID)) $criteria->add(GroupI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(GroupI18nPeer::LOCALE)) $criteria->add(GroupI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(GroupI18nPeer::TITLE)) $criteria->add(GroupI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(GroupI18nPeer::DESCRIPTION)) $criteria->add(GroupI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(GroupI18nPeer::CHAPO)) $criteria->add(GroupI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(GroupI18nPeer::POSTSCRIPTUM)) $criteria->add(GroupI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(GroupI18nPeer::DATABASE_NAME);
+ $criteria->add(GroupI18nPeer::ID, $this->id);
+ $criteria->add(GroupI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of GroupI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return GroupI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return GroupI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new GroupI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Group object.
+ *
+ * @param Group $v
+ * @return GroupI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setGroup(Group $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aGroup = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Group object, it will not be re-added.
+ if ($v !== null) {
+ $v->addGroupI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Group object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Group The associated Group object.
+ * @throws PropelException
+ */
+ public function getGroup(PropelPDO $con = null)
+ {
+ if ($this->aGroup === null && ($this->id !== null)) {
+ $this->aGroup = GroupQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aGroup->addGroupI18ns($this);
+ */
+ }
+
+ return $this->aGroup;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aGroup = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(GroupI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseGroupI18nPeer.php b/core/lib/Thelia/Model/om/BaseGroupI18nPeer.php
new file mode 100644
index 000000000..a76dfab52
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseGroupI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (GroupI18nPeer::ID, GroupI18nPeer::LOCALE, GroupI18nPeer::TITLE, GroupI18nPeer::DESCRIPTION, GroupI18nPeer::CHAPO, GroupI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. GroupI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (GroupI18nPeer::ID => 0, GroupI18nPeer::LOCALE => 1, GroupI18nPeer::TITLE => 2, GroupI18nPeer::DESCRIPTION => 3, GroupI18nPeer::CHAPO => 4, GroupI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = GroupI18nPeer::getFieldNames($toType);
+ $key = isset(GroupI18nPeer::$fieldKeys[$fromType][$name]) ? GroupI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(GroupI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, GroupI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return GroupI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. GroupI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(GroupI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(GroupI18nPeer::ID);
+ $criteria->addSelectColumn(GroupI18nPeer::LOCALE);
+ $criteria->addSelectColumn(GroupI18nPeer::TITLE);
+ $criteria->addSelectColumn(GroupI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(GroupI18nPeer::CHAPO);
+ $criteria->addSelectColumn(GroupI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(GroupI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ GroupI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(GroupI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return GroupI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = GroupI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return GroupI18nPeer::populateObjects(GroupI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ GroupI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(GroupI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param GroupI18n $obj A GroupI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ GroupI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A GroupI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof GroupI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or GroupI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(GroupI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return GroupI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(GroupI18nPeer::$instances[$key])) {
+ return GroupI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ GroupI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to group_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = GroupI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = GroupI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = GroupI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ GroupI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (GroupI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = GroupI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = GroupI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + GroupI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = GroupI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ GroupI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Group table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinGroup(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(GroupI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ GroupI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(GroupI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(GroupI18nPeer::ID, GroupPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of GroupI18n objects pre-filled with their Group objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of GroupI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinGroup(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(GroupI18nPeer::DATABASE_NAME);
+ }
+
+ GroupI18nPeer::addSelectColumns($criteria);
+ $startcol = GroupI18nPeer::NUM_HYDRATE_COLUMNS;
+ GroupPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(GroupI18nPeer::ID, GroupPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = GroupI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = GroupI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = GroupI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ GroupI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = GroupPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = GroupPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = GroupPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ GroupPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (GroupI18n) to $obj2 (Group)
+ $obj2->addGroupI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(GroupI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ GroupI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(GroupI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(GroupI18nPeer::ID, GroupPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of GroupI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of GroupI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(GroupI18nPeer::DATABASE_NAME);
+ }
+
+ GroupI18nPeer::addSelectColumns($criteria);
+ $startcol2 = GroupI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ GroupPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + GroupPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(GroupI18nPeer::ID, GroupPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = GroupI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = GroupI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = GroupI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ GroupI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Group rows
+
+ $key2 = GroupPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = GroupPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = GroupPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ GroupPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (GroupI18n) to the collection in $obj2 (Group)
+ $obj2->addGroupI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(GroupI18nPeer::DATABASE_NAME)->getTable(GroupI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseGroupI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseGroupI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new GroupI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return GroupI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a GroupI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or GroupI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from GroupI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(GroupI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a GroupI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or GroupI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(GroupI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(GroupI18nPeer::ID);
+ $value = $criteria->remove(GroupI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(GroupI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(GroupI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(GroupI18nPeer::LOCALE);
+ $value = $criteria->remove(GroupI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(GroupI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(GroupI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is GroupI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(GroupI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the group_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(GroupI18nPeer::TABLE_NAME, $con, GroupI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ GroupI18nPeer::clearInstancePool();
+ GroupI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a GroupI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or GroupI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ GroupI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof GroupI18n) { // it's a model object
+ // invalidate the cache for this single object
+ GroupI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(GroupI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(GroupI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(GroupI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ GroupI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(GroupI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ GroupI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given GroupI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param GroupI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(GroupI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(GroupI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(GroupI18nPeer::DATABASE_NAME, GroupI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return GroupI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = GroupI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(GroupI18nPeer::DATABASE_NAME);
+ $criteria->add(GroupI18nPeer::ID, $id);
+ $criteria->add(GroupI18nPeer::LOCALE, $locale);
+ $v = GroupI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseGroupI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseGroupI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseGroupI18nQuery.php b/core/lib/Thelia/Model/om/BaseGroupI18nQuery.php
new file mode 100644
index 000000000..9abd503d6
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseGroupI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return GroupI18n|GroupI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = GroupI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(GroupI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return GroupI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `group_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new GroupI18n();
+ $obj->hydrate($row);
+ GroupI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return GroupI18n|GroupI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|GroupI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return GroupI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(GroupI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(GroupI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return GroupI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(GroupI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(GroupI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByGroup()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return GroupI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(GroupI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return GroupI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(GroupI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return GroupI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(GroupI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return GroupI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(GroupI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return GroupI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(GroupI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return GroupI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(GroupI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Group object
+ *
+ * @param Group|PropelObjectCollection $group The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return GroupI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByGroup($group, $comparison = null)
+ {
+ if ($group instanceof Group) {
+ return $this
+ ->addUsingAlias(GroupI18nPeer::ID, $group->getId(), $comparison);
+ } elseif ($group instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(GroupI18nPeer::ID, $group->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByGroup() only accepts arguments of type Group or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Group relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return GroupI18nQuery The current query, for fluid interface
+ */
+ public function joinGroup($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Group');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Group');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Group relation Group object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\GroupQuery A secondary query class using the current class as primary query
+ */
+ public function useGroupQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinGroup($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Group', '\Thelia\Model\GroupQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param GroupI18n $groupI18n Object to remove from the list of results
+ *
+ * @return GroupI18nQuery The current query, for fluid interface
+ */
+ public function prune($groupI18n = null)
+ {
+ if ($groupI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(GroupI18nPeer::ID), $groupI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(GroupI18nPeer::LOCALE), $groupI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseGroupPeer.php b/core/lib/Thelia/Model/om/BaseGroupPeer.php
index e566bd6e3..557528ce6 100644
--- a/core/lib/Thelia/Model/om/BaseGroupPeer.php
+++ b/core/lib/Thelia/Model/om/BaseGroupPeer.php
@@ -11,7 +11,7 @@ use \PropelException;
use \PropelPDO;
use Thelia\Model\AdminGroupPeer;
use Thelia\Model\Group;
-use Thelia\Model\GroupDescPeer;
+use Thelia\Model\GroupI18nPeer;
use Thelia\Model\GroupModulePeer;
use Thelia\Model\GroupPeer;
use Thelia\Model\GroupResourcePeer;
@@ -72,6 +72,13 @@ abstract class BaseGroupPeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -381,9 +388,6 @@ abstract class BaseGroupPeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in GroupDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- GroupDescPeer::clearInstancePool();
// Invalidate objects in AdminGroupPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
AdminGroupPeer::clearInstancePool();
@@ -393,6 +397,9 @@ abstract class BaseGroupPeer
// Invalidate objects in GroupModulePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
GroupModulePeer::clearInstancePool();
+ // Invalidate objects in GroupI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ GroupI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseGroupQuery.php b/core/lib/Thelia/Model/om/BaseGroupQuery.php
index 9fde4c213..9806ff053 100644
--- a/core/lib/Thelia/Model/om/BaseGroupQuery.php
+++ b/core/lib/Thelia/Model/om/BaseGroupQuery.php
@@ -14,7 +14,7 @@ use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\AdminGroup;
use Thelia\Model\Group;
-use Thelia\Model\GroupDesc;
+use Thelia\Model\GroupI18n;
use Thelia\Model\GroupModule;
use Thelia\Model\GroupPeer;
use Thelia\Model\GroupQuery;
@@ -39,10 +39,6 @@ use Thelia\Model\GroupResource;
* @method GroupQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method GroupQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method GroupQuery leftJoinGroupDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupDesc relation
- * @method GroupQuery rightJoinGroupDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupDesc relation
- * @method GroupQuery innerJoinGroupDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupDesc relation
- *
* @method GroupQuery leftJoinAdminGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the AdminGroup relation
* @method GroupQuery rightJoinAdminGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the AdminGroup relation
* @method GroupQuery innerJoinAdminGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the AdminGroup relation
@@ -55,6 +51,10 @@ use Thelia\Model\GroupResource;
* @method GroupQuery rightJoinGroupModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupModule relation
* @method GroupQuery innerJoinGroupModule($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupModule relation
*
+ * @method GroupQuery leftJoinGroupI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupI18n relation
+ * @method GroupQuery rightJoinGroupI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupI18n relation
+ * @method GroupQuery innerJoinGroupI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupI18n relation
+ *
* @method Group findOne(PropelPDO $con = null) Return the first Group matching the query
* @method Group findOneOrCreate(PropelPDO $con = null) Return the first Group matching the query, or a new Group object populated from the query conditions when no match is found
*
@@ -387,80 +387,6 @@ abstract class BaseGroupQuery extends ModelCriteria
return $this->addUsingAlias(GroupPeer::UPDATED_AT, $updatedAt, $comparison);
}
- /**
- * Filter the query by a related GroupDesc object
- *
- * @param GroupDesc|PropelObjectCollection $groupDesc the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return GroupQuery The current query, for fluid interface
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByGroupDesc($groupDesc, $comparison = null)
- {
- if ($groupDesc instanceof GroupDesc) {
- return $this
- ->addUsingAlias(GroupPeer::ID, $groupDesc->getGroupId(), $comparison);
- } elseif ($groupDesc instanceof PropelObjectCollection) {
- return $this
- ->useGroupDescQuery()
- ->filterByPrimaryKeys($groupDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByGroupDesc() only accepts arguments of type GroupDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the GroupDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return GroupQuery The current query, for fluid interface
- */
- public function joinGroupDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('GroupDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'GroupDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the GroupDesc relation GroupDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\GroupDescQuery A secondary query class using the current class as primary query
- */
- public function useGroupDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinGroupDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'GroupDesc', '\Thelia\Model\GroupDescQuery');
- }
-
/**
* Filter the query by a related AdminGroup object
*
@@ -683,6 +609,80 @@ abstract class BaseGroupQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'GroupModule', '\Thelia\Model\GroupModuleQuery');
}
+ /**
+ * Filter the query by a related GroupI18n object
+ *
+ * @param GroupI18n|PropelObjectCollection $groupI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return GroupQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByGroupI18n($groupI18n, $comparison = null)
+ {
+ if ($groupI18n instanceof GroupI18n) {
+ return $this
+ ->addUsingAlias(GroupPeer::ID, $groupI18n->getId(), $comparison);
+ } elseif ($groupI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useGroupI18nQuery()
+ ->filterByPrimaryKeys($groupI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByGroupI18n() only accepts arguments of type GroupI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the GroupI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return GroupQuery The current query, for fluid interface
+ */
+ public function joinGroupI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('GroupI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'GroupI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the GroupI18n relation GroupI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\GroupI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useGroupI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinGroupI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'GroupI18n', '\Thelia\Model\GroupI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -764,4 +764,61 @@ abstract class BaseGroupQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(GroupPeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return GroupQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'GroupI18n';
+
+ return $this
+ ->joinGroupI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return GroupQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('GroupI18n');
+ $this->with['GroupI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return GroupI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'GroupI18n', 'Thelia\Model\GroupI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseImage.php b/core/lib/Thelia/Model/om/BaseImage.php
index 42a6e8378..f86d68573 100644
--- a/core/lib/Thelia/Model/om/BaseImage.php
+++ b/core/lib/Thelia/Model/om/BaseImage.php
@@ -22,8 +22,8 @@ use Thelia\Model\ContentQuery;
use Thelia\Model\Folder;
use Thelia\Model\FolderQuery;
use Thelia\Model\Image;
-use Thelia\Model\ImageDesc;
-use Thelia\Model\ImageDescQuery;
+use Thelia\Model\ImageI18n;
+use Thelia\Model\ImageI18nQuery;
use Thelia\Model\ImagePeer;
use Thelia\Model\ImageQuery;
use Thelia\Model\Product;
@@ -132,10 +132,10 @@ abstract class BaseImage extends BaseObject implements Persistent
protected $aFolder;
/**
- * @var PropelObjectCollection|ImageDesc[] Collection to store aggregation of ImageDesc objects.
+ * @var PropelObjectCollection|ImageI18n[] Collection to store aggregation of ImageI18n objects.
*/
- protected $collImageDescs;
- protected $collImageDescsPartial;
+ protected $collImageI18ns;
+ protected $collImageI18nsPartial;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -151,11 +151,25 @@ abstract class BaseImage extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
+ /**
+ * Current locale
+ * @var string
+ */
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[ImageI18n]
+ */
+ protected $currentTranslations;
+
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
- protected $imageDescsScheduledForDeletion = null;
+ protected $imageI18nsScheduledForDeletion = null;
/**
* Get the [id] column value.
@@ -637,7 +651,7 @@ abstract class BaseImage extends BaseObject implements Persistent
$this->aCategory = null;
$this->aContent = null;
$this->aFolder = null;
- $this->collImageDescs = null;
+ $this->collImageI18ns = null;
} // if (deep)
}
@@ -807,18 +821,17 @@ abstract class BaseImage extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->imageDescsScheduledForDeletion !== null) {
- if (!$this->imageDescsScheduledForDeletion->isEmpty()) {
- foreach ($this->imageDescsScheduledForDeletion as $imageDesc) {
- // need to save related object because we set the relation to null
- $imageDesc->save($con);
- }
- $this->imageDescsScheduledForDeletion = null;
+ if ($this->imageI18nsScheduledForDeletion !== null) {
+ if (!$this->imageI18nsScheduledForDeletion->isEmpty()) {
+ ImageI18nQuery::create()
+ ->filterByPrimaryKeys($this->imageI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->imageI18nsScheduledForDeletion = null;
}
}
- if ($this->collImageDescs !== null) {
- foreach ($this->collImageDescs as $referrerFK) {
+ if ($this->collImageI18ns !== null) {
+ foreach ($this->collImageI18ns as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
@@ -1045,8 +1058,8 @@ abstract class BaseImage extends BaseObject implements Persistent
}
- if ($this->collImageDescs !== null) {
- foreach ($this->collImageDescs as $referrerFK) {
+ if ($this->collImageI18ns !== null) {
+ foreach ($this->collImageI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -1167,8 +1180,8 @@ abstract class BaseImage extends BaseObject implements Persistent
if (null !== $this->aFolder) {
$result['Folder'] = $this->aFolder->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
- if (null !== $this->collImageDescs) {
- $result['ImageDescs'] = $this->collImageDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ if (null !== $this->collImageI18ns) {
+ $result['ImageI18ns'] = $this->collImageI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
@@ -1363,9 +1376,9 @@ abstract class BaseImage extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getImageDescs() as $relObj) {
+ foreach ($this->getImageI18ns() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addImageDesc($relObj->copy($deepCopy));
+ $copyObj->addImageI18n($relObj->copy($deepCopy));
}
}
@@ -1634,40 +1647,40 @@ abstract class BaseImage extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('ImageDesc' == $relationName) {
- $this->initImageDescs();
+ if ('ImageI18n' == $relationName) {
+ $this->initImageI18ns();
}
}
/**
- * Clears out the collImageDescs collection
+ * Clears out the collImageI18ns collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
- * @see addImageDescs()
+ * @see addImageI18ns()
*/
- public function clearImageDescs()
+ public function clearImageI18ns()
{
- $this->collImageDescs = null; // important to set this to null since that means it is uninitialized
- $this->collImageDescsPartial = null;
+ $this->collImageI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collImageI18nsPartial = null;
}
/**
- * reset is the collImageDescs collection loaded partially
+ * reset is the collImageI18ns collection loaded partially
*
* @return void
*/
- public function resetPartialImageDescs($v = true)
+ public function resetPartialImageI18ns($v = true)
{
- $this->collImageDescsPartial = $v;
+ $this->collImageI18nsPartial = $v;
}
/**
- * Initializes the collImageDescs collection.
+ * Initializes the collImageI18ns collection.
*
- * By default this just sets the collImageDescs collection to an empty array (like clearcollImageDescs());
+ * By default this just sets the collImageI18ns collection to an empty array (like clearcollImageI18ns());
* 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.
*
@@ -1676,17 +1689,17 @@ abstract class BaseImage extends BaseObject implements Persistent
*
* @return void
*/
- public function initImageDescs($overrideExisting = true)
+ public function initImageI18ns($overrideExisting = true)
{
- if (null !== $this->collImageDescs && !$overrideExisting) {
+ if (null !== $this->collImageI18ns && !$overrideExisting) {
return;
}
- $this->collImageDescs = new PropelObjectCollection();
- $this->collImageDescs->setModel('ImageDesc');
+ $this->collImageI18ns = new PropelObjectCollection();
+ $this->collImageI18ns->setModel('ImageI18n');
}
/**
- * Gets an array of ImageDesc objects which contain a foreign key that references this object.
+ * Gets an array of ImageI18n objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
@@ -1696,98 +1709,98 @@ abstract class BaseImage extends BaseObject implements Persistent
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|ImageDesc[] List of ImageDesc objects
+ * @return PropelObjectCollection|ImageI18n[] List of ImageI18n objects
* @throws PropelException
*/
- public function getImageDescs($criteria = null, PropelPDO $con = null)
+ public function getImageI18ns($criteria = null, PropelPDO $con = null)
{
- $partial = $this->collImageDescsPartial && !$this->isNew();
- if (null === $this->collImageDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collImageDescs) {
+ $partial = $this->collImageI18nsPartial && !$this->isNew();
+ if (null === $this->collImageI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collImageI18ns) {
// return empty collection
- $this->initImageDescs();
+ $this->initImageI18ns();
} else {
- $collImageDescs = ImageDescQuery::create(null, $criteria)
+ $collImageI18ns = ImageI18nQuery::create(null, $criteria)
->filterByImage($this)
->find($con);
if (null !== $criteria) {
- if (false !== $this->collImageDescsPartial && count($collImageDescs)) {
- $this->initImageDescs(false);
+ if (false !== $this->collImageI18nsPartial && count($collImageI18ns)) {
+ $this->initImageI18ns(false);
- foreach($collImageDescs as $obj) {
- if (false == $this->collImageDescs->contains($obj)) {
- $this->collImageDescs->append($obj);
+ foreach($collImageI18ns as $obj) {
+ if (false == $this->collImageI18ns->contains($obj)) {
+ $this->collImageI18ns->append($obj);
}
}
- $this->collImageDescsPartial = true;
+ $this->collImageI18nsPartial = true;
}
- return $collImageDescs;
+ return $collImageI18ns;
}
- if($partial && $this->collImageDescs) {
- foreach($this->collImageDescs as $obj) {
+ if($partial && $this->collImageI18ns) {
+ foreach($this->collImageI18ns as $obj) {
if($obj->isNew()) {
- $collImageDescs[] = $obj;
+ $collImageI18ns[] = $obj;
}
}
}
- $this->collImageDescs = $collImageDescs;
- $this->collImageDescsPartial = false;
+ $this->collImageI18ns = $collImageI18ns;
+ $this->collImageI18nsPartial = false;
}
}
- return $this->collImageDescs;
+ return $this->collImageI18ns;
}
/**
- * Sets a collection of ImageDesc objects related by a one-to-many relationship
+ * Sets a collection of ImageI18n objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
- * @param PropelCollection $imageDescs A Propel collection.
+ * @param PropelCollection $imageI18ns A Propel collection.
* @param PropelPDO $con Optional connection object
*/
- public function setImageDescs(PropelCollection $imageDescs, PropelPDO $con = null)
+ public function setImageI18ns(PropelCollection $imageI18ns, PropelPDO $con = null)
{
- $this->imageDescsScheduledForDeletion = $this->getImageDescs(new Criteria(), $con)->diff($imageDescs);
+ $this->imageI18nsScheduledForDeletion = $this->getImageI18ns(new Criteria(), $con)->diff($imageI18ns);
- foreach ($this->imageDescsScheduledForDeletion as $imageDescRemoved) {
- $imageDescRemoved->setImage(null);
+ foreach ($this->imageI18nsScheduledForDeletion as $imageI18nRemoved) {
+ $imageI18nRemoved->setImage(null);
}
- $this->collImageDescs = null;
- foreach ($imageDescs as $imageDesc) {
- $this->addImageDesc($imageDesc);
+ $this->collImageI18ns = null;
+ foreach ($imageI18ns as $imageI18n) {
+ $this->addImageI18n($imageI18n);
}
- $this->collImageDescs = $imageDescs;
- $this->collImageDescsPartial = false;
+ $this->collImageI18ns = $imageI18ns;
+ $this->collImageI18nsPartial = false;
}
/**
- * Returns the number of related ImageDesc objects.
+ * Returns the number of related ImageI18n objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
- * @return int Count of related ImageDesc objects.
+ * @return int Count of related ImageI18n objects.
* @throws PropelException
*/
- public function countImageDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ public function countImageI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
- $partial = $this->collImageDescsPartial && !$this->isNew();
- if (null === $this->collImageDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collImageDescs) {
+ $partial = $this->collImageI18nsPartial && !$this->isNew();
+ if (null === $this->collImageI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collImageI18ns) {
return 0;
} else {
if($partial && !$criteria) {
- return count($this->getImageDescs());
+ return count($this->getImageI18ns());
}
- $query = ImageDescQuery::create(null, $criteria);
+ $query = ImageI18nQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -1797,52 +1810,56 @@ abstract class BaseImage extends BaseObject implements Persistent
->count($con);
}
} else {
- return count($this->collImageDescs);
+ return count($this->collImageI18ns);
}
}
/**
- * Method called to associate a ImageDesc object to this object
- * through the ImageDesc foreign key attribute.
+ * Method called to associate a ImageI18n object to this object
+ * through the ImageI18n foreign key attribute.
*
- * @param ImageDesc $l ImageDesc
+ * @param ImageI18n $l ImageI18n
* @return Image The current object (for fluent API support)
*/
- public function addImageDesc(ImageDesc $l)
+ public function addImageI18n(ImageI18n $l)
{
- if ($this->collImageDescs === null) {
- $this->initImageDescs();
- $this->collImageDescsPartial = true;
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
}
- if (!$this->collImageDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddImageDesc($l);
+ if ($this->collImageI18ns === null) {
+ $this->initImageI18ns();
+ $this->collImageI18nsPartial = true;
+ }
+ if (!$this->collImageI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddImageI18n($l);
}
return $this;
}
/**
- * @param ImageDesc $imageDesc The imageDesc object to add.
+ * @param ImageI18n $imageI18n The imageI18n object to add.
*/
- protected function doAddImageDesc($imageDesc)
+ protected function doAddImageI18n($imageI18n)
{
- $this->collImageDescs[]= $imageDesc;
- $imageDesc->setImage($this);
+ $this->collImageI18ns[]= $imageI18n;
+ $imageI18n->setImage($this);
}
/**
- * @param ImageDesc $imageDesc The imageDesc object to remove.
+ * @param ImageI18n $imageI18n The imageI18n object to remove.
*/
- public function removeImageDesc($imageDesc)
+ public function removeImageI18n($imageI18n)
{
- if ($this->getImageDescs()->contains($imageDesc)) {
- $this->collImageDescs->remove($this->collImageDescs->search($imageDesc));
- if (null === $this->imageDescsScheduledForDeletion) {
- $this->imageDescsScheduledForDeletion = clone $this->collImageDescs;
- $this->imageDescsScheduledForDeletion->clear();
+ if ($this->getImageI18ns()->contains($imageI18n)) {
+ $this->collImageI18ns->remove($this->collImageI18ns->search($imageI18n));
+ if (null === $this->imageI18nsScheduledForDeletion) {
+ $this->imageI18nsScheduledForDeletion = clone $this->collImageI18ns;
+ $this->imageI18nsScheduledForDeletion->clear();
}
- $this->imageDescsScheduledForDeletion[]= $imageDesc;
- $imageDesc->setImage(null);
+ $this->imageI18nsScheduledForDeletion[]= $imageI18n;
+ $imageI18n->setImage(null);
}
}
@@ -1880,17 +1897,21 @@ abstract class BaseImage extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collImageDescs) {
- foreach ($this->collImageDescs as $o) {
+ if ($this->collImageI18ns) {
+ foreach ($this->collImageI18ns as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep)
- if ($this->collImageDescs instanceof PropelCollection) {
- $this->collImageDescs->clearIterator();
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
+ if ($this->collImageI18ns instanceof PropelCollection) {
+ $this->collImageI18ns->clearIterator();
}
- $this->collImageDescs = null;
+ $this->collImageI18ns = null;
$this->aProduct = null;
$this->aCategory = null;
$this->aContent = null;
@@ -1931,4 +1952,199 @@ abstract class BaseImage extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Image The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ImageI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collImageI18ns) {
+ foreach ($this->collImageI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new ImageI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = ImageI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addImageI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Image The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ ImageI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collImageI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collImageI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ImageI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return ImageI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return ImageI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return ImageI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return ImageI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseImageI18n.php b/core/lib/Thelia/Model/om/BaseImageI18n.php
new file mode 100644
index 000000000..efadab3e7
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseImageI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseImageI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return ImageI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = ImageI18nPeer::ID;
+ }
+
+ if ($this->aImage !== null && $this->aImage->getId() !== $v) {
+ $this->aImage = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return ImageI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = ImageI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return ImageI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = ImageI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return ImageI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = ImageI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return ImageI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = ImageI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return ImageI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = ImageI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = ImageI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating ImageI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aImage !== null && $this->id !== $this->aImage->getId()) {
+ $this->aImage = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = ImageI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aImage = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ImageI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ ImageI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aImage !== null) {
+ if ($this->aImage->isModified() || $this->aImage->isNew()) {
+ $affectedRows += $this->aImage->save($con);
+ }
+ $this->setImage($this->aImage);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ImageI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(ImageI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(ImageI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(ImageI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(ImageI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(ImageI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `image_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aImage !== null) {
+ if (!$this->aImage->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aImage->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = ImageI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ImageI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['ImageI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ImageI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = ImageI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aImage) {
+ $result['Image'] = $this->aImage->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ImageI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = ImageI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(ImageI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(ImageI18nPeer::ID)) $criteria->add(ImageI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(ImageI18nPeer::LOCALE)) $criteria->add(ImageI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(ImageI18nPeer::TITLE)) $criteria->add(ImageI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(ImageI18nPeer::DESCRIPTION)) $criteria->add(ImageI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(ImageI18nPeer::CHAPO)) $criteria->add(ImageI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(ImageI18nPeer::POSTSCRIPTUM)) $criteria->add(ImageI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(ImageI18nPeer::DATABASE_NAME);
+ $criteria->add(ImageI18nPeer::ID, $this->id);
+ $criteria->add(ImageI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of ImageI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return ImageI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return ImageI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new ImageI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Image object.
+ *
+ * @param Image $v
+ * @return ImageI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setImage(Image $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aImage = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Image object, it will not be re-added.
+ if ($v !== null) {
+ $v->addImageI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Image object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Image The associated Image object.
+ * @throws PropelException
+ */
+ public function getImage(PropelPDO $con = null)
+ {
+ if ($this->aImage === null && ($this->id !== null)) {
+ $this->aImage = ImageQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aImage->addImageI18ns($this);
+ */
+ }
+
+ return $this->aImage;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aImage = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ImageI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseImageI18nPeer.php b/core/lib/Thelia/Model/om/BaseImageI18nPeer.php
new file mode 100644
index 000000000..61ce08b89
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseImageI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (ImageI18nPeer::ID, ImageI18nPeer::LOCALE, ImageI18nPeer::TITLE, ImageI18nPeer::DESCRIPTION, ImageI18nPeer::CHAPO, ImageI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. ImageI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (ImageI18nPeer::ID => 0, ImageI18nPeer::LOCALE => 1, ImageI18nPeer::TITLE => 2, ImageI18nPeer::DESCRIPTION => 3, ImageI18nPeer::CHAPO => 4, ImageI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = ImageI18nPeer::getFieldNames($toType);
+ $key = isset(ImageI18nPeer::$fieldKeys[$fromType][$name]) ? ImageI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ImageI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, ImageI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return ImageI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. ImageI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(ImageI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(ImageI18nPeer::ID);
+ $criteria->addSelectColumn(ImageI18nPeer::LOCALE);
+ $criteria->addSelectColumn(ImageI18nPeer::TITLE);
+ $criteria->addSelectColumn(ImageI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(ImageI18nPeer::CHAPO);
+ $criteria->addSelectColumn(ImageI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ImageI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ImageI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(ImageI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return ImageI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = ImageI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return ImageI18nPeer::populateObjects(ImageI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ ImageI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ImageI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param ImageI18n $obj A ImageI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ ImageI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A ImageI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof ImageI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ImageI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(ImageI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return ImageI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(ImageI18nPeer::$instances[$key])) {
+ return ImageI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ ImageI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to image_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = ImageI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = ImageI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = ImageI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ ImageI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (ImageI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = ImageI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = ImageI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + ImageI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ImageI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ ImageI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Image table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinImage(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ImageI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ImageI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ImageI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ImageI18nPeer::ID, ImagePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of ImageI18n objects pre-filled with their Image objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ImageI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinImage(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ImageI18nPeer::DATABASE_NAME);
+ }
+
+ ImageI18nPeer::addSelectColumns($criteria);
+ $startcol = ImageI18nPeer::NUM_HYDRATE_COLUMNS;
+ ImagePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(ImageI18nPeer::ID, ImagePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ImageI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ImageI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = ImageI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ImageI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = ImagePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = ImagePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = ImagePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ ImagePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (ImageI18n) to $obj2 (Image)
+ $obj2->addImageI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ImageI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ImageI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ImageI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ImageI18nPeer::ID, ImagePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of ImageI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ImageI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ImageI18nPeer::DATABASE_NAME);
+ }
+
+ ImageI18nPeer::addSelectColumns($criteria);
+ $startcol2 = ImageI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ ImagePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + ImagePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(ImageI18nPeer::ID, ImagePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ImageI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ImageI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = ImageI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ImageI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Image rows
+
+ $key2 = ImagePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = ImagePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = ImagePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ ImagePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (ImageI18n) to the collection in $obj2 (Image)
+ $obj2->addImageI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(ImageI18nPeer::DATABASE_NAME)->getTable(ImageI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseImageI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseImageI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new ImageI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return ImageI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ImageI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or ImageI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from ImageI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(ImageI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a ImageI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or ImageI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(ImageI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(ImageI18nPeer::ID);
+ $value = $criteria->remove(ImageI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(ImageI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ImageI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(ImageI18nPeer::LOCALE);
+ $value = $criteria->remove(ImageI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(ImageI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ImageI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is ImageI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(ImageI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the image_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(ImageI18nPeer::TABLE_NAME, $con, ImageI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ ImageI18nPeer::clearInstancePool();
+ ImageI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ImageI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ImageI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ ImageI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof ImageI18n) { // it's a model object
+ // invalidate the cache for this single object
+ ImageI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(ImageI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(ImageI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(ImageI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ ImageI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ImageI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ ImageI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given ImageI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param ImageI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(ImageI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(ImageI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(ImageI18nPeer::DATABASE_NAME, ImageI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return ImageI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = ImageI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(ImageI18nPeer::DATABASE_NAME);
+ $criteria->add(ImageI18nPeer::ID, $id);
+ $criteria->add(ImageI18nPeer::LOCALE, $locale);
+ $v = ImageI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseImageI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseImageI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseImageI18nQuery.php b/core/lib/Thelia/Model/om/BaseImageI18nQuery.php
new file mode 100644
index 000000000..cf4c865ea
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseImageI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ImageI18n|ImageI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ImageI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(ImageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ImageI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `image_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new ImageI18n();
+ $obj->hydrate($row);
+ ImageI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ImageI18n|ImageI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|ImageI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(ImageI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(ImageI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(ImageI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(ImageI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByImage()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ImageI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(ImageI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ImageI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ImageI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ImageI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ImageI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ImageI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ImageI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Image object
+ *
+ * @param Image|PropelObjectCollection $image The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ImageI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByImage($image, $comparison = null)
+ {
+ if ($image instanceof Image) {
+ return $this
+ ->addUsingAlias(ImageI18nPeer::ID, $image->getId(), $comparison);
+ } elseif ($image instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ImageI18nPeer::ID, $image->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByImage() only accepts arguments of type Image or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Image relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ImageI18nQuery The current query, for fluid interface
+ */
+ public function joinImage($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Image');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Image');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Image relation Image object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\ImageQuery A secondary query class using the current class as primary query
+ */
+ public function useImageQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinImage($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Image', '\Thelia\Model\ImageQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ImageI18n $imageI18n Object to remove from the list of results
+ *
+ * @return ImageI18nQuery The current query, for fluid interface
+ */
+ public function prune($imageI18n = null)
+ {
+ if ($imageI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(ImageI18nPeer::ID), $imageI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(ImageI18nPeer::LOCALE), $imageI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseImagePeer.php b/core/lib/Thelia/Model/om/BaseImagePeer.php
index d529374bd..fe793bffb 100644
--- a/core/lib/Thelia/Model/om/BaseImagePeer.php
+++ b/core/lib/Thelia/Model/om/BaseImagePeer.php
@@ -13,7 +13,7 @@ use Thelia\Model\CategoryPeer;
use Thelia\Model\ContentPeer;
use Thelia\Model\FolderPeer;
use Thelia\Model\Image;
-use Thelia\Model\ImageDescPeer;
+use Thelia\Model\ImageI18nPeer;
use Thelia\Model\ImagePeer;
use Thelia\Model\ProductPeer;
use Thelia\Model\map\ImageTableMap;
@@ -88,6 +88,13 @@ abstract class BaseImagePeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -407,9 +414,9 @@ abstract class BaseImagePeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in ImageDescPeer instance pool,
+ // Invalidate objects in ImageI18nPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- ImageDescPeer::clearInstancePool();
+ ImageI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseImageQuery.php b/core/lib/Thelia/Model/om/BaseImageQuery.php
index 82c705938..d1f143825 100644
--- a/core/lib/Thelia/Model/om/BaseImageQuery.php
+++ b/core/lib/Thelia/Model/om/BaseImageQuery.php
@@ -16,7 +16,7 @@ use Thelia\Model\Category;
use Thelia\Model\Content;
use Thelia\Model\Folder;
use Thelia\Model\Image;
-use Thelia\Model\ImageDesc;
+use Thelia\Model\ImageI18n;
use Thelia\Model\ImagePeer;
use Thelia\Model\ImageQuery;
use Thelia\Model\Product;
@@ -66,9 +66,9 @@ use Thelia\Model\Product;
* @method ImageQuery rightJoinFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Folder relation
* @method ImageQuery innerJoinFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the Folder relation
*
- * @method ImageQuery leftJoinImageDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImageDesc relation
- * @method ImageQuery rightJoinImageDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImageDesc relation
- * @method ImageQuery innerJoinImageDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the ImageDesc relation
+ * @method ImageQuery leftJoinImageI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ImageI18n relation
+ * @method ImageQuery rightJoinImageI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ImageI18n relation
+ * @method ImageQuery innerJoinImageI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ImageI18n relation
*
* @method Image findOne(PropelPDO $con = null) Return the first Image matching the query
* @method Image findOneOrCreate(PropelPDO $con = null) Return the first Image matching the query, or a new Image object populated from the query conditions when no match is found
@@ -930,41 +930,41 @@ abstract class BaseImageQuery extends ModelCriteria
}
/**
- * Filter the query by a related ImageDesc object
+ * Filter the query by a related ImageI18n object
*
- * @param ImageDesc|PropelObjectCollection $imageDesc the related object to use as filter
+ * @param ImageI18n|PropelObjectCollection $imageI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ImageQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
- public function filterByImageDesc($imageDesc, $comparison = null)
+ public function filterByImageI18n($imageI18n, $comparison = null)
{
- if ($imageDesc instanceof ImageDesc) {
+ if ($imageI18n instanceof ImageI18n) {
return $this
- ->addUsingAlias(ImagePeer::ID, $imageDesc->getImageId(), $comparison);
- } elseif ($imageDesc instanceof PropelObjectCollection) {
+ ->addUsingAlias(ImagePeer::ID, $imageI18n->getId(), $comparison);
+ } elseif ($imageI18n instanceof PropelObjectCollection) {
return $this
- ->useImageDescQuery()
- ->filterByPrimaryKeys($imageDesc->getPrimaryKeys())
+ ->useImageI18nQuery()
+ ->filterByPrimaryKeys($imageI18n->getPrimaryKeys())
->endUse();
} else {
- throw new PropelException('filterByImageDesc() only accepts arguments of type ImageDesc or PropelCollection');
+ throw new PropelException('filterByImageI18n() only accepts arguments of type ImageI18n or PropelCollection');
}
}
/**
- * Adds a JOIN clause to the query using the ImageDesc relation
+ * Adds a JOIN clause to the query using the ImageI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ImageQuery The current query, for fluid interface
*/
- public function joinImageDesc($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ public function joinImageI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('ImageDesc');
+ $relationMap = $tableMap->getRelation('ImageI18n');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -979,14 +979,14 @@ abstract class BaseImageQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
- $this->addJoinObject($join, 'ImageDesc');
+ $this->addJoinObject($join, 'ImageI18n');
}
return $this;
}
/**
- * Use the ImageDesc relation ImageDesc object
+ * Use the ImageI18n relation ImageI18n object
*
* @see useQuery()
*
@@ -994,13 +994,13 @@ abstract class BaseImageQuery extends ModelCriteria
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
- * @return \Thelia\Model\ImageDescQuery A secondary query class using the current class as primary query
+ * @return \Thelia\Model\ImageI18nQuery A secondary query class using the current class as primary query
*/
- public function useImageDescQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ public function useImageI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
- ->joinImageDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'ImageDesc', '\Thelia\Model\ImageDescQuery');
+ ->joinImageI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ImageI18n', '\Thelia\Model\ImageI18nQuery');
}
/**
@@ -1084,4 +1084,61 @@ abstract class BaseImageQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(ImagePeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ImageQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'ImageI18n';
+
+ return $this
+ ->joinImageI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ImageQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('ImageI18n');
+ $this->with['ImageI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ImageI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ImageI18n', 'Thelia\Model\ImageI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseMessage.php b/core/lib/Thelia/Model/om/BaseMessage.php
index e0119d241..283e188bb 100644
--- a/core/lib/Thelia/Model/om/BaseMessage.php
+++ b/core/lib/Thelia/Model/om/BaseMessage.php
@@ -16,8 +16,8 @@ use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Message;
-use Thelia\Model\MessageDesc;
-use Thelia\Model\MessageDescQuery;
+use Thelia\Model\MessageI18n;
+use Thelia\Model\MessageI18nQuery;
use Thelia\Model\MessagePeer;
use Thelia\Model\MessageQuery;
@@ -67,6 +67,12 @@ abstract class BaseMessage extends BaseObject implements Persistent
*/
protected $secured;
+ /**
+ * The value for the ref field.
+ * @var string
+ */
+ protected $ref;
+
/**
* The value for the created_at field.
* @var string
@@ -80,10 +86,10 @@ abstract class BaseMessage extends BaseObject implements Persistent
protected $updated_at;
/**
- * @var PropelObjectCollection|MessageDesc[] Collection to store aggregation of MessageDesc objects.
+ * @var PropelObjectCollection|MessageI18n[] Collection to store aggregation of MessageI18n objects.
*/
- protected $collMessageDescs;
- protected $collMessageDescsPartial;
+ protected $collMessageI18ns;
+ protected $collMessageI18nsPartial;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -99,11 +105,25 @@ abstract class BaseMessage extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
+ /**
+ * Current locale
+ * @var string
+ */
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[MessageI18n]
+ */
+ protected $currentTranslations;
+
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
- protected $messageDescsScheduledForDeletion = null;
+ protected $messageI18nsScheduledForDeletion = null;
/**
* Get the [id] column value.
@@ -135,6 +155,16 @@ abstract class BaseMessage extends BaseObject implements Persistent
return $this->secured;
}
+ /**
+ * Get the [ref] column value.
+ *
+ * @return string
+ */
+ public function getRef()
+ {
+ return $this->ref;
+ }
+
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -272,6 +302,27 @@ abstract class BaseMessage extends BaseObject implements Persistent
return $this;
} // setSecured()
+ /**
+ * Set the value of [ref] column.
+ *
+ * @param string $v new value
+ * @return Message The current object (for fluent API support)
+ */
+ public function setRef($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->ref !== $v) {
+ $this->ref = $v;
+ $this->modifiedColumns[] = MessagePeer::REF;
+ }
+
+
+ return $this;
+ } // setRef()
+
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -353,8 +404,9 @@ abstract class BaseMessage extends BaseObject implements Persistent
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->code = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->secured = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
- $this->created_at = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
- $this->updated_at = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->ref = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->created_at = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->updated_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
$this->resetModified();
$this->setNew(false);
@@ -363,7 +415,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
$this->ensureConsistency();
}
- return $startcol + 5; // 5 = MessagePeer::NUM_HYDRATE_COLUMNS.
+ return $startcol + 6; // 6 = MessagePeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating Message object", $e);
@@ -425,7 +477,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
- $this->collMessageDescs = null;
+ $this->collMessageI18ns = null;
} // if (deep)
}
@@ -562,17 +614,17 @@ abstract class BaseMessage extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->messageDescsScheduledForDeletion !== null) {
- if (!$this->messageDescsScheduledForDeletion->isEmpty()) {
- MessageDescQuery::create()
- ->filterByPrimaryKeys($this->messageDescsScheduledForDeletion->getPrimaryKeys(false))
+ if ($this->messageI18nsScheduledForDeletion !== null) {
+ if (!$this->messageI18nsScheduledForDeletion->isEmpty()) {
+ MessageI18nQuery::create()
+ ->filterByPrimaryKeys($this->messageI18nsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
- $this->messageDescsScheduledForDeletion = null;
+ $this->messageI18nsScheduledForDeletion = null;
}
}
- if ($this->collMessageDescs !== null) {
- foreach ($this->collMessageDescs as $referrerFK) {
+ if ($this->collMessageI18ns !== null) {
+ foreach ($this->collMessageI18ns as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
@@ -614,6 +666,9 @@ abstract class BaseMessage extends BaseObject implements Persistent
if ($this->isColumnModified(MessagePeer::SECURED)) {
$modifiedColumns[':p' . $index++] = '`SECURED`';
}
+ if ($this->isColumnModified(MessagePeer::REF)) {
+ $modifiedColumns[':p' . $index++] = '`REF`';
+ }
if ($this->isColumnModified(MessagePeer::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = '`CREATED_AT`';
}
@@ -640,6 +695,9 @@ abstract class BaseMessage extends BaseObject implements Persistent
case '`SECURED`':
$stmt->bindValue($identifier, $this->secured, PDO::PARAM_INT);
break;
+ case '`REF`':
+ $stmt->bindValue($identifier, $this->ref, PDO::PARAM_STR);
+ break;
case '`CREATED_AT`':
$stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
break;
@@ -745,8 +803,8 @@ abstract class BaseMessage extends BaseObject implements Persistent
}
- if ($this->collMessageDescs !== null) {
- foreach ($this->collMessageDescs as $referrerFK) {
+ if ($this->collMessageI18ns !== null) {
+ foreach ($this->collMessageI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -798,9 +856,12 @@ abstract class BaseMessage extends BaseObject implements Persistent
return $this->getSecured();
break;
case 3:
- return $this->getCreatedAt();
+ return $this->getRef();
break;
case 4:
+ return $this->getCreatedAt();
+ break;
+ case 5:
return $this->getUpdatedAt();
break;
default:
@@ -835,12 +896,13 @@ abstract class BaseMessage extends BaseObject implements Persistent
$keys[0] => $this->getId(),
$keys[1] => $this->getCode(),
$keys[2] => $this->getSecured(),
- $keys[3] => $this->getCreatedAt(),
- $keys[4] => $this->getUpdatedAt(),
+ $keys[3] => $this->getRef(),
+ $keys[4] => $this->getCreatedAt(),
+ $keys[5] => $this->getUpdatedAt(),
);
if ($includeForeignObjects) {
- if (null !== $this->collMessageDescs) {
- $result['MessageDescs'] = $this->collMessageDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ if (null !== $this->collMessageI18ns) {
+ $result['MessageI18ns'] = $this->collMessageI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
@@ -886,9 +948,12 @@ abstract class BaseMessage extends BaseObject implements Persistent
$this->setSecured($value);
break;
case 3:
- $this->setCreatedAt($value);
+ $this->setRef($value);
break;
case 4:
+ $this->setCreatedAt($value);
+ break;
+ case 5:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -918,8 +983,9 @@ abstract class BaseMessage extends BaseObject implements Persistent
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setSecured($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
+ if (array_key_exists($keys[3], $arr)) $this->setRef($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
}
/**
@@ -934,6 +1000,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
if ($this->isColumnModified(MessagePeer::ID)) $criteria->add(MessagePeer::ID, $this->id);
if ($this->isColumnModified(MessagePeer::CODE)) $criteria->add(MessagePeer::CODE, $this->code);
if ($this->isColumnModified(MessagePeer::SECURED)) $criteria->add(MessagePeer::SECURED, $this->secured);
+ if ($this->isColumnModified(MessagePeer::REF)) $criteria->add(MessagePeer::REF, $this->ref);
if ($this->isColumnModified(MessagePeer::CREATED_AT)) $criteria->add(MessagePeer::CREATED_AT, $this->created_at);
if ($this->isColumnModified(MessagePeer::UPDATED_AT)) $criteria->add(MessagePeer::UPDATED_AT, $this->updated_at);
@@ -1001,6 +1068,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
{
$copyObj->setCode($this->getCode());
$copyObj->setSecured($this->getSecured());
+ $copyObj->setRef($this->getRef());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -1011,9 +1079,9 @@ abstract class BaseMessage extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getMessageDescs() as $relObj) {
+ foreach ($this->getMessageI18ns() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addMessageDesc($relObj->copy($deepCopy));
+ $copyObj->addMessageI18n($relObj->copy($deepCopy));
}
}
@@ -1078,40 +1146,40 @@ abstract class BaseMessage extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('MessageDesc' == $relationName) {
- $this->initMessageDescs();
+ if ('MessageI18n' == $relationName) {
+ $this->initMessageI18ns();
}
}
/**
- * Clears out the collMessageDescs collection
+ * Clears out the collMessageI18ns collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
- * @see addMessageDescs()
+ * @see addMessageI18ns()
*/
- public function clearMessageDescs()
+ public function clearMessageI18ns()
{
- $this->collMessageDescs = null; // important to set this to null since that means it is uninitialized
- $this->collMessageDescsPartial = null;
+ $this->collMessageI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collMessageI18nsPartial = null;
}
/**
- * reset is the collMessageDescs collection loaded partially
+ * reset is the collMessageI18ns collection loaded partially
*
* @return void
*/
- public function resetPartialMessageDescs($v = true)
+ public function resetPartialMessageI18ns($v = true)
{
- $this->collMessageDescsPartial = $v;
+ $this->collMessageI18nsPartial = $v;
}
/**
- * Initializes the collMessageDescs collection.
+ * Initializes the collMessageI18ns collection.
*
- * By default this just sets the collMessageDescs collection to an empty array (like clearcollMessageDescs());
+ * By default this just sets the collMessageI18ns collection to an empty array (like clearcollMessageI18ns());
* 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.
*
@@ -1120,17 +1188,17 @@ abstract class BaseMessage extends BaseObject implements Persistent
*
* @return void
*/
- public function initMessageDescs($overrideExisting = true)
+ public function initMessageI18ns($overrideExisting = true)
{
- if (null !== $this->collMessageDescs && !$overrideExisting) {
+ if (null !== $this->collMessageI18ns && !$overrideExisting) {
return;
}
- $this->collMessageDescs = new PropelObjectCollection();
- $this->collMessageDescs->setModel('MessageDesc');
+ $this->collMessageI18ns = new PropelObjectCollection();
+ $this->collMessageI18ns->setModel('MessageI18n');
}
/**
- * Gets an array of MessageDesc objects which contain a foreign key that references this object.
+ * Gets an array of MessageI18n objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
@@ -1140,98 +1208,98 @@ abstract class BaseMessage extends BaseObject implements Persistent
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|MessageDesc[] List of MessageDesc objects
+ * @return PropelObjectCollection|MessageI18n[] List of MessageI18n objects
* @throws PropelException
*/
- public function getMessageDescs($criteria = null, PropelPDO $con = null)
+ public function getMessageI18ns($criteria = null, PropelPDO $con = null)
{
- $partial = $this->collMessageDescsPartial && !$this->isNew();
- if (null === $this->collMessageDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collMessageDescs) {
+ $partial = $this->collMessageI18nsPartial && !$this->isNew();
+ if (null === $this->collMessageI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collMessageI18ns) {
// return empty collection
- $this->initMessageDescs();
+ $this->initMessageI18ns();
} else {
- $collMessageDescs = MessageDescQuery::create(null, $criteria)
+ $collMessageI18ns = MessageI18nQuery::create(null, $criteria)
->filterByMessage($this)
->find($con);
if (null !== $criteria) {
- if (false !== $this->collMessageDescsPartial && count($collMessageDescs)) {
- $this->initMessageDescs(false);
+ if (false !== $this->collMessageI18nsPartial && count($collMessageI18ns)) {
+ $this->initMessageI18ns(false);
- foreach($collMessageDescs as $obj) {
- if (false == $this->collMessageDescs->contains($obj)) {
- $this->collMessageDescs->append($obj);
+ foreach($collMessageI18ns as $obj) {
+ if (false == $this->collMessageI18ns->contains($obj)) {
+ $this->collMessageI18ns->append($obj);
}
}
- $this->collMessageDescsPartial = true;
+ $this->collMessageI18nsPartial = true;
}
- return $collMessageDescs;
+ return $collMessageI18ns;
}
- if($partial && $this->collMessageDescs) {
- foreach($this->collMessageDescs as $obj) {
+ if($partial && $this->collMessageI18ns) {
+ foreach($this->collMessageI18ns as $obj) {
if($obj->isNew()) {
- $collMessageDescs[] = $obj;
+ $collMessageI18ns[] = $obj;
}
}
}
- $this->collMessageDescs = $collMessageDescs;
- $this->collMessageDescsPartial = false;
+ $this->collMessageI18ns = $collMessageI18ns;
+ $this->collMessageI18nsPartial = false;
}
}
- return $this->collMessageDescs;
+ return $this->collMessageI18ns;
}
/**
- * Sets a collection of MessageDesc objects related by a one-to-many relationship
+ * Sets a collection of MessageI18n objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
- * @param PropelCollection $messageDescs A Propel collection.
+ * @param PropelCollection $messageI18ns A Propel collection.
* @param PropelPDO $con Optional connection object
*/
- public function setMessageDescs(PropelCollection $messageDescs, PropelPDO $con = null)
+ public function setMessageI18ns(PropelCollection $messageI18ns, PropelPDO $con = null)
{
- $this->messageDescsScheduledForDeletion = $this->getMessageDescs(new Criteria(), $con)->diff($messageDescs);
+ $this->messageI18nsScheduledForDeletion = $this->getMessageI18ns(new Criteria(), $con)->diff($messageI18ns);
- foreach ($this->messageDescsScheduledForDeletion as $messageDescRemoved) {
- $messageDescRemoved->setMessage(null);
+ foreach ($this->messageI18nsScheduledForDeletion as $messageI18nRemoved) {
+ $messageI18nRemoved->setMessage(null);
}
- $this->collMessageDescs = null;
- foreach ($messageDescs as $messageDesc) {
- $this->addMessageDesc($messageDesc);
+ $this->collMessageI18ns = null;
+ foreach ($messageI18ns as $messageI18n) {
+ $this->addMessageI18n($messageI18n);
}
- $this->collMessageDescs = $messageDescs;
- $this->collMessageDescsPartial = false;
+ $this->collMessageI18ns = $messageI18ns;
+ $this->collMessageI18nsPartial = false;
}
/**
- * Returns the number of related MessageDesc objects.
+ * Returns the number of related MessageI18n objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
- * @return int Count of related MessageDesc objects.
+ * @return int Count of related MessageI18n objects.
* @throws PropelException
*/
- public function countMessageDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ public function countMessageI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
- $partial = $this->collMessageDescsPartial && !$this->isNew();
- if (null === $this->collMessageDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collMessageDescs) {
+ $partial = $this->collMessageI18nsPartial && !$this->isNew();
+ if (null === $this->collMessageI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collMessageI18ns) {
return 0;
} else {
if($partial && !$criteria) {
- return count($this->getMessageDescs());
+ return count($this->getMessageI18ns());
}
- $query = MessageDescQuery::create(null, $criteria);
+ $query = MessageI18nQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -1241,52 +1309,56 @@ abstract class BaseMessage extends BaseObject implements Persistent
->count($con);
}
} else {
- return count($this->collMessageDescs);
+ return count($this->collMessageI18ns);
}
}
/**
- * Method called to associate a MessageDesc object to this object
- * through the MessageDesc foreign key attribute.
+ * Method called to associate a MessageI18n object to this object
+ * through the MessageI18n foreign key attribute.
*
- * @param MessageDesc $l MessageDesc
+ * @param MessageI18n $l MessageI18n
* @return Message The current object (for fluent API support)
*/
- public function addMessageDesc(MessageDesc $l)
+ public function addMessageI18n(MessageI18n $l)
{
- if ($this->collMessageDescs === null) {
- $this->initMessageDescs();
- $this->collMessageDescsPartial = true;
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
}
- if (!$this->collMessageDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddMessageDesc($l);
+ if ($this->collMessageI18ns === null) {
+ $this->initMessageI18ns();
+ $this->collMessageI18nsPartial = true;
+ }
+ if (!$this->collMessageI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddMessageI18n($l);
}
return $this;
}
/**
- * @param MessageDesc $messageDesc The messageDesc object to add.
+ * @param MessageI18n $messageI18n The messageI18n object to add.
*/
- protected function doAddMessageDesc($messageDesc)
+ protected function doAddMessageI18n($messageI18n)
{
- $this->collMessageDescs[]= $messageDesc;
- $messageDesc->setMessage($this);
+ $this->collMessageI18ns[]= $messageI18n;
+ $messageI18n->setMessage($this);
}
/**
- * @param MessageDesc $messageDesc The messageDesc object to remove.
+ * @param MessageI18n $messageI18n The messageI18n object to remove.
*/
- public function removeMessageDesc($messageDesc)
+ public function removeMessageI18n($messageI18n)
{
- if ($this->getMessageDescs()->contains($messageDesc)) {
- $this->collMessageDescs->remove($this->collMessageDescs->search($messageDesc));
- if (null === $this->messageDescsScheduledForDeletion) {
- $this->messageDescsScheduledForDeletion = clone $this->collMessageDescs;
- $this->messageDescsScheduledForDeletion->clear();
+ if ($this->getMessageI18ns()->contains($messageI18n)) {
+ $this->collMessageI18ns->remove($this->collMessageI18ns->search($messageI18n));
+ if (null === $this->messageI18nsScheduledForDeletion) {
+ $this->messageI18nsScheduledForDeletion = clone $this->collMessageI18ns;
+ $this->messageI18nsScheduledForDeletion->clear();
}
- $this->messageDescsScheduledForDeletion[]= $messageDesc;
- $messageDesc->setMessage(null);
+ $this->messageI18nsScheduledForDeletion[]= $messageI18n;
+ $messageI18n->setMessage(null);
}
}
@@ -1298,6 +1370,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
$this->id = null;
$this->code = null;
$this->secured = null;
+ $this->ref = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
@@ -1320,17 +1393,21 @@ abstract class BaseMessage extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collMessageDescs) {
- foreach ($this->collMessageDescs as $o) {
+ if ($this->collMessageI18ns) {
+ foreach ($this->collMessageI18ns as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep)
- if ($this->collMessageDescs instanceof PropelCollection) {
- $this->collMessageDescs->clearIterator();
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
+ if ($this->collMessageI18ns instanceof PropelCollection) {
+ $this->collMessageI18ns->clearIterator();
}
- $this->collMessageDescs = null;
+ $this->collMessageI18ns = null;
}
/**
@@ -1367,4 +1444,175 @@ abstract class BaseMessage extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Message The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return MessageI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collMessageI18ns) {
+ foreach ($this->collMessageI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new MessageI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = MessageI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addMessageI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Message The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ MessageI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collMessageI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collMessageI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return MessageI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return MessageI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return MessageI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description_html] column value.
+ *
+ * @return string
+ */
+ public function getDescriptionHtml()
+ {
+ return $this->getCurrentTranslation()->getDescriptionHtml();
+ }
+
+
+ /**
+ * Set the value of [description_html] column.
+ *
+ * @param string $v new value
+ * @return MessageI18n The current object (for fluent API support)
+ */
+ public function setDescriptionHtml($v)
+ { $this->getCurrentTranslation()->setDescriptionHtml($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseMessageI18n.php b/core/lib/Thelia/Model/om/BaseMessageI18n.php
new file mode 100644
index 000000000..e4c98eff5
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseMessageI18n.php
@@ -0,0 +1,1118 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseMessageI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [description_html] column value.
+ *
+ * @return string
+ */
+ public function getDescriptionHtml()
+ {
+ return $this->description_html;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return MessageI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = MessageI18nPeer::ID;
+ }
+
+ if ($this->aMessage !== null && $this->aMessage->getId() !== $v) {
+ $this->aMessage = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return MessageI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = MessageI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return MessageI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = MessageI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return MessageI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = MessageI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [description_html] column.
+ *
+ * @param string $v new value
+ * @return MessageI18n The current object (for fluent API support)
+ */
+ public function setDescriptionHtml($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description_html !== $v) {
+ $this->description_html = $v;
+ $this->modifiedColumns[] = MessageI18nPeer::DESCRIPTION_HTML;
+ }
+
+
+ return $this;
+ } // setDescriptionHtml()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->description_html = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 5; // 5 = MessageI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating MessageI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aMessage !== null && $this->id !== $this->aMessage->getId()) {
+ $this->aMessage = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = MessageI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aMessage = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = MessageI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ MessageI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aMessage !== null) {
+ if ($this->aMessage->isModified() || $this->aMessage->isNew()) {
+ $affectedRows += $this->aMessage->save($con);
+ }
+ $this->setMessage($this->aMessage);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(MessageI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(MessageI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(MessageI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(MessageI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(MessageI18nPeer::DESCRIPTION_HTML)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION_HTML`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `message_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION_HTML`':
+ $stmt->bindValue($identifier, $this->description_html, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aMessage !== null) {
+ if (!$this->aMessage->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aMessage->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = MessageI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = MessageI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getDescriptionHtml();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['MessageI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['MessageI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = MessageI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getDescriptionHtml(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aMessage) {
+ $result['Message'] = $this->aMessage->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = MessageI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setDescriptionHtml($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = MessageI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setDescriptionHtml($arr[$keys[4]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(MessageI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(MessageI18nPeer::ID)) $criteria->add(MessageI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(MessageI18nPeer::LOCALE)) $criteria->add(MessageI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(MessageI18nPeer::TITLE)) $criteria->add(MessageI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(MessageI18nPeer::DESCRIPTION)) $criteria->add(MessageI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(MessageI18nPeer::DESCRIPTION_HTML)) $criteria->add(MessageI18nPeer::DESCRIPTION_HTML, $this->description_html);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(MessageI18nPeer::DATABASE_NAME);
+ $criteria->add(MessageI18nPeer::ID, $this->id);
+ $criteria->add(MessageI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of MessageI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setDescriptionHtml($this->getDescriptionHtml());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return MessageI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return MessageI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new MessageI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Message object.
+ *
+ * @param Message $v
+ * @return MessageI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setMessage(Message $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aMessage = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Message object, it will not be re-added.
+ if ($v !== null) {
+ $v->addMessageI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Message object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Message The associated Message object.
+ * @throws PropelException
+ */
+ public function getMessage(PropelPDO $con = null)
+ {
+ if ($this->aMessage === null && ($this->id !== null)) {
+ $this->aMessage = MessageQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aMessage->addMessageI18ns($this);
+ */
+ }
+
+ return $this->aMessage;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->description_html = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aMessage = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(MessageI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseMessageI18nPeer.php b/core/lib/Thelia/Model/om/BaseMessageI18nPeer.php
new file mode 100644
index 000000000..91cc5cd3f
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseMessageI18nPeer.php
@@ -0,0 +1,1004 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'DescriptionHtml', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'descriptionHtml', ),
+ BasePeer::TYPE_COLNAME => array (MessageI18nPeer::ID, MessageI18nPeer::LOCALE, MessageI18nPeer::TITLE, MessageI18nPeer::DESCRIPTION, MessageI18nPeer::DESCRIPTION_HTML, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'DESCRIPTION_HTML', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'description_html', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. MessageI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'DescriptionHtml' => 4, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'descriptionHtml' => 4, ),
+ BasePeer::TYPE_COLNAME => array (MessageI18nPeer::ID => 0, MessageI18nPeer::LOCALE => 1, MessageI18nPeer::TITLE => 2, MessageI18nPeer::DESCRIPTION => 3, MessageI18nPeer::DESCRIPTION_HTML => 4, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'DESCRIPTION_HTML' => 4, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'description_html' => 4, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = MessageI18nPeer::getFieldNames($toType);
+ $key = isset(MessageI18nPeer::$fieldKeys[$fromType][$name]) ? MessageI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(MessageI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, MessageI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return MessageI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. MessageI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(MessageI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(MessageI18nPeer::ID);
+ $criteria->addSelectColumn(MessageI18nPeer::LOCALE);
+ $criteria->addSelectColumn(MessageI18nPeer::TITLE);
+ $criteria->addSelectColumn(MessageI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(MessageI18nPeer::DESCRIPTION_HTML);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION_HTML');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(MessageI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ MessageI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(MessageI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return MessageI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = MessageI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return MessageI18nPeer::populateObjects(MessageI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ MessageI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(MessageI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param MessageI18n $obj A MessageI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ MessageI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A MessageI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof MessageI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or MessageI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(MessageI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return MessageI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(MessageI18nPeer::$instances[$key])) {
+ return MessageI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ MessageI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to message_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = MessageI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = MessageI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = MessageI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ MessageI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (MessageI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = MessageI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = MessageI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + MessageI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = MessageI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ MessageI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Message table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinMessage(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(MessageI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ MessageI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(MessageI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(MessageI18nPeer::ID, MessagePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of MessageI18n objects pre-filled with their Message objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of MessageI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinMessage(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(MessageI18nPeer::DATABASE_NAME);
+ }
+
+ MessageI18nPeer::addSelectColumns($criteria);
+ $startcol = MessageI18nPeer::NUM_HYDRATE_COLUMNS;
+ MessagePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(MessageI18nPeer::ID, MessagePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = MessageI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = MessageI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = MessageI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ MessageI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = MessagePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = MessagePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = MessagePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ MessagePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (MessageI18n) to $obj2 (Message)
+ $obj2->addMessageI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(MessageI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ MessageI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(MessageI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(MessageI18nPeer::ID, MessagePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of MessageI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of MessageI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(MessageI18nPeer::DATABASE_NAME);
+ }
+
+ MessageI18nPeer::addSelectColumns($criteria);
+ $startcol2 = MessageI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ MessagePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + MessagePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(MessageI18nPeer::ID, MessagePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = MessageI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = MessageI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = MessageI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ MessageI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Message rows
+
+ $key2 = MessagePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = MessagePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = MessagePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ MessagePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (MessageI18n) to the collection in $obj2 (Message)
+ $obj2->addMessageI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(MessageI18nPeer::DATABASE_NAME)->getTable(MessageI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseMessageI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseMessageI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new MessageI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return MessageI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a MessageI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or MessageI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from MessageI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(MessageI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a MessageI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or MessageI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(MessageI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(MessageI18nPeer::ID);
+ $value = $criteria->remove(MessageI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(MessageI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(MessageI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(MessageI18nPeer::LOCALE);
+ $value = $criteria->remove(MessageI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(MessageI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(MessageI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is MessageI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(MessageI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the message_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(MessageI18nPeer::TABLE_NAME, $con, MessageI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ MessageI18nPeer::clearInstancePool();
+ MessageI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a MessageI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or MessageI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ MessageI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof MessageI18n) { // it's a model object
+ // invalidate the cache for this single object
+ MessageI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(MessageI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(MessageI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(MessageI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ MessageI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(MessageI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ MessageI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given MessageI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param MessageI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(MessageI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(MessageI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(MessageI18nPeer::DATABASE_NAME, MessageI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return MessageI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = MessageI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(MessageI18nPeer::DATABASE_NAME);
+ $criteria->add(MessageI18nPeer::ID, $id);
+ $criteria->add(MessageI18nPeer::LOCALE, $locale);
+ $v = MessageI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseMessageI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseMessageI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseMessageI18nQuery.php b/core/lib/Thelia/Model/om/BaseMessageI18nQuery.php
new file mode 100644
index 000000000..0888e945f
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseMessageI18nQuery.php
@@ -0,0 +1,489 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return MessageI18n|MessageI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = MessageI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(MessageI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return MessageI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `DESCRIPTION_HTML` FROM `message_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new MessageI18n();
+ $obj->hydrate($row);
+ MessageI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return MessageI18n|MessageI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|MessageI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return MessageI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(MessageI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(MessageI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return MessageI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(MessageI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(MessageI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByMessage()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MessageI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(MessageI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MessageI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(MessageI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MessageI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(MessageI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MessageI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(MessageI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the description_html column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescriptionHtml('fooValue'); // WHERE description_html = 'fooValue'
+ * $query->filterByDescriptionHtml('%fooValue%'); // WHERE description_html LIKE '%fooValue%'
+ *
+ *
+ * @param string $descriptionHtml The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MessageI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescriptionHtml($descriptionHtml = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($descriptionHtml)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $descriptionHtml)) {
+ $descriptionHtml = str_replace('*', '%', $descriptionHtml);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(MessageI18nPeer::DESCRIPTION_HTML, $descriptionHtml, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Message object
+ *
+ * @param Message|PropelObjectCollection $message The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MessageI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByMessage($message, $comparison = null)
+ {
+ if ($message instanceof Message) {
+ return $this
+ ->addUsingAlias(MessageI18nPeer::ID, $message->getId(), $comparison);
+ } elseif ($message instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(MessageI18nPeer::ID, $message->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByMessage() only accepts arguments of type Message or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Message relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return MessageI18nQuery The current query, for fluid interface
+ */
+ public function joinMessage($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Message');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Message');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Message relation Message object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\MessageQuery A secondary query class using the current class as primary query
+ */
+ public function useMessageQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinMessage($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Message', '\Thelia\Model\MessageQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param MessageI18n $messageI18n Object to remove from the list of results
+ *
+ * @return MessageI18nQuery The current query, for fluid interface
+ */
+ public function prune($messageI18n = null)
+ {
+ if ($messageI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(MessageI18nPeer::ID), $messageI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(MessageI18nPeer::LOCALE), $messageI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseMessagePeer.php b/core/lib/Thelia/Model/om/BaseMessagePeer.php
index 39f49d5f7..a2ccf2403 100644
--- a/core/lib/Thelia/Model/om/BaseMessagePeer.php
+++ b/core/lib/Thelia/Model/om/BaseMessagePeer.php
@@ -10,7 +10,7 @@ use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\Message;
-use Thelia\Model\MessageDescPeer;
+use Thelia\Model\MessageI18nPeer;
use Thelia\Model\MessagePeer;
use Thelia\Model\map\MessageTableMap;
@@ -37,13 +37,13 @@ abstract class BaseMessagePeer
const TM_CLASS = 'MessageTableMap';
/** The total number of columns. */
- const NUM_COLUMNS = 5;
+ const NUM_COLUMNS = 6;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
- const NUM_HYDRATE_COLUMNS = 5;
+ const NUM_HYDRATE_COLUMNS = 6;
/** the column name for the ID field */
const ID = 'message.ID';
@@ -54,6 +54,9 @@ abstract class BaseMessagePeer
/** the column name for the SECURED field */
const SECURED = 'message.SECURED';
+ /** the column name for the REF field */
+ const REF = 'message.REF';
+
/** the column name for the CREATED_AT field */
const CREATED_AT = 'message.CREATED_AT';
@@ -72,6 +75,13 @@ abstract class BaseMessagePeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -79,12 +89,12 @@ abstract class BaseMessagePeer
* e.g. MessagePeer::$fieldNames[MessagePeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('Id', 'Code', 'Secured', 'CreatedAt', 'UpdatedAt', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'code', 'secured', 'createdAt', 'updatedAt', ),
- BasePeer::TYPE_COLNAME => array (MessagePeer::ID, MessagePeer::CODE, MessagePeer::SECURED, MessagePeer::CREATED_AT, MessagePeer::UPDATED_AT, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CODE', 'SECURED', 'CREATED_AT', 'UPDATED_AT', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'code', 'secured', 'created_at', 'updated_at', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
+ BasePeer::TYPE_PHPNAME => array ('Id', 'Code', 'Secured', 'Ref', 'CreatedAt', 'UpdatedAt', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'code', 'secured', 'ref', 'createdAt', 'updatedAt', ),
+ BasePeer::TYPE_COLNAME => array (MessagePeer::ID, MessagePeer::CODE, MessagePeer::SECURED, MessagePeer::REF, MessagePeer::CREATED_AT, MessagePeer::UPDATED_AT, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CODE', 'SECURED', 'REF', 'CREATED_AT', 'UPDATED_AT', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'code', 'secured', 'ref', 'created_at', 'updated_at', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
);
/**
@@ -94,12 +104,12 @@ abstract class BaseMessagePeer
* e.g. MessagePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Code' => 1, 'Secured' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'code' => 1, 'secured' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
- BasePeer::TYPE_COLNAME => array (MessagePeer::ID => 0, MessagePeer::CODE => 1, MessagePeer::SECURED => 2, MessagePeer::CREATED_AT => 3, MessagePeer::UPDATED_AT => 4, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CODE' => 1, 'SECURED' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'code' => 1, 'secured' => 2, 'created_at' => 3, 'updated_at' => 4, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Code' => 1, 'Secured' => 2, 'Ref' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
+ BasePeer::TYPE_COLNAME => array (MessagePeer::ID => 0, MessagePeer::CODE => 1, MessagePeer::SECURED => 2, MessagePeer::REF => 3, MessagePeer::CREATED_AT => 4, MessagePeer::UPDATED_AT => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CODE' => 1, 'SECURED' => 2, 'REF' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'created_at' => 4, 'updated_at' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
);
/**
@@ -176,12 +186,14 @@ abstract class BaseMessagePeer
$criteria->addSelectColumn(MessagePeer::ID);
$criteria->addSelectColumn(MessagePeer::CODE);
$criteria->addSelectColumn(MessagePeer::SECURED);
+ $criteria->addSelectColumn(MessagePeer::REF);
$criteria->addSelectColumn(MessagePeer::CREATED_AT);
$criteria->addSelectColumn(MessagePeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CODE');
$criteria->addSelectColumn($alias . '.SECURED');
+ $criteria->addSelectColumn($alias . '.REF');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
@@ -383,9 +395,9 @@ abstract class BaseMessagePeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in MessageDescPeer instance pool,
+ // Invalidate objects in MessageI18nPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- MessageDescPeer::clearInstancePool();
+ MessageI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseMessageQuery.php b/core/lib/Thelia/Model/om/BaseMessageQuery.php
index f9d68f71e..691c71f6e 100644
--- a/core/lib/Thelia/Model/om/BaseMessageQuery.php
+++ b/core/lib/Thelia/Model/om/BaseMessageQuery.php
@@ -13,7 +13,7 @@ use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Message;
-use Thelia\Model\MessageDesc;
+use Thelia\Model\MessageI18n;
use Thelia\Model\MessagePeer;
use Thelia\Model\MessageQuery;
@@ -25,12 +25,14 @@ use Thelia\Model\MessageQuery;
* @method MessageQuery orderById($order = Criteria::ASC) Order by the id column
* @method MessageQuery orderByCode($order = Criteria::ASC) Order by the code column
* @method MessageQuery orderBySecured($order = Criteria::ASC) Order by the secured column
+ * @method MessageQuery orderByRef($order = Criteria::ASC) Order by the ref column
* @method MessageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method MessageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method MessageQuery groupById() Group by the id column
* @method MessageQuery groupByCode() Group by the code column
* @method MessageQuery groupBySecured() Group by the secured column
+ * @method MessageQuery groupByRef() Group by the ref column
* @method MessageQuery groupByCreatedAt() Group by the created_at column
* @method MessageQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -38,9 +40,9 @@ use Thelia\Model\MessageQuery;
* @method MessageQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method MessageQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method MessageQuery leftJoinMessageDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the MessageDesc relation
- * @method MessageQuery rightJoinMessageDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the MessageDesc relation
- * @method MessageQuery innerJoinMessageDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the MessageDesc relation
+ * @method MessageQuery leftJoinMessageI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the MessageI18n relation
+ * @method MessageQuery rightJoinMessageI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the MessageI18n relation
+ * @method MessageQuery innerJoinMessageI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the MessageI18n relation
*
* @method Message findOne(PropelPDO $con = null) Return the first Message matching the query
* @method Message findOneOrCreate(PropelPDO $con = null) Return the first Message matching the query, or a new Message object populated from the query conditions when no match is found
@@ -48,12 +50,14 @@ use Thelia\Model\MessageQuery;
* @method Message findOneById(int $id) Return the first Message filtered by the id column
* @method Message findOneByCode(string $code) Return the first Message filtered by the code column
* @method Message findOneBySecured(int $secured) Return the first Message filtered by the secured column
+ * @method Message findOneByRef(string $ref) Return the first Message filtered by the ref column
* @method Message findOneByCreatedAt(string $created_at) Return the first Message filtered by the created_at column
* @method Message findOneByUpdatedAt(string $updated_at) Return the first Message filtered by the updated_at column
*
* @method array findById(int $id) Return Message objects filtered by the id column
* @method array findByCode(string $code) Return Message objects filtered by the code column
* @method array findBySecured(int $secured) Return Message objects filtered by the secured column
+ * @method array findByRef(string $ref) Return Message objects filtered by the ref column
* @method array findByCreatedAt(string $created_at) Return Message objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return Message objects filtered by the updated_at column
*
@@ -145,7 +149,7 @@ abstract class BaseMessageQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT `ID`, `CODE`, `SECURED`, `CREATED_AT`, `UPDATED_AT` FROM `message` WHERE `ID` = :p0';
+ $sql = 'SELECT `ID`, `CODE`, `SECURED`, `REF`, `CREATED_AT`, `UPDATED_AT` FROM `message` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -331,6 +335,35 @@ abstract class BaseMessageQuery extends ModelCriteria
return $this->addUsingAlias(MessagePeer::SECURED, $secured, $comparison);
}
+ /**
+ * Filter the query on the ref column
+ *
+ * Example usage:
+ *
+ * $query->filterByRef('fooValue'); // WHERE ref = 'fooValue'
+ * $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%'
+ *
+ *
+ * @param string $ref The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MessageQuery The current query, for fluid interface
+ */
+ public function filterByRef($ref = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($ref)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $ref)) {
+ $ref = str_replace('*', '%', $ref);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(MessagePeer::REF, $ref, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
@@ -418,41 +451,41 @@ abstract class BaseMessageQuery extends ModelCriteria
}
/**
- * Filter the query by a related MessageDesc object
+ * Filter the query by a related MessageI18n object
*
- * @param MessageDesc|PropelObjectCollection $messageDesc the related object to use as filter
+ * @param MessageI18n|PropelObjectCollection $messageI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return MessageQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
- public function filterByMessageDesc($messageDesc, $comparison = null)
+ public function filterByMessageI18n($messageI18n, $comparison = null)
{
- if ($messageDesc instanceof MessageDesc) {
+ if ($messageI18n instanceof MessageI18n) {
return $this
- ->addUsingAlias(MessagePeer::ID, $messageDesc->getMessageId(), $comparison);
- } elseif ($messageDesc instanceof PropelObjectCollection) {
+ ->addUsingAlias(MessagePeer::ID, $messageI18n->getId(), $comparison);
+ } elseif ($messageI18n instanceof PropelObjectCollection) {
return $this
- ->useMessageDescQuery()
- ->filterByPrimaryKeys($messageDesc->getPrimaryKeys())
+ ->useMessageI18nQuery()
+ ->filterByPrimaryKeys($messageI18n->getPrimaryKeys())
->endUse();
} else {
- throw new PropelException('filterByMessageDesc() only accepts arguments of type MessageDesc or PropelCollection');
+ throw new PropelException('filterByMessageI18n() only accepts arguments of type MessageI18n or PropelCollection');
}
}
/**
- * Adds a JOIN clause to the query using the MessageDesc relation
+ * Adds a JOIN clause to the query using the MessageI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return MessageQuery The current query, for fluid interface
*/
- public function joinMessageDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function joinMessageI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('MessageDesc');
+ $relationMap = $tableMap->getRelation('MessageI18n');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -467,14 +500,14 @@ abstract class BaseMessageQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
- $this->addJoinObject($join, 'MessageDesc');
+ $this->addJoinObject($join, 'MessageI18n');
}
return $this;
}
/**
- * Use the MessageDesc relation MessageDesc object
+ * Use the MessageI18n relation MessageI18n object
*
* @see useQuery()
*
@@ -482,13 +515,13 @@ abstract class BaseMessageQuery extends ModelCriteria
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
- * @return \Thelia\Model\MessageDescQuery A secondary query class using the current class as primary query
+ * @return \Thelia\Model\MessageI18nQuery A secondary query class using the current class as primary query
*/
- public function useMessageDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function useMessageI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
- ->joinMessageDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'MessageDesc', '\Thelia\Model\MessageDescQuery');
+ ->joinMessageI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'MessageI18n', '\Thelia\Model\MessageI18nQuery');
}
/**
@@ -572,4 +605,61 @@ abstract class BaseMessageQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(MessagePeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return MessageQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'MessageI18n';
+
+ return $this
+ ->joinMessageI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return MessageQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('MessageI18n');
+ $this->with['MessageI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return MessageI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'MessageI18n', 'Thelia\Model\MessageI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseModule.php b/core/lib/Thelia/Model/om/BaseModule.php
index fb80a2ef5..70696cf6f 100644
--- a/core/lib/Thelia/Model/om/BaseModule.php
+++ b/core/lib/Thelia/Model/om/BaseModule.php
@@ -18,8 +18,8 @@ use \PropelPDO;
use Thelia\Model\GroupModule;
use Thelia\Model\GroupModuleQuery;
use Thelia\Model\Module;
-use Thelia\Model\ModuleDesc;
-use Thelia\Model\ModuleDescQuery;
+use Thelia\Model\ModuleI18n;
+use Thelia\Model\ModuleI18nQuery;
use Thelia\Model\ModulePeer;
use Thelia\Model\ModuleQuery;
@@ -93,18 +93,18 @@ abstract class BaseModule extends BaseObject implements Persistent
*/
protected $updated_at;
- /**
- * @var PropelObjectCollection|ModuleDesc[] Collection to store aggregation of ModuleDesc objects.
- */
- protected $collModuleDescs;
- protected $collModuleDescsPartial;
-
/**
* @var PropelObjectCollection|GroupModule[] Collection to store aggregation of GroupModule objects.
*/
protected $collGroupModules;
protected $collGroupModulesPartial;
+ /**
+ * @var PropelObjectCollection|ModuleI18n[] Collection to store aggregation of ModuleI18n objects.
+ */
+ protected $collModuleI18ns;
+ protected $collModuleI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -119,11 +119,19 @@ abstract class BaseModule extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $moduleDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[ModuleI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -131,6 +139,12 @@ abstract class BaseModule extends BaseObject implements Persistent
*/
protected $groupModulesScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $moduleI18nsScheduledForDeletion = null;
+
/**
* Get the [id] column value.
*
@@ -515,10 +529,10 @@ abstract class BaseModule extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
- $this->collModuleDescs = null;
-
$this->collGroupModules = null;
+ $this->collModuleI18ns = null;
+
} // if (deep)
}
@@ -654,23 +668,6 @@ abstract class BaseModule extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->moduleDescsScheduledForDeletion !== null) {
- if (!$this->moduleDescsScheduledForDeletion->isEmpty()) {
- ModuleDescQuery::create()
- ->filterByPrimaryKeys($this->moduleDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->moduleDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collModuleDescs !== null) {
- foreach ($this->collModuleDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->groupModulesScheduledForDeletion !== null) {
if (!$this->groupModulesScheduledForDeletion->isEmpty()) {
foreach ($this->groupModulesScheduledForDeletion as $groupModule) {
@@ -689,6 +686,23 @@ abstract class BaseModule extends BaseObject implements Persistent
}
}
+ if ($this->moduleI18nsScheduledForDeletion !== null) {
+ if (!$this->moduleI18nsScheduledForDeletion->isEmpty()) {
+ ModuleI18nQuery::create()
+ ->filterByPrimaryKeys($this->moduleI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->moduleI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collModuleI18ns !== null) {
+ foreach ($this->collModuleI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -856,16 +870,16 @@ abstract class BaseModule extends BaseObject implements Persistent
}
- if ($this->collModuleDescs !== null) {
- foreach ($this->collModuleDescs as $referrerFK) {
+ if ($this->collGroupModules !== null) {
+ foreach ($this->collGroupModules as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
- if ($this->collGroupModules !== null) {
- foreach ($this->collGroupModules as $referrerFK) {
+ if ($this->collModuleI18ns !== null) {
+ foreach ($this->collModuleI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -966,12 +980,12 @@ abstract class BaseModule extends BaseObject implements Persistent
$keys[6] => $this->getUpdatedAt(),
);
if ($includeForeignObjects) {
- if (null !== $this->collModuleDescs) {
- $result['ModuleDescs'] = $this->collModuleDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collGroupModules) {
$result['GroupModules'] = $this->collGroupModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collModuleI18ns) {
+ $result['ModuleI18ns'] = $this->collModuleI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1153,18 +1167,18 @@ abstract class BaseModule extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getModuleDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addModuleDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getGroupModules() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addGroupModule($relObj->copy($deepCopy));
}
}
+ foreach ($this->getModuleI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addModuleI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1226,218 +1240,11 @@ abstract class BaseModule extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('ModuleDesc' == $relationName) {
- $this->initModuleDescs();
- }
if ('GroupModule' == $relationName) {
$this->initGroupModules();
}
- }
-
- /**
- * Clears out the collModuleDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addModuleDescs()
- */
- public function clearModuleDescs()
- {
- $this->collModuleDescs = null; // important to set this to null since that means it is uninitialized
- $this->collModuleDescsPartial = null;
- }
-
- /**
- * reset is the collModuleDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialModuleDescs($v = true)
- {
- $this->collModuleDescsPartial = $v;
- }
-
- /**
- * Initializes the collModuleDescs collection.
- *
- * By default this just sets the collModuleDescs collection to an empty array (like clearcollModuleDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initModuleDescs($overrideExisting = true)
- {
- if (null !== $this->collModuleDescs && !$overrideExisting) {
- return;
- }
- $this->collModuleDescs = new PropelObjectCollection();
- $this->collModuleDescs->setModel('ModuleDesc');
- }
-
- /**
- * Gets an array of ModuleDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * Next time the same method is called without $criteria, the cached collection is returned.
- * If this Module is new, it will return
- * an empty collection or the current collection; the criteria is ignored on a new object.
- *
- * @param Criteria $criteria optional Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|ModuleDesc[] List of ModuleDesc objects
- * @throws PropelException
- */
- public function getModuleDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collModuleDescsPartial && !$this->isNew();
- if (null === $this->collModuleDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collModuleDescs) {
- // return empty collection
- $this->initModuleDescs();
- } else {
- $collModuleDescs = ModuleDescQuery::create(null, $criteria)
- ->filterByModule($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collModuleDescsPartial && count($collModuleDescs)) {
- $this->initModuleDescs(false);
-
- foreach($collModuleDescs as $obj) {
- if (false == $this->collModuleDescs->contains($obj)) {
- $this->collModuleDescs->append($obj);
- }
- }
-
- $this->collModuleDescsPartial = true;
- }
-
- return $collModuleDescs;
- }
-
- if($partial && $this->collModuleDescs) {
- foreach($this->collModuleDescs as $obj) {
- if($obj->isNew()) {
- $collModuleDescs[] = $obj;
- }
- }
- }
-
- $this->collModuleDescs = $collModuleDescs;
- $this->collModuleDescsPartial = false;
- }
- }
-
- return $this->collModuleDescs;
- }
-
- /**
- * Sets a collection of ModuleDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $moduleDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setModuleDescs(PropelCollection $moduleDescs, PropelPDO $con = null)
- {
- $this->moduleDescsScheduledForDeletion = $this->getModuleDescs(new Criteria(), $con)->diff($moduleDescs);
-
- foreach ($this->moduleDescsScheduledForDeletion as $moduleDescRemoved) {
- $moduleDescRemoved->setModule(null);
- }
-
- $this->collModuleDescs = null;
- foreach ($moduleDescs as $moduleDesc) {
- $this->addModuleDesc($moduleDesc);
- }
-
- $this->collModuleDescs = $moduleDescs;
- $this->collModuleDescsPartial = false;
- }
-
- /**
- * Returns the number of related ModuleDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related ModuleDesc objects.
- * @throws PropelException
- */
- public function countModuleDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collModuleDescsPartial && !$this->isNew();
- if (null === $this->collModuleDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collModuleDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getModuleDescs());
- }
- $query = ModuleDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByModule($this)
- ->count($con);
- }
- } else {
- return count($this->collModuleDescs);
- }
- }
-
- /**
- * Method called to associate a ModuleDesc object to this object
- * through the ModuleDesc foreign key attribute.
- *
- * @param ModuleDesc $l ModuleDesc
- * @return Module The current object (for fluent API support)
- */
- public function addModuleDesc(ModuleDesc $l)
- {
- if ($this->collModuleDescs === null) {
- $this->initModuleDescs();
- $this->collModuleDescsPartial = true;
- }
- if (!$this->collModuleDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddModuleDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param ModuleDesc $moduleDesc The moduleDesc object to add.
- */
- protected function doAddModuleDesc($moduleDesc)
- {
- $this->collModuleDescs[]= $moduleDesc;
- $moduleDesc->setModule($this);
- }
-
- /**
- * @param ModuleDesc $moduleDesc The moduleDesc object to remove.
- */
- public function removeModuleDesc($moduleDesc)
- {
- if ($this->getModuleDescs()->contains($moduleDesc)) {
- $this->collModuleDescs->remove($this->collModuleDescs->search($moduleDesc));
- if (null === $this->moduleDescsScheduledForDeletion) {
- $this->moduleDescsScheduledForDeletion = clone $this->collModuleDescs;
- $this->moduleDescsScheduledForDeletion->clear();
- }
- $this->moduleDescsScheduledForDeletion[]= $moduleDesc;
- $moduleDesc->setModule(null);
+ if ('ModuleI18n' == $relationName) {
+ $this->initModuleI18ns();
}
}
@@ -1673,6 +1480,217 @@ abstract class BaseModule extends BaseObject implements Persistent
return $this->getGroupModules($query, $con);
}
+ /**
+ * Clears out the collModuleI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addModuleI18ns()
+ */
+ public function clearModuleI18ns()
+ {
+ $this->collModuleI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collModuleI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collModuleI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialModuleI18ns($v = true)
+ {
+ $this->collModuleI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collModuleI18ns collection.
+ *
+ * By default this just sets the collModuleI18ns collection to an empty array (like clearcollModuleI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initModuleI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collModuleI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collModuleI18ns = new PropelObjectCollection();
+ $this->collModuleI18ns->setModel('ModuleI18n');
+ }
+
+ /**
+ * Gets an array of ModuleI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this Module is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|ModuleI18n[] List of ModuleI18n objects
+ * @throws PropelException
+ */
+ public function getModuleI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collModuleI18nsPartial && !$this->isNew();
+ if (null === $this->collModuleI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collModuleI18ns) {
+ // return empty collection
+ $this->initModuleI18ns();
+ } else {
+ $collModuleI18ns = ModuleI18nQuery::create(null, $criteria)
+ ->filterByModule($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collModuleI18nsPartial && count($collModuleI18ns)) {
+ $this->initModuleI18ns(false);
+
+ foreach($collModuleI18ns as $obj) {
+ if (false == $this->collModuleI18ns->contains($obj)) {
+ $this->collModuleI18ns->append($obj);
+ }
+ }
+
+ $this->collModuleI18nsPartial = true;
+ }
+
+ return $collModuleI18ns;
+ }
+
+ if($partial && $this->collModuleI18ns) {
+ foreach($this->collModuleI18ns as $obj) {
+ if($obj->isNew()) {
+ $collModuleI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collModuleI18ns = $collModuleI18ns;
+ $this->collModuleI18nsPartial = false;
+ }
+ }
+
+ return $this->collModuleI18ns;
+ }
+
+ /**
+ * Sets a collection of ModuleI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $moduleI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setModuleI18ns(PropelCollection $moduleI18ns, PropelPDO $con = null)
+ {
+ $this->moduleI18nsScheduledForDeletion = $this->getModuleI18ns(new Criteria(), $con)->diff($moduleI18ns);
+
+ foreach ($this->moduleI18nsScheduledForDeletion as $moduleI18nRemoved) {
+ $moduleI18nRemoved->setModule(null);
+ }
+
+ $this->collModuleI18ns = null;
+ foreach ($moduleI18ns as $moduleI18n) {
+ $this->addModuleI18n($moduleI18n);
+ }
+
+ $this->collModuleI18ns = $moduleI18ns;
+ $this->collModuleI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related ModuleI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related ModuleI18n objects.
+ * @throws PropelException
+ */
+ public function countModuleI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collModuleI18nsPartial && !$this->isNew();
+ if (null === $this->collModuleI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collModuleI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getModuleI18ns());
+ }
+ $query = ModuleI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByModule($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collModuleI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a ModuleI18n object to this object
+ * through the ModuleI18n foreign key attribute.
+ *
+ * @param ModuleI18n $l ModuleI18n
+ * @return Module The current object (for fluent API support)
+ */
+ public function addModuleI18n(ModuleI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collModuleI18ns === null) {
+ $this->initModuleI18ns();
+ $this->collModuleI18nsPartial = true;
+ }
+ if (!$this->collModuleI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddModuleI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param ModuleI18n $moduleI18n The moduleI18n object to add.
+ */
+ protected function doAddModuleI18n($moduleI18n)
+ {
+ $this->collModuleI18ns[]= $moduleI18n;
+ $moduleI18n->setModule($this);
+ }
+
+ /**
+ * @param ModuleI18n $moduleI18n The moduleI18n object to remove.
+ */
+ public function removeModuleI18n($moduleI18n)
+ {
+ if ($this->getModuleI18ns()->contains($moduleI18n)) {
+ $this->collModuleI18ns->remove($this->collModuleI18ns->search($moduleI18n));
+ if (null === $this->moduleI18nsScheduledForDeletion) {
+ $this->moduleI18nsScheduledForDeletion = clone $this->collModuleI18ns;
+ $this->moduleI18nsScheduledForDeletion->clear();
+ }
+ $this->moduleI18nsScheduledForDeletion[]= $moduleI18n;
+ $moduleI18n->setModule(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -1705,26 +1723,30 @@ abstract class BaseModule extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collModuleDescs) {
- foreach ($this->collModuleDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collGroupModules) {
foreach ($this->collGroupModules as $o) {
$o->clearAllReferences($deep);
}
}
+ if ($this->collModuleI18ns) {
+ foreach ($this->collModuleI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collModuleDescs instanceof PropelCollection) {
- $this->collModuleDescs->clearIterator();
- }
- $this->collModuleDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collGroupModules instanceof PropelCollection) {
$this->collGroupModules->clearIterator();
}
$this->collGroupModules = null;
+ if ($this->collModuleI18ns instanceof PropelCollection) {
+ $this->collModuleI18ns->clearIterator();
+ }
+ $this->collModuleI18ns = null;
}
/**
@@ -1761,4 +1783,199 @@ abstract class BaseModule extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Module The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ModuleI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collModuleI18ns) {
+ foreach ($this->collModuleI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new ModuleI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = ModuleI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addModuleI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Module The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ ModuleI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collModuleI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collModuleI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ModuleI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return ModuleI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return ModuleI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return ModuleI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return ModuleI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseModuleI18n.php b/core/lib/Thelia/Model/om/BaseModuleI18n.php
new file mode 100644
index 000000000..567ba4306
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseModuleI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseModuleI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return ModuleI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = ModuleI18nPeer::ID;
+ }
+
+ if ($this->aModule !== null && $this->aModule->getId() !== $v) {
+ $this->aModule = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return ModuleI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = ModuleI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return ModuleI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = ModuleI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return ModuleI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = ModuleI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return ModuleI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = ModuleI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return ModuleI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = ModuleI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = ModuleI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating ModuleI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aModule !== null && $this->id !== $this->aModule->getId()) {
+ $this->aModule = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = ModuleI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aModule = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ModuleI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ ModuleI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aModule !== null) {
+ if ($this->aModule->isModified() || $this->aModule->isNew()) {
+ $affectedRows += $this->aModule->save($con);
+ }
+ $this->setModule($this->aModule);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ModuleI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(ModuleI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(ModuleI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(ModuleI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(ModuleI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(ModuleI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `module_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aModule !== null) {
+ if (!$this->aModule->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aModule->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = ModuleI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ModuleI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['ModuleI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ModuleI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = ModuleI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aModule) {
+ $result['Module'] = $this->aModule->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ModuleI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = ModuleI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(ModuleI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(ModuleI18nPeer::ID)) $criteria->add(ModuleI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(ModuleI18nPeer::LOCALE)) $criteria->add(ModuleI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(ModuleI18nPeer::TITLE)) $criteria->add(ModuleI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(ModuleI18nPeer::DESCRIPTION)) $criteria->add(ModuleI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(ModuleI18nPeer::CHAPO)) $criteria->add(ModuleI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(ModuleI18nPeer::POSTSCRIPTUM)) $criteria->add(ModuleI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(ModuleI18nPeer::DATABASE_NAME);
+ $criteria->add(ModuleI18nPeer::ID, $this->id);
+ $criteria->add(ModuleI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of ModuleI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return ModuleI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return ModuleI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new ModuleI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Module object.
+ *
+ * @param Module $v
+ * @return ModuleI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setModule(Module $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aModule = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Module object, it will not be re-added.
+ if ($v !== null) {
+ $v->addModuleI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Module object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Module The associated Module object.
+ * @throws PropelException
+ */
+ public function getModule(PropelPDO $con = null)
+ {
+ if ($this->aModule === null && ($this->id !== null)) {
+ $this->aModule = ModuleQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aModule->addModuleI18ns($this);
+ */
+ }
+
+ return $this->aModule;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aModule = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ModuleI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseModuleI18nPeer.php b/core/lib/Thelia/Model/om/BaseModuleI18nPeer.php
new file mode 100644
index 000000000..a34fa2bf4
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseModuleI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (ModuleI18nPeer::ID, ModuleI18nPeer::LOCALE, ModuleI18nPeer::TITLE, ModuleI18nPeer::DESCRIPTION, ModuleI18nPeer::CHAPO, ModuleI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. ModuleI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (ModuleI18nPeer::ID => 0, ModuleI18nPeer::LOCALE => 1, ModuleI18nPeer::TITLE => 2, ModuleI18nPeer::DESCRIPTION => 3, ModuleI18nPeer::CHAPO => 4, ModuleI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = ModuleI18nPeer::getFieldNames($toType);
+ $key = isset(ModuleI18nPeer::$fieldKeys[$fromType][$name]) ? ModuleI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ModuleI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, ModuleI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return ModuleI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. ModuleI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(ModuleI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(ModuleI18nPeer::ID);
+ $criteria->addSelectColumn(ModuleI18nPeer::LOCALE);
+ $criteria->addSelectColumn(ModuleI18nPeer::TITLE);
+ $criteria->addSelectColumn(ModuleI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(ModuleI18nPeer::CHAPO);
+ $criteria->addSelectColumn(ModuleI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ModuleI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ModuleI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(ModuleI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return ModuleI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = ModuleI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return ModuleI18nPeer::populateObjects(ModuleI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ ModuleI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ModuleI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param ModuleI18n $obj A ModuleI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ ModuleI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A ModuleI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof ModuleI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ModuleI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(ModuleI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return ModuleI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(ModuleI18nPeer::$instances[$key])) {
+ return ModuleI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ ModuleI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to module_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = ModuleI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = ModuleI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = ModuleI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ ModuleI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (ModuleI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = ModuleI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = ModuleI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + ModuleI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ModuleI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ ModuleI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Module table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinModule(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ModuleI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ModuleI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ModuleI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ModuleI18nPeer::ID, ModulePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of ModuleI18n objects pre-filled with their Module objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ModuleI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinModule(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ModuleI18nPeer::DATABASE_NAME);
+ }
+
+ ModuleI18nPeer::addSelectColumns($criteria);
+ $startcol = ModuleI18nPeer::NUM_HYDRATE_COLUMNS;
+ ModulePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(ModuleI18nPeer::ID, ModulePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ModuleI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ModuleI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = ModuleI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ModuleI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = ModulePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = ModulePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = ModulePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ ModulePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (ModuleI18n) to $obj2 (Module)
+ $obj2->addModuleI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ModuleI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ModuleI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ModuleI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ModuleI18nPeer::ID, ModulePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of ModuleI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ModuleI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ModuleI18nPeer::DATABASE_NAME);
+ }
+
+ ModuleI18nPeer::addSelectColumns($criteria);
+ $startcol2 = ModuleI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ ModulePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + ModulePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(ModuleI18nPeer::ID, ModulePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ModuleI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ModuleI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = ModuleI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ModuleI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Module rows
+
+ $key2 = ModulePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = ModulePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = ModulePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ ModulePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (ModuleI18n) to the collection in $obj2 (Module)
+ $obj2->addModuleI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(ModuleI18nPeer::DATABASE_NAME)->getTable(ModuleI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseModuleI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseModuleI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new ModuleI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return ModuleI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ModuleI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or ModuleI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from ModuleI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(ModuleI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a ModuleI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or ModuleI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(ModuleI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(ModuleI18nPeer::ID);
+ $value = $criteria->remove(ModuleI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(ModuleI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ModuleI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(ModuleI18nPeer::LOCALE);
+ $value = $criteria->remove(ModuleI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(ModuleI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ModuleI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is ModuleI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(ModuleI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the module_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(ModuleI18nPeer::TABLE_NAME, $con, ModuleI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ ModuleI18nPeer::clearInstancePool();
+ ModuleI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ModuleI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ModuleI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ ModuleI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof ModuleI18n) { // it's a model object
+ // invalidate the cache for this single object
+ ModuleI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(ModuleI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(ModuleI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(ModuleI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ ModuleI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ModuleI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ ModuleI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given ModuleI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param ModuleI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(ModuleI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(ModuleI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(ModuleI18nPeer::DATABASE_NAME, ModuleI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return ModuleI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = ModuleI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(ModuleI18nPeer::DATABASE_NAME);
+ $criteria->add(ModuleI18nPeer::ID, $id);
+ $criteria->add(ModuleI18nPeer::LOCALE, $locale);
+ $v = ModuleI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseModuleI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseModuleI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseModuleI18nQuery.php b/core/lib/Thelia/Model/om/BaseModuleI18nQuery.php
new file mode 100644
index 000000000..90a7b8f8e
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseModuleI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ModuleI18n|ModuleI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ModuleI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(ModuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ModuleI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `module_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new ModuleI18n();
+ $obj->hydrate($row);
+ ModuleI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ModuleI18n|ModuleI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|ModuleI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ModuleI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(ModuleI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(ModuleI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ModuleI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(ModuleI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(ModuleI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByModule()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ModuleI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(ModuleI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ModuleI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ModuleI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ModuleI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ModuleI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ModuleI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ModuleI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ModuleI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ModuleI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ModuleI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ModuleI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Module object
+ *
+ * @param Module|PropelObjectCollection $module The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ModuleI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByModule($module, $comparison = null)
+ {
+ if ($module instanceof Module) {
+ return $this
+ ->addUsingAlias(ModuleI18nPeer::ID, $module->getId(), $comparison);
+ } elseif ($module instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ModuleI18nPeer::ID, $module->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByModule() only accepts arguments of type Module or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Module relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ModuleI18nQuery The current query, for fluid interface
+ */
+ public function joinModule($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Module');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Module');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Module relation Module object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\ModuleQuery A secondary query class using the current class as primary query
+ */
+ public function useModuleQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinModule($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Module', '\Thelia\Model\ModuleQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ModuleI18n $moduleI18n Object to remove from the list of results
+ *
+ * @return ModuleI18nQuery The current query, for fluid interface
+ */
+ public function prune($moduleI18n = null)
+ {
+ if ($moduleI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(ModuleI18nPeer::ID), $moduleI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(ModuleI18nPeer::LOCALE), $moduleI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseModulePeer.php b/core/lib/Thelia/Model/om/BaseModulePeer.php
index da93b3efe..90a2d0686 100644
--- a/core/lib/Thelia/Model/om/BaseModulePeer.php
+++ b/core/lib/Thelia/Model/om/BaseModulePeer.php
@@ -11,7 +11,7 @@ use \PropelException;
use \PropelPDO;
use Thelia\Model\GroupModulePeer;
use Thelia\Model\Module;
-use Thelia\Model\ModuleDescPeer;
+use Thelia\Model\ModuleI18nPeer;
use Thelia\Model\ModulePeer;
use Thelia\Model\map\ModuleTableMap;
@@ -79,6 +79,13 @@ abstract class BaseModulePeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -394,12 +401,12 @@ abstract class BaseModulePeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in ModuleDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- ModuleDescPeer::clearInstancePool();
// Invalidate objects in GroupModulePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
GroupModulePeer::clearInstancePool();
+ // Invalidate objects in ModuleI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ ModuleI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseModuleQuery.php b/core/lib/Thelia/Model/om/BaseModuleQuery.php
index fe2102d20..02e610571 100644
--- a/core/lib/Thelia/Model/om/BaseModuleQuery.php
+++ b/core/lib/Thelia/Model/om/BaseModuleQuery.php
@@ -14,7 +14,7 @@ use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\GroupModule;
use Thelia\Model\Module;
-use Thelia\Model\ModuleDesc;
+use Thelia\Model\ModuleI18n;
use Thelia\Model\ModulePeer;
use Thelia\Model\ModuleQuery;
@@ -43,14 +43,14 @@ use Thelia\Model\ModuleQuery;
* @method ModuleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ModuleQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method ModuleQuery leftJoinModuleDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleDesc relation
- * @method ModuleQuery rightJoinModuleDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleDesc relation
- * @method ModuleQuery innerJoinModuleDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleDesc relation
- *
* @method ModuleQuery leftJoinGroupModule($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupModule relation
* @method ModuleQuery rightJoinGroupModule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupModule relation
* @method ModuleQuery innerJoinGroupModule($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupModule relation
*
+ * @method ModuleQuery leftJoinModuleI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ModuleI18n relation
+ * @method ModuleQuery rightJoinModuleI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ModuleI18n relation
+ * @method ModuleQuery innerJoinModuleI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ModuleI18n relation
+ *
* @method Module findOne(PropelPDO $con = null) Return the first Module matching the query
* @method Module findOneOrCreate(PropelPDO $con = null) Return the first Module matching the query, or a new Module object populated from the query conditions when no match is found
*
@@ -512,80 +512,6 @@ abstract class BaseModuleQuery extends ModelCriteria
return $this->addUsingAlias(ModulePeer::UPDATED_AT, $updatedAt, $comparison);
}
- /**
- * Filter the query by a related ModuleDesc object
- *
- * @param ModuleDesc|PropelObjectCollection $moduleDesc the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ModuleQuery The current query, for fluid interface
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByModuleDesc($moduleDesc, $comparison = null)
- {
- if ($moduleDesc instanceof ModuleDesc) {
- return $this
- ->addUsingAlias(ModulePeer::ID, $moduleDesc->getModuleId(), $comparison);
- } elseif ($moduleDesc instanceof PropelObjectCollection) {
- return $this
- ->useModuleDescQuery()
- ->filterByPrimaryKeys($moduleDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByModuleDesc() only accepts arguments of type ModuleDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the ModuleDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return ModuleQuery The current query, for fluid interface
- */
- public function joinModuleDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('ModuleDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'ModuleDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the ModuleDesc relation ModuleDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\ModuleDescQuery A secondary query class using the current class as primary query
- */
- public function useModuleDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinModuleDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'ModuleDesc', '\Thelia\Model\ModuleDescQuery');
- }
-
/**
* Filter the query by a related GroupModule object
*
@@ -660,6 +586,80 @@ abstract class BaseModuleQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'GroupModule', '\Thelia\Model\GroupModuleQuery');
}
+ /**
+ * Filter the query by a related ModuleI18n object
+ *
+ * @param ModuleI18n|PropelObjectCollection $moduleI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ModuleQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByModuleI18n($moduleI18n, $comparison = null)
+ {
+ if ($moduleI18n instanceof ModuleI18n) {
+ return $this
+ ->addUsingAlias(ModulePeer::ID, $moduleI18n->getId(), $comparison);
+ } elseif ($moduleI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useModuleI18nQuery()
+ ->filterByPrimaryKeys($moduleI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByModuleI18n() only accepts arguments of type ModuleI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the ModuleI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ModuleQuery The current query, for fluid interface
+ */
+ public function joinModuleI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('ModuleI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'ModuleI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the ModuleI18n relation ModuleI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\ModuleI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useModuleI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinModuleI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ModuleI18n', '\Thelia\Model\ModuleI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -741,4 +741,61 @@ abstract class BaseModuleQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(ModulePeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ModuleQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'ModuleI18n';
+
+ return $this
+ ->joinModuleI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ModuleQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('ModuleI18n');
+ $this->with['ModuleI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ModuleI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ModuleI18n', 'Thelia\Model\ModuleI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseOrderStatus.php b/core/lib/Thelia/Model/om/BaseOrderStatus.php
index 6c146b96c..d9859ff64 100644
--- a/core/lib/Thelia/Model/om/BaseOrderStatus.php
+++ b/core/lib/Thelia/Model/om/BaseOrderStatus.php
@@ -18,8 +18,8 @@ use \PropelPDO;
use Thelia\Model\Order;
use Thelia\Model\OrderQuery;
use Thelia\Model\OrderStatus;
-use Thelia\Model\OrderStatusDesc;
-use Thelia\Model\OrderStatusDescQuery;
+use Thelia\Model\OrderStatusI18n;
+use Thelia\Model\OrderStatusI18nQuery;
use Thelia\Model\OrderStatusPeer;
use Thelia\Model\OrderStatusQuery;
@@ -82,10 +82,10 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
protected $collOrdersPartial;
/**
- * @var PropelObjectCollection|OrderStatusDesc[] Collection to store aggregation of OrderStatusDesc objects.
+ * @var PropelObjectCollection|OrderStatusI18n[] Collection to store aggregation of OrderStatusI18n objects.
*/
- protected $collOrderStatusDescs;
- protected $collOrderStatusDescsPartial;
+ protected $collOrderStatusI18ns;
+ protected $collOrderStatusI18nsPartial;
/**
* Flag to prevent endless save loop, if this object is referenced
@@ -101,6 +101,20 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
+ /**
+ * Current locale
+ * @var string
+ */
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[OrderStatusI18n]
+ */
+ protected $currentTranslations;
+
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
@@ -111,7 +125,7 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
- protected $orderStatusDescsScheduledForDeletion = null;
+ protected $orderStatusI18nsScheduledForDeletion = null;
/**
* Get the [id] column value.
@@ -403,7 +417,7 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
$this->collOrders = null;
- $this->collOrderStatusDescs = null;
+ $this->collOrderStatusI18ns = null;
} // if (deep)
}
@@ -558,17 +572,17 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
}
}
- if ($this->orderStatusDescsScheduledForDeletion !== null) {
- if (!$this->orderStatusDescsScheduledForDeletion->isEmpty()) {
- OrderStatusDescQuery::create()
- ->filterByPrimaryKeys($this->orderStatusDescsScheduledForDeletion->getPrimaryKeys(false))
+ if ($this->orderStatusI18nsScheduledForDeletion !== null) {
+ if (!$this->orderStatusI18nsScheduledForDeletion->isEmpty()) {
+ OrderStatusI18nQuery::create()
+ ->filterByPrimaryKeys($this->orderStatusI18nsScheduledForDeletion->getPrimaryKeys(false))
->delete($con);
- $this->orderStatusDescsScheduledForDeletion = null;
+ $this->orderStatusI18nsScheduledForDeletion = null;
}
}
- if ($this->collOrderStatusDescs !== null) {
- foreach ($this->collOrderStatusDescs as $referrerFK) {
+ if ($this->collOrderStatusI18ns !== null) {
+ foreach ($this->collOrderStatusI18ns as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
@@ -743,8 +757,8 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
}
}
- if ($this->collOrderStatusDescs !== null) {
- foreach ($this->collOrderStatusDescs as $referrerFK) {
+ if ($this->collOrderStatusI18ns !== null) {
+ foreach ($this->collOrderStatusI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -836,8 +850,8 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
if (null !== $this->collOrders) {
$result['Orders'] = $this->collOrders->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
- if (null !== $this->collOrderStatusDescs) {
- $result['OrderStatusDescs'] = $this->collOrderStatusDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ if (null !== $this->collOrderStatusI18ns) {
+ $result['OrderStatusI18ns'] = $this->collOrderStatusI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
}
@@ -1008,9 +1022,9 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
}
}
- foreach ($this->getOrderStatusDescs() as $relObj) {
+ foreach ($this->getOrderStatusI18ns() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addOrderStatusDesc($relObj->copy($deepCopy));
+ $copyObj->addOrderStatusI18n($relObj->copy($deepCopy));
}
}
@@ -1078,8 +1092,8 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
if ('Order' == $relationName) {
$this->initOrders();
}
- if ('OrderStatusDesc' == $relationName) {
- $this->initOrderStatusDescs();
+ if ('OrderStatusI18n' == $relationName) {
+ $this->initOrderStatusI18ns();
}
}
@@ -1391,34 +1405,34 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
}
/**
- * Clears out the collOrderStatusDescs collection
+ * Clears out the collOrderStatusI18ns collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
- * @see addOrderStatusDescs()
+ * @see addOrderStatusI18ns()
*/
- public function clearOrderStatusDescs()
+ public function clearOrderStatusI18ns()
{
- $this->collOrderStatusDescs = null; // important to set this to null since that means it is uninitialized
- $this->collOrderStatusDescsPartial = null;
+ $this->collOrderStatusI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collOrderStatusI18nsPartial = null;
}
/**
- * reset is the collOrderStatusDescs collection loaded partially
+ * reset is the collOrderStatusI18ns collection loaded partially
*
* @return void
*/
- public function resetPartialOrderStatusDescs($v = true)
+ public function resetPartialOrderStatusI18ns($v = true)
{
- $this->collOrderStatusDescsPartial = $v;
+ $this->collOrderStatusI18nsPartial = $v;
}
/**
- * Initializes the collOrderStatusDescs collection.
+ * Initializes the collOrderStatusI18ns collection.
*
- * By default this just sets the collOrderStatusDescs collection to an empty array (like clearcollOrderStatusDescs());
+ * By default this just sets the collOrderStatusI18ns collection to an empty array (like clearcollOrderStatusI18ns());
* 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.
*
@@ -1427,17 +1441,17 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
*
* @return void
*/
- public function initOrderStatusDescs($overrideExisting = true)
+ public function initOrderStatusI18ns($overrideExisting = true)
{
- if (null !== $this->collOrderStatusDescs && !$overrideExisting) {
+ if (null !== $this->collOrderStatusI18ns && !$overrideExisting) {
return;
}
- $this->collOrderStatusDescs = new PropelObjectCollection();
- $this->collOrderStatusDescs->setModel('OrderStatusDesc');
+ $this->collOrderStatusI18ns = new PropelObjectCollection();
+ $this->collOrderStatusI18ns->setModel('OrderStatusI18n');
}
/**
- * Gets an array of OrderStatusDesc objects which contain a foreign key that references this object.
+ * Gets an array of OrderStatusI18n objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
@@ -1447,98 +1461,98 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|OrderStatusDesc[] List of OrderStatusDesc objects
+ * @return PropelObjectCollection|OrderStatusI18n[] List of OrderStatusI18n objects
* @throws PropelException
*/
- public function getOrderStatusDescs($criteria = null, PropelPDO $con = null)
+ public function getOrderStatusI18ns($criteria = null, PropelPDO $con = null)
{
- $partial = $this->collOrderStatusDescsPartial && !$this->isNew();
- if (null === $this->collOrderStatusDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collOrderStatusDescs) {
+ $partial = $this->collOrderStatusI18nsPartial && !$this->isNew();
+ if (null === $this->collOrderStatusI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collOrderStatusI18ns) {
// return empty collection
- $this->initOrderStatusDescs();
+ $this->initOrderStatusI18ns();
} else {
- $collOrderStatusDescs = OrderStatusDescQuery::create(null, $criteria)
+ $collOrderStatusI18ns = OrderStatusI18nQuery::create(null, $criteria)
->filterByOrderStatus($this)
->find($con);
if (null !== $criteria) {
- if (false !== $this->collOrderStatusDescsPartial && count($collOrderStatusDescs)) {
- $this->initOrderStatusDescs(false);
+ if (false !== $this->collOrderStatusI18nsPartial && count($collOrderStatusI18ns)) {
+ $this->initOrderStatusI18ns(false);
- foreach($collOrderStatusDescs as $obj) {
- if (false == $this->collOrderStatusDescs->contains($obj)) {
- $this->collOrderStatusDescs->append($obj);
+ foreach($collOrderStatusI18ns as $obj) {
+ if (false == $this->collOrderStatusI18ns->contains($obj)) {
+ $this->collOrderStatusI18ns->append($obj);
}
}
- $this->collOrderStatusDescsPartial = true;
+ $this->collOrderStatusI18nsPartial = true;
}
- return $collOrderStatusDescs;
+ return $collOrderStatusI18ns;
}
- if($partial && $this->collOrderStatusDescs) {
- foreach($this->collOrderStatusDescs as $obj) {
+ if($partial && $this->collOrderStatusI18ns) {
+ foreach($this->collOrderStatusI18ns as $obj) {
if($obj->isNew()) {
- $collOrderStatusDescs[] = $obj;
+ $collOrderStatusI18ns[] = $obj;
}
}
}
- $this->collOrderStatusDescs = $collOrderStatusDescs;
- $this->collOrderStatusDescsPartial = false;
+ $this->collOrderStatusI18ns = $collOrderStatusI18ns;
+ $this->collOrderStatusI18nsPartial = false;
}
}
- return $this->collOrderStatusDescs;
+ return $this->collOrderStatusI18ns;
}
/**
- * Sets a collection of OrderStatusDesc objects related by a one-to-many relationship
+ * Sets a collection of OrderStatusI18n objects related by a one-to-many relationship
* to the current object.
* It will also schedule objects for deletion based on a diff between old objects (aka persisted)
* and new objects from the given Propel collection.
*
- * @param PropelCollection $orderStatusDescs A Propel collection.
+ * @param PropelCollection $orderStatusI18ns A Propel collection.
* @param PropelPDO $con Optional connection object
*/
- public function setOrderStatusDescs(PropelCollection $orderStatusDescs, PropelPDO $con = null)
+ public function setOrderStatusI18ns(PropelCollection $orderStatusI18ns, PropelPDO $con = null)
{
- $this->orderStatusDescsScheduledForDeletion = $this->getOrderStatusDescs(new Criteria(), $con)->diff($orderStatusDescs);
+ $this->orderStatusI18nsScheduledForDeletion = $this->getOrderStatusI18ns(new Criteria(), $con)->diff($orderStatusI18ns);
- foreach ($this->orderStatusDescsScheduledForDeletion as $orderStatusDescRemoved) {
- $orderStatusDescRemoved->setOrderStatus(null);
+ foreach ($this->orderStatusI18nsScheduledForDeletion as $orderStatusI18nRemoved) {
+ $orderStatusI18nRemoved->setOrderStatus(null);
}
- $this->collOrderStatusDescs = null;
- foreach ($orderStatusDescs as $orderStatusDesc) {
- $this->addOrderStatusDesc($orderStatusDesc);
+ $this->collOrderStatusI18ns = null;
+ foreach ($orderStatusI18ns as $orderStatusI18n) {
+ $this->addOrderStatusI18n($orderStatusI18n);
}
- $this->collOrderStatusDescs = $orderStatusDescs;
- $this->collOrderStatusDescsPartial = false;
+ $this->collOrderStatusI18ns = $orderStatusI18ns;
+ $this->collOrderStatusI18nsPartial = false;
}
/**
- * Returns the number of related OrderStatusDesc objects.
+ * Returns the number of related OrderStatusI18n objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
- * @return int Count of related OrderStatusDesc objects.
+ * @return int Count of related OrderStatusI18n objects.
* @throws PropelException
*/
- public function countOrderStatusDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ public function countOrderStatusI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
- $partial = $this->collOrderStatusDescsPartial && !$this->isNew();
- if (null === $this->collOrderStatusDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collOrderStatusDescs) {
+ $partial = $this->collOrderStatusI18nsPartial && !$this->isNew();
+ if (null === $this->collOrderStatusI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collOrderStatusI18ns) {
return 0;
} else {
if($partial && !$criteria) {
- return count($this->getOrderStatusDescs());
+ return count($this->getOrderStatusI18ns());
}
- $query = OrderStatusDescQuery::create(null, $criteria);
+ $query = OrderStatusI18nQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
@@ -1548,52 +1562,56 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
->count($con);
}
} else {
- return count($this->collOrderStatusDescs);
+ return count($this->collOrderStatusI18ns);
}
}
/**
- * Method called to associate a OrderStatusDesc object to this object
- * through the OrderStatusDesc foreign key attribute.
+ * Method called to associate a OrderStatusI18n object to this object
+ * through the OrderStatusI18n foreign key attribute.
*
- * @param OrderStatusDesc $l OrderStatusDesc
+ * @param OrderStatusI18n $l OrderStatusI18n
* @return OrderStatus The current object (for fluent API support)
*/
- public function addOrderStatusDesc(OrderStatusDesc $l)
+ public function addOrderStatusI18n(OrderStatusI18n $l)
{
- if ($this->collOrderStatusDescs === null) {
- $this->initOrderStatusDescs();
- $this->collOrderStatusDescsPartial = true;
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
}
- if (!$this->collOrderStatusDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddOrderStatusDesc($l);
+ if ($this->collOrderStatusI18ns === null) {
+ $this->initOrderStatusI18ns();
+ $this->collOrderStatusI18nsPartial = true;
+ }
+ if (!$this->collOrderStatusI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddOrderStatusI18n($l);
}
return $this;
}
/**
- * @param OrderStatusDesc $orderStatusDesc The orderStatusDesc object to add.
+ * @param OrderStatusI18n $orderStatusI18n The orderStatusI18n object to add.
*/
- protected function doAddOrderStatusDesc($orderStatusDesc)
+ protected function doAddOrderStatusI18n($orderStatusI18n)
{
- $this->collOrderStatusDescs[]= $orderStatusDesc;
- $orderStatusDesc->setOrderStatus($this);
+ $this->collOrderStatusI18ns[]= $orderStatusI18n;
+ $orderStatusI18n->setOrderStatus($this);
}
/**
- * @param OrderStatusDesc $orderStatusDesc The orderStatusDesc object to remove.
+ * @param OrderStatusI18n $orderStatusI18n The orderStatusI18n object to remove.
*/
- public function removeOrderStatusDesc($orderStatusDesc)
+ public function removeOrderStatusI18n($orderStatusI18n)
{
- if ($this->getOrderStatusDescs()->contains($orderStatusDesc)) {
- $this->collOrderStatusDescs->remove($this->collOrderStatusDescs->search($orderStatusDesc));
- if (null === $this->orderStatusDescsScheduledForDeletion) {
- $this->orderStatusDescsScheduledForDeletion = clone $this->collOrderStatusDescs;
- $this->orderStatusDescsScheduledForDeletion->clear();
+ if ($this->getOrderStatusI18ns()->contains($orderStatusI18n)) {
+ $this->collOrderStatusI18ns->remove($this->collOrderStatusI18ns->search($orderStatusI18n));
+ if (null === $this->orderStatusI18nsScheduledForDeletion) {
+ $this->orderStatusI18nsScheduledForDeletion = clone $this->collOrderStatusI18ns;
+ $this->orderStatusI18nsScheduledForDeletion->clear();
}
- $this->orderStatusDescsScheduledForDeletion[]= $orderStatusDesc;
- $orderStatusDesc->setOrderStatus(null);
+ $this->orderStatusI18nsScheduledForDeletion[]= $orderStatusI18n;
+ $orderStatusI18n->setOrderStatus(null);
}
}
@@ -1631,21 +1649,25 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
- if ($this->collOrderStatusDescs) {
- foreach ($this->collOrderStatusDescs as $o) {
+ if ($this->collOrderStatusI18ns) {
+ foreach ($this->collOrderStatusI18ns as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep)
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collOrders instanceof PropelCollection) {
$this->collOrders->clearIterator();
}
$this->collOrders = null;
- if ($this->collOrderStatusDescs instanceof PropelCollection) {
- $this->collOrderStatusDescs->clearIterator();
+ if ($this->collOrderStatusI18ns instanceof PropelCollection) {
+ $this->collOrderStatusI18ns->clearIterator();
}
- $this->collOrderStatusDescs = null;
+ $this->collOrderStatusI18ns = null;
}
/**
@@ -1682,4 +1704,199 @@ abstract class BaseOrderStatus extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return OrderStatus The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return OrderStatusI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collOrderStatusI18ns) {
+ foreach ($this->collOrderStatusI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new OrderStatusI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = OrderStatusI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addOrderStatusI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return OrderStatus The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ OrderStatusI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collOrderStatusI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collOrderStatusI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return OrderStatusI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return OrderStatusI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return OrderStatusI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return OrderStatusI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return OrderStatusI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseOrderStatusI18n.php b/core/lib/Thelia/Model/om/BaseOrderStatusI18n.php
new file mode 100644
index 000000000..252ef0116
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseOrderStatusI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseOrderStatusI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return OrderStatusI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = OrderStatusI18nPeer::ID;
+ }
+
+ if ($this->aOrderStatus !== null && $this->aOrderStatus->getId() !== $v) {
+ $this->aOrderStatus = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return OrderStatusI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = OrderStatusI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return OrderStatusI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = OrderStatusI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return OrderStatusI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = OrderStatusI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return OrderStatusI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = OrderStatusI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return OrderStatusI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = OrderStatusI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = OrderStatusI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating OrderStatusI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aOrderStatus !== null && $this->id !== $this->aOrderStatus->getId()) {
+ $this->aOrderStatus = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = OrderStatusI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aOrderStatus = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = OrderStatusI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ OrderStatusI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aOrderStatus !== null) {
+ if ($this->aOrderStatus->isModified() || $this->aOrderStatus->isNew()) {
+ $affectedRows += $this->aOrderStatus->save($con);
+ }
+ $this->setOrderStatus($this->aOrderStatus);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(OrderStatusI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(OrderStatusI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(OrderStatusI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(OrderStatusI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(OrderStatusI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(OrderStatusI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `order_status_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aOrderStatus !== null) {
+ if (!$this->aOrderStatus->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aOrderStatus->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = OrderStatusI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = OrderStatusI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['OrderStatusI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['OrderStatusI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = OrderStatusI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aOrderStatus) {
+ $result['OrderStatus'] = $this->aOrderStatus->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = OrderStatusI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = OrderStatusI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(OrderStatusI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(OrderStatusI18nPeer::ID)) $criteria->add(OrderStatusI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(OrderStatusI18nPeer::LOCALE)) $criteria->add(OrderStatusI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(OrderStatusI18nPeer::TITLE)) $criteria->add(OrderStatusI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(OrderStatusI18nPeer::DESCRIPTION)) $criteria->add(OrderStatusI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(OrderStatusI18nPeer::CHAPO)) $criteria->add(OrderStatusI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(OrderStatusI18nPeer::POSTSCRIPTUM)) $criteria->add(OrderStatusI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(OrderStatusI18nPeer::DATABASE_NAME);
+ $criteria->add(OrderStatusI18nPeer::ID, $this->id);
+ $criteria->add(OrderStatusI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of OrderStatusI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return OrderStatusI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return OrderStatusI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new OrderStatusI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a OrderStatus object.
+ *
+ * @param OrderStatus $v
+ * @return OrderStatusI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setOrderStatus(OrderStatus $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aOrderStatus = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the OrderStatus object, it will not be re-added.
+ if ($v !== null) {
+ $v->addOrderStatusI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated OrderStatus object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return OrderStatus The associated OrderStatus object.
+ * @throws PropelException
+ */
+ public function getOrderStatus(PropelPDO $con = null)
+ {
+ if ($this->aOrderStatus === null && ($this->id !== null)) {
+ $this->aOrderStatus = OrderStatusQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aOrderStatus->addOrderStatusI18ns($this);
+ */
+ }
+
+ return $this->aOrderStatus;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aOrderStatus = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(OrderStatusI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseOrderStatusI18nPeer.php b/core/lib/Thelia/Model/om/BaseOrderStatusI18nPeer.php
new file mode 100644
index 000000000..1e10fa95a
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseOrderStatusI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (OrderStatusI18nPeer::ID, OrderStatusI18nPeer::LOCALE, OrderStatusI18nPeer::TITLE, OrderStatusI18nPeer::DESCRIPTION, OrderStatusI18nPeer::CHAPO, OrderStatusI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. OrderStatusI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (OrderStatusI18nPeer::ID => 0, OrderStatusI18nPeer::LOCALE => 1, OrderStatusI18nPeer::TITLE => 2, OrderStatusI18nPeer::DESCRIPTION => 3, OrderStatusI18nPeer::CHAPO => 4, OrderStatusI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = OrderStatusI18nPeer::getFieldNames($toType);
+ $key = isset(OrderStatusI18nPeer::$fieldKeys[$fromType][$name]) ? OrderStatusI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(OrderStatusI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, OrderStatusI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return OrderStatusI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. OrderStatusI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(OrderStatusI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(OrderStatusI18nPeer::ID);
+ $criteria->addSelectColumn(OrderStatusI18nPeer::LOCALE);
+ $criteria->addSelectColumn(OrderStatusI18nPeer::TITLE);
+ $criteria->addSelectColumn(OrderStatusI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(OrderStatusI18nPeer::CHAPO);
+ $criteria->addSelectColumn(OrderStatusI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(OrderStatusI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ OrderStatusI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(OrderStatusI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return OrderStatusI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = OrderStatusI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return OrderStatusI18nPeer::populateObjects(OrderStatusI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ OrderStatusI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(OrderStatusI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param OrderStatusI18n $obj A OrderStatusI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ OrderStatusI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A OrderStatusI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof OrderStatusI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or OrderStatusI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(OrderStatusI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return OrderStatusI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(OrderStatusI18nPeer::$instances[$key])) {
+ return OrderStatusI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ OrderStatusI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to order_status_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = OrderStatusI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = OrderStatusI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = OrderStatusI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ OrderStatusI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (OrderStatusI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = OrderStatusI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = OrderStatusI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + OrderStatusI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = OrderStatusI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ OrderStatusI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related OrderStatus table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinOrderStatus(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(OrderStatusI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ OrderStatusI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(OrderStatusI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(OrderStatusI18nPeer::ID, OrderStatusPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of OrderStatusI18n objects pre-filled with their OrderStatus objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of OrderStatusI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinOrderStatus(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(OrderStatusI18nPeer::DATABASE_NAME);
+ }
+
+ OrderStatusI18nPeer::addSelectColumns($criteria);
+ $startcol = OrderStatusI18nPeer::NUM_HYDRATE_COLUMNS;
+ OrderStatusPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(OrderStatusI18nPeer::ID, OrderStatusPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = OrderStatusI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = OrderStatusI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = OrderStatusI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ OrderStatusI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = OrderStatusPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = OrderStatusPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = OrderStatusPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ OrderStatusPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (OrderStatusI18n) to $obj2 (OrderStatus)
+ $obj2->addOrderStatusI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(OrderStatusI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ OrderStatusI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(OrderStatusI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(OrderStatusI18nPeer::ID, OrderStatusPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of OrderStatusI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of OrderStatusI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(OrderStatusI18nPeer::DATABASE_NAME);
+ }
+
+ OrderStatusI18nPeer::addSelectColumns($criteria);
+ $startcol2 = OrderStatusI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ OrderStatusPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + OrderStatusPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(OrderStatusI18nPeer::ID, OrderStatusPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = OrderStatusI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = OrderStatusI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = OrderStatusI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ OrderStatusI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined OrderStatus rows
+
+ $key2 = OrderStatusPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = OrderStatusPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = OrderStatusPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ OrderStatusPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (OrderStatusI18n) to the collection in $obj2 (OrderStatus)
+ $obj2->addOrderStatusI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(OrderStatusI18nPeer::DATABASE_NAME)->getTable(OrderStatusI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseOrderStatusI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseOrderStatusI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new OrderStatusI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return OrderStatusI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a OrderStatusI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or OrderStatusI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from OrderStatusI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(OrderStatusI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a OrderStatusI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or OrderStatusI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(OrderStatusI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(OrderStatusI18nPeer::ID);
+ $value = $criteria->remove(OrderStatusI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(OrderStatusI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(OrderStatusI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(OrderStatusI18nPeer::LOCALE);
+ $value = $criteria->remove(OrderStatusI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(OrderStatusI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(OrderStatusI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is OrderStatusI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(OrderStatusI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the order_status_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(OrderStatusI18nPeer::TABLE_NAME, $con, OrderStatusI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ OrderStatusI18nPeer::clearInstancePool();
+ OrderStatusI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a OrderStatusI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or OrderStatusI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ OrderStatusI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof OrderStatusI18n) { // it's a model object
+ // invalidate the cache for this single object
+ OrderStatusI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(OrderStatusI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(OrderStatusI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(OrderStatusI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ OrderStatusI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(OrderStatusI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ OrderStatusI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given OrderStatusI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param OrderStatusI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(OrderStatusI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(OrderStatusI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(OrderStatusI18nPeer::DATABASE_NAME, OrderStatusI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return OrderStatusI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = OrderStatusI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(OrderStatusI18nPeer::DATABASE_NAME);
+ $criteria->add(OrderStatusI18nPeer::ID, $id);
+ $criteria->add(OrderStatusI18nPeer::LOCALE, $locale);
+ $v = OrderStatusI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseOrderStatusI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseOrderStatusI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseOrderStatusI18nQuery.php b/core/lib/Thelia/Model/om/BaseOrderStatusI18nQuery.php
new file mode 100644
index 000000000..90be26fb4
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseOrderStatusI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return OrderStatusI18n|OrderStatusI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = OrderStatusI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(OrderStatusI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return OrderStatusI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `order_status_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new OrderStatusI18n();
+ $obj->hydrate($row);
+ OrderStatusI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return OrderStatusI18n|OrderStatusI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|OrderStatusI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return OrderStatusI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(OrderStatusI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(OrderStatusI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return OrderStatusI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(OrderStatusI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(OrderStatusI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByOrderStatus()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return OrderStatusI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(OrderStatusI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return OrderStatusI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(OrderStatusI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return OrderStatusI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(OrderStatusI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return OrderStatusI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(OrderStatusI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return OrderStatusI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(OrderStatusI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return OrderStatusI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(OrderStatusI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related OrderStatus object
+ *
+ * @param OrderStatus|PropelObjectCollection $orderStatus The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return OrderStatusI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByOrderStatus($orderStatus, $comparison = null)
+ {
+ if ($orderStatus instanceof OrderStatus) {
+ return $this
+ ->addUsingAlias(OrderStatusI18nPeer::ID, $orderStatus->getId(), $comparison);
+ } elseif ($orderStatus instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(OrderStatusI18nPeer::ID, $orderStatus->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByOrderStatus() only accepts arguments of type OrderStatus or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the OrderStatus relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return OrderStatusI18nQuery The current query, for fluid interface
+ */
+ public function joinOrderStatus($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('OrderStatus');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'OrderStatus');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the OrderStatus relation OrderStatus object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\OrderStatusQuery A secondary query class using the current class as primary query
+ */
+ public function useOrderStatusQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinOrderStatus($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'OrderStatus', '\Thelia\Model\OrderStatusQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param OrderStatusI18n $orderStatusI18n Object to remove from the list of results
+ *
+ * @return OrderStatusI18nQuery The current query, for fluid interface
+ */
+ public function prune($orderStatusI18n = null)
+ {
+ if ($orderStatusI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(OrderStatusI18nPeer::ID), $orderStatusI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(OrderStatusI18nPeer::LOCALE), $orderStatusI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseOrderStatusPeer.php b/core/lib/Thelia/Model/om/BaseOrderStatusPeer.php
index 27e60e8a1..11ab23b9d 100644
--- a/core/lib/Thelia/Model/om/BaseOrderStatusPeer.php
+++ b/core/lib/Thelia/Model/om/BaseOrderStatusPeer.php
@@ -11,7 +11,7 @@ use \PropelException;
use \PropelPDO;
use Thelia\Model\OrderPeer;
use Thelia\Model\OrderStatus;
-use Thelia\Model\OrderStatusDescPeer;
+use Thelia\Model\OrderStatusI18nPeer;
use Thelia\Model\OrderStatusPeer;
use Thelia\Model\map\OrderStatusTableMap;
@@ -70,6 +70,13 @@ abstract class BaseOrderStatusPeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -382,9 +389,9 @@ abstract class BaseOrderStatusPeer
// Invalidate objects in OrderPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
OrderPeer::clearInstancePool();
- // Invalidate objects in OrderStatusDescPeer instance pool,
+ // Invalidate objects in OrderStatusI18nPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- OrderStatusDescPeer::clearInstancePool();
+ OrderStatusI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseOrderStatusQuery.php b/core/lib/Thelia/Model/om/BaseOrderStatusQuery.php
index 589337a6b..946a36d9d 100644
--- a/core/lib/Thelia/Model/om/BaseOrderStatusQuery.php
+++ b/core/lib/Thelia/Model/om/BaseOrderStatusQuery.php
@@ -14,7 +14,7 @@ use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Order;
use Thelia\Model\OrderStatus;
-use Thelia\Model\OrderStatusDesc;
+use Thelia\Model\OrderStatusI18n;
use Thelia\Model\OrderStatusPeer;
use Thelia\Model\OrderStatusQuery;
@@ -41,9 +41,9 @@ use Thelia\Model\OrderStatusQuery;
* @method OrderStatusQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
* @method OrderStatusQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
*
- * @method OrderStatusQuery leftJoinOrderStatusDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderStatusDesc relation
- * @method OrderStatusQuery rightJoinOrderStatusDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderStatusDesc relation
- * @method OrderStatusQuery innerJoinOrderStatusDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderStatusDesc relation
+ * @method OrderStatusQuery leftJoinOrderStatusI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderStatusI18n relation
+ * @method OrderStatusQuery rightJoinOrderStatusI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderStatusI18n relation
+ * @method OrderStatusQuery innerJoinOrderStatusI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderStatusI18n relation
*
* @method OrderStatus findOne(PropelPDO $con = null) Return the first OrderStatus matching the query
* @method OrderStatus findOneOrCreate(PropelPDO $con = null) Return the first OrderStatus matching the query, or a new OrderStatus object populated from the query conditions when no match is found
@@ -452,41 +452,41 @@ abstract class BaseOrderStatusQuery extends ModelCriteria
}
/**
- * Filter the query by a related OrderStatusDesc object
+ * Filter the query by a related OrderStatusI18n object
*
- * @param OrderStatusDesc|PropelObjectCollection $orderStatusDesc the related object to use as filter
+ * @param OrderStatusI18n|PropelObjectCollection $orderStatusI18n the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return OrderStatusQuery The current query, for fluid interface
* @throws PropelException - if the provided filter is invalid.
*/
- public function filterByOrderStatusDesc($orderStatusDesc, $comparison = null)
+ public function filterByOrderStatusI18n($orderStatusI18n, $comparison = null)
{
- if ($orderStatusDesc instanceof OrderStatusDesc) {
+ if ($orderStatusI18n instanceof OrderStatusI18n) {
return $this
- ->addUsingAlias(OrderStatusPeer::ID, $orderStatusDesc->getStatusId(), $comparison);
- } elseif ($orderStatusDesc instanceof PropelObjectCollection) {
+ ->addUsingAlias(OrderStatusPeer::ID, $orderStatusI18n->getId(), $comparison);
+ } elseif ($orderStatusI18n instanceof PropelObjectCollection) {
return $this
- ->useOrderStatusDescQuery()
- ->filterByPrimaryKeys($orderStatusDesc->getPrimaryKeys())
+ ->useOrderStatusI18nQuery()
+ ->filterByPrimaryKeys($orderStatusI18n->getPrimaryKeys())
->endUse();
} else {
- throw new PropelException('filterByOrderStatusDesc() only accepts arguments of type OrderStatusDesc or PropelCollection');
+ throw new PropelException('filterByOrderStatusI18n() only accepts arguments of type OrderStatusI18n or PropelCollection');
}
}
/**
- * Adds a JOIN clause to the query using the OrderStatusDesc relation
+ * Adds a JOIN clause to the query using the OrderStatusI18n relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return OrderStatusQuery The current query, for fluid interface
*/
- public function joinOrderStatusDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function joinOrderStatusI18n($relationAlias = null, $joinType = 'LEFT JOIN')
{
$tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('OrderStatusDesc');
+ $relationMap = $tableMap->getRelation('OrderStatusI18n');
// create a ModelJoin object for this join
$join = new ModelJoin();
@@ -501,14 +501,14 @@ abstract class BaseOrderStatusQuery extends ModelCriteria
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
- $this->addJoinObject($join, 'OrderStatusDesc');
+ $this->addJoinObject($join, 'OrderStatusI18n');
}
return $this;
}
/**
- * Use the OrderStatusDesc relation OrderStatusDesc object
+ * Use the OrderStatusI18n relation OrderStatusI18n object
*
* @see useQuery()
*
@@ -516,13 +516,13 @@ abstract class BaseOrderStatusQuery extends ModelCriteria
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
- * @return \Thelia\Model\OrderStatusDescQuery A secondary query class using the current class as primary query
+ * @return \Thelia\Model\OrderStatusI18nQuery A secondary query class using the current class as primary query
*/
- public function useOrderStatusDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
+ public function useOrderStatusI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
- ->joinOrderStatusDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'OrderStatusDesc', '\Thelia\Model\OrderStatusDescQuery');
+ ->joinOrderStatusI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'OrderStatusI18n', '\Thelia\Model\OrderStatusI18nQuery');
}
/**
@@ -606,4 +606,61 @@ abstract class BaseOrderStatusQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(OrderStatusPeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return OrderStatusQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'OrderStatusI18n';
+
+ return $this
+ ->joinOrderStatusI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return OrderStatusQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('OrderStatusI18n');
+ $this->with['OrderStatusI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return OrderStatusI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'OrderStatusI18n', 'Thelia\Model\OrderStatusI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseProduct.php b/core/lib/Thelia/Model/om/BaseProduct.php
index b47d93095..539c798d8 100644
--- a/core/lib/Thelia/Model/om/BaseProduct.php
+++ b/core/lib/Thelia/Model/om/BaseProduct.php
@@ -28,8 +28,8 @@ use Thelia\Model\ImageQuery;
use Thelia\Model\Product;
use Thelia\Model\ProductCategory;
use Thelia\Model\ProductCategoryQuery;
-use Thelia\Model\ProductDesc;
-use Thelia\Model\ProductDescQuery;
+use Thelia\Model\ProductI18n;
+use Thelia\Model\ProductI18nQuery;
use Thelia\Model\ProductPeer;
use Thelia\Model\ProductQuery;
use Thelia\Model\Rewriting;
@@ -160,12 +160,6 @@ abstract class BaseProduct extends BaseObject implements Persistent
*/
protected $aTaxRule;
- /**
- * @var PropelObjectCollection|ProductDesc[] Collection to store aggregation of ProductDesc objects.
- */
- protected $collProductDescs;
- protected $collProductDescsPartial;
-
/**
* @var PropelObjectCollection|ProductCategory[] Collection to store aggregation of ProductCategory objects.
*/
@@ -220,6 +214,12 @@ abstract class BaseProduct extends BaseObject implements Persistent
protected $collRewritings;
protected $collRewritingsPartial;
+ /**
+ * @var PropelObjectCollection|ProductI18n[] Collection to store aggregation of ProductI18n objects.
+ */
+ protected $collProductI18ns;
+ protected $collProductI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -234,11 +234,19 @@ abstract class BaseProduct extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $productDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[ProductI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -294,6 +302,12 @@ abstract class BaseProduct extends BaseObject implements Persistent
*/
protected $rewritingsScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $productI18nsScheduledForDeletion = null;
+
/**
* Applies default values to this object.
* This method should be called from the object's constructor (or
@@ -950,8 +964,6 @@ abstract class BaseProduct extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
$this->aTaxRule = null;
- $this->collProductDescs = null;
-
$this->collProductCategorys = null;
$this->collFeatureProds = null;
@@ -970,6 +982,8 @@ abstract class BaseProduct extends BaseObject implements Persistent
$this->collRewritings = null;
+ $this->collProductI18ns = null;
+
} // if (deep)
}
@@ -1117,23 +1131,6 @@ abstract class BaseProduct extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->productDescsScheduledForDeletion !== null) {
- if (!$this->productDescsScheduledForDeletion->isEmpty()) {
- ProductDescQuery::create()
- ->filterByPrimaryKeys($this->productDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->productDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collProductDescs !== null) {
- foreach ($this->collProductDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->productCategorysScheduledForDeletion !== null) {
if (!$this->productCategorysScheduledForDeletion->isEmpty()) {
ProductCategoryQuery::create()
@@ -1291,6 +1288,23 @@ abstract class BaseProduct extends BaseObject implements Persistent
}
}
+ if ($this->productI18nsScheduledForDeletion !== null) {
+ if (!$this->productI18nsScheduledForDeletion->isEmpty()) {
+ ProductI18nQuery::create()
+ ->filterByPrimaryKeys($this->productI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->productI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collProductI18ns !== null) {
+ foreach ($this->collProductI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -1523,14 +1537,6 @@ abstract class BaseProduct extends BaseObject implements Persistent
}
- if ($this->collProductDescs !== null) {
- foreach ($this->collProductDescs as $referrerFK) {
- if (!$referrerFK->validate($columns)) {
- $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
- }
- }
- }
-
if ($this->collProductCategorys !== null) {
foreach ($this->collProductCategorys as $referrerFK) {
if (!$referrerFK->validate($columns)) {
@@ -1603,6 +1609,14 @@ abstract class BaseProduct extends BaseObject implements Persistent
}
}
+ if ($this->collProductI18ns !== null) {
+ foreach ($this->collProductI18ns as $referrerFK) {
+ if (!$referrerFK->validate($columns)) {
+ $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
+ }
+ }
+ }
+
$this->alreadyInValidation = false;
}
@@ -1728,9 +1742,6 @@ abstract class BaseProduct extends BaseObject implements Persistent
if (null !== $this->aTaxRule) {
$result['TaxRule'] = $this->aTaxRule->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
}
- if (null !== $this->collProductDescs) {
- $result['ProductDescs'] = $this->collProductDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collProductCategorys) {
$result['ProductCategorys'] = $this->collProductCategorys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
@@ -1758,6 +1769,9 @@ abstract class BaseProduct extends BaseObject implements Persistent
if (null !== $this->collRewritings) {
$result['Rewritings'] = $this->collRewritings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collProductI18ns) {
+ $result['ProductI18ns'] = $this->collProductI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1981,12 +1995,6 @@ abstract class BaseProduct extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getProductDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addProductDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getProductCategorys() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addProductCategory($relObj->copy($deepCopy));
@@ -2041,6 +2049,12 @@ abstract class BaseProduct extends BaseObject implements Persistent
}
}
+ foreach ($this->getProductI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addProductI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -2153,9 +2167,6 @@ abstract class BaseProduct extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('ProductDesc' == $relationName) {
- $this->initProductDescs();
- }
if ('ProductCategory' == $relationName) {
$this->initProductCategorys();
}
@@ -2183,212 +2194,8 @@ abstract class BaseProduct extends BaseObject implements Persistent
if ('Rewriting' == $relationName) {
$this->initRewritings();
}
- }
-
- /**
- * Clears out the collProductDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addProductDescs()
- */
- public function clearProductDescs()
- {
- $this->collProductDescs = null; // important to set this to null since that means it is uninitialized
- $this->collProductDescsPartial = null;
- }
-
- /**
- * reset is the collProductDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialProductDescs($v = true)
- {
- $this->collProductDescsPartial = $v;
- }
-
- /**
- * Initializes the collProductDescs collection.
- *
- * By default this just sets the collProductDescs collection to an empty array (like clearcollProductDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initProductDescs($overrideExisting = true)
- {
- if (null !== $this->collProductDescs && !$overrideExisting) {
- return;
- }
- $this->collProductDescs = new PropelObjectCollection();
- $this->collProductDescs->setModel('ProductDesc');
- }
-
- /**
- * Gets an array of ProductDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * Next time the same method is called without $criteria, the cached collection is returned.
- * If this Product is new, it will return
- * an empty collection or the current collection; the criteria is ignored on a new object.
- *
- * @param Criteria $criteria optional Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|ProductDesc[] List of ProductDesc objects
- * @throws PropelException
- */
- public function getProductDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collProductDescsPartial && !$this->isNew();
- if (null === $this->collProductDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collProductDescs) {
- // return empty collection
- $this->initProductDescs();
- } else {
- $collProductDescs = ProductDescQuery::create(null, $criteria)
- ->filterByProduct($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collProductDescsPartial && count($collProductDescs)) {
- $this->initProductDescs(false);
-
- foreach($collProductDescs as $obj) {
- if (false == $this->collProductDescs->contains($obj)) {
- $this->collProductDescs->append($obj);
- }
- }
-
- $this->collProductDescsPartial = true;
- }
-
- return $collProductDescs;
- }
-
- if($partial && $this->collProductDescs) {
- foreach($this->collProductDescs as $obj) {
- if($obj->isNew()) {
- $collProductDescs[] = $obj;
- }
- }
- }
-
- $this->collProductDescs = $collProductDescs;
- $this->collProductDescsPartial = false;
- }
- }
-
- return $this->collProductDescs;
- }
-
- /**
- * Sets a collection of ProductDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $productDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setProductDescs(PropelCollection $productDescs, PropelPDO $con = null)
- {
- $this->productDescsScheduledForDeletion = $this->getProductDescs(new Criteria(), $con)->diff($productDescs);
-
- foreach ($this->productDescsScheduledForDeletion as $productDescRemoved) {
- $productDescRemoved->setProduct(null);
- }
-
- $this->collProductDescs = null;
- foreach ($productDescs as $productDesc) {
- $this->addProductDesc($productDesc);
- }
-
- $this->collProductDescs = $productDescs;
- $this->collProductDescsPartial = false;
- }
-
- /**
- * Returns the number of related ProductDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related ProductDesc objects.
- * @throws PropelException
- */
- public function countProductDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collProductDescsPartial && !$this->isNew();
- if (null === $this->collProductDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collProductDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getProductDescs());
- }
- $query = ProductDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByProduct($this)
- ->count($con);
- }
- } else {
- return count($this->collProductDescs);
- }
- }
-
- /**
- * Method called to associate a ProductDesc object to this object
- * through the ProductDesc foreign key attribute.
- *
- * @param ProductDesc $l ProductDesc
- * @return Product The current object (for fluent API support)
- */
- public function addProductDesc(ProductDesc $l)
- {
- if ($this->collProductDescs === null) {
- $this->initProductDescs();
- $this->collProductDescsPartial = true;
- }
- if (!$this->collProductDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddProductDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param ProductDesc $productDesc The productDesc object to add.
- */
- protected function doAddProductDesc($productDesc)
- {
- $this->collProductDescs[]= $productDesc;
- $productDesc->setProduct($this);
- }
-
- /**
- * @param ProductDesc $productDesc The productDesc object to remove.
- */
- public function removeProductDesc($productDesc)
- {
- if ($this->getProductDescs()->contains($productDesc)) {
- $this->collProductDescs->remove($this->collProductDescs->search($productDesc));
- if (null === $this->productDescsScheduledForDeletion) {
- $this->productDescsScheduledForDeletion = clone $this->collProductDescs;
- $this->productDescsScheduledForDeletion->clear();
- }
- $this->productDescsScheduledForDeletion[]= $productDesc;
- $productDesc->setProduct(null);
+ if ('ProductI18n' == $relationName) {
+ $this->initProductI18ns();
}
}
@@ -4630,6 +4437,217 @@ abstract class BaseProduct extends BaseObject implements Persistent
return $this->getRewritings($query, $con);
}
+ /**
+ * Clears out the collProductI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addProductI18ns()
+ */
+ public function clearProductI18ns()
+ {
+ $this->collProductI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collProductI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collProductI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialProductI18ns($v = true)
+ {
+ $this->collProductI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collProductI18ns collection.
+ *
+ * By default this just sets the collProductI18ns collection to an empty array (like clearcollProductI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initProductI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collProductI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collProductI18ns = new PropelObjectCollection();
+ $this->collProductI18ns->setModel('ProductI18n');
+ }
+
+ /**
+ * Gets an array of ProductI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this Product is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|ProductI18n[] List of ProductI18n objects
+ * @throws PropelException
+ */
+ public function getProductI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collProductI18nsPartial && !$this->isNew();
+ if (null === $this->collProductI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collProductI18ns) {
+ // return empty collection
+ $this->initProductI18ns();
+ } else {
+ $collProductI18ns = ProductI18nQuery::create(null, $criteria)
+ ->filterByProduct($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collProductI18nsPartial && count($collProductI18ns)) {
+ $this->initProductI18ns(false);
+
+ foreach($collProductI18ns as $obj) {
+ if (false == $this->collProductI18ns->contains($obj)) {
+ $this->collProductI18ns->append($obj);
+ }
+ }
+
+ $this->collProductI18nsPartial = true;
+ }
+
+ return $collProductI18ns;
+ }
+
+ if($partial && $this->collProductI18ns) {
+ foreach($this->collProductI18ns as $obj) {
+ if($obj->isNew()) {
+ $collProductI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collProductI18ns = $collProductI18ns;
+ $this->collProductI18nsPartial = false;
+ }
+ }
+
+ return $this->collProductI18ns;
+ }
+
+ /**
+ * Sets a collection of ProductI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $productI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setProductI18ns(PropelCollection $productI18ns, PropelPDO $con = null)
+ {
+ $this->productI18nsScheduledForDeletion = $this->getProductI18ns(new Criteria(), $con)->diff($productI18ns);
+
+ foreach ($this->productI18nsScheduledForDeletion as $productI18nRemoved) {
+ $productI18nRemoved->setProduct(null);
+ }
+
+ $this->collProductI18ns = null;
+ foreach ($productI18ns as $productI18n) {
+ $this->addProductI18n($productI18n);
+ }
+
+ $this->collProductI18ns = $productI18ns;
+ $this->collProductI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related ProductI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related ProductI18n objects.
+ * @throws PropelException
+ */
+ public function countProductI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collProductI18nsPartial && !$this->isNew();
+ if (null === $this->collProductI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collProductI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getProductI18ns());
+ }
+ $query = ProductI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByProduct($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collProductI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a ProductI18n object to this object
+ * through the ProductI18n foreign key attribute.
+ *
+ * @param ProductI18n $l ProductI18n
+ * @return Product The current object (for fluent API support)
+ */
+ public function addProductI18n(ProductI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collProductI18ns === null) {
+ $this->initProductI18ns();
+ $this->collProductI18nsPartial = true;
+ }
+ if (!$this->collProductI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddProductI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param ProductI18n $productI18n The productI18n object to add.
+ */
+ protected function doAddProductI18n($productI18n)
+ {
+ $this->collProductI18ns[]= $productI18n;
+ $productI18n->setProduct($this);
+ }
+
+ /**
+ * @param ProductI18n $productI18n The productI18n object to remove.
+ */
+ public function removeProductI18n($productI18n)
+ {
+ if ($this->getProductI18ns()->contains($productI18n)) {
+ $this->collProductI18ns->remove($this->collProductI18ns->search($productI18n));
+ if (null === $this->productI18nsScheduledForDeletion) {
+ $this->productI18nsScheduledForDeletion = clone $this->collProductI18ns;
+ $this->productI18nsScheduledForDeletion->clear();
+ }
+ $this->productI18nsScheduledForDeletion[]= $productI18n;
+ $productI18n->setProduct(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -4670,11 +4688,6 @@ abstract class BaseProduct extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collProductDescs) {
- foreach ($this->collProductDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collProductCategorys) {
foreach ($this->collProductCategorys as $o) {
$o->clearAllReferences($deep);
@@ -4720,12 +4733,17 @@ abstract class BaseProduct extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
+ if ($this->collProductI18ns) {
+ foreach ($this->collProductI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collProductDescs instanceof PropelCollection) {
- $this->collProductDescs->clearIterator();
- }
- $this->collProductDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collProductCategorys instanceof PropelCollection) {
$this->collProductCategorys->clearIterator();
}
@@ -4762,6 +4780,10 @@ abstract class BaseProduct extends BaseObject implements Persistent
$this->collRewritings->clearIterator();
}
$this->collRewritings = null;
+ if ($this->collProductI18ns instanceof PropelCollection) {
+ $this->collProductI18ns->clearIterator();
+ }
+ $this->collProductI18ns = null;
$this->aTaxRule = null;
}
@@ -4799,4 +4821,199 @@ abstract class BaseProduct extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Product The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ProductI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collProductI18ns) {
+ foreach ($this->collProductI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new ProductI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = ProductI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addProductI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Product The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ ProductI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collProductI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collProductI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ProductI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return ProductI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return ProductI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return ProductI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return ProductI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseProductI18n.php b/core/lib/Thelia/Model/om/BaseProductI18n.php
new file mode 100644
index 000000000..c65a5ab38
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseProductI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseProductI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return ProductI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = ProductI18nPeer::ID;
+ }
+
+ if ($this->aProduct !== null && $this->aProduct->getId() !== $v) {
+ $this->aProduct = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return ProductI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = ProductI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return ProductI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = ProductI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return ProductI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = ProductI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return ProductI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = ProductI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return ProductI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = ProductI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = ProductI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating ProductI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aProduct !== null && $this->id !== $this->aProduct->getId()) {
+ $this->aProduct = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = ProductI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aProduct = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ProductI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ ProductI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aProduct !== null) {
+ if ($this->aProduct->isModified() || $this->aProduct->isNew()) {
+ $affectedRows += $this->aProduct->save($con);
+ }
+ $this->setProduct($this->aProduct);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ProductI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(ProductI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(ProductI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(ProductI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(ProductI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(ProductI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `product_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aProduct !== null) {
+ if (!$this->aProduct->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aProduct->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = ProductI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ProductI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['ProductI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ProductI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = ProductI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aProduct) {
+ $result['Product'] = $this->aProduct->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ProductI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = ProductI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(ProductI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(ProductI18nPeer::ID)) $criteria->add(ProductI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(ProductI18nPeer::LOCALE)) $criteria->add(ProductI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(ProductI18nPeer::TITLE)) $criteria->add(ProductI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(ProductI18nPeer::DESCRIPTION)) $criteria->add(ProductI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(ProductI18nPeer::CHAPO)) $criteria->add(ProductI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(ProductI18nPeer::POSTSCRIPTUM)) $criteria->add(ProductI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(ProductI18nPeer::DATABASE_NAME);
+ $criteria->add(ProductI18nPeer::ID, $this->id);
+ $criteria->add(ProductI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of ProductI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return ProductI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return ProductI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new ProductI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Product object.
+ *
+ * @param Product $v
+ * @return ProductI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setProduct(Product $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aProduct = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Product object, it will not be re-added.
+ if ($v !== null) {
+ $v->addProductI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Product object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Product The associated Product object.
+ * @throws PropelException
+ */
+ public function getProduct(PropelPDO $con = null)
+ {
+ if ($this->aProduct === null && ($this->id !== null)) {
+ $this->aProduct = ProductQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aProduct->addProductI18ns($this);
+ */
+ }
+
+ return $this->aProduct;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aProduct = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ProductI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseProductI18nPeer.php b/core/lib/Thelia/Model/om/BaseProductI18nPeer.php
new file mode 100644
index 000000000..a06f20c28
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseProductI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (ProductI18nPeer::ID, ProductI18nPeer::LOCALE, ProductI18nPeer::TITLE, ProductI18nPeer::DESCRIPTION, ProductI18nPeer::CHAPO, ProductI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. ProductI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (ProductI18nPeer::ID => 0, ProductI18nPeer::LOCALE => 1, ProductI18nPeer::TITLE => 2, ProductI18nPeer::DESCRIPTION => 3, ProductI18nPeer::CHAPO => 4, ProductI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = ProductI18nPeer::getFieldNames($toType);
+ $key = isset(ProductI18nPeer::$fieldKeys[$fromType][$name]) ? ProductI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ProductI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, ProductI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return ProductI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. ProductI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(ProductI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(ProductI18nPeer::ID);
+ $criteria->addSelectColumn(ProductI18nPeer::LOCALE);
+ $criteria->addSelectColumn(ProductI18nPeer::TITLE);
+ $criteria->addSelectColumn(ProductI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(ProductI18nPeer::CHAPO);
+ $criteria->addSelectColumn(ProductI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ProductI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ProductI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(ProductI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return ProductI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = ProductI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return ProductI18nPeer::populateObjects(ProductI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ ProductI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ProductI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param ProductI18n $obj A ProductI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ ProductI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A ProductI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof ProductI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ProductI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(ProductI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return ProductI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(ProductI18nPeer::$instances[$key])) {
+ return ProductI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ ProductI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to product_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = ProductI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = ProductI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = ProductI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ ProductI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (ProductI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = ProductI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = ProductI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + ProductI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ProductI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ ProductI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Product table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ProductI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ProductI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ProductI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ProductI18nPeer::ID, ProductPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of ProductI18n objects pre-filled with their Product objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ProductI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ProductI18nPeer::DATABASE_NAME);
+ }
+
+ ProductI18nPeer::addSelectColumns($criteria);
+ $startcol = ProductI18nPeer::NUM_HYDRATE_COLUMNS;
+ ProductPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(ProductI18nPeer::ID, ProductPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ProductI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ProductI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = ProductI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ProductI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = ProductPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = ProductPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ ProductPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (ProductI18n) to $obj2 (Product)
+ $obj2->addProductI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ProductI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ProductI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ProductI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ProductI18nPeer::ID, ProductPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of ProductI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ProductI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ProductI18nPeer::DATABASE_NAME);
+ }
+
+ ProductI18nPeer::addSelectColumns($criteria);
+ $startcol2 = ProductI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ ProductPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(ProductI18nPeer::ID, ProductPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ProductI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ProductI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = ProductI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ProductI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Product rows
+
+ $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = ProductPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = ProductPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ ProductPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (ProductI18n) to the collection in $obj2 (Product)
+ $obj2->addProductI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(ProductI18nPeer::DATABASE_NAME)->getTable(ProductI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseProductI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseProductI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new ProductI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return ProductI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ProductI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or ProductI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from ProductI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(ProductI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a ProductI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or ProductI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(ProductI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(ProductI18nPeer::ID);
+ $value = $criteria->remove(ProductI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(ProductI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ProductI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(ProductI18nPeer::LOCALE);
+ $value = $criteria->remove(ProductI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(ProductI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ProductI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is ProductI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(ProductI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the product_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(ProductI18nPeer::TABLE_NAME, $con, ProductI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ ProductI18nPeer::clearInstancePool();
+ ProductI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ProductI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ProductI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ ProductI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof ProductI18n) { // it's a model object
+ // invalidate the cache for this single object
+ ProductI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(ProductI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(ProductI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(ProductI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ ProductI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ProductI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ ProductI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given ProductI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param ProductI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(ProductI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(ProductI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(ProductI18nPeer::DATABASE_NAME, ProductI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return ProductI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = ProductI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(ProductI18nPeer::DATABASE_NAME);
+ $criteria->add(ProductI18nPeer::ID, $id);
+ $criteria->add(ProductI18nPeer::LOCALE, $locale);
+ $v = ProductI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseProductI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseProductI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseProductI18nQuery.php b/core/lib/Thelia/Model/om/BaseProductI18nQuery.php
new file mode 100644
index 000000000..2f47b2172
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseProductI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ProductI18n|ProductI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ProductI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(ProductI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ProductI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `product_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new ProductI18n();
+ $obj->hydrate($row);
+ ProductI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ProductI18n|ProductI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|ProductI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ProductI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(ProductI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(ProductI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ProductI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(ProductI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(ProductI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByProduct()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ProductI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(ProductI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ProductI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ProductI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ProductI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ProductI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ProductI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ProductI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ProductI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ProductI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ProductI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ProductI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Product object
+ *
+ * @param Product|PropelObjectCollection $product The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ProductI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByProduct($product, $comparison = null)
+ {
+ if ($product instanceof Product) {
+ return $this
+ ->addUsingAlias(ProductI18nPeer::ID, $product->getId(), $comparison);
+ } elseif ($product instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ProductI18nPeer::ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByProduct() only accepts arguments of type Product or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Product relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ProductI18nQuery The current query, for fluid interface
+ */
+ public function joinProduct($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Product');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Product');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Product relation Product object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
+ */
+ public function useProductQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinProduct($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ProductI18n $productI18n Object to remove from the list of results
+ *
+ * @return ProductI18nQuery The current query, for fluid interface
+ */
+ public function prune($productI18n = null)
+ {
+ if ($productI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(ProductI18nPeer::ID), $productI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(ProductI18nPeer::LOCALE), $productI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseProductPeer.php b/core/lib/Thelia/Model/om/BaseProductPeer.php
index c3ee0bbcc..c81cfb9fa 100644
--- a/core/lib/Thelia/Model/om/BaseProductPeer.php
+++ b/core/lib/Thelia/Model/om/BaseProductPeer.php
@@ -16,7 +16,7 @@ use Thelia\Model\FeatureProdPeer;
use Thelia\Model\ImagePeer;
use Thelia\Model\Product;
use Thelia\Model\ProductCategoryPeer;
-use Thelia\Model\ProductDescPeer;
+use Thelia\Model\ProductI18nPeer;
use Thelia\Model\ProductPeer;
use Thelia\Model\RewritingPeer;
use Thelia\Model\StockPeer;
@@ -108,6 +108,13 @@ abstract class BaseProductPeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -437,9 +444,6 @@ abstract class BaseProductPeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in ProductDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- ProductDescPeer::clearInstancePool();
// Invalidate objects in ProductCategoryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ProductCategoryPeer::clearInstancePool();
@@ -467,6 +471,9 @@ abstract class BaseProductPeer
// Invalidate objects in RewritingPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
RewritingPeer::clearInstancePool();
+ // Invalidate objects in ProductI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ ProductI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseProductQuery.php b/core/lib/Thelia/Model/om/BaseProductQuery.php
index b60aef4c8..337de1c7e 100644
--- a/core/lib/Thelia/Model/om/BaseProductQuery.php
+++ b/core/lib/Thelia/Model/om/BaseProductQuery.php
@@ -19,7 +19,7 @@ use Thelia\Model\FeatureProd;
use Thelia\Model\Image;
use Thelia\Model\Product;
use Thelia\Model\ProductCategory;
-use Thelia\Model\ProductDesc;
+use Thelia\Model\ProductI18n;
use Thelia\Model\ProductPeer;
use Thelia\Model\ProductQuery;
use Thelia\Model\Rewriting;
@@ -69,10 +69,6 @@ use Thelia\Model\TaxRule;
* @method ProductQuery rightJoinTaxRule($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRule relation
* @method ProductQuery innerJoinTaxRule($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRule relation
*
- * @method ProductQuery leftJoinProductDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductDesc relation
- * @method ProductQuery rightJoinProductDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductDesc relation
- * @method ProductQuery innerJoinProductDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductDesc relation
- *
* @method ProductQuery leftJoinProductCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductCategory relation
* @method ProductQuery rightJoinProductCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductCategory relation
* @method ProductQuery innerJoinProductCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductCategory relation
@@ -109,6 +105,10 @@ use Thelia\Model\TaxRule;
* @method ProductQuery rightJoinRewriting($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Rewriting relation
* @method ProductQuery innerJoinRewriting($relationAlias = null) Adds a INNER JOIN clause to the query using the Rewriting relation
*
+ * @method ProductQuery leftJoinProductI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductI18n relation
+ * @method ProductQuery rightJoinProductI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductI18n relation
+ * @method ProductQuery innerJoinProductI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductI18n relation
+ *
* @method Product findOne(PropelPDO $con = null) Return the first Product matching the query
* @method Product findOneOrCreate(PropelPDO $con = null) Return the first Product matching the query, or a new Product object populated from the query conditions when no match is found
*
@@ -949,80 +949,6 @@ abstract class BaseProductQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'TaxRule', '\Thelia\Model\TaxRuleQuery');
}
- /**
- * Filter the query by a related ProductDesc object
- *
- * @param ProductDesc|PropelObjectCollection $productDesc the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ProductQuery The current query, for fluid interface
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByProductDesc($productDesc, $comparison = null)
- {
- if ($productDesc instanceof ProductDesc) {
- return $this
- ->addUsingAlias(ProductPeer::ID, $productDesc->getProductId(), $comparison);
- } elseif ($productDesc instanceof PropelObjectCollection) {
- return $this
- ->useProductDescQuery()
- ->filterByPrimaryKeys($productDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByProductDesc() only accepts arguments of type ProductDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the ProductDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return ProductQuery The current query, for fluid interface
- */
- public function joinProductDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('ProductDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'ProductDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the ProductDesc relation ProductDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\ProductDescQuery A secondary query class using the current class as primary query
- */
- public function useProductDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinProductDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'ProductDesc', '\Thelia\Model\ProductDescQuery');
- }
-
/**
* Filter the query by a related ProductCategory object
*
@@ -1689,6 +1615,80 @@ abstract class BaseProductQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'Rewriting', '\Thelia\Model\RewritingQuery');
}
+ /**
+ * Filter the query by a related ProductI18n object
+ *
+ * @param ProductI18n|PropelObjectCollection $productI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ProductQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByProductI18n($productI18n, $comparison = null)
+ {
+ if ($productI18n instanceof ProductI18n) {
+ return $this
+ ->addUsingAlias(ProductPeer::ID, $productI18n->getId(), $comparison);
+ } elseif ($productI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useProductI18nQuery()
+ ->filterByPrimaryKeys($productI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByProductI18n() only accepts arguments of type ProductI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the ProductI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ProductQuery The current query, for fluid interface
+ */
+ public function joinProductI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('ProductI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'ProductI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the ProductI18n relation ProductI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\ProductI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useProductI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinProductI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ProductI18n', '\Thelia\Model\ProductI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -1770,4 +1770,61 @@ abstract class BaseProductQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(ProductPeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ProductQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'ProductI18n';
+
+ return $this
+ ->joinProductI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ProductQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('ProductI18n');
+ $this->with['ProductI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ProductI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ProductI18n', 'Thelia\Model\ProductI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseResource.php b/core/lib/Thelia/Model/om/BaseResource.php
index b22798bf6..03a4945d7 100644
--- a/core/lib/Thelia/Model/om/BaseResource.php
+++ b/core/lib/Thelia/Model/om/BaseResource.php
@@ -18,8 +18,8 @@ use \PropelPDO;
use Thelia\Model\GroupResource;
use Thelia\Model\GroupResourceQuery;
use Thelia\Model\Resource;
-use Thelia\Model\ResourceDesc;
-use Thelia\Model\ResourceDescQuery;
+use Thelia\Model\ResourceI18n;
+use Thelia\Model\ResourceI18nQuery;
use Thelia\Model\ResourcePeer;
use Thelia\Model\ResourceQuery;
@@ -75,18 +75,18 @@ abstract class BaseResource extends BaseObject implements Persistent
*/
protected $updated_at;
- /**
- * @var PropelObjectCollection|ResourceDesc[] Collection to store aggregation of ResourceDesc objects.
- */
- protected $collResourceDescs;
- protected $collResourceDescsPartial;
-
/**
* @var PropelObjectCollection|GroupResource[] Collection to store aggregation of GroupResource objects.
*/
protected $collGroupResources;
protected $collGroupResourcesPartial;
+ /**
+ * @var PropelObjectCollection|ResourceI18n[] Collection to store aggregation of ResourceI18n objects.
+ */
+ protected $collResourceI18ns;
+ protected $collResourceI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -101,11 +101,19 @@ abstract class BaseResource extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $resourceDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[ResourceI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -113,6 +121,12 @@ abstract class BaseResource extends BaseObject implements Persistent
*/
protected $groupResourcesScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $resourceI18nsScheduledForDeletion = null;
+
/**
* Get the [id] column value.
*
@@ -401,10 +415,10 @@ abstract class BaseResource extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
- $this->collResourceDescs = null;
-
$this->collGroupResources = null;
+ $this->collResourceI18ns = null;
+
} // if (deep)
}
@@ -540,23 +554,6 @@ abstract class BaseResource extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->resourceDescsScheduledForDeletion !== null) {
- if (!$this->resourceDescsScheduledForDeletion->isEmpty()) {
- ResourceDescQuery::create()
- ->filterByPrimaryKeys($this->resourceDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->resourceDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collResourceDescs !== null) {
- foreach ($this->collResourceDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->groupResourcesScheduledForDeletion !== null) {
if (!$this->groupResourcesScheduledForDeletion->isEmpty()) {
GroupResourceQuery::create()
@@ -574,6 +571,23 @@ abstract class BaseResource extends BaseObject implements Persistent
}
}
+ if ($this->resourceI18nsScheduledForDeletion !== null) {
+ if (!$this->resourceI18nsScheduledForDeletion->isEmpty()) {
+ ResourceI18nQuery::create()
+ ->filterByPrimaryKeys($this->resourceI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->resourceI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collResourceI18ns !== null) {
+ foreach ($this->collResourceI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -734,16 +748,16 @@ abstract class BaseResource extends BaseObject implements Persistent
}
- if ($this->collResourceDescs !== null) {
- foreach ($this->collResourceDescs as $referrerFK) {
+ if ($this->collGroupResources !== null) {
+ foreach ($this->collGroupResources as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
- if ($this->collGroupResources !== null) {
- foreach ($this->collGroupResources as $referrerFK) {
+ if ($this->collResourceI18ns !== null) {
+ foreach ($this->collResourceI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -832,12 +846,12 @@ abstract class BaseResource extends BaseObject implements Persistent
$keys[3] => $this->getUpdatedAt(),
);
if ($includeForeignObjects) {
- if (null !== $this->collResourceDescs) {
- $result['ResourceDescs'] = $this->collResourceDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collGroupResources) {
$result['GroupResources'] = $this->collGroupResources->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collResourceI18ns) {
+ $result['ResourceI18ns'] = $this->collResourceI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1001,18 +1015,18 @@ abstract class BaseResource extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getResourceDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addResourceDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getGroupResources() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addGroupResource($relObj->copy($deepCopy));
}
}
+ foreach ($this->getResourceI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addResourceI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1074,218 +1088,11 @@ abstract class BaseResource extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('ResourceDesc' == $relationName) {
- $this->initResourceDescs();
- }
if ('GroupResource' == $relationName) {
$this->initGroupResources();
}
- }
-
- /**
- * Clears out the collResourceDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addResourceDescs()
- */
- public function clearResourceDescs()
- {
- $this->collResourceDescs = null; // important to set this to null since that means it is uninitialized
- $this->collResourceDescsPartial = null;
- }
-
- /**
- * reset is the collResourceDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialResourceDescs($v = true)
- {
- $this->collResourceDescsPartial = $v;
- }
-
- /**
- * Initializes the collResourceDescs collection.
- *
- * By default this just sets the collResourceDescs collection to an empty array (like clearcollResourceDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initResourceDescs($overrideExisting = true)
- {
- if (null !== $this->collResourceDescs && !$overrideExisting) {
- return;
- }
- $this->collResourceDescs = new PropelObjectCollection();
- $this->collResourceDescs->setModel('ResourceDesc');
- }
-
- /**
- * Gets an array of ResourceDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * Next time the same method is called without $criteria, the cached collection is returned.
- * If this Resource is new, it will return
- * an empty collection or the current collection; the criteria is ignored on a new object.
- *
- * @param Criteria $criteria optional Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|ResourceDesc[] List of ResourceDesc objects
- * @throws PropelException
- */
- public function getResourceDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collResourceDescsPartial && !$this->isNew();
- if (null === $this->collResourceDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collResourceDescs) {
- // return empty collection
- $this->initResourceDescs();
- } else {
- $collResourceDescs = ResourceDescQuery::create(null, $criteria)
- ->filterByResource($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collResourceDescsPartial && count($collResourceDescs)) {
- $this->initResourceDescs(false);
-
- foreach($collResourceDescs as $obj) {
- if (false == $this->collResourceDescs->contains($obj)) {
- $this->collResourceDescs->append($obj);
- }
- }
-
- $this->collResourceDescsPartial = true;
- }
-
- return $collResourceDescs;
- }
-
- if($partial && $this->collResourceDescs) {
- foreach($this->collResourceDescs as $obj) {
- if($obj->isNew()) {
- $collResourceDescs[] = $obj;
- }
- }
- }
-
- $this->collResourceDescs = $collResourceDescs;
- $this->collResourceDescsPartial = false;
- }
- }
-
- return $this->collResourceDescs;
- }
-
- /**
- * Sets a collection of ResourceDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $resourceDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setResourceDescs(PropelCollection $resourceDescs, PropelPDO $con = null)
- {
- $this->resourceDescsScheduledForDeletion = $this->getResourceDescs(new Criteria(), $con)->diff($resourceDescs);
-
- foreach ($this->resourceDescsScheduledForDeletion as $resourceDescRemoved) {
- $resourceDescRemoved->setResource(null);
- }
-
- $this->collResourceDescs = null;
- foreach ($resourceDescs as $resourceDesc) {
- $this->addResourceDesc($resourceDesc);
- }
-
- $this->collResourceDescs = $resourceDescs;
- $this->collResourceDescsPartial = false;
- }
-
- /**
- * Returns the number of related ResourceDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related ResourceDesc objects.
- * @throws PropelException
- */
- public function countResourceDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collResourceDescsPartial && !$this->isNew();
- if (null === $this->collResourceDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collResourceDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getResourceDescs());
- }
- $query = ResourceDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByResource($this)
- ->count($con);
- }
- } else {
- return count($this->collResourceDescs);
- }
- }
-
- /**
- * Method called to associate a ResourceDesc object to this object
- * through the ResourceDesc foreign key attribute.
- *
- * @param ResourceDesc $l ResourceDesc
- * @return Resource The current object (for fluent API support)
- */
- public function addResourceDesc(ResourceDesc $l)
- {
- if ($this->collResourceDescs === null) {
- $this->initResourceDescs();
- $this->collResourceDescsPartial = true;
- }
- if (!$this->collResourceDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddResourceDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param ResourceDesc $resourceDesc The resourceDesc object to add.
- */
- protected function doAddResourceDesc($resourceDesc)
- {
- $this->collResourceDescs[]= $resourceDesc;
- $resourceDesc->setResource($this);
- }
-
- /**
- * @param ResourceDesc $resourceDesc The resourceDesc object to remove.
- */
- public function removeResourceDesc($resourceDesc)
- {
- if ($this->getResourceDescs()->contains($resourceDesc)) {
- $this->collResourceDescs->remove($this->collResourceDescs->search($resourceDesc));
- if (null === $this->resourceDescsScheduledForDeletion) {
- $this->resourceDescsScheduledForDeletion = clone $this->collResourceDescs;
- $this->resourceDescsScheduledForDeletion->clear();
- }
- $this->resourceDescsScheduledForDeletion[]= $resourceDesc;
- $resourceDesc->setResource(null);
+ if ('ResourceI18n' == $relationName) {
+ $this->initResourceI18ns();
}
}
@@ -1521,6 +1328,217 @@ abstract class BaseResource extends BaseObject implements Persistent
return $this->getGroupResources($query, $con);
}
+ /**
+ * Clears out the collResourceI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addResourceI18ns()
+ */
+ public function clearResourceI18ns()
+ {
+ $this->collResourceI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collResourceI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collResourceI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialResourceI18ns($v = true)
+ {
+ $this->collResourceI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collResourceI18ns collection.
+ *
+ * By default this just sets the collResourceI18ns collection to an empty array (like clearcollResourceI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initResourceI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collResourceI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collResourceI18ns = new PropelObjectCollection();
+ $this->collResourceI18ns->setModel('ResourceI18n');
+ }
+
+ /**
+ * Gets an array of ResourceI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this Resource is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|ResourceI18n[] List of ResourceI18n objects
+ * @throws PropelException
+ */
+ public function getResourceI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collResourceI18nsPartial && !$this->isNew();
+ if (null === $this->collResourceI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collResourceI18ns) {
+ // return empty collection
+ $this->initResourceI18ns();
+ } else {
+ $collResourceI18ns = ResourceI18nQuery::create(null, $criteria)
+ ->filterByResource($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collResourceI18nsPartial && count($collResourceI18ns)) {
+ $this->initResourceI18ns(false);
+
+ foreach($collResourceI18ns as $obj) {
+ if (false == $this->collResourceI18ns->contains($obj)) {
+ $this->collResourceI18ns->append($obj);
+ }
+ }
+
+ $this->collResourceI18nsPartial = true;
+ }
+
+ return $collResourceI18ns;
+ }
+
+ if($partial && $this->collResourceI18ns) {
+ foreach($this->collResourceI18ns as $obj) {
+ if($obj->isNew()) {
+ $collResourceI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collResourceI18ns = $collResourceI18ns;
+ $this->collResourceI18nsPartial = false;
+ }
+ }
+
+ return $this->collResourceI18ns;
+ }
+
+ /**
+ * Sets a collection of ResourceI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $resourceI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setResourceI18ns(PropelCollection $resourceI18ns, PropelPDO $con = null)
+ {
+ $this->resourceI18nsScheduledForDeletion = $this->getResourceI18ns(new Criteria(), $con)->diff($resourceI18ns);
+
+ foreach ($this->resourceI18nsScheduledForDeletion as $resourceI18nRemoved) {
+ $resourceI18nRemoved->setResource(null);
+ }
+
+ $this->collResourceI18ns = null;
+ foreach ($resourceI18ns as $resourceI18n) {
+ $this->addResourceI18n($resourceI18n);
+ }
+
+ $this->collResourceI18ns = $resourceI18ns;
+ $this->collResourceI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related ResourceI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related ResourceI18n objects.
+ * @throws PropelException
+ */
+ public function countResourceI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collResourceI18nsPartial && !$this->isNew();
+ if (null === $this->collResourceI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collResourceI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getResourceI18ns());
+ }
+ $query = ResourceI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByResource($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collResourceI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a ResourceI18n object to this object
+ * through the ResourceI18n foreign key attribute.
+ *
+ * @param ResourceI18n $l ResourceI18n
+ * @return Resource The current object (for fluent API support)
+ */
+ public function addResourceI18n(ResourceI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collResourceI18ns === null) {
+ $this->initResourceI18ns();
+ $this->collResourceI18nsPartial = true;
+ }
+ if (!$this->collResourceI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddResourceI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param ResourceI18n $resourceI18n The resourceI18n object to add.
+ */
+ protected function doAddResourceI18n($resourceI18n)
+ {
+ $this->collResourceI18ns[]= $resourceI18n;
+ $resourceI18n->setResource($this);
+ }
+
+ /**
+ * @param ResourceI18n $resourceI18n The resourceI18n object to remove.
+ */
+ public function removeResourceI18n($resourceI18n)
+ {
+ if ($this->getResourceI18ns()->contains($resourceI18n)) {
+ $this->collResourceI18ns->remove($this->collResourceI18ns->search($resourceI18n));
+ if (null === $this->resourceI18nsScheduledForDeletion) {
+ $this->resourceI18nsScheduledForDeletion = clone $this->collResourceI18ns;
+ $this->resourceI18nsScheduledForDeletion->clear();
+ }
+ $this->resourceI18nsScheduledForDeletion[]= $resourceI18n;
+ $resourceI18n->setResource(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -1550,26 +1568,30 @@ abstract class BaseResource extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collResourceDescs) {
- foreach ($this->collResourceDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collGroupResources) {
foreach ($this->collGroupResources as $o) {
$o->clearAllReferences($deep);
}
}
+ if ($this->collResourceI18ns) {
+ foreach ($this->collResourceI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collResourceDescs instanceof PropelCollection) {
- $this->collResourceDescs->clearIterator();
- }
- $this->collResourceDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collGroupResources instanceof PropelCollection) {
$this->collGroupResources->clearIterator();
}
$this->collGroupResources = null;
+ if ($this->collResourceI18ns instanceof PropelCollection) {
+ $this->collResourceI18ns->clearIterator();
+ }
+ $this->collResourceI18ns = null;
}
/**
@@ -1606,4 +1628,199 @@ abstract class BaseResource extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Resource The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ResourceI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collResourceI18ns) {
+ foreach ($this->collResourceI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new ResourceI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = ResourceI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addResourceI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Resource The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ ResourceI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collResourceI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collResourceI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ResourceI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return ResourceI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return ResourceI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->getCurrentTranslation()->getChapo();
+ }
+
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return ResourceI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ { $this->getCurrentTranslation()->setChapo($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->getCurrentTranslation()->getPostscriptum();
+ }
+
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return ResourceI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ { $this->getCurrentTranslation()->setPostscriptum($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseResourceI18n.php b/core/lib/Thelia/Model/om/BaseResourceI18n.php
new file mode 100644
index 000000000..f08f576d4
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseResourceI18n.php
@@ -0,0 +1,1173 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseResourceI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Get the [chapo] column value.
+ *
+ * @return string
+ */
+ public function getChapo()
+ {
+ return $this->chapo;
+ }
+
+ /**
+ * Get the [postscriptum] column value.
+ *
+ * @return string
+ */
+ public function getPostscriptum()
+ {
+ return $this->postscriptum;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return ResourceI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = ResourceI18nPeer::ID;
+ }
+
+ if ($this->aResource !== null && $this->aResource->getId() !== $v) {
+ $this->aResource = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return ResourceI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = ResourceI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return ResourceI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = ResourceI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return ResourceI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = ResourceI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Set the value of [chapo] column.
+ *
+ * @param string $v new value
+ * @return ResourceI18n The current object (for fluent API support)
+ */
+ public function setChapo($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->chapo !== $v) {
+ $this->chapo = $v;
+ $this->modifiedColumns[] = ResourceI18nPeer::CHAPO;
+ }
+
+
+ return $this;
+ } // setChapo()
+
+ /**
+ * Set the value of [postscriptum] column.
+ *
+ * @param string $v new value
+ * @return ResourceI18n The current object (for fluent API support)
+ */
+ public function setPostscriptum($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->postscriptum !== $v) {
+ $this->postscriptum = $v;
+ $this->modifiedColumns[] = ResourceI18nPeer::POSTSCRIPTUM;
+ }
+
+
+ return $this;
+ } // setPostscriptum()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->chapo = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->postscriptum = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 6; // 6 = ResourceI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating ResourceI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aResource !== null && $this->id !== $this->aResource->getId()) {
+ $this->aResource = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = ResourceI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aResource = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = ResourceI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ ResourceI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aResource !== null) {
+ if ($this->aResource->isModified() || $this->aResource->isNew()) {
+ $affectedRows += $this->aResource->save($con);
+ }
+ $this->setResource($this->aResource);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(ResourceI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(ResourceI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(ResourceI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(ResourceI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+ if ($this->isColumnModified(ResourceI18nPeer::CHAPO)) {
+ $modifiedColumns[':p' . $index++] = '`CHAPO`';
+ }
+ if ($this->isColumnModified(ResourceI18nPeer::POSTSCRIPTUM)) {
+ $modifiedColumns[':p' . $index++] = '`POSTSCRIPTUM`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `resource_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ case '`CHAPO`':
+ $stmt->bindValue($identifier, $this->chapo, PDO::PARAM_STR);
+ break;
+ case '`POSTSCRIPTUM`':
+ $stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aResource !== null) {
+ if (!$this->aResource->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aResource->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = ResourceI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ResourceI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getChapo();
+ break;
+ case 5:
+ return $this->getPostscriptum();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['ResourceI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['ResourceI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = ResourceI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getChapo(),
+ $keys[5] => $this->getPostscriptum(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aResource) {
+ $result['Resource'] = $this->aResource->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = ResourceI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setChapo($value);
+ break;
+ case 5:
+ $this->setPostscriptum($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = ResourceI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(ResourceI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(ResourceI18nPeer::ID)) $criteria->add(ResourceI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(ResourceI18nPeer::LOCALE)) $criteria->add(ResourceI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(ResourceI18nPeer::TITLE)) $criteria->add(ResourceI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(ResourceI18nPeer::DESCRIPTION)) $criteria->add(ResourceI18nPeer::DESCRIPTION, $this->description);
+ if ($this->isColumnModified(ResourceI18nPeer::CHAPO)) $criteria->add(ResourceI18nPeer::CHAPO, $this->chapo);
+ if ($this->isColumnModified(ResourceI18nPeer::POSTSCRIPTUM)) $criteria->add(ResourceI18nPeer::POSTSCRIPTUM, $this->postscriptum);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(ResourceI18nPeer::DATABASE_NAME);
+ $criteria->add(ResourceI18nPeer::ID, $this->id);
+ $criteria->add(ResourceI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of ResourceI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+ $copyObj->setChapo($this->getChapo());
+ $copyObj->setPostscriptum($this->getPostscriptum());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return ResourceI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return ResourceI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new ResourceI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Resource object.
+ *
+ * @param Resource $v
+ * @return ResourceI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setResource(Resource $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aResource = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Resource object, it will not be re-added.
+ if ($v !== null) {
+ $v->addResourceI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Resource object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Resource The associated Resource object.
+ * @throws PropelException
+ */
+ public function getResource(PropelPDO $con = null)
+ {
+ if ($this->aResource === null && ($this->id !== null)) {
+ $this->aResource = ResourceQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aResource->addResourceI18ns($this);
+ */
+ }
+
+ return $this->aResource;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->chapo = null;
+ $this->postscriptum = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aResource = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(ResourceI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseResourceI18nPeer.php b/core/lib/Thelia/Model/om/BaseResourceI18nPeer.php
new file mode 100644
index 000000000..f316e8a82
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseResourceI18nPeer.php
@@ -0,0 +1,1009 @@
+ array ('Id', 'Locale', 'Title', 'Description', 'Chapo', 'Postscriptum', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_COLNAME => array (ResourceI18nPeer::ID, ResourceI18nPeer::LOCALE, ResourceI18nPeer::TITLE, ResourceI18nPeer::DESCRIPTION, ResourceI18nPeer::CHAPO, ResourceI18nPeer::POSTSCRIPTUM, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', 'CHAPO', 'POSTSCRIPTUM', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', 'chapo', 'postscriptum', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. ResourceI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, 'Chapo' => 4, 'Postscriptum' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_COLNAME => array (ResourceI18nPeer::ID => 0, ResourceI18nPeer::LOCALE => 1, ResourceI18nPeer::TITLE => 2, ResourceI18nPeer::DESCRIPTION => 3, ResourceI18nPeer::CHAPO => 4, ResourceI18nPeer::POSTSCRIPTUM => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CHAPO' => 4, 'POSTSCRIPTUM' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, 'chapo' => 4, 'postscriptum' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = ResourceI18nPeer::getFieldNames($toType);
+ $key = isset(ResourceI18nPeer::$fieldKeys[$fromType][$name]) ? ResourceI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ResourceI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, ResourceI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return ResourceI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. ResourceI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(ResourceI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(ResourceI18nPeer::ID);
+ $criteria->addSelectColumn(ResourceI18nPeer::LOCALE);
+ $criteria->addSelectColumn(ResourceI18nPeer::TITLE);
+ $criteria->addSelectColumn(ResourceI18nPeer::DESCRIPTION);
+ $criteria->addSelectColumn(ResourceI18nPeer::CHAPO);
+ $criteria->addSelectColumn(ResourceI18nPeer::POSTSCRIPTUM);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ $criteria->addSelectColumn($alias . '.CHAPO');
+ $criteria->addSelectColumn($alias . '.POSTSCRIPTUM');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ResourceI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ResourceI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(ResourceI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return ResourceI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = ResourceI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return ResourceI18nPeer::populateObjects(ResourceI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ ResourceI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ResourceI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param ResourceI18n $obj A ResourceI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ ResourceI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A ResourceI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof ResourceI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ResourceI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(ResourceI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return ResourceI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(ResourceI18nPeer::$instances[$key])) {
+ return ResourceI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ ResourceI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to resource_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = ResourceI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = ResourceI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = ResourceI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ ResourceI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (ResourceI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = ResourceI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = ResourceI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + ResourceI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = ResourceI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ ResourceI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Resource table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinResource(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ResourceI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ResourceI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ResourceI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ResourceI18nPeer::ID, ResourcePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of ResourceI18n objects pre-filled with their Resource objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ResourceI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinResource(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ResourceI18nPeer::DATABASE_NAME);
+ }
+
+ ResourceI18nPeer::addSelectColumns($criteria);
+ $startcol = ResourceI18nPeer::NUM_HYDRATE_COLUMNS;
+ ResourcePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(ResourceI18nPeer::ID, ResourcePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ResourceI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ResourceI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = ResourceI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ResourceI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = ResourcePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = ResourcePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = ResourcePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ ResourcePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (ResourceI18n) to $obj2 (Resource)
+ $obj2->addResourceI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(ResourceI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ ResourceI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(ResourceI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(ResourceI18nPeer::ID, ResourcePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of ResourceI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of ResourceI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(ResourceI18nPeer::DATABASE_NAME);
+ }
+
+ ResourceI18nPeer::addSelectColumns($criteria);
+ $startcol2 = ResourceI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ ResourcePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + ResourcePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(ResourceI18nPeer::ID, ResourcePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = ResourceI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = ResourceI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = ResourceI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ ResourceI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Resource rows
+
+ $key2 = ResourcePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = ResourcePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = ResourcePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ ResourcePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (ResourceI18n) to the collection in $obj2 (Resource)
+ $obj2->addResourceI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(ResourceI18nPeer::DATABASE_NAME)->getTable(ResourceI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseResourceI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseResourceI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new ResourceI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return ResourceI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a ResourceI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or ResourceI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from ResourceI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(ResourceI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a ResourceI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or ResourceI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(ResourceI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(ResourceI18nPeer::ID);
+ $value = $criteria->remove(ResourceI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(ResourceI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ResourceI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(ResourceI18nPeer::LOCALE);
+ $value = $criteria->remove(ResourceI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(ResourceI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(ResourceI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is ResourceI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(ResourceI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the resource_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(ResourceI18nPeer::TABLE_NAME, $con, ResourceI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ ResourceI18nPeer::clearInstancePool();
+ ResourceI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a ResourceI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or ResourceI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ ResourceI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof ResourceI18n) { // it's a model object
+ // invalidate the cache for this single object
+ ResourceI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(ResourceI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(ResourceI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(ResourceI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ ResourceI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(ResourceI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ ResourceI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given ResourceI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param ResourceI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(ResourceI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(ResourceI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(ResourceI18nPeer::DATABASE_NAME, ResourceI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return ResourceI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = ResourceI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(ResourceI18nPeer::DATABASE_NAME);
+ $criteria->add(ResourceI18nPeer::ID, $id);
+ $criteria->add(ResourceI18nPeer::LOCALE, $locale);
+ $v = ResourceI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseResourceI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseResourceI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseResourceI18nQuery.php b/core/lib/Thelia/Model/om/BaseResourceI18nQuery.php
new file mode 100644
index 000000000..07898fa19
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseResourceI18nQuery.php
@@ -0,0 +1,522 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return ResourceI18n|ResourceI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = ResourceI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(ResourceI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ResourceI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION`, `CHAPO`, `POSTSCRIPTUM` FROM `resource_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new ResourceI18n();
+ $obj->hydrate($row);
+ ResourceI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return ResourceI18n|ResourceI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|ResourceI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return ResourceI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(ResourceI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(ResourceI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return ResourceI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(ResourceI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(ResourceI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByResource()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ResourceI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(ResourceI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ResourceI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ResourceI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ResourceI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ResourceI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ResourceI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ResourceI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query on the chapo column
+ *
+ * Example usage:
+ *
+ * $query->filterByChapo('fooValue'); // WHERE chapo = 'fooValue'
+ * $query->filterByChapo('%fooValue%'); // WHERE chapo LIKE '%fooValue%'
+ *
+ *
+ * @param string $chapo The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ResourceI18nQuery The current query, for fluid interface
+ */
+ public function filterByChapo($chapo = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($chapo)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $chapo)) {
+ $chapo = str_replace('*', '%', $chapo);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ResourceI18nPeer::CHAPO, $chapo, $comparison);
+ }
+
+ /**
+ * Filter the query on the postscriptum column
+ *
+ * Example usage:
+ *
+ * $query->filterByPostscriptum('fooValue'); // WHERE postscriptum = 'fooValue'
+ * $query->filterByPostscriptum('%fooValue%'); // WHERE postscriptum LIKE '%fooValue%'
+ *
+ *
+ * @param string $postscriptum The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ResourceI18nQuery The current query, for fluid interface
+ */
+ public function filterByPostscriptum($postscriptum = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($postscriptum)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $postscriptum)) {
+ $postscriptum = str_replace('*', '%', $postscriptum);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(ResourceI18nPeer::POSTSCRIPTUM, $postscriptum, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Resource object
+ *
+ * @param Resource|PropelObjectCollection $resource The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ResourceI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByResource($resource, $comparison = null)
+ {
+ if ($resource instanceof Resource) {
+ return $this
+ ->addUsingAlias(ResourceI18nPeer::ID, $resource->getId(), $comparison);
+ } elseif ($resource instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(ResourceI18nPeer::ID, $resource->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByResource() only accepts arguments of type Resource or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Resource relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ResourceI18nQuery The current query, for fluid interface
+ */
+ public function joinResource($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Resource');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Resource');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Resource relation Resource object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\ResourceQuery A secondary query class using the current class as primary query
+ */
+ public function useResourceQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinResource($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Resource', '\Thelia\Model\ResourceQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param ResourceI18n $resourceI18n Object to remove from the list of results
+ *
+ * @return ResourceI18nQuery The current query, for fluid interface
+ */
+ public function prune($resourceI18n = null)
+ {
+ if ($resourceI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(ResourceI18nPeer::ID), $resourceI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(ResourceI18nPeer::LOCALE), $resourceI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseResourcePeer.php b/core/lib/Thelia/Model/om/BaseResourcePeer.php
index e8bfad535..cfe59b459 100644
--- a/core/lib/Thelia/Model/om/BaseResourcePeer.php
+++ b/core/lib/Thelia/Model/om/BaseResourcePeer.php
@@ -11,7 +11,7 @@ use \PropelException;
use \PropelPDO;
use Thelia\Model\GroupResourcePeer;
use Thelia\Model\Resource;
-use Thelia\Model\ResourceDescPeer;
+use Thelia\Model\ResourceI18nPeer;
use Thelia\Model\ResourcePeer;
use Thelia\Model\map\ResourceTableMap;
@@ -70,6 +70,13 @@ abstract class BaseResourcePeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -379,12 +386,12 @@ abstract class BaseResourcePeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in ResourceDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- ResourceDescPeer::clearInstancePool();
// Invalidate objects in GroupResourcePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
GroupResourcePeer::clearInstancePool();
+ // Invalidate objects in ResourceI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ ResourceI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseResourceQuery.php b/core/lib/Thelia/Model/om/BaseResourceQuery.php
index 575b22d48..7792a1462 100644
--- a/core/lib/Thelia/Model/om/BaseResourceQuery.php
+++ b/core/lib/Thelia/Model/om/BaseResourceQuery.php
@@ -14,7 +14,7 @@ use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\GroupResource;
use Thelia\Model\Resource;
-use Thelia\Model\ResourceDesc;
+use Thelia\Model\ResourceI18n;
use Thelia\Model\ResourcePeer;
use Thelia\Model\ResourceQuery;
@@ -37,14 +37,14 @@ use Thelia\Model\ResourceQuery;
* @method ResourceQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ResourceQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method ResourceQuery leftJoinResourceDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the ResourceDesc relation
- * @method ResourceQuery rightJoinResourceDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ResourceDesc relation
- * @method ResourceQuery innerJoinResourceDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the ResourceDesc relation
- *
* @method ResourceQuery leftJoinGroupResource($relationAlias = null) Adds a LEFT JOIN clause to the query using the GroupResource relation
* @method ResourceQuery rightJoinGroupResource($relationAlias = null) Adds a RIGHT JOIN clause to the query using the GroupResource relation
* @method ResourceQuery innerJoinGroupResource($relationAlias = null) Adds a INNER JOIN clause to the query using the GroupResource relation
*
+ * @method ResourceQuery leftJoinResourceI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the ResourceI18n relation
+ * @method ResourceQuery rightJoinResourceI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ResourceI18n relation
+ * @method ResourceQuery innerJoinResourceI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ResourceI18n relation
+ *
* @method Resource findOne(PropelPDO $con = null) Return the first Resource matching the query
* @method Resource findOneOrCreate(PropelPDO $con = null) Return the first Resource matching the query, or a new Resource object populated from the query conditions when no match is found
*
@@ -377,80 +377,6 @@ abstract class BaseResourceQuery extends ModelCriteria
return $this->addUsingAlias(ResourcePeer::UPDATED_AT, $updatedAt, $comparison);
}
- /**
- * Filter the query by a related ResourceDesc object
- *
- * @param ResourceDesc|PropelObjectCollection $resourceDesc the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return ResourceQuery The current query, for fluid interface
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByResourceDesc($resourceDesc, $comparison = null)
- {
- if ($resourceDesc instanceof ResourceDesc) {
- return $this
- ->addUsingAlias(ResourcePeer::ID, $resourceDesc->getResourceId(), $comparison);
- } elseif ($resourceDesc instanceof PropelObjectCollection) {
- return $this
- ->useResourceDescQuery()
- ->filterByPrimaryKeys($resourceDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByResourceDesc() only accepts arguments of type ResourceDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the ResourceDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return ResourceQuery The current query, for fluid interface
- */
- public function joinResourceDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('ResourceDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'ResourceDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the ResourceDesc relation ResourceDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\ResourceDescQuery A secondary query class using the current class as primary query
- */
- public function useResourceDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinResourceDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'ResourceDesc', '\Thelia\Model\ResourceDescQuery');
- }
-
/**
* Filter the query by a related GroupResource object
*
@@ -525,6 +451,80 @@ abstract class BaseResourceQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'GroupResource', '\Thelia\Model\GroupResourceQuery');
}
+ /**
+ * Filter the query by a related ResourceI18n object
+ *
+ * @param ResourceI18n|PropelObjectCollection $resourceI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ResourceQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByResourceI18n($resourceI18n, $comparison = null)
+ {
+ if ($resourceI18n instanceof ResourceI18n) {
+ return $this
+ ->addUsingAlias(ResourcePeer::ID, $resourceI18n->getId(), $comparison);
+ } elseif ($resourceI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useResourceI18nQuery()
+ ->filterByPrimaryKeys($resourceI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByResourceI18n() only accepts arguments of type ResourceI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the ResourceI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return ResourceQuery The current query, for fluid interface
+ */
+ public function joinResourceI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('ResourceI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'ResourceI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the ResourceI18n relation ResourceI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\ResourceI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useResourceI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinResourceI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ResourceI18n', '\Thelia\Model\ResourceI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -606,4 +606,61 @@ abstract class BaseResourceQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(ResourcePeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ResourceQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'ResourceI18n';
+
+ return $this
+ ->joinResourceI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ResourceQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('ResourceI18n');
+ $this->with['ResourceI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return ResourceI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'ResourceI18n', 'Thelia\Model\ResourceI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseTax.php b/core/lib/Thelia/Model/om/BaseTax.php
index f0cb83d1b..e98a029ff 100644
--- a/core/lib/Thelia/Model/om/BaseTax.php
+++ b/core/lib/Thelia/Model/om/BaseTax.php
@@ -16,8 +16,8 @@ use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Tax;
-use Thelia\Model\TaxDesc;
-use Thelia\Model\TaxDescQuery;
+use Thelia\Model\TaxI18n;
+use Thelia\Model\TaxI18nQuery;
use Thelia\Model\TaxPeer;
use Thelia\Model\TaxQuery;
use Thelia\Model\TaxRuleCountry;
@@ -75,18 +75,18 @@ abstract class BaseTax extends BaseObject implements Persistent
*/
protected $updated_at;
- /**
- * @var PropelObjectCollection|TaxDesc[] Collection to store aggregation of TaxDesc objects.
- */
- protected $collTaxDescs;
- protected $collTaxDescsPartial;
-
/**
* @var PropelObjectCollection|TaxRuleCountry[] Collection to store aggregation of TaxRuleCountry objects.
*/
protected $collTaxRuleCountrys;
protected $collTaxRuleCountrysPartial;
+ /**
+ * @var PropelObjectCollection|TaxI18n[] Collection to store aggregation of TaxI18n objects.
+ */
+ protected $collTaxI18ns;
+ protected $collTaxI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -101,11 +101,19 @@ abstract class BaseTax extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
/**
- * An array of objects scheduled for deletion.
- * @var PropelObjectCollection
+ * Current locale
+ * @var string
*/
- protected $taxDescsScheduledForDeletion = null;
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[TaxI18n]
+ */
+ protected $currentTranslations;
/**
* An array of objects scheduled for deletion.
@@ -113,6 +121,12 @@ abstract class BaseTax extends BaseObject implements Persistent
*/
protected $taxRuleCountrysScheduledForDeletion = null;
+ /**
+ * An array of objects scheduled for deletion.
+ * @var PropelObjectCollection
+ */
+ protected $taxI18nsScheduledForDeletion = null;
+
/**
* Get the [id] column value.
*
@@ -401,10 +415,10 @@ abstract class BaseTax extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
- $this->collTaxDescs = null;
-
$this->collTaxRuleCountrys = null;
+ $this->collTaxI18ns = null;
+
} // if (deep)
}
@@ -540,23 +554,6 @@ abstract class BaseTax extends BaseObject implements Persistent
$this->resetModified();
}
- if ($this->taxDescsScheduledForDeletion !== null) {
- if (!$this->taxDescsScheduledForDeletion->isEmpty()) {
- TaxDescQuery::create()
- ->filterByPrimaryKeys($this->taxDescsScheduledForDeletion->getPrimaryKeys(false))
- ->delete($con);
- $this->taxDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collTaxDescs !== null) {
- foreach ($this->collTaxDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->taxRuleCountrysScheduledForDeletion !== null) {
if (!$this->taxRuleCountrysScheduledForDeletion->isEmpty()) {
foreach ($this->taxRuleCountrysScheduledForDeletion as $taxRuleCountry) {
@@ -575,6 +572,23 @@ abstract class BaseTax extends BaseObject implements Persistent
}
}
+ if ($this->taxI18nsScheduledForDeletion !== null) {
+ if (!$this->taxI18nsScheduledForDeletion->isEmpty()) {
+ TaxI18nQuery::create()
+ ->filterByPrimaryKeys($this->taxI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->taxI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collTaxI18ns !== null) {
+ foreach ($this->collTaxI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -735,16 +749,16 @@ abstract class BaseTax extends BaseObject implements Persistent
}
- if ($this->collTaxDescs !== null) {
- foreach ($this->collTaxDescs as $referrerFK) {
+ if ($this->collTaxRuleCountrys !== null) {
+ foreach ($this->collTaxRuleCountrys as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
- if ($this->collTaxRuleCountrys !== null) {
- foreach ($this->collTaxRuleCountrys as $referrerFK) {
+ if ($this->collTaxI18ns !== null) {
+ foreach ($this->collTaxI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -833,12 +847,12 @@ abstract class BaseTax extends BaseObject implements Persistent
$keys[3] => $this->getUpdatedAt(),
);
if ($includeForeignObjects) {
- if (null !== $this->collTaxDescs) {
- $result['TaxDescs'] = $this->collTaxDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collTaxRuleCountrys) {
$result['TaxRuleCountrys'] = $this->collTaxRuleCountrys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collTaxI18ns) {
+ $result['TaxI18ns'] = $this->collTaxI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -1002,18 +1016,18 @@ abstract class BaseTax extends BaseObject implements Persistent
// store object hash to prevent cycle
$this->startCopy = true;
- foreach ($this->getTaxDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addTaxDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getTaxRuleCountrys() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addTaxRuleCountry($relObj->copy($deepCopy));
}
}
+ foreach ($this->getTaxI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addTaxI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1075,218 +1089,11 @@ abstract class BaseTax extends BaseObject implements Persistent
*/
public function initRelation($relationName)
{
- if ('TaxDesc' == $relationName) {
- $this->initTaxDescs();
- }
if ('TaxRuleCountry' == $relationName) {
$this->initTaxRuleCountrys();
}
- }
-
- /**
- * Clears out the collTaxDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addTaxDescs()
- */
- public function clearTaxDescs()
- {
- $this->collTaxDescs = null; // important to set this to null since that means it is uninitialized
- $this->collTaxDescsPartial = null;
- }
-
- /**
- * reset is the collTaxDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialTaxDescs($v = true)
- {
- $this->collTaxDescsPartial = $v;
- }
-
- /**
- * Initializes the collTaxDescs collection.
- *
- * By default this just sets the collTaxDescs collection to an empty array (like clearcollTaxDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initTaxDescs($overrideExisting = true)
- {
- if (null !== $this->collTaxDescs && !$overrideExisting) {
- return;
- }
- $this->collTaxDescs = new PropelObjectCollection();
- $this->collTaxDescs->setModel('TaxDesc');
- }
-
- /**
- * Gets an array of TaxDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * Next time the same method is called without $criteria, the cached collection is returned.
- * If this Tax is new, it will return
- * an empty collection or the current collection; the criteria is ignored on a new object.
- *
- * @param Criteria $criteria optional Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|TaxDesc[] List of TaxDesc objects
- * @throws PropelException
- */
- public function getTaxDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collTaxDescsPartial && !$this->isNew();
- if (null === $this->collTaxDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collTaxDescs) {
- // return empty collection
- $this->initTaxDescs();
- } else {
- $collTaxDescs = TaxDescQuery::create(null, $criteria)
- ->filterByTax($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collTaxDescsPartial && count($collTaxDescs)) {
- $this->initTaxDescs(false);
-
- foreach($collTaxDescs as $obj) {
- if (false == $this->collTaxDescs->contains($obj)) {
- $this->collTaxDescs->append($obj);
- }
- }
-
- $this->collTaxDescsPartial = true;
- }
-
- return $collTaxDescs;
- }
-
- if($partial && $this->collTaxDescs) {
- foreach($this->collTaxDescs as $obj) {
- if($obj->isNew()) {
- $collTaxDescs[] = $obj;
- }
- }
- }
-
- $this->collTaxDescs = $collTaxDescs;
- $this->collTaxDescsPartial = false;
- }
- }
-
- return $this->collTaxDescs;
- }
-
- /**
- * Sets a collection of TaxDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $taxDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setTaxDescs(PropelCollection $taxDescs, PropelPDO $con = null)
- {
- $this->taxDescsScheduledForDeletion = $this->getTaxDescs(new Criteria(), $con)->diff($taxDescs);
-
- foreach ($this->taxDescsScheduledForDeletion as $taxDescRemoved) {
- $taxDescRemoved->setTax(null);
- }
-
- $this->collTaxDescs = null;
- foreach ($taxDescs as $taxDesc) {
- $this->addTaxDesc($taxDesc);
- }
-
- $this->collTaxDescs = $taxDescs;
- $this->collTaxDescsPartial = false;
- }
-
- /**
- * Returns the number of related TaxDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related TaxDesc objects.
- * @throws PropelException
- */
- public function countTaxDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collTaxDescsPartial && !$this->isNew();
- if (null === $this->collTaxDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collTaxDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getTaxDescs());
- }
- $query = TaxDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByTax($this)
- ->count($con);
- }
- } else {
- return count($this->collTaxDescs);
- }
- }
-
- /**
- * Method called to associate a TaxDesc object to this object
- * through the TaxDesc foreign key attribute.
- *
- * @param TaxDesc $l TaxDesc
- * @return Tax The current object (for fluent API support)
- */
- public function addTaxDesc(TaxDesc $l)
- {
- if ($this->collTaxDescs === null) {
- $this->initTaxDescs();
- $this->collTaxDescsPartial = true;
- }
- if (!$this->collTaxDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddTaxDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param TaxDesc $taxDesc The taxDesc object to add.
- */
- protected function doAddTaxDesc($taxDesc)
- {
- $this->collTaxDescs[]= $taxDesc;
- $taxDesc->setTax($this);
- }
-
- /**
- * @param TaxDesc $taxDesc The taxDesc object to remove.
- */
- public function removeTaxDesc($taxDesc)
- {
- if ($this->getTaxDescs()->contains($taxDesc)) {
- $this->collTaxDescs->remove($this->collTaxDescs->search($taxDesc));
- if (null === $this->taxDescsScheduledForDeletion) {
- $this->taxDescsScheduledForDeletion = clone $this->collTaxDescs;
- $this->taxDescsScheduledForDeletion->clear();
- }
- $this->taxDescsScheduledForDeletion[]= $taxDesc;
- $taxDesc->setTax(null);
+ if ('TaxI18n' == $relationName) {
+ $this->initTaxI18ns();
}
}
@@ -1547,6 +1354,217 @@ abstract class BaseTax extends BaseObject implements Persistent
return $this->getTaxRuleCountrys($query, $con);
}
+ /**
+ * Clears out the collTaxI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addTaxI18ns()
+ */
+ public function clearTaxI18ns()
+ {
+ $this->collTaxI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collTaxI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collTaxI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialTaxI18ns($v = true)
+ {
+ $this->collTaxI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collTaxI18ns collection.
+ *
+ * By default this just sets the collTaxI18ns collection to an empty array (like clearcollTaxI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initTaxI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collTaxI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collTaxI18ns = new PropelObjectCollection();
+ $this->collTaxI18ns->setModel('TaxI18n');
+ }
+
+ /**
+ * Gets an array of TaxI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this Tax is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|TaxI18n[] List of TaxI18n objects
+ * @throws PropelException
+ */
+ public function getTaxI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collTaxI18nsPartial && !$this->isNew();
+ if (null === $this->collTaxI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collTaxI18ns) {
+ // return empty collection
+ $this->initTaxI18ns();
+ } else {
+ $collTaxI18ns = TaxI18nQuery::create(null, $criteria)
+ ->filterByTax($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collTaxI18nsPartial && count($collTaxI18ns)) {
+ $this->initTaxI18ns(false);
+
+ foreach($collTaxI18ns as $obj) {
+ if (false == $this->collTaxI18ns->contains($obj)) {
+ $this->collTaxI18ns->append($obj);
+ }
+ }
+
+ $this->collTaxI18nsPartial = true;
+ }
+
+ return $collTaxI18ns;
+ }
+
+ if($partial && $this->collTaxI18ns) {
+ foreach($this->collTaxI18ns as $obj) {
+ if($obj->isNew()) {
+ $collTaxI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collTaxI18ns = $collTaxI18ns;
+ $this->collTaxI18nsPartial = false;
+ }
+ }
+
+ return $this->collTaxI18ns;
+ }
+
+ /**
+ * Sets a collection of TaxI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $taxI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setTaxI18ns(PropelCollection $taxI18ns, PropelPDO $con = null)
+ {
+ $this->taxI18nsScheduledForDeletion = $this->getTaxI18ns(new Criteria(), $con)->diff($taxI18ns);
+
+ foreach ($this->taxI18nsScheduledForDeletion as $taxI18nRemoved) {
+ $taxI18nRemoved->setTax(null);
+ }
+
+ $this->collTaxI18ns = null;
+ foreach ($taxI18ns as $taxI18n) {
+ $this->addTaxI18n($taxI18n);
+ }
+
+ $this->collTaxI18ns = $taxI18ns;
+ $this->collTaxI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related TaxI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related TaxI18n objects.
+ * @throws PropelException
+ */
+ public function countTaxI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collTaxI18nsPartial && !$this->isNew();
+ if (null === $this->collTaxI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collTaxI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getTaxI18ns());
+ }
+ $query = TaxI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByTax($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collTaxI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a TaxI18n object to this object
+ * through the TaxI18n foreign key attribute.
+ *
+ * @param TaxI18n $l TaxI18n
+ * @return Tax The current object (for fluent API support)
+ */
+ public function addTaxI18n(TaxI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collTaxI18ns === null) {
+ $this->initTaxI18ns();
+ $this->collTaxI18nsPartial = true;
+ }
+ if (!$this->collTaxI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddTaxI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param TaxI18n $taxI18n The taxI18n object to add.
+ */
+ protected function doAddTaxI18n($taxI18n)
+ {
+ $this->collTaxI18ns[]= $taxI18n;
+ $taxI18n->setTax($this);
+ }
+
+ /**
+ * @param TaxI18n $taxI18n The taxI18n object to remove.
+ */
+ public function removeTaxI18n($taxI18n)
+ {
+ if ($this->getTaxI18ns()->contains($taxI18n)) {
+ $this->collTaxI18ns->remove($this->collTaxI18ns->search($taxI18n));
+ if (null === $this->taxI18nsScheduledForDeletion) {
+ $this->taxI18nsScheduledForDeletion = clone $this->collTaxI18ns;
+ $this->taxI18nsScheduledForDeletion->clear();
+ }
+ $this->taxI18nsScheduledForDeletion[]= $taxI18n;
+ $taxI18n->setTax(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -1576,26 +1594,30 @@ abstract class BaseTax extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
- if ($this->collTaxDescs) {
- foreach ($this->collTaxDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collTaxRuleCountrys) {
foreach ($this->collTaxRuleCountrys as $o) {
$o->clearAllReferences($deep);
}
}
+ if ($this->collTaxI18ns) {
+ foreach ($this->collTaxI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
- if ($this->collTaxDescs instanceof PropelCollection) {
- $this->collTaxDescs->clearIterator();
- }
- $this->collTaxDescs = null;
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collTaxRuleCountrys instanceof PropelCollection) {
$this->collTaxRuleCountrys->clearIterator();
}
$this->collTaxRuleCountrys = null;
+ if ($this->collTaxI18ns instanceof PropelCollection) {
+ $this->collTaxI18ns->clearIterator();
+ }
+ $this->collTaxI18ns = null;
}
/**
@@ -1632,4 +1654,151 @@ abstract class BaseTax extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return Tax The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return TaxI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collTaxI18ns) {
+ foreach ($this->collTaxI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new TaxI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = TaxI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addTaxI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Tax The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ TaxI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collTaxI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collTaxI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return TaxI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->getCurrentTranslation()->getTitle();
+ }
+
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return TaxI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ { $this->getCurrentTranslation()->setTitle($v);
+
+ return $this;
+ }
+
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->getCurrentTranslation()->getDescription();
+ }
+
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return TaxI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ { $this->getCurrentTranslation()->setDescription($v);
+
+ return $this;
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseTaxI18n.php b/core/lib/Thelia/Model/om/BaseTaxI18n.php
new file mode 100644
index 000000000..07763ac61
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseTaxI18n.php
@@ -0,0 +1,1063 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseTaxI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return TaxI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = TaxI18nPeer::ID;
+ }
+
+ if ($this->aTax !== null && $this->aTax->getId() !== $v) {
+ $this->aTax = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return TaxI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = TaxI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return TaxI18n The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = TaxI18nPeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return TaxI18n The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = TaxI18nPeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 4; // 4 = TaxI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating TaxI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aTax !== null && $this->id !== $this->aTax->getId()) {
+ $this->aTax = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = TaxI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aTax = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = TaxI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ TaxI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aTax !== null) {
+ if ($this->aTax->isModified() || $this->aTax->isNew()) {
+ $affectedRows += $this->aTax->save($con);
+ }
+ $this->setTax($this->aTax);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(TaxI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(TaxI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+ if ($this->isColumnModified(TaxI18nPeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(TaxI18nPeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `tax_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aTax !== null) {
+ if (!$this->aTax->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aTax->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = TaxI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = TaxI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ case 2:
+ return $this->getTitle();
+ break;
+ case 3:
+ return $this->getDescription();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['TaxI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['TaxI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = TaxI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aTax) {
+ $result['Tax'] = $this->aTax->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = TaxI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ case 2:
+ $this->setTitle($value);
+ break;
+ case 3:
+ $this->setDescription($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = TaxI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(TaxI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(TaxI18nPeer::ID)) $criteria->add(TaxI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(TaxI18nPeer::LOCALE)) $criteria->add(TaxI18nPeer::LOCALE, $this->locale);
+ if ($this->isColumnModified(TaxI18nPeer::TITLE)) $criteria->add(TaxI18nPeer::TITLE, $this->title);
+ if ($this->isColumnModified(TaxI18nPeer::DESCRIPTION)) $criteria->add(TaxI18nPeer::DESCRIPTION, $this->description);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(TaxI18nPeer::DATABASE_NAME);
+ $criteria->add(TaxI18nPeer::ID, $this->id);
+ $criteria->add(TaxI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of TaxI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return TaxI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return TaxI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new TaxI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a Tax object.
+ *
+ * @param Tax $v
+ * @return TaxI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setTax(Tax $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aTax = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the Tax object, it will not be re-added.
+ if ($v !== null) {
+ $v->addTaxI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated Tax object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return Tax The associated Tax object.
+ * @throws PropelException
+ */
+ public function getTax(PropelPDO $con = null)
+ {
+ if ($this->aTax === null && ($this->id !== null)) {
+ $this->aTax = TaxQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aTax->addTaxI18ns($this);
+ */
+ }
+
+ return $this->aTax;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->title = null;
+ $this->description = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aTax = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(TaxI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseTaxI18nPeer.php b/core/lib/Thelia/Model/om/BaseTaxI18nPeer.php
new file mode 100644
index 000000000..6efb315e9
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseTaxI18nPeer.php
@@ -0,0 +1,999 @@
+ array ('Id', 'Locale', 'Title', 'Description', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', 'title', 'description', ),
+ BasePeer::TYPE_COLNAME => array (TaxI18nPeer::ID, TaxI18nPeer::LOCALE, TaxI18nPeer::TITLE, TaxI18nPeer::DESCRIPTION, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', 'TITLE', 'DESCRIPTION', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', 'title', 'description', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. TaxI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, 'Title' => 2, 'Description' => 3, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, ),
+ BasePeer::TYPE_COLNAME => array (TaxI18nPeer::ID => 0, TaxI18nPeer::LOCALE => 1, TaxI18nPeer::TITLE => 2, TaxI18nPeer::DESCRIPTION => 3, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, 'title' => 2, 'description' => 3, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = TaxI18nPeer::getFieldNames($toType);
+ $key = isset(TaxI18nPeer::$fieldKeys[$fromType][$name]) ? TaxI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(TaxI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, TaxI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return TaxI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. TaxI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(TaxI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(TaxI18nPeer::ID);
+ $criteria->addSelectColumn(TaxI18nPeer::LOCALE);
+ $criteria->addSelectColumn(TaxI18nPeer::TITLE);
+ $criteria->addSelectColumn(TaxI18nPeer::DESCRIPTION);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(TaxI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ TaxI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(TaxI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return TaxI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = TaxI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return TaxI18nPeer::populateObjects(TaxI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ TaxI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(TaxI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param TaxI18n $obj A TaxI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ TaxI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A TaxI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof TaxI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or TaxI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(TaxI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return TaxI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(TaxI18nPeer::$instances[$key])) {
+ return TaxI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ TaxI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to tax_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = TaxI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = TaxI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = TaxI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ TaxI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (TaxI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = TaxI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = TaxI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + TaxI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = TaxI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ TaxI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related Tax table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinTax(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(TaxI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ TaxI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(TaxI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(TaxI18nPeer::ID, TaxPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of TaxI18n objects pre-filled with their Tax objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of TaxI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinTax(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(TaxI18nPeer::DATABASE_NAME);
+ }
+
+ TaxI18nPeer::addSelectColumns($criteria);
+ $startcol = TaxI18nPeer::NUM_HYDRATE_COLUMNS;
+ TaxPeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(TaxI18nPeer::ID, TaxPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = TaxI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = TaxI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = TaxI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ TaxI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = TaxPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = TaxPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = TaxPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ TaxPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (TaxI18n) to $obj2 (Tax)
+ $obj2->addTaxI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(TaxI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ TaxI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(TaxI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(TaxI18nPeer::ID, TaxPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of TaxI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of TaxI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(TaxI18nPeer::DATABASE_NAME);
+ }
+
+ TaxI18nPeer::addSelectColumns($criteria);
+ $startcol2 = TaxI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ TaxPeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + TaxPeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(TaxI18nPeer::ID, TaxPeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = TaxI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = TaxI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = TaxI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ TaxI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined Tax rows
+
+ $key2 = TaxPeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = TaxPeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = TaxPeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ TaxPeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (TaxI18n) to the collection in $obj2 (Tax)
+ $obj2->addTaxI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(TaxI18nPeer::DATABASE_NAME)->getTable(TaxI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseTaxI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseTaxI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new TaxI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return TaxI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a TaxI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or TaxI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from TaxI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(TaxI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a TaxI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or TaxI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(TaxI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(TaxI18nPeer::ID);
+ $value = $criteria->remove(TaxI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(TaxI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(TaxI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(TaxI18nPeer::LOCALE);
+ $value = $criteria->remove(TaxI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(TaxI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(TaxI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is TaxI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(TaxI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the tax_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(TaxI18nPeer::TABLE_NAME, $con, TaxI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ TaxI18nPeer::clearInstancePool();
+ TaxI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a TaxI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or TaxI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ TaxI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof TaxI18n) { // it's a model object
+ // invalidate the cache for this single object
+ TaxI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(TaxI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(TaxI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(TaxI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ TaxI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(TaxI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ TaxI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given TaxI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param TaxI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(TaxI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(TaxI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(TaxI18nPeer::DATABASE_NAME, TaxI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return TaxI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = TaxI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(TaxI18nPeer::DATABASE_NAME);
+ $criteria->add(TaxI18nPeer::ID, $id);
+ $criteria->add(TaxI18nPeer::LOCALE, $locale);
+ $v = TaxI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseTaxI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseTaxI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseTaxI18nQuery.php b/core/lib/Thelia/Model/om/BaseTaxI18nQuery.php
new file mode 100644
index 000000000..30750361c
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseTaxI18nQuery.php
@@ -0,0 +1,456 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return TaxI18n|TaxI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = TaxI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(TaxI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return TaxI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE`, `TITLE`, `DESCRIPTION` FROM `tax_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new TaxI18n();
+ $obj->hydrate($row);
+ TaxI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return TaxI18n|TaxI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|TaxI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return TaxI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(TaxI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(TaxI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return TaxI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(TaxI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(TaxI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByTax()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return TaxI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(TaxI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return TaxI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(TaxI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return TaxI18nQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(TaxI18nPeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return TaxI18nQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(TaxI18nPeer::DESCRIPTION, $description, $comparison);
+ }
+
+ /**
+ * Filter the query by a related Tax object
+ *
+ * @param Tax|PropelObjectCollection $tax The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return TaxI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByTax($tax, $comparison = null)
+ {
+ if ($tax instanceof Tax) {
+ return $this
+ ->addUsingAlias(TaxI18nPeer::ID, $tax->getId(), $comparison);
+ } elseif ($tax instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(TaxI18nPeer::ID, $tax->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByTax() only accepts arguments of type Tax or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the Tax relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return TaxI18nQuery The current query, for fluid interface
+ */
+ public function joinTax($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('Tax');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'Tax');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the Tax relation Tax object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\TaxQuery A secondary query class using the current class as primary query
+ */
+ public function useTaxQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinTax($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'Tax', '\Thelia\Model\TaxQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param TaxI18n $taxI18n Object to remove from the list of results
+ *
+ * @return TaxI18nQuery The current query, for fluid interface
+ */
+ public function prune($taxI18n = null)
+ {
+ if ($taxI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(TaxI18nPeer::ID), $taxI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(TaxI18nPeer::LOCALE), $taxI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseTaxPeer.php b/core/lib/Thelia/Model/om/BaseTaxPeer.php
index 1615d0f4c..31e205686 100644
--- a/core/lib/Thelia/Model/om/BaseTaxPeer.php
+++ b/core/lib/Thelia/Model/om/BaseTaxPeer.php
@@ -10,7 +10,7 @@ use \Propel;
use \PropelException;
use \PropelPDO;
use Thelia\Model\Tax;
-use Thelia\Model\TaxDescPeer;
+use Thelia\Model\TaxI18nPeer;
use Thelia\Model\TaxPeer;
use Thelia\Model\TaxRuleCountryPeer;
use Thelia\Model\map\TaxTableMap;
@@ -70,6 +70,13 @@ abstract class BaseTaxPeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -379,12 +386,12 @@ abstract class BaseTaxPeer
*/
public static function clearRelatedInstancePool()
{
- // Invalidate objects in TaxDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- TaxDescPeer::clearInstancePool();
// Invalidate objects in TaxRuleCountryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
TaxRuleCountryPeer::clearInstancePool();
+ // Invalidate objects in TaxI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ TaxI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseTaxQuery.php b/core/lib/Thelia/Model/om/BaseTaxQuery.php
index c2853d9d9..e84cc24bd 100644
--- a/core/lib/Thelia/Model/om/BaseTaxQuery.php
+++ b/core/lib/Thelia/Model/om/BaseTaxQuery.php
@@ -13,7 +13,7 @@ use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use Thelia\Model\Tax;
-use Thelia\Model\TaxDesc;
+use Thelia\Model\TaxI18n;
use Thelia\Model\TaxPeer;
use Thelia\Model\TaxQuery;
use Thelia\Model\TaxRuleCountry;
@@ -37,14 +37,14 @@ use Thelia\Model\TaxRuleCountry;
* @method TaxQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method TaxQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
- * @method TaxQuery leftJoinTaxDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the TaxDesc relation
- * @method TaxQuery rightJoinTaxDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxDesc relation
- * @method TaxQuery innerJoinTaxDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxDesc relation
- *
* @method TaxQuery leftJoinTaxRuleCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the TaxRuleCountry relation
* @method TaxQuery rightJoinTaxRuleCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRuleCountry relation
* @method TaxQuery innerJoinTaxRuleCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRuleCountry relation
*
+ * @method TaxQuery leftJoinTaxI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the TaxI18n relation
+ * @method TaxQuery rightJoinTaxI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxI18n relation
+ * @method TaxQuery innerJoinTaxI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxI18n relation
+ *
* @method Tax findOne(PropelPDO $con = null) Return the first Tax matching the query
* @method Tax findOneOrCreate(PropelPDO $con = null) Return the first Tax matching the query, or a new Tax object populated from the query conditions when no match is found
*
@@ -389,80 +389,6 @@ abstract class BaseTaxQuery extends ModelCriteria
return $this->addUsingAlias(TaxPeer::UPDATED_AT, $updatedAt, $comparison);
}
- /**
- * Filter the query by a related TaxDesc object
- *
- * @param TaxDesc|PropelObjectCollection $taxDesc the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return TaxQuery The current query, for fluid interface
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByTaxDesc($taxDesc, $comparison = null)
- {
- if ($taxDesc instanceof TaxDesc) {
- return $this
- ->addUsingAlias(TaxPeer::ID, $taxDesc->getTaxId(), $comparison);
- } elseif ($taxDesc instanceof PropelObjectCollection) {
- return $this
- ->useTaxDescQuery()
- ->filterByPrimaryKeys($taxDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByTaxDesc() only accepts arguments of type TaxDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the TaxDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return TaxQuery The current query, for fluid interface
- */
- public function joinTaxDesc($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('TaxDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'TaxDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the TaxDesc relation TaxDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\TaxDescQuery A secondary query class using the current class as primary query
- */
- public function useTaxDescQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
- {
- return $this
- ->joinTaxDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'TaxDesc', '\Thelia\Model\TaxDescQuery');
- }
-
/**
* Filter the query by a related TaxRuleCountry object
*
@@ -537,6 +463,80 @@ abstract class BaseTaxQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'TaxRuleCountry', '\Thelia\Model\TaxRuleCountryQuery');
}
+ /**
+ * Filter the query by a related TaxI18n object
+ *
+ * @param TaxI18n|PropelObjectCollection $taxI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return TaxQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByTaxI18n($taxI18n, $comparison = null)
+ {
+ if ($taxI18n instanceof TaxI18n) {
+ return $this
+ ->addUsingAlias(TaxPeer::ID, $taxI18n->getId(), $comparison);
+ } elseif ($taxI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useTaxI18nQuery()
+ ->filterByPrimaryKeys($taxI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByTaxI18n() only accepts arguments of type TaxI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the TaxI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return TaxQuery The current query, for fluid interface
+ */
+ public function joinTaxI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('TaxI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'TaxI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the TaxI18n relation TaxI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\TaxI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useTaxI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinTaxI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'TaxI18n', '\Thelia\Model\TaxI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -618,4 +618,61 @@ abstract class BaseTaxQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(TaxPeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return TaxQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'TaxI18n';
+
+ return $this
+ ->joinTaxI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return TaxQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('TaxI18n');
+ $this->with['TaxI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return TaxI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'TaxI18n', 'Thelia\Model\TaxI18nQuery');
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseTaxRule.php b/core/lib/Thelia/Model/om/BaseTaxRule.php
index e6291bd07..e7859aef6 100644
--- a/core/lib/Thelia/Model/om/BaseTaxRule.php
+++ b/core/lib/Thelia/Model/om/BaseTaxRule.php
@@ -20,8 +20,8 @@ use Thelia\Model\ProductQuery;
use Thelia\Model\TaxRule;
use Thelia\Model\TaxRuleCountry;
use Thelia\Model\TaxRuleCountryQuery;
-use Thelia\Model\TaxRuleDesc;
-use Thelia\Model\TaxRuleDescQuery;
+use Thelia\Model\TaxRuleI18n;
+use Thelia\Model\TaxRuleI18nQuery;
use Thelia\Model\TaxRulePeer;
use Thelia\Model\TaxRuleQuery;
@@ -65,6 +65,18 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
*/
protected $code;
+ /**
+ * The value for the title field.
+ * @var string
+ */
+ protected $title;
+
+ /**
+ * The value for the description field.
+ * @var string
+ */
+ protected $description;
+
/**
* The value for the created_at field.
* @var string
@@ -83,18 +95,18 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
protected $collProducts;
protected $collProductsPartial;
- /**
- * @var PropelObjectCollection|TaxRuleDesc[] Collection to store aggregation of TaxRuleDesc objects.
- */
- protected $collTaxRuleDescs;
- protected $collTaxRuleDescsPartial;
-
/**
* @var PropelObjectCollection|TaxRuleCountry[] Collection to store aggregation of TaxRuleCountry objects.
*/
protected $collTaxRuleCountrys;
protected $collTaxRuleCountrysPartial;
+ /**
+ * @var PropelObjectCollection|TaxRuleI18n[] Collection to store aggregation of TaxRuleI18n objects.
+ */
+ protected $collTaxRuleI18ns;
+ protected $collTaxRuleI18nsPartial;
+
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -109,6 +121,20 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
+ // i18n behavior
+
+ /**
+ * Current locale
+ * @var string
+ */
+ protected $currentLocale = 'en_EN';
+
+ /**
+ * Current translation objects
+ * @var array[TaxRuleI18n]
+ */
+ protected $currentTranslations;
+
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
@@ -119,13 +145,13 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
- protected $taxRuleDescsScheduledForDeletion = null;
+ protected $taxRuleCountrysScheduledForDeletion = null;
/**
* An array of objects scheduled for deletion.
* @var PropelObjectCollection
*/
- protected $taxRuleCountrysScheduledForDeletion = null;
+ protected $taxRuleI18nsScheduledForDeletion = null;
/**
* Get the [id] column value.
@@ -147,6 +173,26 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
return $this->code;
}
+ /**
+ * Get the [title] column value.
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Get the [description] column value.
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -263,6 +309,48 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
return $this;
} // setCode()
+ /**
+ * Set the value of [title] column.
+ *
+ * @param string $v new value
+ * @return TaxRule The current object (for fluent API support)
+ */
+ public function setTitle($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->title !== $v) {
+ $this->title = $v;
+ $this->modifiedColumns[] = TaxRulePeer::TITLE;
+ }
+
+
+ return $this;
+ } // setTitle()
+
+ /**
+ * Set the value of [description] column.
+ *
+ * @param string $v new value
+ * @return TaxRule The current object (for fluent API support)
+ */
+ public function setDescription($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->description !== $v) {
+ $this->description = $v;
+ $this->modifiedColumns[] = TaxRulePeer::DESCRIPTION;
+ }
+
+
+ return $this;
+ } // setDescription()
+
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -343,8 +431,10 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->code = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
- $this->created_at = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->updated_at = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->title = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->description = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->created_at = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->updated_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
$this->resetModified();
$this->setNew(false);
@@ -353,7 +443,7 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
$this->ensureConsistency();
}
- return $startcol + 4; // 4 = TaxRulePeer::NUM_HYDRATE_COLUMNS.
+ return $startcol + 6; // 6 = TaxRulePeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating TaxRule object", $e);
@@ -417,10 +507,10 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
$this->collProducts = null;
- $this->collTaxRuleDescs = null;
-
$this->collTaxRuleCountrys = null;
+ $this->collTaxRuleI18ns = null;
+
} // if (deep)
}
@@ -574,24 +664,6 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
}
}
- if ($this->taxRuleDescsScheduledForDeletion !== null) {
- if (!$this->taxRuleDescsScheduledForDeletion->isEmpty()) {
- foreach ($this->taxRuleDescsScheduledForDeletion as $taxRuleDesc) {
- // need to save related object because we set the relation to null
- $taxRuleDesc->save($con);
- }
- $this->taxRuleDescsScheduledForDeletion = null;
- }
- }
-
- if ($this->collTaxRuleDescs !== null) {
- foreach ($this->collTaxRuleDescs as $referrerFK) {
- if (!$referrerFK->isDeleted()) {
- $affectedRows += $referrerFK->save($con);
- }
- }
- }
-
if ($this->taxRuleCountrysScheduledForDeletion !== null) {
if (!$this->taxRuleCountrysScheduledForDeletion->isEmpty()) {
foreach ($this->taxRuleCountrysScheduledForDeletion as $taxRuleCountry) {
@@ -610,6 +682,23 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
}
}
+ if ($this->taxRuleI18nsScheduledForDeletion !== null) {
+ if (!$this->taxRuleI18nsScheduledForDeletion->isEmpty()) {
+ TaxRuleI18nQuery::create()
+ ->filterByPrimaryKeys($this->taxRuleI18nsScheduledForDeletion->getPrimaryKeys(false))
+ ->delete($con);
+ $this->taxRuleI18nsScheduledForDeletion = null;
+ }
+ }
+
+ if ($this->collTaxRuleI18ns !== null) {
+ foreach ($this->collTaxRuleI18ns as $referrerFK) {
+ if (!$referrerFK->isDeleted()) {
+ $affectedRows += $referrerFK->save($con);
+ }
+ }
+ }
+
$this->alreadyInSave = false;
}
@@ -642,6 +731,12 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
if ($this->isColumnModified(TaxRulePeer::CODE)) {
$modifiedColumns[':p' . $index++] = '`CODE`';
}
+ if ($this->isColumnModified(TaxRulePeer::TITLE)) {
+ $modifiedColumns[':p' . $index++] = '`TITLE`';
+ }
+ if ($this->isColumnModified(TaxRulePeer::DESCRIPTION)) {
+ $modifiedColumns[':p' . $index++] = '`DESCRIPTION`';
+ }
if ($this->isColumnModified(TaxRulePeer::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = '`CREATED_AT`';
}
@@ -665,6 +760,12 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
case '`CODE`':
$stmt->bindValue($identifier, $this->code, PDO::PARAM_STR);
break;
+ case '`TITLE`':
+ $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
+ break;
+ case '`DESCRIPTION`':
+ $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
+ break;
case '`CREATED_AT`':
$stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
break;
@@ -778,16 +879,16 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
}
}
- if ($this->collTaxRuleDescs !== null) {
- foreach ($this->collTaxRuleDescs as $referrerFK) {
+ if ($this->collTaxRuleCountrys !== null) {
+ foreach ($this->collTaxRuleCountrys as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
- if ($this->collTaxRuleCountrys !== null) {
- foreach ($this->collTaxRuleCountrys as $referrerFK) {
+ if ($this->collTaxRuleI18ns !== null) {
+ foreach ($this->collTaxRuleI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
@@ -836,9 +937,15 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
return $this->getCode();
break;
case 2:
- return $this->getCreatedAt();
+ return $this->getTitle();
break;
case 3:
+ return $this->getDescription();
+ break;
+ case 4:
+ return $this->getCreatedAt();
+ break;
+ case 5:
return $this->getUpdatedAt();
break;
default:
@@ -872,19 +979,21 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
$result = array(
$keys[0] => $this->getId(),
$keys[1] => $this->getCode(),
- $keys[2] => $this->getCreatedAt(),
- $keys[3] => $this->getUpdatedAt(),
+ $keys[2] => $this->getTitle(),
+ $keys[3] => $this->getDescription(),
+ $keys[4] => $this->getCreatedAt(),
+ $keys[5] => $this->getUpdatedAt(),
);
if ($includeForeignObjects) {
if (null !== $this->collProducts) {
$result['Products'] = $this->collProducts->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
- if (null !== $this->collTaxRuleDescs) {
- $result['TaxRuleDescs'] = $this->collTaxRuleDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
- }
if (null !== $this->collTaxRuleCountrys) {
$result['TaxRuleCountrys'] = $this->collTaxRuleCountrys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
}
+ if (null !== $this->collTaxRuleI18ns) {
+ $result['TaxRuleI18ns'] = $this->collTaxRuleI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
+ }
}
return $result;
@@ -926,9 +1035,15 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
$this->setCode($value);
break;
case 2:
- $this->setCreatedAt($value);
+ $this->setTitle($value);
break;
case 3:
+ $this->setDescription($value);
+ break;
+ case 4:
+ $this->setCreatedAt($value);
+ break;
+ case 5:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -957,8 +1072,10 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]);
- if (array_key_exists($keys[2], $arr)) $this->setCreatedAt($arr[$keys[2]]);
- if (array_key_exists($keys[3], $arr)) $this->setUpdatedAt($arr[$keys[3]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTitle($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
}
/**
@@ -972,6 +1089,8 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
if ($this->isColumnModified(TaxRulePeer::ID)) $criteria->add(TaxRulePeer::ID, $this->id);
if ($this->isColumnModified(TaxRulePeer::CODE)) $criteria->add(TaxRulePeer::CODE, $this->code);
+ if ($this->isColumnModified(TaxRulePeer::TITLE)) $criteria->add(TaxRulePeer::TITLE, $this->title);
+ if ($this->isColumnModified(TaxRulePeer::DESCRIPTION)) $criteria->add(TaxRulePeer::DESCRIPTION, $this->description);
if ($this->isColumnModified(TaxRulePeer::CREATED_AT)) $criteria->add(TaxRulePeer::CREATED_AT, $this->created_at);
if ($this->isColumnModified(TaxRulePeer::UPDATED_AT)) $criteria->add(TaxRulePeer::UPDATED_AT, $this->updated_at);
@@ -1038,6 +1157,8 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setCode($this->getCode());
+ $copyObj->setTitle($this->getTitle());
+ $copyObj->setDescription($this->getDescription());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
@@ -1054,18 +1175,18 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
}
}
- foreach ($this->getTaxRuleDescs() as $relObj) {
- if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
- $copyObj->addTaxRuleDesc($relObj->copy($deepCopy));
- }
- }
-
foreach ($this->getTaxRuleCountrys() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addTaxRuleCountry($relObj->copy($deepCopy));
}
}
+ foreach ($this->getTaxRuleI18ns() as $relObj) {
+ if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
+ $copyObj->addTaxRuleI18n($relObj->copy($deepCopy));
+ }
+ }
+
//unflag object copy
$this->startCopy = false;
} // if ($deepCopy)
@@ -1130,12 +1251,12 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
if ('Product' == $relationName) {
$this->initProducts();
}
- if ('TaxRuleDesc' == $relationName) {
- $this->initTaxRuleDescs();
- }
if ('TaxRuleCountry' == $relationName) {
$this->initTaxRuleCountrys();
}
+ if ('TaxRuleI18n' == $relationName) {
+ $this->initTaxRuleI18ns();
+ }
}
/**
@@ -1345,213 +1466,6 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
}
}
- /**
- * Clears out the collTaxRuleDescs collection
- *
- * This does not modify the database; however, it will remove any associated objects, causing
- * them to be refetched by subsequent calls to accessor method.
- *
- * @return void
- * @see addTaxRuleDescs()
- */
- public function clearTaxRuleDescs()
- {
- $this->collTaxRuleDescs = null; // important to set this to null since that means it is uninitialized
- $this->collTaxRuleDescsPartial = null;
- }
-
- /**
- * reset is the collTaxRuleDescs collection loaded partially
- *
- * @return void
- */
- public function resetPartialTaxRuleDescs($v = true)
- {
- $this->collTaxRuleDescsPartial = $v;
- }
-
- /**
- * Initializes the collTaxRuleDescs collection.
- *
- * By default this just sets the collTaxRuleDescs collection to an empty array (like clearcollTaxRuleDescs());
- * 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.
- *
- * @param boolean $overrideExisting If set to true, the method call initializes
- * the collection even if it is not empty
- *
- * @return void
- */
- public function initTaxRuleDescs($overrideExisting = true)
- {
- if (null !== $this->collTaxRuleDescs && !$overrideExisting) {
- return;
- }
- $this->collTaxRuleDescs = new PropelObjectCollection();
- $this->collTaxRuleDescs->setModel('TaxRuleDesc');
- }
-
- /**
- * Gets an array of TaxRuleDesc objects which contain a foreign key that references this object.
- *
- * If the $criteria is not null, it is used to always fetch the results from the database.
- * Otherwise the results are fetched from the database the first time, then cached.
- * Next time the same method is called without $criteria, the cached collection is returned.
- * If this TaxRule is new, it will return
- * an empty collection or the current collection; the criteria is ignored on a new object.
- *
- * @param Criteria $criteria optional Criteria object to narrow the query
- * @param PropelPDO $con optional connection object
- * @return PropelObjectCollection|TaxRuleDesc[] List of TaxRuleDesc objects
- * @throws PropelException
- */
- public function getTaxRuleDescs($criteria = null, PropelPDO $con = null)
- {
- $partial = $this->collTaxRuleDescsPartial && !$this->isNew();
- if (null === $this->collTaxRuleDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collTaxRuleDescs) {
- // return empty collection
- $this->initTaxRuleDescs();
- } else {
- $collTaxRuleDescs = TaxRuleDescQuery::create(null, $criteria)
- ->filterByTaxRule($this)
- ->find($con);
- if (null !== $criteria) {
- if (false !== $this->collTaxRuleDescsPartial && count($collTaxRuleDescs)) {
- $this->initTaxRuleDescs(false);
-
- foreach($collTaxRuleDescs as $obj) {
- if (false == $this->collTaxRuleDescs->contains($obj)) {
- $this->collTaxRuleDescs->append($obj);
- }
- }
-
- $this->collTaxRuleDescsPartial = true;
- }
-
- return $collTaxRuleDescs;
- }
-
- if($partial && $this->collTaxRuleDescs) {
- foreach($this->collTaxRuleDescs as $obj) {
- if($obj->isNew()) {
- $collTaxRuleDescs[] = $obj;
- }
- }
- }
-
- $this->collTaxRuleDescs = $collTaxRuleDescs;
- $this->collTaxRuleDescsPartial = false;
- }
- }
-
- return $this->collTaxRuleDescs;
- }
-
- /**
- * Sets a collection of TaxRuleDesc objects related by a one-to-many relationship
- * to the current object.
- * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
- * and new objects from the given Propel collection.
- *
- * @param PropelCollection $taxRuleDescs A Propel collection.
- * @param PropelPDO $con Optional connection object
- */
- public function setTaxRuleDescs(PropelCollection $taxRuleDescs, PropelPDO $con = null)
- {
- $this->taxRuleDescsScheduledForDeletion = $this->getTaxRuleDescs(new Criteria(), $con)->diff($taxRuleDescs);
-
- foreach ($this->taxRuleDescsScheduledForDeletion as $taxRuleDescRemoved) {
- $taxRuleDescRemoved->setTaxRule(null);
- }
-
- $this->collTaxRuleDescs = null;
- foreach ($taxRuleDescs as $taxRuleDesc) {
- $this->addTaxRuleDesc($taxRuleDesc);
- }
-
- $this->collTaxRuleDescs = $taxRuleDescs;
- $this->collTaxRuleDescsPartial = false;
- }
-
- /**
- * Returns the number of related TaxRuleDesc objects.
- *
- * @param Criteria $criteria
- * @param boolean $distinct
- * @param PropelPDO $con
- * @return int Count of related TaxRuleDesc objects.
- * @throws PropelException
- */
- public function countTaxRuleDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
- {
- $partial = $this->collTaxRuleDescsPartial && !$this->isNew();
- if (null === $this->collTaxRuleDescs || null !== $criteria || $partial) {
- if ($this->isNew() && null === $this->collTaxRuleDescs) {
- return 0;
- } else {
- if($partial && !$criteria) {
- return count($this->getTaxRuleDescs());
- }
- $query = TaxRuleDescQuery::create(null, $criteria);
- if ($distinct) {
- $query->distinct();
- }
-
- return $query
- ->filterByTaxRule($this)
- ->count($con);
- }
- } else {
- return count($this->collTaxRuleDescs);
- }
- }
-
- /**
- * Method called to associate a TaxRuleDesc object to this object
- * through the TaxRuleDesc foreign key attribute.
- *
- * @param TaxRuleDesc $l TaxRuleDesc
- * @return TaxRule The current object (for fluent API support)
- */
- public function addTaxRuleDesc(TaxRuleDesc $l)
- {
- if ($this->collTaxRuleDescs === null) {
- $this->initTaxRuleDescs();
- $this->collTaxRuleDescsPartial = true;
- }
- if (!$this->collTaxRuleDescs->contains($l)) { // only add it if the **same** object is not already associated
- $this->doAddTaxRuleDesc($l);
- }
-
- return $this;
- }
-
- /**
- * @param TaxRuleDesc $taxRuleDesc The taxRuleDesc object to add.
- */
- protected function doAddTaxRuleDesc($taxRuleDesc)
- {
- $this->collTaxRuleDescs[]= $taxRuleDesc;
- $taxRuleDesc->setTaxRule($this);
- }
-
- /**
- * @param TaxRuleDesc $taxRuleDesc The taxRuleDesc object to remove.
- */
- public function removeTaxRuleDesc($taxRuleDesc)
- {
- if ($this->getTaxRuleDescs()->contains($taxRuleDesc)) {
- $this->collTaxRuleDescs->remove($this->collTaxRuleDescs->search($taxRuleDesc));
- if (null === $this->taxRuleDescsScheduledForDeletion) {
- $this->taxRuleDescsScheduledForDeletion = clone $this->collTaxRuleDescs;
- $this->taxRuleDescsScheduledForDeletion->clear();
- }
- $this->taxRuleDescsScheduledForDeletion[]= $taxRuleDesc;
- $taxRuleDesc->setTaxRule(null);
- }
- }
-
/**
* Clears out the collTaxRuleCountrys collection
*
@@ -1809,6 +1723,217 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
return $this->getTaxRuleCountrys($query, $con);
}
+ /**
+ * Clears out the collTaxRuleI18ns collection
+ *
+ * This does not modify the database; however, it will remove any associated objects, causing
+ * them to be refetched by subsequent calls to accessor method.
+ *
+ * @return void
+ * @see addTaxRuleI18ns()
+ */
+ public function clearTaxRuleI18ns()
+ {
+ $this->collTaxRuleI18ns = null; // important to set this to null since that means it is uninitialized
+ $this->collTaxRuleI18nsPartial = null;
+ }
+
+ /**
+ * reset is the collTaxRuleI18ns collection loaded partially
+ *
+ * @return void
+ */
+ public function resetPartialTaxRuleI18ns($v = true)
+ {
+ $this->collTaxRuleI18nsPartial = $v;
+ }
+
+ /**
+ * Initializes the collTaxRuleI18ns collection.
+ *
+ * By default this just sets the collTaxRuleI18ns collection to an empty array (like clearcollTaxRuleI18ns());
+ * 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.
+ *
+ * @param boolean $overrideExisting If set to true, the method call initializes
+ * the collection even if it is not empty
+ *
+ * @return void
+ */
+ public function initTaxRuleI18ns($overrideExisting = true)
+ {
+ if (null !== $this->collTaxRuleI18ns && !$overrideExisting) {
+ return;
+ }
+ $this->collTaxRuleI18ns = new PropelObjectCollection();
+ $this->collTaxRuleI18ns->setModel('TaxRuleI18n');
+ }
+
+ /**
+ * Gets an array of TaxRuleI18n objects which contain a foreign key that references this object.
+ *
+ * If the $criteria is not null, it is used to always fetch the results from the database.
+ * Otherwise the results are fetched from the database the first time, then cached.
+ * Next time the same method is called without $criteria, the cached collection is returned.
+ * If this TaxRule is new, it will return
+ * an empty collection or the current collection; the criteria is ignored on a new object.
+ *
+ * @param Criteria $criteria optional Criteria object to narrow the query
+ * @param PropelPDO $con optional connection object
+ * @return PropelObjectCollection|TaxRuleI18n[] List of TaxRuleI18n objects
+ * @throws PropelException
+ */
+ public function getTaxRuleI18ns($criteria = null, PropelPDO $con = null)
+ {
+ $partial = $this->collTaxRuleI18nsPartial && !$this->isNew();
+ if (null === $this->collTaxRuleI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collTaxRuleI18ns) {
+ // return empty collection
+ $this->initTaxRuleI18ns();
+ } else {
+ $collTaxRuleI18ns = TaxRuleI18nQuery::create(null, $criteria)
+ ->filterByTaxRule($this)
+ ->find($con);
+ if (null !== $criteria) {
+ if (false !== $this->collTaxRuleI18nsPartial && count($collTaxRuleI18ns)) {
+ $this->initTaxRuleI18ns(false);
+
+ foreach($collTaxRuleI18ns as $obj) {
+ if (false == $this->collTaxRuleI18ns->contains($obj)) {
+ $this->collTaxRuleI18ns->append($obj);
+ }
+ }
+
+ $this->collTaxRuleI18nsPartial = true;
+ }
+
+ return $collTaxRuleI18ns;
+ }
+
+ if($partial && $this->collTaxRuleI18ns) {
+ foreach($this->collTaxRuleI18ns as $obj) {
+ if($obj->isNew()) {
+ $collTaxRuleI18ns[] = $obj;
+ }
+ }
+ }
+
+ $this->collTaxRuleI18ns = $collTaxRuleI18ns;
+ $this->collTaxRuleI18nsPartial = false;
+ }
+ }
+
+ return $this->collTaxRuleI18ns;
+ }
+
+ /**
+ * Sets a collection of TaxRuleI18n objects related by a one-to-many relationship
+ * to the current object.
+ * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
+ * and new objects from the given Propel collection.
+ *
+ * @param PropelCollection $taxRuleI18ns A Propel collection.
+ * @param PropelPDO $con Optional connection object
+ */
+ public function setTaxRuleI18ns(PropelCollection $taxRuleI18ns, PropelPDO $con = null)
+ {
+ $this->taxRuleI18nsScheduledForDeletion = $this->getTaxRuleI18ns(new Criteria(), $con)->diff($taxRuleI18ns);
+
+ foreach ($this->taxRuleI18nsScheduledForDeletion as $taxRuleI18nRemoved) {
+ $taxRuleI18nRemoved->setTaxRule(null);
+ }
+
+ $this->collTaxRuleI18ns = null;
+ foreach ($taxRuleI18ns as $taxRuleI18n) {
+ $this->addTaxRuleI18n($taxRuleI18n);
+ }
+
+ $this->collTaxRuleI18ns = $taxRuleI18ns;
+ $this->collTaxRuleI18nsPartial = false;
+ }
+
+ /**
+ * Returns the number of related TaxRuleI18n objects.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct
+ * @param PropelPDO $con
+ * @return int Count of related TaxRuleI18n objects.
+ * @throws PropelException
+ */
+ public function countTaxRuleI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
+ {
+ $partial = $this->collTaxRuleI18nsPartial && !$this->isNew();
+ if (null === $this->collTaxRuleI18ns || null !== $criteria || $partial) {
+ if ($this->isNew() && null === $this->collTaxRuleI18ns) {
+ return 0;
+ } else {
+ if($partial && !$criteria) {
+ return count($this->getTaxRuleI18ns());
+ }
+ $query = TaxRuleI18nQuery::create(null, $criteria);
+ if ($distinct) {
+ $query->distinct();
+ }
+
+ return $query
+ ->filterByTaxRule($this)
+ ->count($con);
+ }
+ } else {
+ return count($this->collTaxRuleI18ns);
+ }
+ }
+
+ /**
+ * Method called to associate a TaxRuleI18n object to this object
+ * through the TaxRuleI18n foreign key attribute.
+ *
+ * @param TaxRuleI18n $l TaxRuleI18n
+ * @return TaxRule The current object (for fluent API support)
+ */
+ public function addTaxRuleI18n(TaxRuleI18n $l)
+ {
+ if ($l && $locale = $l->getLocale()) {
+ $this->setLocale($locale);
+ $this->currentTranslations[$locale] = $l;
+ }
+ if ($this->collTaxRuleI18ns === null) {
+ $this->initTaxRuleI18ns();
+ $this->collTaxRuleI18nsPartial = true;
+ }
+ if (!$this->collTaxRuleI18ns->contains($l)) { // only add it if the **same** object is not already associated
+ $this->doAddTaxRuleI18n($l);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param TaxRuleI18n $taxRuleI18n The taxRuleI18n object to add.
+ */
+ protected function doAddTaxRuleI18n($taxRuleI18n)
+ {
+ $this->collTaxRuleI18ns[]= $taxRuleI18n;
+ $taxRuleI18n->setTaxRule($this);
+ }
+
+ /**
+ * @param TaxRuleI18n $taxRuleI18n The taxRuleI18n object to remove.
+ */
+ public function removeTaxRuleI18n($taxRuleI18n)
+ {
+ if ($this->getTaxRuleI18ns()->contains($taxRuleI18n)) {
+ $this->collTaxRuleI18ns->remove($this->collTaxRuleI18ns->search($taxRuleI18n));
+ if (null === $this->taxRuleI18nsScheduledForDeletion) {
+ $this->taxRuleI18nsScheduledForDeletion = clone $this->collTaxRuleI18ns;
+ $this->taxRuleI18nsScheduledForDeletion->clear();
+ }
+ $this->taxRuleI18nsScheduledForDeletion[]= $taxRuleI18n;
+ $taxRuleI18n->setTaxRule(null);
+ }
+ }
+
/**
* Clears the current object and sets all attributes to their default values
*/
@@ -1816,6 +1941,8 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
{
$this->id = null;
$this->code = null;
+ $this->title = null;
+ $this->description = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
@@ -1843,30 +1970,34 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
$o->clearAllReferences($deep);
}
}
- if ($this->collTaxRuleDescs) {
- foreach ($this->collTaxRuleDescs as $o) {
- $o->clearAllReferences($deep);
- }
- }
if ($this->collTaxRuleCountrys) {
foreach ($this->collTaxRuleCountrys as $o) {
$o->clearAllReferences($deep);
}
}
+ if ($this->collTaxRuleI18ns) {
+ foreach ($this->collTaxRuleI18ns as $o) {
+ $o->clearAllReferences($deep);
+ }
+ }
} // if ($deep)
+ // i18n behavior
+ $this->currentLocale = 'en_EN';
+ $this->currentTranslations = null;
+
if ($this->collProducts instanceof PropelCollection) {
$this->collProducts->clearIterator();
}
$this->collProducts = null;
- if ($this->collTaxRuleDescs instanceof PropelCollection) {
- $this->collTaxRuleDescs->clearIterator();
- }
- $this->collTaxRuleDescs = null;
if ($this->collTaxRuleCountrys instanceof PropelCollection) {
$this->collTaxRuleCountrys->clearIterator();
}
$this->collTaxRuleCountrys = null;
+ if ($this->collTaxRuleI18ns instanceof PropelCollection) {
+ $this->collTaxRuleI18ns->clearIterator();
+ }
+ $this->collTaxRuleI18ns = null;
}
/**
@@ -1903,4 +2034,103 @@ abstract class BaseTaxRule extends BaseObject implements Persistent
return $this;
}
+ // i18n behavior
+
+ /**
+ * Sets the locale for translations
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ *
+ * @return TaxRule The current object (for fluent API support)
+ */
+ public function setLocale($locale = 'en_EN')
+ {
+ $this->currentLocale = $locale;
+
+ return $this;
+ }
+
+ /**
+ * Gets the locale for translations
+ *
+ * @return string $locale Locale to use for the translation, e.g. 'fr_FR'
+ */
+ public function getLocale()
+ {
+ return $this->currentLocale;
+ }
+
+ /**
+ * Returns the current translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return TaxRuleI18n */
+ public function getTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!isset($this->currentTranslations[$locale])) {
+ if (null !== $this->collTaxRuleI18ns) {
+ foreach ($this->collTaxRuleI18ns as $translation) {
+ if ($translation->getLocale() == $locale) {
+ $this->currentTranslations[$locale] = $translation;
+
+ return $translation;
+ }
+ }
+ }
+ if ($this->isNew()) {
+ $translation = new TaxRuleI18n();
+ $translation->setLocale($locale);
+ } else {
+ $translation = TaxRuleI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->findOneOrCreate($con);
+ $this->currentTranslations[$locale] = $translation;
+ }
+ $this->addTaxRuleI18n($translation);
+ }
+
+ return $this->currentTranslations[$locale];
+ }
+
+ /**
+ * Remove the translation for a given locale
+ *
+ * @param string $locale Locale to use for the translation, e.g. 'fr_FR'
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return TaxRule The current object (for fluent API support)
+ */
+ public function removeTranslation($locale = 'en_EN', PropelPDO $con = null)
+ {
+ if (!$this->isNew()) {
+ TaxRuleI18nQuery::create()
+ ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
+ ->delete($con);
+ }
+ if (isset($this->currentTranslations[$locale])) {
+ unset($this->currentTranslations[$locale]);
+ }
+ foreach ($this->collTaxRuleI18ns as $key => $translation) {
+ if ($translation->getLocale() == $locale) {
+ unset($this->collTaxRuleI18ns[$key]);
+ break;
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the current translation
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return TaxRuleI18n */
+ public function getCurrentTranslation(PropelPDO $con = null)
+ {
+ return $this->getTranslation($this->getLocale(), $con);
+ }
+
}
diff --git a/core/lib/Thelia/Model/om/BaseTaxRuleI18n.php b/core/lib/Thelia/Model/om/BaseTaxRuleI18n.php
new file mode 100644
index 000000000..5735f6b9a
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseTaxRuleI18n.php
@@ -0,0 +1,953 @@
+locale = 'en_EN';
+ }
+
+ /**
+ * Initializes internal state of BaseTaxRuleI18n object.
+ * @see applyDefaults()
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->applyDefaultValues();
+ }
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Get the [locale] column value.
+ *
+ * @return string
+ */
+ public function getLocale()
+ {
+ return $this->locale;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return TaxRuleI18n The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = TaxRuleI18nPeer::ID;
+ }
+
+ if ($this->aTaxRule !== null && $this->aTaxRule->getId() !== $v) {
+ $this->aTaxRule = null;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [locale] column.
+ *
+ * @param string $v new value
+ * @return TaxRuleI18n The current object (for fluent API support)
+ */
+ public function setLocale($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->locale !== $v) {
+ $this->locale = $v;
+ $this->modifiedColumns[] = TaxRuleI18nPeer::LOCALE;
+ }
+
+
+ return $this;
+ } // setLocale()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ if ($this->locale !== 'en_EN') {
+ return false;
+ }
+
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which restultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->locale = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+
+ return $startcol + 2; // 2 = TaxRuleI18nPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating TaxRuleI18n object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ if ($this->aTaxRule !== null && $this->id !== $this->aTaxRule->getId()) {
+ $this->aTaxRule = null;
+ }
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ public function reload($deep = false, PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("Cannot reload a deleted object.");
+ }
+
+ if ($this->isNew()) {
+ throw new PropelException("Cannot reload an unsaved object.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = TaxRuleI18nPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
+ $row = $stmt->fetch(PDO::FETCH_NUM);
+ $stmt->closeCursor();
+ if (!$row) {
+ throw new PropelException('Cannot find matching row in the database to reload object values.');
+ }
+ $this->hydrate($row, 0, true); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ $this->aTaxRule = null;
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = TaxRuleI18nQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ TaxRuleI18nPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ // We call the save method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aTaxRule !== null) {
+ if ($this->aTaxRule->isModified() || $this->aTaxRule->isNew()) {
+ $affectedRows += $this->aTaxRule->save($con);
+ }
+ $this->setTaxRule($this->aTaxRule);
+ }
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(TaxRuleI18nPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`ID`';
+ }
+ if ($this->isColumnModified(TaxRuleI18nPeer::LOCALE)) {
+ $modifiedColumns[':p' . $index++] = '`LOCALE`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `tax_rule_i18n` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`ID`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`LOCALE`':
+ $stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ } else {
+ $this->validationFailures = $res;
+
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass; array of ValidationFailed objets otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ // We call the validate method on the following object(s) if they
+ // were passed to this object by their coresponding set
+ // method. This object relates to these object(s) by a
+ // foreign key reference.
+
+ if ($this->aTaxRule !== null) {
+ if (!$this->aTaxRule->validate($columns)) {
+ $failureMap = array_merge($failureMap, $this->aTaxRule->getValidationFailures());
+ }
+ }
+
+
+ if (($retval = TaxRuleI18nPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = TaxRuleI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getLocale();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
+ {
+ if (isset($alreadyDumpedObjects['TaxRuleI18n'][serialize($this->getPrimaryKey())])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['TaxRuleI18n'][serialize($this->getPrimaryKey())] = true;
+ $keys = TaxRuleI18nPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getLocale(),
+ );
+ if ($includeForeignObjects) {
+ if (null !== $this->aTaxRule) {
+ $result['TaxRule'] = $this->aTaxRule->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = TaxRuleI18nPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setLocale($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = TaxRuleI18nPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setLocale($arr[$keys[1]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(TaxRuleI18nPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(TaxRuleI18nPeer::ID)) $criteria->add(TaxRuleI18nPeer::ID, $this->id);
+ if ($this->isColumnModified(TaxRuleI18nPeer::LOCALE)) $criteria->add(TaxRuleI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(TaxRuleI18nPeer::DATABASE_NAME);
+ $criteria->add(TaxRuleI18nPeer::ID, $this->id);
+ $criteria->add(TaxRuleI18nPeer::LOCALE, $this->locale);
+
+ return $criteria;
+ }
+
+ /**
+ * 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()
+ {
+ $pks = array();
+ $pks[0] = $this->getId();
+ $pks[1] = $this->getLocale();
+
+ return $pks;
+ }
+
+ /**
+ * Set the [composite] primary key.
+ *
+ * @param array $keys The elements of the composite key (order must match the order in XML file).
+ * @return void
+ */
+ public function setPrimaryKey($keys)
+ {
+ $this->setId($keys[0]);
+ $this->setLocale($keys[1]);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return (null === $this->getId()) && (null === $this->getLocale());
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of TaxRuleI18n (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setId($this->getId());
+ $copyObj->setLocale($this->getLocale());
+
+ if ($deepCopy && !$this->startCopy) {
+ // important: temporarily setNew(false) because this affects the behavior of
+ // the getter/setter methods for fkey referrer objects.
+ $copyObj->setNew(false);
+ // store object hash to prevent cycle
+ $this->startCopy = true;
+
+ //unflag object copy
+ $this->startCopy = false;
+ } // if ($deepCopy)
+
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return TaxRuleI18n Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return TaxRuleI18nPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new TaxRuleI18nPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Declares an association between this object and a TaxRule object.
+ *
+ * @param TaxRule $v
+ * @return TaxRuleI18n The current object (for fluent API support)
+ * @throws PropelException
+ */
+ public function setTaxRule(TaxRule $v = null)
+ {
+ if ($v === null) {
+ $this->setId(NULL);
+ } else {
+ $this->setId($v->getId());
+ }
+
+ $this->aTaxRule = $v;
+
+ // Add binding for other direction of this n:n relationship.
+ // If this object has already been added to the TaxRule object, it will not be re-added.
+ if ($v !== null) {
+ $v->addTaxRuleI18n($this);
+ }
+
+
+ return $this;
+ }
+
+
+ /**
+ * Get the associated TaxRule object
+ *
+ * @param PropelPDO $con Optional Connection object.
+ * @return TaxRule The associated TaxRule object.
+ * @throws PropelException
+ */
+ public function getTaxRule(PropelPDO $con = null)
+ {
+ if ($this->aTaxRule === null && ($this->id !== null)) {
+ $this->aTaxRule = TaxRuleQuery::create()->findPk($this->id, $con);
+ /* The following can be used additionally to
+ guarantee the related object contains a reference
+ to this object. This level of coupling may, however, be
+ undesirable since it could result in an only partially populated collection
+ in the referenced object.
+ $this->aTaxRule->addTaxRuleI18ns($this);
+ */
+ }
+
+ return $this->aTaxRule;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->locale = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->clearAllReferences();
+ $this->applyDefaultValues();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volumne/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep) {
+ } // if ($deep)
+
+ $this->aTaxRule = null;
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(TaxRuleI18nPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseTaxRuleI18nPeer.php b/core/lib/Thelia/Model/om/BaseTaxRuleI18nPeer.php
new file mode 100644
index 000000000..46740708d
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseTaxRuleI18nPeer.php
@@ -0,0 +1,989 @@
+ array ('Id', 'Locale', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'locale', ),
+ BasePeer::TYPE_COLNAME => array (TaxRuleI18nPeer::ID, TaxRuleI18nPeer::LOCALE, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'locale', ),
+ BasePeer::TYPE_NUM => array (0, 1, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. TaxRuleI18nPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Locale' => 1, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'locale' => 1, ),
+ BasePeer::TYPE_COLNAME => array (TaxRuleI18nPeer::ID => 0, TaxRuleI18nPeer::LOCALE => 1, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE' => 1, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale' => 1, ),
+ BasePeer::TYPE_NUM => array (0, 1, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = TaxRuleI18nPeer::getFieldNames($toType);
+ $key = isset(TaxRuleI18nPeer::$fieldKeys[$fromType][$name]) ? TaxRuleI18nPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(TaxRuleI18nPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, TaxRuleI18nPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return TaxRuleI18nPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. TaxRuleI18nPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(TaxRuleI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(TaxRuleI18nPeer::ID);
+ $criteria->addSelectColumn(TaxRuleI18nPeer::LOCALE);
+ } else {
+ $criteria->addSelectColumn($alias . '.ID');
+ $criteria->addSelectColumn($alias . '.LOCALE');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(TaxRuleI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ TaxRuleI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(TaxRuleI18nPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return TaxRuleI18n
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = TaxRuleI18nPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return TaxRuleI18nPeer::populateObjects(TaxRuleI18nPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement durirectly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ TaxRuleI18nPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(TaxRuleI18nPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param TaxRuleI18n $obj A TaxRuleI18n object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = serialize(array((string) $obj->getId(), (string) $obj->getLocale()));
+ } // if key === null
+ TaxRuleI18nPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A TaxRuleI18n object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof TaxRuleI18n) {
+ $key = serialize(array((string) $value->getId(), (string) $value->getLocale()));
+ } elseif (is_array($value) && count($value) === 2) {
+ // assume we've been passed a primary key
+ $key = serialize(array((string) $value[0], (string) $value[1]));
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or TaxRuleI18n object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(TaxRuleI18nPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return TaxRuleI18n Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(TaxRuleI18nPeer::$instances[$key])) {
+ return TaxRuleI18nPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool()
+ {
+ TaxRuleI18nPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to tax_rule_i18n
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null && $row[$startcol + 1] === null) {
+ return null;
+ }
+
+ return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1]));
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return array((int) $row[$startcol], (string) $row[$startcol + 1]);
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = TaxRuleI18nPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = TaxRuleI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = TaxRuleI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ TaxRuleI18nPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (TaxRuleI18n object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = TaxRuleI18nPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = TaxRuleI18nPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + TaxRuleI18nPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = TaxRuleI18nPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ TaxRuleI18nPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining the related TaxRule table
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinTaxRule(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(TaxRuleI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ TaxRuleI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(TaxRuleI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(TaxRuleI18nPeer::ID, TaxRulePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+
+ /**
+ * Selects a collection of TaxRuleI18n objects pre-filled with their TaxRule objects.
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of TaxRuleI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinTaxRule(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(TaxRuleI18nPeer::DATABASE_NAME);
+ }
+
+ TaxRuleI18nPeer::addSelectColumns($criteria);
+ $startcol = TaxRuleI18nPeer::NUM_HYDRATE_COLUMNS;
+ TaxRulePeer::addSelectColumns($criteria);
+
+ $criteria->addJoin(TaxRuleI18nPeer::ID, TaxRulePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = TaxRuleI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = TaxRuleI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+
+ $cls = TaxRuleI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ TaxRuleI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if $obj1 already loaded
+
+ $key2 = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if ($key2 !== null) {
+ $obj2 = TaxRulePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = TaxRulePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol);
+ TaxRulePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 already loaded
+
+ // Add the $obj1 (TaxRuleI18n) to $obj2 (TaxRule)
+ $obj2->addTaxRuleI18n($obj1);
+
+ } // if joined row was not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+
+ /**
+ * Returns the number of rows matching criteria, joining all related tables
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return int Number of matching rows.
+ */
+ public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(TaxRuleI18nPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ TaxRuleI18nPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+
+ // Set the correct dbName
+ $criteria->setDbName(TaxRuleI18nPeer::DATABASE_NAME);
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria->addJoin(TaxRuleI18nPeer::ID, TaxRulePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+
+ /**
+ * Selects a collection of TaxRuleI18n objects pre-filled with all related objects.
+ *
+ * @param Criteria $criteria
+ * @param PropelPDO $con
+ * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
+ * @return array Array of TaxRuleI18n objects.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
+ {
+ $criteria = clone $criteria;
+
+ // Set the correct dbName if it has not been overridden
+ if ($criteria->getDbName() == Propel::getDefaultDB()) {
+ $criteria->setDbName(TaxRuleI18nPeer::DATABASE_NAME);
+ }
+
+ TaxRuleI18nPeer::addSelectColumns($criteria);
+ $startcol2 = TaxRuleI18nPeer::NUM_HYDRATE_COLUMNS;
+
+ TaxRulePeer::addSelectColumns($criteria);
+ $startcol3 = $startcol2 + TaxRulePeer::NUM_HYDRATE_COLUMNS;
+
+ $criteria->addJoin(TaxRuleI18nPeer::ID, TaxRulePeer::ID, $join_behavior);
+
+ $stmt = BasePeer::doSelect($criteria, $con);
+ $results = array();
+
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key1 = TaxRuleI18nPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj1 = TaxRuleI18nPeer::getInstanceFromPool($key1))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj1->hydrate($row, 0, true); // rehydrate
+ } else {
+ $cls = TaxRuleI18nPeer::getOMClass();
+
+ $obj1 = new $cls();
+ $obj1->hydrate($row);
+ TaxRuleI18nPeer::addInstanceToPool($obj1, $key1);
+ } // if obj1 already loaded
+
+ // Add objects for joined TaxRule rows
+
+ $key2 = TaxRulePeer::getPrimaryKeyHashFromRow($row, $startcol2);
+ if ($key2 !== null) {
+ $obj2 = TaxRulePeer::getInstanceFromPool($key2);
+ if (!$obj2) {
+
+ $cls = TaxRulePeer::getOMClass();
+
+ $obj2 = new $cls();
+ $obj2->hydrate($row, $startcol2);
+ TaxRulePeer::addInstanceToPool($obj2, $key2);
+ } // if obj2 loaded
+
+ // Add the $obj1 (TaxRuleI18n) to the collection in $obj2 (TaxRule)
+ $obj2->addTaxRuleI18n($obj1);
+ } // if joined row not null
+
+ $results[] = $obj1;
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(TaxRuleI18nPeer::DATABASE_NAME)->getTable(TaxRuleI18nPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseTaxRuleI18nPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseTaxRuleI18nPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new TaxRuleI18nTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass()
+ {
+ return TaxRuleI18nPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a TaxRuleI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or TaxRuleI18n object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from TaxRuleI18n object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(TaxRuleI18nPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a TaxRuleI18n or Criteria object.
+ *
+ * @param mixed $values Criteria or TaxRuleI18n object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(TaxRuleI18nPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(TaxRuleI18nPeer::ID);
+ $value = $criteria->remove(TaxRuleI18nPeer::ID);
+ if ($value) {
+ $selectCriteria->add(TaxRuleI18nPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(TaxRuleI18nPeer::TABLE_NAME);
+ }
+
+ $comparison = $criteria->getComparison(TaxRuleI18nPeer::LOCALE);
+ $value = $criteria->remove(TaxRuleI18nPeer::LOCALE);
+ if ($value) {
+ $selectCriteria->add(TaxRuleI18nPeer::LOCALE, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(TaxRuleI18nPeer::TABLE_NAME);
+ }
+
+ } else { // $values is TaxRuleI18n object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(TaxRuleI18nPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the tax_rule_i18n table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(TaxRuleI18nPeer::TABLE_NAME, $con, TaxRuleI18nPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ TaxRuleI18nPeer::clearInstancePool();
+ TaxRuleI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a TaxRuleI18n or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or TaxRuleI18n object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ TaxRuleI18nPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof TaxRuleI18n) { // it's a model object
+ // invalidate the cache for this single object
+ TaxRuleI18nPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(TaxRuleI18nPeer::DATABASE_NAME);
+ // primary key is composite; we therefore, expect
+ // the primary key passed to be an array of pkey values
+ if (count($values) == count($values, COUNT_RECURSIVE)) {
+ // array is not multi-dimensional
+ $values = array($values);
+ }
+ foreach ($values as $value) {
+ $criterion = $criteria->getNewCriterion(TaxRuleI18nPeer::ID, $value[0]);
+ $criterion->addAnd($criteria->getNewCriterion(TaxRuleI18nPeer::LOCALE, $value[1]));
+ $criteria->addOr($criterion);
+ // we can invalidate the cache for this single PK
+ TaxRuleI18nPeer::removeInstanceFromPool($value);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(TaxRuleI18nPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ TaxRuleI18nPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given TaxRuleI18n object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param TaxRuleI18n $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(TaxRuleI18nPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(TaxRuleI18nPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(TaxRuleI18nPeer::DATABASE_NAME, TaxRuleI18nPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve object using using composite pkey values.
+ * @param int $id
+ * @param string $locale
+ * @param PropelPDO $con
+ * @return TaxRuleI18n
+ */
+ public static function retrieveByPK($id, $locale, PropelPDO $con = null) {
+ $_instancePoolKey = serialize(array((string) $id, (string) $locale));
+ if (null !== ($obj = TaxRuleI18nPeer::getInstanceFromPool($_instancePoolKey))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $criteria = new Criteria(TaxRuleI18nPeer::DATABASE_NAME);
+ $criteria->add(TaxRuleI18nPeer::ID, $id);
+ $criteria->add(TaxRuleI18nPeer::LOCALE, $locale);
+ $v = TaxRuleI18nPeer::doSelect($criteria, $con);
+
+ return !empty($v) ? $v[0] : null;
+ }
+} // BaseTaxRuleI18nPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseTaxRuleI18nPeer::buildTableMap();
+
diff --git a/core/lib/Thelia/Model/om/BaseTaxRuleI18nQuery.php b/core/lib/Thelia/Model/om/BaseTaxRuleI18nQuery.php
new file mode 100644
index 000000000..85dcf2fc8
--- /dev/null
+++ b/core/lib/Thelia/Model/om/BaseTaxRuleI18nQuery.php
@@ -0,0 +1,390 @@
+setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ *
+ * $obj = $c->findPk(array(12, 34), $con);
+ *
+ *
+ * @param array $key Primary key to use for the query
+ A Primary key composition: [$id, $locale]
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return TaxRuleI18n|TaxRuleI18n[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = TaxRuleI18nPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
+ // the object is alredy in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(TaxRuleI18nPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return TaxRuleI18n A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `ID`, `LOCALE` FROM `tax_rule_i18n` WHERE `ID` = :p0 AND `LOCALE` = :p1';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
+ $stmt->bindValue(':p1', $key[1], PDO::PARAM_STR);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new TaxRuleI18n();
+ $obj->hydrate($row);
+ TaxRuleI18nPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return TaxRuleI18n|TaxRuleI18n[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ *
+ * $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
+ *
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|TaxRuleI18n[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return TaxRuleI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+ $this->addUsingAlias(TaxRuleI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $this->addUsingAlias(TaxRuleI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+
+ return $this;
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return TaxRuleI18nQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+ if (empty($keys)) {
+ return $this->add(null, '1<>1', Criteria::CUSTOM);
+ }
+ foreach ($keys as $key) {
+ $cton0 = $this->getNewCriterion(TaxRuleI18nPeer::ID, $key[0], Criteria::EQUAL);
+ $cton1 = $this->getNewCriterion(TaxRuleI18nPeer::LOCALE, $key[1], Criteria::EQUAL);
+ $cton0->addAnd($cton1);
+ $this->addOr($cton0);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ *
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id > 12
+ *
+ *
+ * @see filterByTaxRule()
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return TaxRuleI18nQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id) && null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this->addUsingAlias(TaxRuleI18nPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the locale column
+ *
+ * Example usage:
+ *
+ * $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
+ * $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
+ *
+ *
+ * @param string $locale The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return TaxRuleI18nQuery The current query, for fluid interface
+ */
+ public function filterByLocale($locale = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($locale)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $locale)) {
+ $locale = str_replace('*', '%', $locale);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(TaxRuleI18nPeer::LOCALE, $locale, $comparison);
+ }
+
+ /**
+ * Filter the query by a related TaxRule object
+ *
+ * @param TaxRule|PropelObjectCollection $taxRule The related object(s) to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return TaxRuleI18nQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByTaxRule($taxRule, $comparison = null)
+ {
+ if ($taxRule instanceof TaxRule) {
+ return $this
+ ->addUsingAlias(TaxRuleI18nPeer::ID, $taxRule->getId(), $comparison);
+ } elseif ($taxRule instanceof PropelObjectCollection) {
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+
+ return $this
+ ->addUsingAlias(TaxRuleI18nPeer::ID, $taxRule->toKeyValue('PrimaryKey', 'Id'), $comparison);
+ } else {
+ throw new PropelException('filterByTaxRule() only accepts arguments of type TaxRule or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the TaxRule relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return TaxRuleI18nQuery The current query, for fluid interface
+ */
+ public function joinTaxRule($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('TaxRule');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'TaxRule');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the TaxRule relation TaxRule object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\TaxRuleQuery A secondary query class using the current class as primary query
+ */
+ public function useTaxRuleQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinTaxRule($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'TaxRule', '\Thelia\Model\TaxRuleQuery');
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param TaxRuleI18n $taxRuleI18n Object to remove from the list of results
+ *
+ * @return TaxRuleI18nQuery The current query, for fluid interface
+ */
+ public function prune($taxRuleI18n = null)
+ {
+ if ($taxRuleI18n) {
+ $this->addCond('pruneCond0', $this->getAliasedColName(TaxRuleI18nPeer::ID), $taxRuleI18n->getId(), Criteria::NOT_EQUAL);
+ $this->addCond('pruneCond1', $this->getAliasedColName(TaxRuleI18nPeer::LOCALE), $taxRuleI18n->getLocale(), Criteria::NOT_EQUAL);
+ $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
+ }
+
+ return $this;
+ }
+
+}
diff --git a/core/lib/Thelia/Model/om/BaseTaxRulePeer.php b/core/lib/Thelia/Model/om/BaseTaxRulePeer.php
index 31117ed29..9a771852f 100644
--- a/core/lib/Thelia/Model/om/BaseTaxRulePeer.php
+++ b/core/lib/Thelia/Model/om/BaseTaxRulePeer.php
@@ -12,7 +12,7 @@ use \PropelPDO;
use Thelia\Model\ProductPeer;
use Thelia\Model\TaxRule;
use Thelia\Model\TaxRuleCountryPeer;
-use Thelia\Model\TaxRuleDescPeer;
+use Thelia\Model\TaxRuleI18nPeer;
use Thelia\Model\TaxRulePeer;
use Thelia\Model\map\TaxRuleTableMap;
@@ -39,13 +39,13 @@ abstract class BaseTaxRulePeer
const TM_CLASS = 'TaxRuleTableMap';
/** The total number of columns. */
- const NUM_COLUMNS = 4;
+ const NUM_COLUMNS = 6;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
- const NUM_HYDRATE_COLUMNS = 4;
+ const NUM_HYDRATE_COLUMNS = 6;
/** the column name for the ID field */
const ID = 'tax_rule.ID';
@@ -53,6 +53,12 @@ abstract class BaseTaxRulePeer
/** the column name for the CODE field */
const CODE = 'tax_rule.CODE';
+ /** the column name for the TITLE field */
+ const TITLE = 'tax_rule.TITLE';
+
+ /** the column name for the DESCRIPTION field */
+ const DESCRIPTION = 'tax_rule.DESCRIPTION';
+
/** the column name for the CREATED_AT field */
const CREATED_AT = 'tax_rule.CREATED_AT';
@@ -71,6 +77,13 @@ abstract class BaseTaxRulePeer
public static $instances = array();
+ // i18n behavior
+
+ /**
+ * The default locale to use for translations
+ * @var string
+ */
+ const DEFAULT_LOCALE = 'en_EN';
/**
* holds an array of fieldnames
*
@@ -78,12 +91,12 @@ abstract class BaseTaxRulePeer
* e.g. TaxRulePeer::$fieldNames[TaxRulePeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('Id', 'Code', 'CreatedAt', 'UpdatedAt', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'code', 'createdAt', 'updatedAt', ),
- BasePeer::TYPE_COLNAME => array (TaxRulePeer::ID, TaxRulePeer::CODE, TaxRulePeer::CREATED_AT, TaxRulePeer::UPDATED_AT, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CODE', 'CREATED_AT', 'UPDATED_AT', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'code', 'created_at', 'updated_at', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
+ BasePeer::TYPE_PHPNAME => array ('Id', 'Code', 'Title', 'Description', 'CreatedAt', 'UpdatedAt', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'code', 'title', 'description', 'createdAt', 'updatedAt', ),
+ BasePeer::TYPE_COLNAME => array (TaxRulePeer::ID, TaxRulePeer::CODE, TaxRulePeer::TITLE, TaxRulePeer::DESCRIPTION, TaxRulePeer::CREATED_AT, TaxRulePeer::UPDATED_AT, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CODE', 'TITLE', 'DESCRIPTION', 'CREATED_AT', 'UPDATED_AT', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'code', 'title', 'description', 'created_at', 'updated_at', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
);
/**
@@ -93,12 +106,12 @@ abstract class BaseTaxRulePeer
* e.g. TaxRulePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Code' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'code' => 1, 'createdAt' => 2, 'updatedAt' => 3, ),
- BasePeer::TYPE_COLNAME => array (TaxRulePeer::ID => 0, TaxRulePeer::CODE => 1, TaxRulePeer::CREATED_AT => 2, TaxRulePeer::UPDATED_AT => 3, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CODE' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'code' => 1, 'created_at' => 2, 'updated_at' => 3, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Code' => 1, 'Title' => 2, 'Description' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'code' => 1, 'title' => 2, 'description' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
+ BasePeer::TYPE_COLNAME => array (TaxRulePeer::ID => 0, TaxRulePeer::CODE => 1, TaxRulePeer::TITLE => 2, TaxRulePeer::DESCRIPTION => 3, TaxRulePeer::CREATED_AT => 4, TaxRulePeer::UPDATED_AT => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CODE' => 1, 'TITLE' => 2, 'DESCRIPTION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'code' => 1, 'title' => 2, 'description' => 3, 'created_at' => 4, 'updated_at' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
);
/**
@@ -174,11 +187,15 @@ abstract class BaseTaxRulePeer
if (null === $alias) {
$criteria->addSelectColumn(TaxRulePeer::ID);
$criteria->addSelectColumn(TaxRulePeer::CODE);
+ $criteria->addSelectColumn(TaxRulePeer::TITLE);
+ $criteria->addSelectColumn(TaxRulePeer::DESCRIPTION);
$criteria->addSelectColumn(TaxRulePeer::CREATED_AT);
$criteria->addSelectColumn(TaxRulePeer::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.CODE');
+ $criteria->addSelectColumn($alias . '.TITLE');
+ $criteria->addSelectColumn($alias . '.DESCRIPTION');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
@@ -383,12 +400,12 @@ abstract class BaseTaxRulePeer
// Invalidate objects in ProductPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
ProductPeer::clearInstancePool();
- // Invalidate objects in TaxRuleDescPeer instance pool,
- // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
- TaxRuleDescPeer::clearInstancePool();
// Invalidate objects in TaxRuleCountryPeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
TaxRuleCountryPeer::clearInstancePool();
+ // Invalidate objects in TaxRuleI18nPeer instance pool,
+ // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
+ TaxRuleI18nPeer::clearInstancePool();
}
/**
diff --git a/core/lib/Thelia/Model/om/BaseTaxRuleQuery.php b/core/lib/Thelia/Model/om/BaseTaxRuleQuery.php
index 53945ee71..2468cd7eb 100644
--- a/core/lib/Thelia/Model/om/BaseTaxRuleQuery.php
+++ b/core/lib/Thelia/Model/om/BaseTaxRuleQuery.php
@@ -15,7 +15,7 @@ use \PropelPDO;
use Thelia\Model\Product;
use Thelia\Model\TaxRule;
use Thelia\Model\TaxRuleCountry;
-use Thelia\Model\TaxRuleDesc;
+use Thelia\Model\TaxRuleI18n;
use Thelia\Model\TaxRulePeer;
use Thelia\Model\TaxRuleQuery;
@@ -26,11 +26,15 @@ use Thelia\Model\TaxRuleQuery;
*
* @method TaxRuleQuery orderById($order = Criteria::ASC) Order by the id column
* @method TaxRuleQuery orderByCode($order = Criteria::ASC) Order by the code column
+ * @method TaxRuleQuery orderByTitle($order = Criteria::ASC) Order by the title column
+ * @method TaxRuleQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method TaxRuleQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method TaxRuleQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method TaxRuleQuery groupById() Group by the id column
* @method TaxRuleQuery groupByCode() Group by the code column
+ * @method TaxRuleQuery groupByTitle() Group by the title column
+ * @method TaxRuleQuery groupByDescription() Group by the description column
* @method TaxRuleQuery groupByCreatedAt() Group by the created_at column
* @method TaxRuleQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -42,24 +46,28 @@ use Thelia\Model\TaxRuleQuery;
* @method TaxRuleQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
* @method TaxRuleQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
*
- * @method TaxRuleQuery leftJoinTaxRuleDesc($relationAlias = null) Adds a LEFT JOIN clause to the query using the TaxRuleDesc relation
- * @method TaxRuleQuery rightJoinTaxRuleDesc($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRuleDesc relation
- * @method TaxRuleQuery innerJoinTaxRuleDesc($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRuleDesc relation
- *
* @method TaxRuleQuery leftJoinTaxRuleCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the TaxRuleCountry relation
* @method TaxRuleQuery rightJoinTaxRuleCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRuleCountry relation
* @method TaxRuleQuery innerJoinTaxRuleCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRuleCountry relation
*
+ * @method TaxRuleQuery leftJoinTaxRuleI18n($relationAlias = null) Adds a LEFT JOIN clause to the query using the TaxRuleI18n relation
+ * @method TaxRuleQuery rightJoinTaxRuleI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the TaxRuleI18n relation
+ * @method TaxRuleQuery innerJoinTaxRuleI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the TaxRuleI18n relation
+ *
* @method TaxRule findOne(PropelPDO $con = null) Return the first TaxRule matching the query
* @method TaxRule findOneOrCreate(PropelPDO $con = null) Return the first TaxRule matching the query, or a new TaxRule object populated from the query conditions when no match is found
*
* @method TaxRule findOneById(int $id) Return the first TaxRule filtered by the id column
* @method TaxRule findOneByCode(string $code) Return the first TaxRule filtered by the code column
+ * @method TaxRule findOneByTitle(string $title) Return the first TaxRule filtered by the title column
+ * @method TaxRule findOneByDescription(string $description) Return the first TaxRule filtered by the description column
* @method TaxRule findOneByCreatedAt(string $created_at) Return the first TaxRule filtered by the created_at column
* @method TaxRule findOneByUpdatedAt(string $updated_at) Return the first TaxRule filtered by the updated_at column
*
* @method array findById(int $id) Return TaxRule objects filtered by the id column
* @method array findByCode(string $code) Return TaxRule objects filtered by the code column
+ * @method array findByTitle(string $title) Return TaxRule objects filtered by the title column
+ * @method array findByDescription(string $description) Return TaxRule objects filtered by the description column
* @method array findByCreatedAt(string $created_at) Return TaxRule objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return TaxRule objects filtered by the updated_at column
*
@@ -151,7 +159,7 @@ abstract class BaseTaxRuleQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT `ID`, `CODE`, `CREATED_AT`, `UPDATED_AT` FROM `tax_rule` WHERE `ID` = :p0';
+ $sql = 'SELECT `ID`, `CODE`, `TITLE`, `DESCRIPTION`, `CREATED_AT`, `UPDATED_AT` FROM `tax_rule` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -296,6 +304,64 @@ abstract class BaseTaxRuleQuery extends ModelCriteria
return $this->addUsingAlias(TaxRulePeer::CODE, $code, $comparison);
}
+ /**
+ * Filter the query on the title column
+ *
+ * Example usage:
+ *
+ * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue'
+ * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
+ *
+ *
+ * @param string $title The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return TaxRuleQuery The current query, for fluid interface
+ */
+ public function filterByTitle($title = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($title)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $title)) {
+ $title = str_replace('*', '%', $title);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(TaxRulePeer::TITLE, $title, $comparison);
+ }
+
+ /**
+ * Filter the query on the description column
+ *
+ * Example usage:
+ *
+ * $query->filterByDescription('fooValue'); // WHERE description = 'fooValue'
+ * $query->filterByDescription('%fooValue%'); // WHERE description LIKE '%fooValue%'
+ *
+ *
+ * @param string $description The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return TaxRuleQuery The current query, for fluid interface
+ */
+ public function filterByDescription($description = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($description)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $description)) {
+ $description = str_replace('*', '%', $description);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(TaxRulePeer::DESCRIPTION, $description, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
@@ -456,80 +522,6 @@ abstract class BaseTaxRuleQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
}
- /**
- * Filter the query by a related TaxRuleDesc object
- *
- * @param TaxRuleDesc|PropelObjectCollection $taxRuleDesc the related object to use as filter
- * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
- *
- * @return TaxRuleQuery The current query, for fluid interface
- * @throws PropelException - if the provided filter is invalid.
- */
- public function filterByTaxRuleDesc($taxRuleDesc, $comparison = null)
- {
- if ($taxRuleDesc instanceof TaxRuleDesc) {
- return $this
- ->addUsingAlias(TaxRulePeer::ID, $taxRuleDesc->getTaxRuleId(), $comparison);
- } elseif ($taxRuleDesc instanceof PropelObjectCollection) {
- return $this
- ->useTaxRuleDescQuery()
- ->filterByPrimaryKeys($taxRuleDesc->getPrimaryKeys())
- ->endUse();
- } else {
- throw new PropelException('filterByTaxRuleDesc() only accepts arguments of type TaxRuleDesc or PropelCollection');
- }
- }
-
- /**
- * Adds a JOIN clause to the query using the TaxRuleDesc relation
- *
- * @param string $relationAlias optional alias for the relation
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return TaxRuleQuery The current query, for fluid interface
- */
- public function joinTaxRuleDesc($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
- {
- $tableMap = $this->getTableMap();
- $relationMap = $tableMap->getRelation('TaxRuleDesc');
-
- // create a ModelJoin object for this join
- $join = new ModelJoin();
- $join->setJoinType($joinType);
- $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
- if ($previousJoin = $this->getPreviousJoin()) {
- $join->setPreviousJoin($previousJoin);
- }
-
- // add the ModelJoin to the current object
- if ($relationAlias) {
- $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
- $this->addJoinObject($join, $relationAlias);
- } else {
- $this->addJoinObject($join, 'TaxRuleDesc');
- }
-
- return $this;
- }
-
- /**
- * Use the TaxRuleDesc relation TaxRuleDesc object
- *
- * @see useQuery()
- *
- * @param string $relationAlias optional alias for the relation,
- * to be used as main alias in the secondary query
- * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
- *
- * @return \Thelia\Model\TaxRuleDescQuery A secondary query class using the current class as primary query
- */
- public function useTaxRuleDescQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
- {
- return $this
- ->joinTaxRuleDesc($relationAlias, $joinType)
- ->useQuery($relationAlias ? $relationAlias : 'TaxRuleDesc', '\Thelia\Model\TaxRuleDescQuery');
- }
-
/**
* Filter the query by a related TaxRuleCountry object
*
@@ -604,6 +596,80 @@ abstract class BaseTaxRuleQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'TaxRuleCountry', '\Thelia\Model\TaxRuleCountryQuery');
}
+ /**
+ * Filter the query by a related TaxRuleI18n object
+ *
+ * @param TaxRuleI18n|PropelObjectCollection $taxRuleI18n the related object to use as filter
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return TaxRuleQuery The current query, for fluid interface
+ * @throws PropelException - if the provided filter is invalid.
+ */
+ public function filterByTaxRuleI18n($taxRuleI18n, $comparison = null)
+ {
+ if ($taxRuleI18n instanceof TaxRuleI18n) {
+ return $this
+ ->addUsingAlias(TaxRulePeer::ID, $taxRuleI18n->getId(), $comparison);
+ } elseif ($taxRuleI18n instanceof PropelObjectCollection) {
+ return $this
+ ->useTaxRuleI18nQuery()
+ ->filterByPrimaryKeys($taxRuleI18n->getPrimaryKeys())
+ ->endUse();
+ } else {
+ throw new PropelException('filterByTaxRuleI18n() only accepts arguments of type TaxRuleI18n or PropelCollection');
+ }
+ }
+
+ /**
+ * Adds a JOIN clause to the query using the TaxRuleI18n relation
+ *
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return TaxRuleQuery The current query, for fluid interface
+ */
+ public function joinTaxRuleI18n($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ $tableMap = $this->getTableMap();
+ $relationMap = $tableMap->getRelation('TaxRuleI18n');
+
+ // create a ModelJoin object for this join
+ $join = new ModelJoin();
+ $join->setJoinType($joinType);
+ $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
+ if ($previousJoin = $this->getPreviousJoin()) {
+ $join->setPreviousJoin($previousJoin);
+ }
+
+ // add the ModelJoin to the current object
+ if ($relationAlias) {
+ $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
+ $this->addJoinObject($join, $relationAlias);
+ } else {
+ $this->addJoinObject($join, 'TaxRuleI18n');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Use the TaxRuleI18n relation TaxRuleI18n object
+ *
+ * @see useQuery()
+ *
+ * @param string $relationAlias optional alias for the relation,
+ * to be used as main alias in the secondary query
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
+ *
+ * @return \Thelia\Model\TaxRuleI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useTaxRuleI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
+ {
+ return $this
+ ->joinTaxRuleI18n($relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'TaxRuleI18n', '\Thelia\Model\TaxRuleI18nQuery');
+ }
+
/**
* Exclude object from result
*
@@ -685,4 +751,61 @@ abstract class BaseTaxRuleQuery extends ModelCriteria
{
return $this->addAscendingOrderByColumn(TaxRulePeer::CREATED_AT);
}
+ // i18n behavior
+
+ /**
+ * Adds a JOIN clause to the query using the i18n relation
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return TaxRuleQuery The current query, for fluid interface
+ */
+ public function joinI18n($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ $relationName = $relationAlias ? $relationAlias : 'TaxRuleI18n';
+
+ return $this
+ ->joinTaxRuleI18n($relationAlias, $joinType)
+ ->addJoinCondition($relationName, $relationName . '.Locale = ?', $locale);
+ }
+
+ /**
+ * Adds a JOIN clause to the query and hydrates the related I18n object.
+ * Shortcut for $c->joinI18n($locale)->with()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return TaxRuleQuery The current query, for fluid interface
+ */
+ public function joinWithI18n($locale = 'en_EN', $joinType = Criteria::LEFT_JOIN)
+ {
+ $this
+ ->joinI18n($locale, null, $joinType)
+ ->with('TaxRuleI18n');
+ $this->with['TaxRuleI18n']->setIsWithOneToMany(false);
+
+ return $this;
+ }
+
+ /**
+ * Use the I18n relation query object
+ *
+ * @see useQuery()
+ *
+ * @param string $locale Locale to use for the join condition, e.g. 'fr_FR'
+ * @param string $relationAlias optional alias for the relation
+ * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'. Defaults to left join.
+ *
+ * @return TaxRuleI18nQuery A secondary query class using the current class as primary query
+ */
+ public function useI18nQuery($locale = 'en_EN', $relationAlias = null, $joinType = Criteria::LEFT_JOIN)
+ {
+ return $this
+ ->joinI18n($locale, $relationAlias, $joinType)
+ ->useQuery($relationAlias ? $relationAlias : 'TaxRuleI18n', 'Thelia\Model\TaxRuleI18nQuery');
+ }
+
}
diff --git a/local/config/schema.xml b/local/config/schema.xml
index d98538cb1..055bc695a 100644
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -6,23 +6,14 @@