reverse thelia schema
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
cache/*
|
||||
local/config/build.properties
|
||||
|
||||
@@ -43,8 +43,8 @@ class AccessoryTableMap extends TableMap
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('PRODUCT_ID', 'ProductId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('ACCESSORY', 'Accessory', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null);
|
||||
$this->addForeignKey('ACCESSORY', 'Accessory', 'INTEGER', 'product', 'ID', true, null, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -56,8 +56,8 @@ class AccessoryTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::ONE_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::ONE_TO_ONE, array('accessory' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ProductRelatedByProductId', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('ProductRelatedByAccessory', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('accessory' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // AccessoryTableMap
|
||||
|
||||
@@ -44,8 +44,8 @@ class AddressTableMap extends TableMap
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('CUSTOMER_ID', 'CustomerId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CUSTOMER_TITLE_ID', 'CustomerTitleId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('CUSTOMER_ID', 'CustomerId', 'INTEGER', 'customer', 'ID', true, null, null);
|
||||
$this->addForeignKey('CUSTOMER_TITLE_ID', 'CustomerTitleId', 'INTEGER', 'customer_title', 'ID', false, null, null);
|
||||
$this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 255, null);
|
||||
@@ -66,8 +66,8 @@ class AddressTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Customer', 'Thelia\\Model\\Customer', RelationMap::ONE_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('CustomerTitle', 'Thelia\\Model\\CustomerTitle', RelationMap::ONE_TO_ONE, array('customer_title_id' => 'id', ), 'RESTRICT', 'RESTRICT');
|
||||
$this->addRelation('Customer', 'Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CustomerTitle', 'Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('customer_title_id' => 'id', ), null, null);
|
||||
} // buildRelations()
|
||||
|
||||
} // AddressTableMap
|
||||
|
||||
@@ -43,8 +43,8 @@ class AdminGroupTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('GROUP_ID', 'GroupId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('ADMIN_ID', 'AdminId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('GROUP_ID', 'GroupId', 'INTEGER', 'group', 'ID', false, null, null);
|
||||
$this->addForeignKey('ADMIN_ID', 'AdminId', 'INTEGER', 'admin', 'ID', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
// validators
|
||||
@@ -55,8 +55,8 @@ class AdminGroupTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Admin', 'Thelia\\Model\\Admin', RelationMap::ONE_TO_ONE, array('admin_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Group', 'Thelia\\Model\\Group', RelationMap::ONE_TO_ONE, array('group_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Group', 'Thelia\\Model\\Group', RelationMap::MANY_TO_ONE, array('group_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Admin', 'Thelia\\Model\\Admin', RelationMap::MANY_TO_ONE, array('admin_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // AdminGroupTableMap
|
||||
|
||||
@@ -42,7 +42,7 @@ class AdminTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'admin_group', 'ADMIN_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 100, null);
|
||||
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 100, null);
|
||||
$this->addColumn('LOGIN', 'Login', 'VARCHAR', true, 100, null);
|
||||
@@ -59,7 +59,7 @@ class AdminTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('AdminGroup', 'Thelia\\Model\\AdminGroup', RelationMap::MANY_TO_ONE, array('id' => 'admin_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('AdminGroup', 'Thelia\\Model\\AdminGroup', RelationMap::ONE_TO_MANY, array('id' => 'admin_id', ), 'CASCADE', null, 'AdminGroups');
|
||||
} // buildRelations()
|
||||
|
||||
} // AdminTableMap
|
||||
|
||||
@@ -42,8 +42,7 @@ class AreaTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'country', 'AREA_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'delivzone', 'AREA_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('NAME', 'Name', 'VARCHAR', true, 100, null);
|
||||
$this->addColumn('UNIT', 'Unit', 'FLOAT', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -56,8 +55,8 @@ class AreaTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Country', 'Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('id' => 'area_id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('Delivzone', 'Thelia\\Model\\Delivzone', RelationMap::MANY_TO_ONE, array('id' => 'area_id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('Country', 'Thelia\\Model\\Country', RelationMap::ONE_TO_MANY, array('id' => 'area_id', ), 'SET NULL', null, 'Countrys');
|
||||
$this->addRelation('Delivzone', 'Thelia\\Model\\Delivzone', RelationMap::ONE_TO_MANY, array('id' => 'area_id', ), 'SET NULL', null, 'Delivzones');
|
||||
} // buildRelations()
|
||||
|
||||
} // AreaTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class AttributeAvDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('ATTRIBUTE_AV_ID', 'AttributeAvId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('ATTRIBUTE_AV_ID', 'AttributeAvId', 'INTEGER', 'attribute_av', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -58,7 +58,7 @@ class AttributeAvDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('AttributeAv', 'Thelia\\Model\\AttributeAv', RelationMap::ONE_TO_ONE, array('attribute_av_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('AttributeAv', 'Thelia\\Model\\AttributeAv', RelationMap::MANY_TO_ONE, array('attribute_av_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // AttributeAvDescTableMap
|
||||
|
||||
@@ -42,9 +42,8 @@ class AttributeAvTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute_av_desc', 'ATTRIBUTE_AV_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute_combination', 'ATTRIBUTE_AV_ID', true, null, null);
|
||||
$this->addColumn('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', 'attribute', 'ID', true, null, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -56,9 +55,9 @@ class AttributeAvTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('AttributeAvDesc', 'Thelia\\Model\\AttributeAvDesc', RelationMap::MANY_TO_ONE, array('id' => 'attribute_av_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('AttributeCombination', 'Thelia\\Model\\AttributeCombination', RelationMap::MANY_TO_ONE, array('id' => 'attribute_av_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Attribute', 'Thelia\\Model\\Attribute', RelationMap::ONE_TO_ONE, array('attribute_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Attribute', 'Thelia\\Model\\Attribute', RelationMap::MANY_TO_ONE, array('attribute_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('AttributeAvDesc', 'Thelia\\Model\\AttributeAvDesc', RelationMap::ONE_TO_MANY, array('id' => 'attribute_av_id', ), 'CASCADE', null, 'AttributeAvDescs');
|
||||
$this->addRelation('AttributeCombination', 'Thelia\\Model\\AttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'attribute_av_id', ), 'CASCADE', null, 'AttributeCombinations');
|
||||
} // buildRelations()
|
||||
|
||||
} // AttributeAvTableMap
|
||||
|
||||
@@ -43,8 +43,8 @@ class AttributeCategoryTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CATEGORY_ID', 'CategoryId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', true, null, null);
|
||||
$this->addForeignKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', 'attribute', 'ID', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
// validators
|
||||
@@ -55,8 +55,8 @@ class AttributeCategoryTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Attribute', 'Thelia\\Model\\Attribute', RelationMap::ONE_TO_ONE, array('attribute_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::ONE_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Attribute', 'Thelia\\Model\\Attribute', RelationMap::MANY_TO_ONE, array('attribute_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // AttributeCategoryTableMap
|
||||
|
||||
@@ -43,9 +43,9 @@ class AttributeCombinationTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addPrimaryKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', true, null, null);
|
||||
$this->addPrimaryKey('COMBINATION_ID', 'CombinationId', 'INTEGER', true, null, null);
|
||||
$this->addPrimaryKey('ATTRIBUTE_AV_ID', 'AttributeAvId', 'INTEGER', true, null, null);
|
||||
$this->addForeignPrimaryKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER' , 'attribute', 'ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('COMBINATION_ID', 'CombinationId', 'INTEGER' , 'combination', 'ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ATTRIBUTE_AV_ID', 'AttributeAvId', 'INTEGER' , 'attribute_av', 'ID', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
// validators
|
||||
@@ -56,9 +56,9 @@ class AttributeCombinationTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Attribute', 'Thelia\\Model\\Attribute', RelationMap::ONE_TO_ONE, array('attribute_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('AttributeAv', 'Thelia\\Model\\AttributeAv', RelationMap::ONE_TO_ONE, array('attribute_av_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Combination', 'Thelia\\Model\\Combination', RelationMap::ONE_TO_ONE, array('combination_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Attribute', 'Thelia\\Model\\Attribute', RelationMap::MANY_TO_ONE, array('attribute_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('AttributeAv', 'Thelia\\Model\\AttributeAv', RelationMap::MANY_TO_ONE, array('attribute_av_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Combination', 'Thelia\\Model\\Combination', RelationMap::MANY_TO_ONE, array('combination_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // AttributeCombinationTableMap
|
||||
|
||||
@@ -44,7 +44,7 @@ class AttributeDescTableMap extends TableMap
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('ATTRIBUTE_ID', 'AttributeId', 'INTEGER', 'attribute', 'ID', true, null, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
|
||||
@@ -58,7 +58,7 @@ class AttributeDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Attribute', 'Thelia\\Model\\Attribute', RelationMap::ONE_TO_ONE, array('attribute_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Attribute', 'Thelia\\Model\\Attribute', RelationMap::MANY_TO_ONE, array('attribute_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // AttributeDescTableMap
|
||||
|
||||
@@ -42,10 +42,7 @@ class AttributeTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute_av', 'ATTRIBUTE_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute_category', 'ATTRIBUTE_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute_combination', 'ATTRIBUTE_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute_desc', 'ATTRIBUTE_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -57,10 +54,10 @@ class AttributeTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('AttributeAv', 'Thelia\\Model\\AttributeAv', RelationMap::MANY_TO_ONE, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('AttributeCategory', 'Thelia\\Model\\AttributeCategory', RelationMap::MANY_TO_ONE, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('AttributeCombination', 'Thelia\\Model\\AttributeCombination', RelationMap::MANY_TO_ONE, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('AttributeDesc', 'Thelia\\Model\\AttributeDesc', RelationMap::MANY_TO_ONE, array('id' => 'attribute_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('AttributeAv', 'Thelia\\Model\\AttributeAv', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', null, 'AttributeAvs');
|
||||
$this->addRelation('AttributeCategory', 'Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', null, 'AttributeCategorys');
|
||||
$this->addRelation('AttributeCombination', 'Thelia\\Model\\AttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', null, 'AttributeCombinations');
|
||||
$this->addRelation('AttributeDesc', 'Thelia\\Model\\AttributeDesc', RelationMap::ONE_TO_MANY, array('id' => 'attribute_id', ), 'CASCADE', null, 'AttributeDescs');
|
||||
} // buildRelations()
|
||||
|
||||
} // AttributeTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class CategoryDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CATEGORY_ID', 'CategoryId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
|
||||
@@ -59,7 +59,7 @@ class CategoryDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::ONE_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CategoryDescTableMap
|
||||
|
||||
@@ -42,14 +42,7 @@ class CategoryTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute_category', 'CATEGORY_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'category_desc', 'CATEGORY_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'content_assoc', 'CATEGORY_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'document', 'CATEGORY_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature_category', 'CATEGORY_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'image', 'CATEGORY_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'product_category', 'CATEGORY_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'rewriting', 'CATEGORY_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('PARENT', 'Parent', 'INTEGER', false, null, null);
|
||||
$this->addColumn('LINK', 'Link', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, null);
|
||||
@@ -64,14 +57,14 @@ class CategoryTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('AttributeCategory', 'Thelia\\Model\\AttributeCategory', RelationMap::MANY_TO_ONE, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('CategoryDesc', 'Thelia\\Model\\CategoryDesc', RelationMap::MANY_TO_ONE, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ContentAssoc', 'Thelia\\Model\\ContentAssoc', RelationMap::MANY_TO_ONE, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::MANY_TO_ONE, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('FeatureCategory', 'Thelia\\Model\\FeatureCategory', RelationMap::MANY_TO_ONE, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::MANY_TO_ONE, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ProductCategory', 'Thelia\\Model\\ProductCategory', RelationMap::MANY_TO_ONE, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::MANY_TO_ONE, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('AttributeCategory', 'Thelia\\Model\\AttributeCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', null, 'AttributeCategorys');
|
||||
$this->addRelation('CategoryDesc', 'Thelia\\Model\\CategoryDesc', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', null, 'CategoryDescs');
|
||||
$this->addRelation('ContentAssoc', 'Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', null, 'ContentAssocs');
|
||||
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', null, 'Documents');
|
||||
$this->addRelation('FeatureCategory', 'Thelia\\Model\\FeatureCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', null, 'FeatureCategorys');
|
||||
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', null, 'Images');
|
||||
$this->addRelation('ProductCategory', 'Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', null, 'ProductCategorys');
|
||||
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', null, 'Rewritings');
|
||||
} // buildRelations()
|
||||
|
||||
} // CategoryTableMap
|
||||
|
||||
@@ -42,8 +42,7 @@ class CombinationTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'attribute_combination', 'COMBINATION_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'stock', 'COMBINATION_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('REF', 'Ref', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -55,8 +54,8 @@ class CombinationTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('AttributeCombination', 'Thelia\\Model\\AttributeCombination', RelationMap::MANY_TO_ONE, array('id' => 'combination_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Stock', 'Thelia\\Model\\Stock', RelationMap::MANY_TO_ONE, array('id' => 'combination_id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('AttributeCombination', 'Thelia\\Model\\AttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'combination_id', ), 'CASCADE', null, 'AttributeCombinations');
|
||||
$this->addRelation('Stock', 'Thelia\\Model\\Stock', RelationMap::ONE_TO_MANY, array('id' => 'combination_id', ), 'SET NULL', null, 'Stocks');
|
||||
} // buildRelations()
|
||||
|
||||
} // CombinationTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class ConfigDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CONFIG_ID', 'ConfigId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('CONFIG_ID', 'ConfigId', 'INTEGER', 'config', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -58,7 +58,7 @@ class ConfigDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Config', 'Thelia\\Model\\Config', RelationMap::ONE_TO_ONE, array('config_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Config', 'Thelia\\Model\\Config', RelationMap::MANY_TO_ONE, array('config_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // ConfigDescTableMap
|
||||
|
||||
@@ -42,7 +42,7 @@ class ConfigTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'config_desc', 'CONFIG_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('NAME', 'Name', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('VALUE', 'Value', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('SECURE', 'Secure', 'TINYINT', true, null, 1);
|
||||
@@ -57,7 +57,7 @@ class ConfigTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('ConfigDesc', 'Thelia\\Model\\ConfigDesc', RelationMap::MANY_TO_ONE, array('id' => 'config_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ConfigDesc', 'Thelia\\Model\\ConfigDesc', RelationMap::ONE_TO_MANY, array('id' => 'config_id', ), 'CASCADE', null, 'ConfigDescs');
|
||||
} // buildRelations()
|
||||
|
||||
} // ConfigTableMap
|
||||
|
||||
@@ -43,9 +43,9 @@ class ContentAssocTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CATEGORY_ID', 'CategoryId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('PRODUCT_ID', 'ProductId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CONTENT_ID', 'ContentId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', false, null, null);
|
||||
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', false, null, null);
|
||||
$this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', false, null, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
@@ -57,9 +57,9 @@ class ContentAssocTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::ONE_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::ONE_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::ONE_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // ContentAssocTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class ContentDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CONTENT_ID', 'ContentId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -59,7 +59,7 @@ class ContentDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::ONE_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // ContentDescTableMap
|
||||
|
||||
@@ -42,8 +42,8 @@ class ContentFolderTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addPrimaryKey('CONTENT_ID', 'ContentId', 'INTEGER', true, null, null);
|
||||
$this->addPrimaryKey('FOLDER_ID', 'FolderId', 'INTEGER', true, null, null);
|
||||
$this->addForeignPrimaryKey('CONTENT_ID', 'ContentId', 'INTEGER' , 'content', 'ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('FOLDER_ID', 'FolderId', 'INTEGER' , 'folder', 'ID', true, null, null);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
@@ -52,8 +52,8 @@ class ContentFolderTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::ONE_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::ONE_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::MANY_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // ContentFolderTableMap
|
||||
|
||||
@@ -42,12 +42,7 @@ class ContentTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'content_assoc', 'CONTENT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'content_desc', 'CONTENT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'content_folder', 'CONTENT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'document', 'CONTENT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'image', 'CONTENT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'rewriting', 'CONTENT_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', false, null, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -60,12 +55,12 @@ class ContentTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('ContentAssoc', 'Thelia\\Model\\ContentAssoc', RelationMap::MANY_TO_ONE, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ContentDesc', 'Thelia\\Model\\ContentDesc', RelationMap::MANY_TO_ONE, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ContentFolder', 'Thelia\\Model\\ContentFolder', RelationMap::MANY_TO_ONE, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::MANY_TO_ONE, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::MANY_TO_ONE, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::MANY_TO_ONE, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ContentAssoc', 'Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', null, 'ContentAssocs');
|
||||
$this->addRelation('ContentDesc', 'Thelia\\Model\\ContentDesc', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', null, 'ContentDescs');
|
||||
$this->addRelation('ContentFolder', 'Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', null, 'ContentFolders');
|
||||
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', null, 'Documents');
|
||||
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', null, 'Images');
|
||||
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', null, 'Rewritings');
|
||||
} // buildRelations()
|
||||
|
||||
} // ContentTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class CountryDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('COUNTRY_ID', 'CountryId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('COUNTRY_ID', 'CountryId', 'INTEGER', 'country', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -58,7 +58,7 @@ class CountryDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Country', 'Thelia\\Model\\Country', RelationMap::ONE_TO_ONE, array('country_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Country', 'Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CountryDescTableMap
|
||||
|
||||
@@ -42,9 +42,8 @@ class CountryTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'country_desc', 'COUNTRY_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_rule_country', 'COUNTRY_ID', true, null, null);
|
||||
$this->addColumn('AREA_ID', 'AreaId', 'INTEGER', false, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', false, null, null);
|
||||
$this->addColumn('ISOCODE', 'Isocode', 'VARCHAR', true, 4, null);
|
||||
$this->addColumn('ISOALPHA2', 'Isoalpha2', 'VARCHAR', false, 2, null);
|
||||
$this->addColumn('ISOALPHA3', 'Isoalpha3', 'VARCHAR', false, 4, null);
|
||||
@@ -58,9 +57,9 @@ class CountryTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CountryDesc', 'Thelia\\Model\\CountryDesc', RelationMap::MANY_TO_ONE, array('id' => 'country_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('TaxRuleCountry', 'Thelia\\Model\\TaxRuleCountry', RelationMap::MANY_TO_ONE, array('id' => 'country_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Area', 'Thelia\\Model\\Area', RelationMap::ONE_TO_ONE, array('area_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('Area', 'Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'SET NULL', null);
|
||||
$this->addRelation('CountryDesc', 'Thelia\\Model\\CountryDesc', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', null, 'CountryDescs');
|
||||
$this->addRelation('TaxRuleCountry', 'Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'country_id', ), 'CASCADE', null, 'TaxRuleCountrys');
|
||||
} // buildRelations()
|
||||
|
||||
} // CountryTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class CouponOrderTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('ORDER_ID', 'OrderId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('VALUE', 'Value', 'FLOAT', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -56,7 +56,7 @@ class CouponOrderTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::ONE_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CouponOrderTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class CouponRuleTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('COUPON_ID', 'CouponId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('COUPON_ID', 'CouponId', 'INTEGER', 'coupon', 'ID', true, null, null);
|
||||
$this->addColumn('CONTROLLER', 'Controller', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('OPERATION', 'Operation', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('VALUE', 'Value', 'FLOAT', false, null, null);
|
||||
@@ -57,7 +57,7 @@ class CouponRuleTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Coupon', 'Thelia\\Model\\Coupon', RelationMap::ONE_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Coupon', 'Thelia\\Model\\Coupon', RelationMap::MANY_TO_ONE, array('coupon_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CouponRuleTableMap
|
||||
|
||||
@@ -42,7 +42,7 @@ class CouponTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon_rule', 'COUPON_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('ACTION', 'Action', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('VALUE', 'Value', 'FLOAT', true, null, null);
|
||||
@@ -60,7 +60,7 @@ class CouponTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CouponRule', 'Thelia\\Model\\CouponRule', RelationMap::MANY_TO_ONE, array('id' => 'coupon_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('CouponRule', 'Thelia\\Model\\CouponRule', RelationMap::ONE_TO_MANY, array('id' => 'coupon_id', ), 'CASCADE', null, 'CouponRules');
|
||||
} // buildRelations()
|
||||
|
||||
} // CouponTableMap
|
||||
|
||||
@@ -42,7 +42,7 @@ class CurrencyTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order', 'CURRENCY_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('NAME', 'Name', 'VARCHAR', false, 45, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', false, 45, null);
|
||||
$this->addColumn('SYMBOL', 'Symbol', 'VARCHAR', false, 45, null);
|
||||
@@ -58,7 +58,7 @@ class CurrencyTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('id' => 'currency_id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), 'SET NULL', null, 'Orders');
|
||||
} // buildRelations()
|
||||
|
||||
} // CurrencyTableMap
|
||||
|
||||
@@ -42,10 +42,9 @@ class CustomerTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'address', 'CUSTOMER_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order', 'CUSTOMER_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('REF', 'Ref', 'VARCHAR', true, 50, null);
|
||||
$this->addColumn('CUSTOMER_TITLE_ID', 'CustomerTitleId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('CUSTOMER_TITLE_ID', 'CustomerTitleId', 'INTEGER', 'customer_title', 'ID', false, null, null);
|
||||
$this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 255, null);
|
||||
@@ -75,9 +74,9 @@ class CustomerTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Address', 'Thelia\\Model\\Address', RelationMap::MANY_TO_ONE, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('id' => 'customer_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('CustomerTitle', 'Thelia\\Model\\CustomerTitle', RelationMap::ONE_TO_ONE, array('customer_title_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('CustomerTitle', 'Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('customer_title_id' => 'id', ), 'SET NULL', null);
|
||||
$this->addRelation('Address', 'Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', null, 'Addresss');
|
||||
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'customer_id', ), 'CASCADE', null, 'Orders');
|
||||
} // buildRelations()
|
||||
|
||||
} // CustomerTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class CustomerTitleDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CUSTOMER_TITLE_ID', 'CustomerTitleId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('CUSTOMER_TITLE_ID', 'CustomerTitleId', 'INTEGER', 'customer_title', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('SHORT', 'Short', 'VARCHAR', false, 10, null);
|
||||
$this->addColumn('LONG', 'Long', 'VARCHAR', false, 45, null);
|
||||
@@ -57,7 +57,7 @@ class CustomerTitleDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CustomerTitle', 'Thelia\\Model\\CustomerTitle', RelationMap::ONE_TO_ONE, array('customer_title_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CustomerTitle', 'Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('customer_title_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // CustomerTitleDescTableMap
|
||||
|
||||
@@ -42,9 +42,7 @@ class CustomerTitleTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'address', 'CUSTOMER_TITLE_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'customer', 'CUSTOMER_TITLE_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'customer_title_desc', 'CUSTOMER_TITLE_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('DEFAULT_UTILITY', 'DefaultUtility', 'INTEGER', true, null, 0);
|
||||
$this->addColumn('POSITION', 'Position', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -57,9 +55,9 @@ class CustomerTitleTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Address', 'Thelia\\Model\\Address', RelationMap::MANY_TO_ONE, array('id' => 'customer_title_id', ), 'RESTRICT', 'RESTRICT');
|
||||
$this->addRelation('Customer', 'Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('id' => 'customer_title_id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('CustomerTitleDesc', 'Thelia\\Model\\CustomerTitleDesc', RelationMap::MANY_TO_ONE, array('id' => 'customer_title_id', ), 'CASCADE', null);
|
||||
$this->addRelation('Address', 'Thelia\\Model\\Address', RelationMap::ONE_TO_MANY, array('id' => 'customer_title_id', ), null, null, 'Addresss');
|
||||
$this->addRelation('Customer', 'Thelia\\Model\\Customer', RelationMap::ONE_TO_MANY, array('id' => 'customer_title_id', ), 'SET NULL', null, 'Customers');
|
||||
$this->addRelation('CustomerTitleDesc', 'Thelia\\Model\\CustomerTitleDesc', RelationMap::ONE_TO_MANY, array('id' => 'customer_title_id', ), 'CASCADE', null, 'CustomerTitleDescs');
|
||||
} // buildRelations()
|
||||
|
||||
} // CustomerTitleTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class DelivzoneTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('AREA_ID', 'AreaId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', false, null, null);
|
||||
$this->addColumn('DELIVERY', 'Delivery', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -55,7 +55,7 @@ class DelivzoneTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Area', 'Thelia\\Model\\Area', RelationMap::ONE_TO_ONE, array('area_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('Area', 'Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'SET NULL', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // DelivzoneTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class DocumentDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('DOCUMENT_ID', 'DocumentId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('DOCUMENT_ID', 'DocumentId', 'INTEGER', 'document', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -58,7 +58,7 @@ class DocumentDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::ONE_TO_ONE, array('document_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::MANY_TO_ONE, array('document_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // DocumentDescTableMap
|
||||
|
||||
@@ -42,11 +42,11 @@ class DocumentTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'document_desc', 'DOCUMENT_ID', true, null, null);
|
||||
$this->addColumn('PRODUCT_ID', 'ProductId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CATEGORY_ID', 'CategoryId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('FOLDER_ID', 'FolderId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CONTENT_ID', 'ContentId', 'INTEGER', false, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', false, null, null);
|
||||
$this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', false, null, null);
|
||||
$this->addForeignKey('FOLDER_ID', 'FolderId', 'INTEGER', 'folder', 'ID', false, null, null);
|
||||
$this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', false, null, null);
|
||||
$this->addColumn('FILE', 'File', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -59,11 +59,11 @@ class DocumentTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('DocumentDesc', 'Thelia\\Model\\DocumentDesc', RelationMap::MANY_TO_ONE, array('id' => 'document_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::ONE_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::ONE_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::ONE_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::ONE_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::MANY_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('DocumentDesc', 'Thelia\\Model\\DocumentDesc', RelationMap::ONE_TO_MANY, array('id' => 'document_id', ), 'CASCADE', null, 'DocumentDescs');
|
||||
} // buildRelations()
|
||||
|
||||
} // DocumentTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class FeatureAvDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('FEATURE_AV_ID', 'FeatureAvId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('FEATURE_AV_ID', 'FeatureAvId', 'INTEGER', 'feature_av', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', true, null, null);
|
||||
@@ -56,7 +56,7 @@ class FeatureAvDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('FeatureAv', 'Thelia\\Model\\FeatureAv', RelationMap::ONE_TO_ONE, array('feature_av_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('FeatureAv', 'Thelia\\Model\\FeatureAv', RelationMap::MANY_TO_ONE, array('feature_av_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // FeatureAvDescTableMap
|
||||
|
||||
@@ -42,9 +42,8 @@ class FeatureAvTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature_av_desc', 'FEATURE_AV_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature_prod', 'FEATURE_AV_ID', true, null, null);
|
||||
$this->addColumn('FEATURE_ID', 'FeatureId', 'INTEGER', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('FEATURE_ID', 'FeatureId', 'INTEGER', 'feature', 'ID', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
// validators
|
||||
@@ -55,9 +54,9 @@ class FeatureAvTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('FeatureAvDesc', 'Thelia\\Model\\FeatureAvDesc', RelationMap::MANY_TO_ONE, array('id' => 'feature_av_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('FeatureProd', 'Thelia\\Model\\FeatureProd', RelationMap::MANY_TO_ONE, array('id' => 'feature_av_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Feature', 'Thelia\\Model\\Feature', RelationMap::ONE_TO_ONE, array('feature_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Feature', 'Thelia\\Model\\Feature', RelationMap::MANY_TO_ONE, array('feature_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('FeatureAvDesc', 'Thelia\\Model\\FeatureAvDesc', RelationMap::ONE_TO_MANY, array('id' => 'feature_av_id', ), 'CASCADE', null, 'FeatureAvDescs');
|
||||
$this->addRelation('FeatureProd', 'Thelia\\Model\\FeatureProd', RelationMap::ONE_TO_MANY, array('id' => 'feature_av_id', ), 'CASCADE', null, 'FeatureProds');
|
||||
} // buildRelations()
|
||||
|
||||
} // FeatureAvTableMap
|
||||
|
||||
@@ -43,8 +43,8 @@ class FeatureCategoryTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('FEATURE_ID', 'FeatureId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CATEGORY_ID', 'CategoryId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('FEATURE_ID', 'FeatureId', 'INTEGER', 'feature', 'ID', true, null, null);
|
||||
$this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
// validators
|
||||
@@ -55,8 +55,8 @@ class FeatureCategoryTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::ONE_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Feature', 'Thelia\\Model\\Feature', RelationMap::ONE_TO_ONE, array('feature_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Feature', 'Thelia\\Model\\Feature', RelationMap::MANY_TO_ONE, array('feature_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // FeatureCategoryTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class FeatureDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('FEATURE_ID', 'FeatureId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('FEATURE_ID', 'FeatureId', 'INTEGER', 'feature', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -58,7 +58,7 @@ class FeatureDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Feature', 'Thelia\\Model\\Feature', RelationMap::ONE_TO_ONE, array('feature_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Feature', 'Thelia\\Model\\Feature', RelationMap::MANY_TO_ONE, array('feature_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // FeatureDescTableMap
|
||||
|
||||
@@ -43,9 +43,9 @@ class FeatureProdTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('PRODUCT_ID', 'ProductId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('FEATURE_ID', 'FeatureId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('FEATURE_AV_ID', 'FeatureAvId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null);
|
||||
$this->addForeignKey('FEATURE_ID', 'FeatureId', 'INTEGER', 'feature', 'ID', true, null, null);
|
||||
$this->addForeignKey('FEATURE_AV_ID', 'FeatureAvId', 'INTEGER', 'feature_av', 'ID', false, null, null);
|
||||
$this->addColumn('DEFAULT_UTILITY', 'DefaultUtility', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -58,9 +58,9 @@ class FeatureProdTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Feature', 'Thelia\\Model\\Feature', RelationMap::ONE_TO_ONE, array('feature_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('FeatureAv', 'Thelia\\Model\\FeatureAv', RelationMap::ONE_TO_ONE, array('feature_av_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::ONE_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('FeatureAv', 'Thelia\\Model\\FeatureAv', RelationMap::MANY_TO_ONE, array('feature_av_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Feature', 'Thelia\\Model\\Feature', RelationMap::MANY_TO_ONE, array('feature_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // FeatureProdTableMap
|
||||
|
||||
@@ -42,10 +42,7 @@ class FeatureTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature_av', 'FEATURE_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature_category', 'FEATURE_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature_desc', 'FEATURE_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature_prod', 'FEATURE_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('VISIBLE', 'Visible', 'INTEGER', false, null, 0);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -58,10 +55,10 @@ class FeatureTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('FeatureAv', 'Thelia\\Model\\FeatureAv', RelationMap::MANY_TO_ONE, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('FeatureCategory', 'Thelia\\Model\\FeatureCategory', RelationMap::MANY_TO_ONE, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('FeatureDesc', 'Thelia\\Model\\FeatureDesc', RelationMap::MANY_TO_ONE, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('FeatureProd', 'Thelia\\Model\\FeatureProd', RelationMap::MANY_TO_ONE, array('id' => 'feature_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('FeatureAv', 'Thelia\\Model\\FeatureAv', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', null, 'FeatureAvs');
|
||||
$this->addRelation('FeatureCategory', 'Thelia\\Model\\FeatureCategory', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', null, 'FeatureCategorys');
|
||||
$this->addRelation('FeatureDesc', 'Thelia\\Model\\FeatureDesc', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', null, 'FeatureDescs');
|
||||
$this->addRelation('FeatureProd', 'Thelia\\Model\\FeatureProd', RelationMap::ONE_TO_MANY, array('id' => 'feature_id', ), 'CASCADE', null, 'FeatureProds');
|
||||
} // buildRelations()
|
||||
|
||||
} // FeatureTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class FolderDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('FOLDER_ID', 'FolderId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('FOLDER_ID', 'FolderId', 'INTEGER', 'folder', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -59,7 +59,7 @@ class FolderDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::ONE_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::MANY_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // FolderDescTableMap
|
||||
|
||||
@@ -42,11 +42,7 @@ class FolderTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'content_folder', 'FOLDER_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'document', 'FOLDER_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'folder_desc', 'FOLDER_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'image', 'FOLDER_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'rewriting', 'FOLDER_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('PARENT', 'Parent', 'INTEGER', true, null, null);
|
||||
$this->addColumn('LINK', 'Link', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', false, null, null);
|
||||
@@ -61,11 +57,11 @@ class FolderTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('ContentFolder', 'Thelia\\Model\\ContentFolder', RelationMap::MANY_TO_ONE, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::MANY_TO_ONE, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('FolderDesc', 'Thelia\\Model\\FolderDesc', RelationMap::MANY_TO_ONE, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::MANY_TO_ONE, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::MANY_TO_ONE, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ContentFolder', 'Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', null, 'ContentFolders');
|
||||
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', null, 'Documents');
|
||||
$this->addRelation('FolderDesc', 'Thelia\\Model\\FolderDesc', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', null, 'FolderDescs');
|
||||
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', null, 'Images');
|
||||
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', null, 'Rewritings');
|
||||
} // buildRelations()
|
||||
|
||||
} // FolderTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class GroupDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('GROUP_ID', 'GroupId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('GROUP_ID', 'GroupId', 'INTEGER', 'group', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -58,7 +58,7 @@ class GroupDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Group', 'Thelia\\Model\\Group', RelationMap::ONE_TO_ONE, array('group_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Group', 'Thelia\\Model\\Group', RelationMap::MANY_TO_ONE, array('group_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // GroupDescTableMap
|
||||
|
||||
@@ -43,8 +43,8 @@ class GroupModuleTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('GROUP_ID', 'GroupId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('MODULE_ID', 'ModuleId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('GROUP_ID', 'GroupId', 'INTEGER', 'group', 'ID', true, null, null);
|
||||
$this->addForeignKey('MODULE_ID', 'ModuleId', 'INTEGER', 'module', 'ID', false, null, null);
|
||||
$this->addColumn('ACCESS', 'Access', 'TINYINT', false, null, 0);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -56,8 +56,8 @@ class GroupModuleTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Group', 'Thelia\\Model\\Group', RelationMap::ONE_TO_ONE, array('group_id' => 'id', ), 'CASCADE', 'CASCADE');
|
||||
$this->addRelation('Module', 'Thelia\\Model\\Module', RelationMap::ONE_TO_ONE, array('module_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Group', 'Thelia\\Model\\Group', RelationMap::MANY_TO_ONE, array('group_id' => 'id', ), 'CASCADE', 'CASCADE');
|
||||
$this->addRelation('Module', 'Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('module_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // GroupModuleTableMap
|
||||
|
||||
@@ -43,8 +43,8 @@ class GroupResourceTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('GROUP_ID', 'GroupId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('RESOURCE_ID', 'ResourceId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('GROUP_ID', 'GroupId', 'INTEGER', 'group', 'ID', true, null, null);
|
||||
$this->addForeignKey('RESOURCE_ID', 'ResourceId', 'INTEGER', 'resource', 'ID', true, null, null);
|
||||
$this->addColumn('READ', 'Read', 'TINYINT', false, null, 0);
|
||||
$this->addColumn('WRITE', 'Write', 'TINYINT', false, null, 0);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -57,8 +57,8 @@ class GroupResourceTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Group', 'Thelia\\Model\\Group', RelationMap::ONE_TO_ONE, array('group_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Resource', 'Thelia\\Model\\Resource', RelationMap::ONE_TO_ONE, array('resource_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Group', 'Thelia\\Model\\Group', RelationMap::MANY_TO_ONE, array('group_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Resource', 'Thelia\\Model\\Resource', RelationMap::MANY_TO_ONE, array('resource_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // GroupResourceTableMap
|
||||
|
||||
@@ -42,10 +42,7 @@ class GroupTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'admin_group', 'GROUP_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'group_desc', 'GROUP_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'group_module', 'GROUP_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'group_resource', 'GROUP_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 30, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -57,10 +54,10 @@ class GroupTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('AdminGroup', 'Thelia\\Model\\AdminGroup', RelationMap::MANY_TO_ONE, array('id' => 'group_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('GroupDesc', 'Thelia\\Model\\GroupDesc', RelationMap::MANY_TO_ONE, array('id' => 'group_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('GroupModule', 'Thelia\\Model\\GroupModule', RelationMap::MANY_TO_ONE, array('id' => 'group_id', ), 'CASCADE', 'CASCADE');
|
||||
$this->addRelation('GroupResource', 'Thelia\\Model\\GroupResource', RelationMap::MANY_TO_ONE, array('id' => 'group_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('AdminGroup', 'Thelia\\Model\\AdminGroup', RelationMap::ONE_TO_MANY, array('id' => 'group_id', ), 'CASCADE', null, 'AdminGroups');
|
||||
$this->addRelation('GroupDesc', 'Thelia\\Model\\GroupDesc', RelationMap::ONE_TO_MANY, array('id' => 'group_id', ), 'CASCADE', null, 'GroupDescs');
|
||||
$this->addRelation('GroupModule', 'Thelia\\Model\\GroupModule', RelationMap::ONE_TO_MANY, array('id' => 'group_id', ), 'CASCADE', 'CASCADE', 'GroupModules');
|
||||
$this->addRelation('GroupResource', 'Thelia\\Model\\GroupResource', RelationMap::ONE_TO_MANY, array('id' => 'group_id', ), 'CASCADE', null, 'GroupResources');
|
||||
} // buildRelations()
|
||||
|
||||
} // GroupTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class ImageDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('IMAGE_ID', 'ImageId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('IMAGE_ID', 'ImageId', 'INTEGER', 'image', 'ID', false, null, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
$this->addColumn('CHAPO', 'Chapo', 'LONGVARCHAR', false, null, null);
|
||||
@@ -57,7 +57,7 @@ class ImageDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::ONE_TO_ONE, array('image_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::MANY_TO_ONE, array('image_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // ImageDescTableMap
|
||||
|
||||
@@ -42,11 +42,11 @@ class ImageTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'image_desc', 'IMAGE_ID', true, null, null);
|
||||
$this->addColumn('PRODUCT_ID', 'ProductId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CATEGORY_ID', 'CategoryId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('FOLDER_ID', 'FolderId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CONTENT_ID', 'ContentId', 'INTEGER', false, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', false, null, null);
|
||||
$this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', false, null, null);
|
||||
$this->addForeignKey('FOLDER_ID', 'FolderId', 'INTEGER', 'folder', 'ID', false, null, null);
|
||||
$this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', false, null, null);
|
||||
$this->addColumn('FILE', 'File', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -59,11 +59,11 @@ class ImageTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('ImageDesc', 'Thelia\\Model\\ImageDesc', RelationMap::MANY_TO_ONE, array('id' => 'image_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::ONE_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::ONE_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::ONE_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::ONE_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::MANY_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('ImageDesc', 'Thelia\\Model\\ImageDesc', RelationMap::ONE_TO_MANY, array('id' => 'image_id', ), 'CASCADE', null, 'ImageDescs');
|
||||
} // buildRelations()
|
||||
|
||||
} // ImageTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class MessageDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('MESSAGE_ID', 'MessageId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('MESSAGE_ID', 'MessageId', 'INTEGER', 'message', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 45, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -58,7 +58,7 @@ class MessageDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Message', 'Thelia\\Model\\Message', RelationMap::ONE_TO_ONE, array('message_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Message', 'Thelia\\Model\\Message', RelationMap::MANY_TO_ONE, array('message_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // MessageDescTableMap
|
||||
|
||||
@@ -42,7 +42,7 @@ class MessageTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'message_desc', 'MESSAGE_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('SECURE', 'Secure', 'TINYINT', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -55,7 +55,7 @@ class MessageTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('MessageDesc', 'Thelia\\Model\\MessageDesc', RelationMap::MANY_TO_ONE, array('id' => 'message_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('MessageDesc', 'Thelia\\Model\\MessageDesc', RelationMap::ONE_TO_MANY, array('id' => 'message_id', ), 'CASCADE', null, 'MessageDescs');
|
||||
} // buildRelations()
|
||||
|
||||
} // MessageTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class ModuleDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('MODULE_ID', 'ModuleId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('MODULE_ID', 'ModuleId', 'INTEGER', 'module', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -59,7 +59,7 @@ class ModuleDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Module', 'Thelia\\Model\\Module', RelationMap::ONE_TO_ONE, array('module_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Module', 'Thelia\\Model\\Module', RelationMap::MANY_TO_ONE, array('module_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // ModuleDescTableMap
|
||||
|
||||
@@ -42,8 +42,7 @@ class ModuleTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'group_module', 'MODULE_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'module_desc', 'MODULE_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 55, null);
|
||||
$this->addColumn('TYPE', 'Type', 'TINYINT', true, null, null);
|
||||
$this->addColumn('ACTIVATE', 'Activate', 'TINYINT', false, null, null);
|
||||
@@ -58,8 +57,8 @@ class ModuleTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('GroupModule', 'Thelia\\Model\\GroupModule', RelationMap::MANY_TO_ONE, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ModuleDesc', 'Thelia\\Model\\ModuleDesc', RelationMap::MANY_TO_ONE, array('id' => 'module_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('GroupModule', 'Thelia\\Model\\GroupModule', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', null, 'GroupModules');
|
||||
$this->addRelation('ModuleDesc', 'Thelia\\Model\\ModuleDesc', RelationMap::ONE_TO_MANY, array('id' => 'module_id', ), 'CASCADE', null, 'ModuleDescs');
|
||||
} // buildRelations()
|
||||
|
||||
} // ModuleTableMap
|
||||
|
||||
@@ -42,8 +42,7 @@ class OrderAddressTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order', 'ADDRESS_INVOICE', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order', 'ADDRESS_DELIVERY', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CUSTOMER_TITLE_ID', 'CustomerTitleId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null);
|
||||
@@ -65,8 +64,8 @@ class OrderAddressTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('id' => 'address_invoice', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('id' => 'address_delivery', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('OrderRelatedByAddressInvoice', 'Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'address_invoice', ), 'SET NULL', null, 'OrdersRelatedByAddressInvoice');
|
||||
$this->addRelation('OrderRelatedByAddressDelivery', 'Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'address_delivery', ), 'SET NULL', null, 'OrdersRelatedByAddressDelivery');
|
||||
} // buildRelations()
|
||||
|
||||
} // OrderAddressTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class OrderFeatureTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('ORDER_PRODUCT_ID', 'OrderProductId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('ORDER_PRODUCT_ID', 'OrderProductId', 'INTEGER', 'order_product', 'ID', true, null, null);
|
||||
$this->addColumn('FEATURE_DESC', 'FeatureDesc', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('FEATURE_AV_DESC', 'FeatureAvDesc', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -56,7 +56,7 @@ class OrderFeatureTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('OrderProduct', 'Thelia\\Model\\OrderProduct', RelationMap::ONE_TO_ONE, array('order_product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('OrderProduct', 'Thelia\\Model\\OrderProduct', RelationMap::MANY_TO_ONE, array('order_product_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // OrderFeatureTableMap
|
||||
|
||||
@@ -42,8 +42,8 @@ class OrderProductTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order_feature', 'ORDER_PRODUCT_ID', true, null, null);
|
||||
$this->addColumn('ORDER_ID', 'OrderId', 'INTEGER', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null);
|
||||
$this->addColumn('PRODUCT_REF', 'ProductRef', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -62,8 +62,8 @@ class OrderProductTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('OrderFeature', 'Thelia\\Model\\OrderFeature', RelationMap::MANY_TO_ONE, array('id' => 'order_product_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::ONE_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('OrderFeature', 'Thelia\\Model\\OrderFeature', RelationMap::ONE_TO_MANY, array('id' => 'order_product_id', ), 'CASCADE', null, 'OrderFeatures');
|
||||
} // buildRelations()
|
||||
|
||||
} // OrderProductTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class OrderStatusDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('STATUS_ID', 'StatusId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('STATUS_ID', 'StatusId', 'INTEGER', 'order_status', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -58,7 +58,7 @@ class OrderStatusDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('OrderStatus', 'Thelia\\Model\\OrderStatus', RelationMap::ONE_TO_ONE, array('status_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('OrderStatus', 'Thelia\\Model\\OrderStatus', RelationMap::MANY_TO_ONE, array('status_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // OrderStatusDescTableMap
|
||||
|
||||
@@ -42,8 +42,7 @@ class OrderStatusTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order', 'STATUS_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order_status_desc', 'STATUS_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', false, 45, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -55,8 +54,8 @@ class OrderStatusTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('id' => 'status_id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('OrderStatusDesc', 'Thelia\\Model\\OrderStatusDesc', RelationMap::MANY_TO_ONE, array('id' => 'status_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Order', 'Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'status_id', ), 'SET NULL', null, 'Orders');
|
||||
$this->addRelation('OrderStatusDesc', 'Thelia\\Model\\OrderStatusDesc', RelationMap::ONE_TO_MANY, array('id' => 'status_id', ), 'CASCADE', null, 'OrderStatusDescs');
|
||||
} // buildRelations()
|
||||
|
||||
} // OrderStatusTableMap
|
||||
|
||||
@@ -42,14 +42,13 @@ class OrderTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'coupon_order', 'ORDER_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order_product', 'ORDER_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('REF', 'Ref', 'VARCHAR', false, 45, null);
|
||||
$this->addColumn('CUSTOMER_ID', 'CustomerId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('ADDRESS_INVOICE', 'AddressInvoice', 'INTEGER', false, null, null);
|
||||
$this->addColumn('ADDRESS_DELIVERY', 'AddressDelivery', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('CUSTOMER_ID', 'CustomerId', 'INTEGER', 'customer', 'ID', true, null, null);
|
||||
$this->addForeignKey('ADDRESS_INVOICE', 'AddressInvoice', 'INTEGER', 'order_address', 'ID', false, null, null);
|
||||
$this->addForeignKey('ADDRESS_DELIVERY', 'AddressDelivery', 'INTEGER', 'order_address', 'ID', false, null, null);
|
||||
$this->addColumn('INVOICE_DATE', 'InvoiceDate', 'DATE', false, null, null);
|
||||
$this->addColumn('CURRENCY_ID', 'CurrencyId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('CURRENCY_ID', 'CurrencyId', 'INTEGER', 'currency', 'ID', false, null, null);
|
||||
$this->addColumn('CURRENCY_RATE', 'CurrencyRate', 'FLOAT', true, null, null);
|
||||
$this->addColumn('TRANSACTION', 'Transaction', 'VARCHAR', false, 100, null);
|
||||
$this->addColumn('DELIVERY_NUM', 'DeliveryNum', 'VARCHAR', false, 100, null);
|
||||
@@ -57,7 +56,7 @@ class OrderTableMap extends TableMap
|
||||
$this->addColumn('POSTAGE', 'Postage', 'FLOAT', false, null, null);
|
||||
$this->addColumn('PAYMENT', 'Payment', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('CARRIER', 'Carrier', 'VARCHAR', true, 45, null);
|
||||
$this->addColumn('STATUS_ID', 'StatusId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('STATUS_ID', 'StatusId', 'INTEGER', 'order_status', 'ID', false, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -69,13 +68,13 @@ class OrderTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CouponOrder', 'Thelia\\Model\\CouponOrder', RelationMap::MANY_TO_ONE, array('id' => 'order_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('OrderProduct', 'Thelia\\Model\\OrderProduct', RelationMap::MANY_TO_ONE, array('id' => 'order_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Currency', 'Thelia\\Model\\Currency', RelationMap::ONE_TO_ONE, array('currency_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('Customer', 'Thelia\\Model\\Customer', RelationMap::ONE_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('OrderAddress', 'Thelia\\Model\\OrderAddress', RelationMap::ONE_TO_ONE, array('address_invoice' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('OrderAddress', 'Thelia\\Model\\OrderAddress', RelationMap::ONE_TO_ONE, array('address_delivery' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('OrderStatus', 'Thelia\\Model\\OrderStatus', RelationMap::ONE_TO_ONE, array('status_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('Currency', 'Thelia\\Model\\Currency', RelationMap::MANY_TO_ONE, array('currency_id' => 'id', ), 'SET NULL', null);
|
||||
$this->addRelation('Customer', 'Thelia\\Model\\Customer', RelationMap::MANY_TO_ONE, array('customer_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('OrderAddressRelatedByAddressInvoice', 'Thelia\\Model\\OrderAddress', RelationMap::MANY_TO_ONE, array('address_invoice' => 'id', ), 'SET NULL', null);
|
||||
$this->addRelation('OrderAddressRelatedByAddressDelivery', 'Thelia\\Model\\OrderAddress', RelationMap::MANY_TO_ONE, array('address_delivery' => 'id', ), 'SET NULL', null);
|
||||
$this->addRelation('OrderStatus', 'Thelia\\Model\\OrderStatus', RelationMap::MANY_TO_ONE, array('status_id' => 'id', ), 'SET NULL', null);
|
||||
$this->addRelation('CouponOrder', 'Thelia\\Model\\CouponOrder', RelationMap::ONE_TO_MANY, array('id' => 'order_id', ), 'CASCADE', null, 'CouponOrders');
|
||||
$this->addRelation('OrderProduct', 'Thelia\\Model\\OrderProduct', RelationMap::ONE_TO_MANY, array('id' => 'order_id', ), 'CASCADE', null, 'OrderProducts');
|
||||
} // buildRelations()
|
||||
|
||||
} // OrderTableMap
|
||||
|
||||
@@ -42,8 +42,8 @@ class ProductCategoryTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addPrimaryKey('PRODUCT_ID', 'ProductId', 'INTEGER', true, null, null);
|
||||
$this->addPrimaryKey('CATEGORY_ID', 'CategoryId', 'INTEGER', true, null, null);
|
||||
$this->addForeignPrimaryKey('PRODUCT_ID', 'ProductId', 'INTEGER' , 'product', 'ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('CATEGORY_ID', 'CategoryId', 'INTEGER' , 'category', 'ID', true, null, null);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
@@ -52,8 +52,8 @@ class ProductCategoryTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::ONE_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::ONE_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // ProductCategoryTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class ProductDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('PRODUCT_ID', 'ProductId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'CLOB', false, null, null);
|
||||
@@ -59,7 +59,7 @@ class ProductDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::ONE_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // ProductDescTableMap
|
||||
|
||||
@@ -42,17 +42,8 @@ class ProductTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'accessory', 'PRODUCT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'accessory', 'ACCESSORY', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'content_assoc', 'PRODUCT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'document', 'PRODUCT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'feature_prod', 'PRODUCT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'image', 'PRODUCT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'product_category', 'PRODUCT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'product_desc', 'PRODUCT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'rewriting', 'PRODUCT_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'stock', 'PRODUCT_ID', true, null, null);
|
||||
$this->addColumn('TAX_RULE_ID', 'TaxRuleId', 'INTEGER', false, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('TAX_RULE_ID', 'TaxRuleId', 'INTEGER', 'tax_rule', 'ID', false, null, null);
|
||||
$this->addColumn('REF', 'Ref', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null);
|
||||
$this->addColumn('PRICE2', 'Price2', 'FLOAT', false, null, null);
|
||||
@@ -73,17 +64,17 @@ class ProductTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Accessory', 'Thelia\\Model\\Accessory', RelationMap::MANY_TO_ONE, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Accessory', 'Thelia\\Model\\Accessory', RelationMap::MANY_TO_ONE, array('id' => 'accessory', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ContentAssoc', 'Thelia\\Model\\ContentAssoc', RelationMap::MANY_TO_ONE, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::MANY_TO_ONE, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('FeatureProd', 'Thelia\\Model\\FeatureProd', RelationMap::MANY_TO_ONE, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::MANY_TO_ONE, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ProductCategory', 'Thelia\\Model\\ProductCategory', RelationMap::MANY_TO_ONE, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ProductDesc', 'Thelia\\Model\\ProductDesc', RelationMap::MANY_TO_ONE, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::MANY_TO_ONE, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Stock', 'Thelia\\Model\\Stock', RelationMap::MANY_TO_ONE, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('TaxRule', 'Thelia\\Model\\TaxRule', RelationMap::ONE_TO_ONE, array('tax_rule_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('TaxRule', 'Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'SET NULL', null);
|
||||
$this->addRelation('AccessoryRelatedByProductId', 'Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', null, 'AccessorysRelatedByProductId');
|
||||
$this->addRelation('AccessoryRelatedByAccessory', 'Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'accessory', ), 'CASCADE', null, 'AccessorysRelatedByAccessory');
|
||||
$this->addRelation('ContentAssoc', 'Thelia\\Model\\ContentAssoc', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', null, 'ContentAssocs');
|
||||
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', null, 'Documents');
|
||||
$this->addRelation('FeatureProd', 'Thelia\\Model\\FeatureProd', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', null, 'FeatureProds');
|
||||
$this->addRelation('Image', 'Thelia\\Model\\Image', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', null, 'Images');
|
||||
$this->addRelation('ProductCategory', 'Thelia\\Model\\ProductCategory', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', null, 'ProductCategorys');
|
||||
$this->addRelation('ProductDesc', 'Thelia\\Model\\ProductDesc', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', null, 'ProductDescs');
|
||||
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', null, 'Rewritings');
|
||||
$this->addRelation('Stock', 'Thelia\\Model\\Stock', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', null, 'Stocks');
|
||||
} // buildRelations()
|
||||
|
||||
} // ProductTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class ResourceDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('RESOURCE_ID', 'ResourceId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('RESOURCE_ID', 'ResourceId', 'INTEGER', 'resource', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -56,7 +56,7 @@ class ResourceDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Resource', 'Thelia\\Model\\Resource', RelationMap::ONE_TO_ONE, array('resource_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Resource', 'Thelia\\Model\\Resource', RelationMap::MANY_TO_ONE, array('resource_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // ResourceDescTableMap
|
||||
|
||||
@@ -42,8 +42,7 @@ class ResourceTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'group_resource', 'RESOURCE_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'resource_desc', 'RESOURCE_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 30, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
@@ -55,8 +54,8 @@ class ResourceTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('GroupResource', 'Thelia\\Model\\GroupResource', RelationMap::MANY_TO_ONE, array('id' => 'resource_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('ResourceDesc', 'Thelia\\Model\\ResourceDesc', RelationMap::MANY_TO_ONE, array('id' => 'resource_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('GroupResource', 'Thelia\\Model\\GroupResource', RelationMap::ONE_TO_MANY, array('id' => 'resource_id', ), 'CASCADE', null, 'GroupResources');
|
||||
$this->addRelation('ResourceDesc', 'Thelia\\Model\\ResourceDesc', RelationMap::ONE_TO_MANY, array('id' => 'resource_id', ), 'CASCADE', null, 'ResourceDescs');
|
||||
} // buildRelations()
|
||||
|
||||
} // ResourceTableMap
|
||||
|
||||
@@ -44,10 +44,10 @@ class RewritingTableMap extends TableMap
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('URL', 'Url', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('PRODUCT_ID', 'ProductId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CATEGORY_ID', 'CategoryId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('FOLDER_ID', 'FolderId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CONTENT_ID', 'ContentId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', false, null, null);
|
||||
$this->addForeignKey('CATEGORY_ID', 'CategoryId', 'INTEGER', 'category', 'ID', false, null, null);
|
||||
$this->addForeignKey('FOLDER_ID', 'FolderId', 'INTEGER', 'folder', 'ID', false, null, null);
|
||||
$this->addForeignKey('CONTENT_ID', 'ContentId', 'INTEGER', 'content', 'ID', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
// validators
|
||||
@@ -58,10 +58,10 @@ class RewritingTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::ONE_TO_ONE, array('category_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::ONE_TO_ONE, array('content_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::ONE_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::ONE_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('category_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::MANY_TO_ONE, array('folder_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('content_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // RewritingTableMap
|
||||
|
||||
@@ -43,8 +43,8 @@ class StockTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('COMBINATION_ID', 'CombinationId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('PRODUCT_ID', 'ProductId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('COMBINATION_ID', 'CombinationId', 'INTEGER', 'combination', 'ID', false, null, null);
|
||||
$this->addForeignKey('PRODUCT_ID', 'ProductId', 'INTEGER', 'product', 'ID', true, null, null);
|
||||
$this->addColumn('INCREASE', 'Increase', 'FLOAT', false, null, null);
|
||||
$this->addColumn('VALUE', 'Value', 'FLOAT', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -57,8 +57,8 @@ class StockTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Combination', 'Thelia\\Model\\Combination', RelationMap::ONE_TO_ONE, array('combination_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::ONE_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Combination', 'Thelia\\Model\\Combination', RelationMap::MANY_TO_ONE, array('combination_id' => 'id', ), 'SET NULL', null);
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // StockTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class TaxDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('TAX_ID', 'TaxId', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('TAX_ID', 'TaxId', 'INTEGER', 'tax', 'ID', true, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -57,7 +57,7 @@ class TaxDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Tax', 'Thelia\\Model\\Tax', RelationMap::ONE_TO_ONE, array('tax_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Tax', 'Thelia\\Model\\Tax', RelationMap::MANY_TO_ONE, array('tax_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // TaxDescTableMap
|
||||
|
||||
@@ -43,9 +43,9 @@ class TaxRuleCountryTableMap extends TableMap
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('TAX_RULE_ID', 'TaxRuleId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('COUNTRY_ID', 'CountryId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('TAX_ID', 'TaxId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('TAX_RULE_ID', 'TaxRuleId', 'INTEGER', 'tax_rule', 'ID', false, null, null);
|
||||
$this->addForeignKey('COUNTRY_ID', 'CountryId', 'INTEGER', 'country', 'ID', false, null, null);
|
||||
$this->addForeignKey('TAX_ID', 'TaxId', 'INTEGER', 'tax', 'ID', false, null, null);
|
||||
$this->addColumn('NONE', 'None', 'TINYINT', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -57,9 +57,9 @@ class TaxRuleCountryTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Country', 'Thelia\\Model\\Country', RelationMap::ONE_TO_ONE, array('country_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Tax', 'Thelia\\Model\\Tax', RelationMap::ONE_TO_ONE, array('tax_id' => 'id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('TaxRule', 'Thelia\\Model\\TaxRule', RelationMap::ONE_TO_ONE, array('tax_rule_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Tax', 'Thelia\\Model\\Tax', RelationMap::MANY_TO_ONE, array('tax_id' => 'id', ), 'SET NULL', null);
|
||||
$this->addRelation('TaxRule', 'Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('Country', 'Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // TaxRuleCountryTableMap
|
||||
|
||||
@@ -43,7 +43,7 @@ class TaxRuleDescTableMap extends TableMap
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('TAX_RULE_ID', 'TaxRuleId', 'INTEGER', false, null, null);
|
||||
$this->addForeignKey('TAX_RULE_ID', 'TaxRuleId', 'INTEGER', 'tax_rule', 'ID', false, null, null);
|
||||
$this->addColumn('LANG', 'Lang', 'VARCHAR', false, 10, null);
|
||||
$this->addColumn('TITLE', 'Title', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('DESCRIPTION', 'Description', 'LONGVARCHAR', false, null, null);
|
||||
@@ -57,7 +57,7 @@ class TaxRuleDescTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('TaxRule', 'Thelia\\Model\\TaxRule', RelationMap::ONE_TO_ONE, array('tax_rule_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('TaxRule', 'Thelia\\Model\\TaxRule', RelationMap::MANY_TO_ONE, array('tax_rule_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
} // TaxRuleDescTableMap
|
||||
|
||||
@@ -42,9 +42,7 @@ class TaxRuleTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'product', 'TAX_RULE_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_rule_country', 'TAX_RULE_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_rule_desc', 'TAX_RULE_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', false, 45, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', true, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', true, null, null);
|
||||
@@ -56,9 +54,9 @@ class TaxRuleTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('id' => 'tax_rule_id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('TaxRuleCountry', 'Thelia\\Model\\TaxRuleCountry', RelationMap::MANY_TO_ONE, array('id' => 'tax_rule_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('TaxRuleDesc', 'Thelia\\Model\\TaxRuleDesc', RelationMap::MANY_TO_ONE, array('id' => 'tax_rule_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::ONE_TO_MANY, array('id' => 'tax_rule_id', ), 'SET NULL', null, 'Products');
|
||||
$this->addRelation('TaxRuleCountry', 'Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'tax_rule_id', ), 'CASCADE', null, 'TaxRuleCountrys');
|
||||
$this->addRelation('TaxRuleDesc', 'Thelia\\Model\\TaxRuleDesc', RelationMap::ONE_TO_MANY, array('id' => 'tax_rule_id', ), 'CASCADE', null, 'TaxRuleDescs');
|
||||
} // buildRelations()
|
||||
|
||||
} // TaxRuleTableMap
|
||||
|
||||
@@ -42,8 +42,7 @@ class TaxTableMap extends TableMap
|
||||
$this->setPackage('Thelia.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_desc', 'TAX_ID', true, null, null);
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'tax_rule_country', 'TAX_ID', true, null, null);
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('RATE', 'Rate', 'FLOAT', true, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
@@ -55,8 +54,8 @@ class TaxTableMap extends TableMap
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('TaxDesc', 'Thelia\\Model\\TaxDesc', RelationMap::MANY_TO_ONE, array('id' => 'tax_id', ), 'CASCADE', 'RESTRICT');
|
||||
$this->addRelation('TaxRuleCountry', 'Thelia\\Model\\TaxRuleCountry', RelationMap::MANY_TO_ONE, array('id' => 'tax_id', ), 'SET NULL', 'RESTRICT');
|
||||
$this->addRelation('TaxDesc', 'Thelia\\Model\\TaxDesc', RelationMap::ONE_TO_MANY, array('id' => 'tax_id', ), 'CASCADE', null, 'TaxDescs');
|
||||
$this->addRelation('TaxRuleCountry', 'Thelia\\Model\\TaxRuleCountry', RelationMap::ONE_TO_MANY, array('id' => 'tax_id', ), 'SET NULL', null, 'TaxRuleCountrys');
|
||||
} // buildRelations()
|
||||
|
||||
} // TaxTableMap
|
||||
|
||||
@@ -10,10 +10,8 @@ use \Exception;
|
||||
use \PDO;
|
||||
use \Persistent;
|
||||
use \Propel;
|
||||
use \PropelCollection;
|
||||
use \PropelDateTime;
|
||||
use \PropelException;
|
||||
use \PropelObjectCollection;
|
||||
use \PropelPDO;
|
||||
use Thelia\Model\Accessory;
|
||||
use Thelia\Model\AccessoryPeer;
|
||||
@@ -86,14 +84,14 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var Product one-to-one related Product object
|
||||
* @var Product
|
||||
*/
|
||||
protected $singleProduct;
|
||||
protected $aProductRelatedByProductId;
|
||||
|
||||
/**
|
||||
* @var Product one-to-one related Product object
|
||||
* @var Product
|
||||
*/
|
||||
protected $singleProduct;
|
||||
protected $aProductRelatedByAccessory;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -109,18 +107,6 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $productsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $productsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
@@ -273,6 +259,10 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AccessoryPeer::PRODUCT_ID;
|
||||
}
|
||||
|
||||
if ($this->aProductRelatedByProductId !== null && $this->aProductRelatedByProductId->getId() !== $v) {
|
||||
$this->aProductRelatedByProductId = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setProductId()
|
||||
@@ -294,6 +284,10 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AccessoryPeer::ACCESSORY;
|
||||
}
|
||||
|
||||
if ($this->aProductRelatedByAccessory !== null && $this->aProductRelatedByAccessory->getId() !== $v) {
|
||||
$this->aProductRelatedByAccessory = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setAccessory()
|
||||
@@ -434,6 +428,12 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
public function ensureConsistency()
|
||||
{
|
||||
|
||||
if ($this->aProductRelatedByProductId !== null && $this->product_id !== $this->aProductRelatedByProductId->getId()) {
|
||||
$this->aProductRelatedByProductId = null;
|
||||
}
|
||||
if ($this->aProductRelatedByAccessory !== null && $this->accessory !== $this->aProductRelatedByAccessory->getId()) {
|
||||
$this->aProductRelatedByAccessory = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -473,10 +473,8 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->singleProduct = null;
|
||||
|
||||
$this->singleProduct = null;
|
||||
|
||||
$this->aProductRelatedByProductId = null;
|
||||
$this->aProductRelatedByAccessory = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -590,6 +588,25 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
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->aProductRelatedByProductId !== null) {
|
||||
if ($this->aProductRelatedByProductId->isModified() || $this->aProductRelatedByProductId->isNew()) {
|
||||
$affectedRows += $this->aProductRelatedByProductId->save($con);
|
||||
}
|
||||
$this->setProductRelatedByProductId($this->aProductRelatedByProductId);
|
||||
}
|
||||
|
||||
if ($this->aProductRelatedByAccessory !== null) {
|
||||
if ($this->aProductRelatedByAccessory->isModified() || $this->aProductRelatedByAccessory->isNew()) {
|
||||
$affectedRows += $this->aProductRelatedByAccessory->save($con);
|
||||
}
|
||||
$this->setProductRelatedByAccessory($this->aProductRelatedByAccessory);
|
||||
}
|
||||
|
||||
if ($this->isNew() || $this->isModified()) {
|
||||
// persist changes
|
||||
if ($this->isNew()) {
|
||||
@@ -601,36 +618,6 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->productsScheduledForDeletion !== null) {
|
||||
if (!$this->productsScheduledForDeletion->isEmpty()) {
|
||||
ProductQuery::create()
|
||||
->filterByPrimaryKeys($this->productsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->productsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleProduct !== null) {
|
||||
if (!$this->singleProduct->isDeleted()) {
|
||||
$affectedRows += $this->singleProduct->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->productsScheduledForDeletion !== null) {
|
||||
if (!$this->productsScheduledForDeletion->isEmpty()) {
|
||||
ProductQuery::create()
|
||||
->filterByPrimaryKeys($this->productsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->productsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleProduct !== null) {
|
||||
if (!$this->singleProduct->isDeleted()) {
|
||||
$affectedRows += $this->singleProduct->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -787,23 +774,29 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
$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->aProductRelatedByProductId !== null) {
|
||||
if (!$this->aProductRelatedByProductId->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aProductRelatedByProductId->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->aProductRelatedByAccessory !== null) {
|
||||
if (!$this->aProductRelatedByAccessory->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aProductRelatedByAccessory->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($retval = AccessoryPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
if ($this->singleProduct !== null) {
|
||||
if (!$this->singleProduct->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleProduct->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleProduct !== null) {
|
||||
if (!$this->singleProduct->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleProduct->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
@@ -894,11 +887,11 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
$keys[5] => $this->getUpdatedAt(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->singleProduct) {
|
||||
$result['Product'] = $this->singleProduct->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aProductRelatedByProductId) {
|
||||
$result['ProductRelatedByProductId'] = $this->aProductRelatedByProductId->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
if (null !== $this->singleProduct) {
|
||||
$result['Product'] = $this->singleProduct->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aProductRelatedByAccessory) {
|
||||
$result['ProductRelatedByAccessory'] = $this->aProductRelatedByAccessory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1075,16 +1068,6 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
// store object hash to prevent cycle
|
||||
$this->startCopy = true;
|
||||
|
||||
$relObj = $this->getProduct();
|
||||
if ($relObj) {
|
||||
$copyObj->setProduct($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
$relObj = $this->getProduct();
|
||||
if ($relObj) {
|
||||
$copyObj->setProduct($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
//unflag object copy
|
||||
$this->startCopy = false;
|
||||
} // if ($deepCopy)
|
||||
@@ -1135,91 +1118,108 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
return self::$peer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a collection based on the name of a relation.
|
||||
* Avoids crafting an 'init[$relationName]s' method name
|
||||
* that wouldn't work when StandardEnglishPluralizer is used.
|
||||
* Declares an association between this object and a Product object.
|
||||
*
|
||||
* @param string $relationName The name of the relation to initialize
|
||||
* @return void
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single Product object, which is related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return Product
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getProduct(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleProduct === null && !$this->isNew()) {
|
||||
$this->singleProduct = ProductQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
}
|
||||
|
||||
return $this->singleProduct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single Product object as related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param Product $v Product
|
||||
* @param Product $v
|
||||
* @return Accessory The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setProduct(Product $v = null)
|
||||
public function setProductRelatedByProductId(Product $v = null)
|
||||
{
|
||||
$this->singleProduct = $v;
|
||||
|
||||
// Make sure that that the passed-in Product isn't already associated with this object
|
||||
if ($v !== null && $v->getAccessory() === null) {
|
||||
$v->setAccessory($this);
|
||||
if ($v === null) {
|
||||
$this->setProductId(NULL);
|
||||
} else {
|
||||
$this->setProductId($v->getId());
|
||||
}
|
||||
|
||||
$this->aProductRelatedByProductId = $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->addAccessoryRelatedByProductId($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a single Product object, which is related to this object by a one-to-one relationship.
|
||||
* Get the associated Product object
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return Product
|
||||
* @param PropelPDO $con Optional Connection object.
|
||||
* @return Product The associated Product object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getProduct(PropelPDO $con = null)
|
||||
public function getProductRelatedByProductId(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleProduct === null && !$this->isNew()) {
|
||||
$this->singleProduct = ProductQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
if ($this->aProductRelatedByProductId === null && ($this->product_id !== null)) {
|
||||
$this->aProductRelatedByProductId = ProductQuery::create()->findPk($this->product_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->aProductRelatedByProductId->addAccessorysRelatedByProductId($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->singleProduct;
|
||||
return $this->aProductRelatedByProductId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single Product object as related to this object by a one-to-one relationship.
|
||||
* Declares an association between this object and a Product object.
|
||||
*
|
||||
* @param Product $v Product
|
||||
* @param Product $v
|
||||
* @return Accessory The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setProduct(Product $v = null)
|
||||
public function setProductRelatedByAccessory(Product $v = null)
|
||||
{
|
||||
$this->singleProduct = $v;
|
||||
|
||||
// Make sure that that the passed-in Product isn't already associated with this object
|
||||
if ($v !== null && $v->getAccessory() === null) {
|
||||
$v->setAccessory($this);
|
||||
if ($v === null) {
|
||||
$this->setAccessory(NULL);
|
||||
} else {
|
||||
$this->setAccessory($v->getId());
|
||||
}
|
||||
|
||||
$this->aProductRelatedByAccessory = $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->addAccessoryRelatedByAccessory($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated Product object
|
||||
*
|
||||
* @param PropelPDO $con Optional Connection object.
|
||||
* @return Product The associated Product object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getProductRelatedByAccessory(PropelPDO $con = null)
|
||||
{
|
||||
if ($this->aProductRelatedByAccessory === null && ($this->accessory !== null)) {
|
||||
$this->aProductRelatedByAccessory = ProductQuery::create()->findPk($this->accessory, $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->aProductRelatedByAccessory->addAccessorysRelatedByAccessory($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aProductRelatedByAccessory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
@@ -1251,22 +1251,10 @@ abstract class BaseAccessory extends BaseObject implements Persistent
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->singleProduct) {
|
||||
$this->singleProduct->clearAllReferences($deep);
|
||||
}
|
||||
if ($this->singleProduct) {
|
||||
$this->singleProduct->clearAllReferences($deep);
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
if ($this->singleProduct instanceof PropelCollection) {
|
||||
$this->singleProduct->clearIterator();
|
||||
}
|
||||
$this->singleProduct = null;
|
||||
if ($this->singleProduct instanceof PropelCollection) {
|
||||
$this->singleProduct->clearIterator();
|
||||
}
|
||||
$this->singleProduct = null;
|
||||
$this->aProductRelatedByProductId = null;
|
||||
$this->aProductRelatedByAccessory = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class BaseAccessoryPeer
|
||||
{
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'mydb';
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'accessory';
|
||||
@@ -388,12 +388,6 @@ abstract class BaseAccessoryPeer
|
||||
*/
|
||||
public static function clearRelatedInstancePool()
|
||||
{
|
||||
// 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 ProductPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
ProductPeer::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -490,6 +484,585 @@ abstract class BaseAccessoryPeer
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related ProductRelatedByProductId 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 doCountJoinProductRelatedByProductId(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(AccessoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AccessoryPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AccessoryPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AccessoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AccessoryPeer::PRODUCT_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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related ProductRelatedByAccessory 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 doCountJoinProductRelatedByAccessory(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(AccessoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AccessoryPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AccessoryPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AccessoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AccessoryPeer::ACCESSORY, 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 Accessory 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 Accessory objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinProductRelatedByProductId(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(AccessoryPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AccessoryPeer::addSelectColumns($criteria);
|
||||
$startcol = AccessoryPeer::NUM_HYDRATE_COLUMNS;
|
||||
ProductPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AccessoryPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AccessoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AccessoryPeer::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 = AccessoryPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AccessoryPeer::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 (Accessory) to $obj2 (Product)
|
||||
$obj2->addAccessoryRelatedByProductId($obj1);
|
||||
|
||||
} // if joined row was not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of Accessory 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 Accessory objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinProductRelatedByAccessory(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(AccessoryPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AccessoryPeer::addSelectColumns($criteria);
|
||||
$startcol = AccessoryPeer::NUM_HYDRATE_COLUMNS;
|
||||
ProductPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AccessoryPeer::ACCESSORY, ProductPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AccessoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AccessoryPeer::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 = AccessoryPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AccessoryPeer::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 (Accessory) to $obj2 (Product)
|
||||
$obj2->addAccessoryRelatedByAccessory($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(AccessoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AccessoryPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AccessoryPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AccessoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AccessoryPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
|
||||
|
||||
$criteria->addJoin(AccessoryPeer::ACCESSORY, 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 Accessory 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 Accessory 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(AccessoryPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AccessoryPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AccessoryPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
ProductPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
ProductPeer::addSelectColumns($criteria);
|
||||
$startcol4 = $startcol3 + ProductPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AccessoryPeer::PRODUCT_ID, ProductPeer::ID, $join_behavior);
|
||||
|
||||
$criteria->addJoin(AccessoryPeer::ACCESSORY, ProductPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AccessoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AccessoryPeer::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 = AccessoryPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AccessoryPeer::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 (Accessory) to the collection in $obj2 (Product)
|
||||
$obj2->addAccessoryRelatedByProductId($obj1);
|
||||
} // if joined row not null
|
||||
|
||||
// Add objects for joined Product rows
|
||||
|
||||
$key3 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol3);
|
||||
if ($key3 !== null) {
|
||||
$obj3 = ProductPeer::getInstanceFromPool($key3);
|
||||
if (!$obj3) {
|
||||
|
||||
$cls = ProductPeer::getOMClass();
|
||||
|
||||
$obj3 = new $cls();
|
||||
$obj3->hydrate($row, $startcol3);
|
||||
ProductPeer::addInstanceToPool($obj3, $key3);
|
||||
} // if obj3 loaded
|
||||
|
||||
// Add the $obj1 (Accessory) to the collection in $obj3 (Product)
|
||||
$obj3->addAccessoryRelatedByAccessory($obj1);
|
||||
} // if joined row not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related ProductRelatedByProductId 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 doCountJoinAllExceptProductRelatedByProductId(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(AccessoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AccessoryPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AccessoryPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AccessoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related ProductRelatedByAccessory 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 doCountJoinAllExceptProductRelatedByAccessory(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(AccessoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AccessoryPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AccessoryPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AccessoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$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 Accessory objects pre-filled with all related objects except ProductRelatedByProductId.
|
||||
*
|
||||
* @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 Accessory objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAllExceptProductRelatedByProductId(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
// $criteria->getDbName() will return the same object if not set to another value
|
||||
// so == check is okay and faster
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(AccessoryPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AccessoryPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AccessoryPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AccessoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AccessoryPeer::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 = AccessoryPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AccessoryPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if obj1 already loaded
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of Accessory objects pre-filled with all related objects except ProductRelatedByAccessory.
|
||||
*
|
||||
* @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 Accessory objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAllExceptProductRelatedByAccessory(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
// $criteria->getDbName() will return the same object if not set to another value
|
||||
// so == check is okay and faster
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(AccessoryPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AccessoryPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AccessoryPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AccessoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AccessoryPeer::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 = AccessoryPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AccessoryPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if obj1 already loaded
|
||||
|
||||
$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.
|
||||
@@ -619,7 +1192,6 @@ abstract class BaseAccessoryPeer
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += AccessoryPeer::doOnDeleteCascade(new Criteria(AccessoryPeer::DATABASE_NAME), $con);
|
||||
$affectedRows += BasePeer::doDeleteAll(AccessoryPeer::TABLE_NAME, $con, AccessoryPeer::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
|
||||
@@ -653,14 +1225,24 @@ abstract class BaseAccessoryPeer
|
||||
}
|
||||
|
||||
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.
|
||||
AccessoryPeer::clearInstancePool();
|
||||
// rename for clarity
|
||||
$criteria = clone $values;
|
||||
} elseif ($values instanceof Accessory) { // it's a model object
|
||||
// invalidate the cache for this single object
|
||||
AccessoryPeer::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(AccessoryPeer::DATABASE_NAME);
|
||||
$criteria->add(AccessoryPeer::ID, (array) $values, Criteria::IN);
|
||||
// invalidate the cache for this object(s)
|
||||
foreach ((array) $values as $singleval) {
|
||||
AccessoryPeer::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
@@ -673,23 +1255,6 @@ abstract class BaseAccessoryPeer
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
// cloning the Criteria in case it's modified by doSelect() or doSelectStmt()
|
||||
$c = clone $criteria;
|
||||
$affectedRows += AccessoryPeer::doOnDeleteCascade($c, $con);
|
||||
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
if ($values instanceof Criteria) {
|
||||
AccessoryPeer::clearInstancePool();
|
||||
} elseif ($values instanceof Accessory) { // it's a model object
|
||||
AccessoryPeer::removeInstanceFromPool($values);
|
||||
} else { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) {
|
||||
AccessoryPeer::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||
AccessoryPeer::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
@@ -701,45 +1266,6 @@ abstract class BaseAccessoryPeer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
|
||||
* feature (like MySQL or SQLite).
|
||||
*
|
||||
* This method is not very speedy because it must perform a query first to get
|
||||
* the implicated records and then perform the deletes by calling those Peer classes.
|
||||
*
|
||||
* This method should be used within a transaction if possible.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param PropelPDO $con
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
|
||||
{
|
||||
// initialize var to track total num of affected rows
|
||||
$affectedRows = 0;
|
||||
|
||||
// first find the objects that are implicated by the $criteria
|
||||
$objects = AccessoryPeer::doSelect($criteria, $con);
|
||||
foreach ($objects as $obj) {
|
||||
|
||||
|
||||
// delete related Product objects
|
||||
$criteria = new Criteria(ProductPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(ProductPeer::ID, $obj->getProductId());
|
||||
$affectedRows += ProductPeer::doDelete($criteria, $con);
|
||||
|
||||
// delete related Product objects
|
||||
$criteria = new Criteria(ProductPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(ProductPeer::ID, $obj->getAccessory());
|
||||
$affectedRows += ProductPeer::doDelete($criteria, $con);
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates all modified columns of given Accessory object.
|
||||
* If parameter $columns is either a single column name or an array of column names
|
||||
|
||||
@@ -40,13 +40,13 @@ use Thelia\Model\Product;
|
||||
* @method AccessoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method AccessoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method AccessoryQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
|
||||
* @method AccessoryQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
|
||||
* @method AccessoryQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
|
||||
* @method AccessoryQuery leftJoinProductRelatedByProductId($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductRelatedByProductId relation
|
||||
* @method AccessoryQuery rightJoinProductRelatedByProductId($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductRelatedByProductId relation
|
||||
* @method AccessoryQuery innerJoinProductRelatedByProductId($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductRelatedByProductId relation
|
||||
*
|
||||
* @method AccessoryQuery leftJoinProduct($relationAlias = null) Adds a LEFT JOIN clause to the query using the Product relation
|
||||
* @method AccessoryQuery rightJoinProduct($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Product relation
|
||||
* @method AccessoryQuery innerJoinProduct($relationAlias = null) Adds a INNER JOIN clause to the query using the Product relation
|
||||
* @method AccessoryQuery leftJoinProductRelatedByAccessory($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductRelatedByAccessory relation
|
||||
* @method AccessoryQuery rightJoinProductRelatedByAccessory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductRelatedByAccessory relation
|
||||
* @method AccessoryQuery innerJoinProductRelatedByAccessory($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductRelatedByAccessory relation
|
||||
*
|
||||
* @method Accessory findOne(PropelPDO $con = null) Return the first Accessory matching the query
|
||||
* @method Accessory findOneOrCreate(PropelPDO $con = null) Return the first Accessory matching the query, or a new Accessory object populated from the query conditions when no match is found
|
||||
@@ -76,7 +76,7 @@ abstract class BaseAccessoryQuery extends ModelCriteria
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'mydb', $modelName = 'Thelia\\Model\\Accessory', $modelAlias = null)
|
||||
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Accessory', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
@@ -279,6 +279,8 @@ abstract class BaseAccessoryQuery extends ModelCriteria
|
||||
* $query->filterByProductId(array('min' => 12)); // WHERE product_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByProductRelatedByProductId()
|
||||
*
|
||||
* @param mixed $productId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -320,6 +322,8 @@ abstract class BaseAccessoryQuery extends ModelCriteria
|
||||
* $query->filterByAccessory(array('min' => 12)); // WHERE accessory > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByProductRelatedByAccessory()
|
||||
*
|
||||
* @param mixed $accessory The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -481,39 +485,41 @@ abstract class BaseAccessoryQuery extends ModelCriteria
|
||||
/**
|
||||
* Filter the query by a related Product object
|
||||
*
|
||||
* @param Product|PropelObjectCollection $product the related object to use as filter
|
||||
* @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 AccessoryQuery The current query, for fluid interface
|
||||
* @throws PropelException - if the provided filter is invalid.
|
||||
*/
|
||||
public function filterByProduct($product, $comparison = null)
|
||||
public function filterByProductRelatedByProductId($product, $comparison = null)
|
||||
{
|
||||
if ($product instanceof Product) {
|
||||
return $this
|
||||
->addUsingAlias(AccessoryPeer::PRODUCT_ID, $product->getId(), $comparison);
|
||||
} elseif ($product instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->useProductQuery()
|
||||
->filterByPrimaryKeys($product->getPrimaryKeys())
|
||||
->endUse();
|
||||
->addUsingAlias(AccessoryPeer::PRODUCT_ID, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByProduct() only accepts arguments of type Product or PropelCollection');
|
||||
throw new PropelException('filterByProductRelatedByProductId() only accepts arguments of type Product or PropelCollection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Product relation
|
||||
* Adds a JOIN clause to the query using the ProductRelatedByProductId relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return AccessoryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinProductRelatedByProductId($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Product');
|
||||
$relationMap = $tableMap->getRelation('ProductRelatedByProductId');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
@@ -528,14 +534,14 @@ abstract class BaseAccessoryQuery extends ModelCriteria
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Product');
|
||||
$this->addJoinObject($join, 'ProductRelatedByProductId');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Product relation Product object
|
||||
* Use the ProductRelatedByProductId relation Product object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
@@ -545,49 +551,51 @@ abstract class BaseAccessoryQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useProductRelatedByProductIdQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinProduct($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
|
||||
->joinProductRelatedByProductId($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'ProductRelatedByProductId', '\Thelia\Model\ProductQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Product object
|
||||
*
|
||||
* @param Product|PropelObjectCollection $product the related object to use as filter
|
||||
* @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 AccessoryQuery The current query, for fluid interface
|
||||
* @throws PropelException - if the provided filter is invalid.
|
||||
*/
|
||||
public function filterByProduct($product, $comparison = null)
|
||||
public function filterByProductRelatedByAccessory($product, $comparison = null)
|
||||
{
|
||||
if ($product instanceof Product) {
|
||||
return $this
|
||||
->addUsingAlias(AccessoryPeer::ACCESSORY, $product->getId(), $comparison);
|
||||
} elseif ($product instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->useProductQuery()
|
||||
->filterByPrimaryKeys($product->getPrimaryKeys())
|
||||
->endUse();
|
||||
->addUsingAlias(AccessoryPeer::ACCESSORY, $product->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByProduct() only accepts arguments of type Product or PropelCollection');
|
||||
throw new PropelException('filterByProductRelatedByAccessory() only accepts arguments of type Product or PropelCollection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Product relation
|
||||
* Adds a JOIN clause to the query using the ProductRelatedByAccessory relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return AccessoryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinProductRelatedByAccessory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Product');
|
||||
$relationMap = $tableMap->getRelation('ProductRelatedByAccessory');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
@@ -602,14 +610,14 @@ abstract class BaseAccessoryQuery extends ModelCriteria
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Product');
|
||||
$this->addJoinObject($join, 'ProductRelatedByAccessory');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Product relation Product object
|
||||
* Use the ProductRelatedByAccessory relation Product object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
@@ -619,11 +627,11 @@ abstract class BaseAccessoryQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useProductRelatedByAccessoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinProduct($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Product', '\Thelia\Model\ProductQuery');
|
||||
->joinProductRelatedByAccessory($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'ProductRelatedByAccessory', '\Thelia\Model\ProductQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,10 +10,8 @@ use \Exception;
|
||||
use \PDO;
|
||||
use \Persistent;
|
||||
use \Propel;
|
||||
use \PropelCollection;
|
||||
use \PropelDateTime;
|
||||
use \PropelException;
|
||||
use \PropelObjectCollection;
|
||||
use \PropelPDO;
|
||||
use Thelia\Model\Address;
|
||||
use Thelia\Model\AddressPeer;
|
||||
@@ -148,14 +146,14 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var Customer one-to-one related Customer object
|
||||
* @var Customer
|
||||
*/
|
||||
protected $singleCustomer;
|
||||
protected $aCustomer;
|
||||
|
||||
/**
|
||||
* @var CustomerTitle one-to-one related CustomerTitle object
|
||||
* @var CustomerTitle
|
||||
*/
|
||||
protected $singleCustomerTitle;
|
||||
protected $aCustomerTitle;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -171,18 +169,6 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $customersScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $customerTitlesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
@@ -456,6 +442,10 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AddressPeer::CUSTOMER_ID;
|
||||
}
|
||||
|
||||
if ($this->aCustomer !== null && $this->aCustomer->getId() !== $v) {
|
||||
$this->aCustomer = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setCustomerId()
|
||||
@@ -477,6 +467,10 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AddressPeer::CUSTOMER_TITLE_ID;
|
||||
}
|
||||
|
||||
if ($this->aCustomerTitle !== null && $this->aCustomerTitle->getId() !== $v) {
|
||||
$this->aCustomerTitle = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setCustomerTitleId()
|
||||
@@ -816,6 +810,12 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
public function ensureConsistency()
|
||||
{
|
||||
|
||||
if ($this->aCustomer !== null && $this->customer_id !== $this->aCustomer->getId()) {
|
||||
$this->aCustomer = null;
|
||||
}
|
||||
if ($this->aCustomerTitle !== null && $this->customer_title_id !== $this->aCustomerTitle->getId()) {
|
||||
$this->aCustomerTitle = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -855,10 +855,8 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->singleCustomer = null;
|
||||
|
||||
$this->singleCustomerTitle = null;
|
||||
|
||||
$this->aCustomer = null;
|
||||
$this->aCustomerTitle = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -972,6 +970,25 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
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->aCustomer !== null) {
|
||||
if ($this->aCustomer->isModified() || $this->aCustomer->isNew()) {
|
||||
$affectedRows += $this->aCustomer->save($con);
|
||||
}
|
||||
$this->setCustomer($this->aCustomer);
|
||||
}
|
||||
|
||||
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()) {
|
||||
@@ -983,36 +1000,6 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->customersScheduledForDeletion !== null) {
|
||||
if (!$this->customersScheduledForDeletion->isEmpty()) {
|
||||
CustomerQuery::create()
|
||||
->filterByPrimaryKeys($this->customersScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->customersScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleCustomer !== null) {
|
||||
if (!$this->singleCustomer->isDeleted()) {
|
||||
$affectedRows += $this->singleCustomer->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->customerTitlesScheduledForDeletion !== null) {
|
||||
if (!$this->customerTitlesScheduledForDeletion->isEmpty()) {
|
||||
CustomerTitleQuery::create()
|
||||
->filterByPrimaryKeys($this->customerTitlesScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->customerTitlesScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleCustomerTitle !== null) {
|
||||
if (!$this->singleCustomerTitle->isDeleted()) {
|
||||
$affectedRows += $this->singleCustomerTitle->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -1240,23 +1227,29 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
$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->aCustomer !== null) {
|
||||
if (!$this->aCustomer->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aCustomer->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->aCustomerTitle !== null) {
|
||||
if (!$this->aCustomerTitle->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aCustomerTitle->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($retval = AddressPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
if ($this->singleCustomer !== null) {
|
||||
if (!$this->singleCustomer->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleCustomer->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleCustomerTitle !== null) {
|
||||
if (!$this->singleCustomerTitle->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleCustomerTitle->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
@@ -1387,11 +1380,11 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
$keys[15] => $this->getUpdatedAt(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->singleCustomer) {
|
||||
$result['Customer'] = $this->singleCustomer->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aCustomer) {
|
||||
$result['Customer'] = $this->aCustomer->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
if (null !== $this->singleCustomerTitle) {
|
||||
$result['CustomerTitle'] = $this->singleCustomerTitle->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aCustomerTitle) {
|
||||
$result['CustomerTitle'] = $this->aCustomerTitle->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1628,16 +1621,6 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
// store object hash to prevent cycle
|
||||
$this->startCopy = true;
|
||||
|
||||
$relObj = $this->getCustomer();
|
||||
if ($relObj) {
|
||||
$copyObj->setCustomer($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
$relObj = $this->getCustomerTitle();
|
||||
if ($relObj) {
|
||||
$copyObj->setCustomerTitle($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
//unflag object copy
|
||||
$this->startCopy = false;
|
||||
} // if ($deepCopy)
|
||||
@@ -1688,91 +1671,108 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
return self::$peer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a collection based on the name of a relation.
|
||||
* Avoids crafting an 'init[$relationName]s' method name
|
||||
* that wouldn't work when StandardEnglishPluralizer is used.
|
||||
* Declares an association between this object and a Customer object.
|
||||
*
|
||||
* @param string $relationName The name of the relation to initialize
|
||||
* @return void
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single Customer object, which is related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return Customer
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCustomer(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleCustomer === null && !$this->isNew()) {
|
||||
$this->singleCustomer = CustomerQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
}
|
||||
|
||||
return $this->singleCustomer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single Customer object as related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param Customer $v Customer
|
||||
* @param Customer $v
|
||||
* @return Address The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setCustomer(Customer $v = null)
|
||||
{
|
||||
$this->singleCustomer = $v;
|
||||
|
||||
// Make sure that that the passed-in Customer isn't already associated with this object
|
||||
if ($v !== null && $v->getAddress() === null) {
|
||||
$v->setAddress($this);
|
||||
if ($v === null) {
|
||||
$this->setCustomerId(NULL);
|
||||
} else {
|
||||
$this->setCustomerId($v->getId());
|
||||
}
|
||||
|
||||
$this->aCustomer = $v;
|
||||
|
||||
// Add binding for other direction of this n:n relationship.
|
||||
// If this object has already been added to the Customer object, it will not be re-added.
|
||||
if ($v !== null) {
|
||||
$v->addAddress($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a single CustomerTitle object, which is related to this object by a one-to-one relationship.
|
||||
* Get the associated Customer object
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return CustomerTitle
|
||||
* @param PropelPDO $con Optional Connection object.
|
||||
* @return Customer The associated Customer object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCustomerTitle(PropelPDO $con = null)
|
||||
public function getCustomer(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleCustomerTitle === null && !$this->isNew()) {
|
||||
$this->singleCustomerTitle = CustomerTitleQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
if ($this->aCustomer === null && ($this->customer_id !== null)) {
|
||||
$this->aCustomer = CustomerQuery::create()->findPk($this->customer_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->aCustomer->addAddresss($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->singleCustomerTitle;
|
||||
return $this->aCustomer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single CustomerTitle object as related to this object by a one-to-one relationship.
|
||||
* Declares an association between this object and a CustomerTitle object.
|
||||
*
|
||||
* @param CustomerTitle $v CustomerTitle
|
||||
* @param CustomerTitle $v
|
||||
* @return Address The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setCustomerTitle(CustomerTitle $v = null)
|
||||
{
|
||||
$this->singleCustomerTitle = $v;
|
||||
|
||||
// Make sure that that the passed-in CustomerTitle isn't already associated with this object
|
||||
if ($v !== null && $v->getAddress() === null) {
|
||||
$v->setAddress($this);
|
||||
if ($v === null) {
|
||||
$this->setCustomerTitleId(NULL);
|
||||
} else {
|
||||
$this->setCustomerTitleId($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->addAddress($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->customer_title_id !== null)) {
|
||||
$this->aCustomerTitle = CustomerTitleQuery::create()->findPk($this->customer_title_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->addAddresss($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aCustomerTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
@@ -1814,22 +1814,10 @@ abstract class BaseAddress extends BaseObject implements Persistent
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->singleCustomer) {
|
||||
$this->singleCustomer->clearAllReferences($deep);
|
||||
}
|
||||
if ($this->singleCustomerTitle) {
|
||||
$this->singleCustomerTitle->clearAllReferences($deep);
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
if ($this->singleCustomer instanceof PropelCollection) {
|
||||
$this->singleCustomer->clearIterator();
|
||||
}
|
||||
$this->singleCustomer = null;
|
||||
if ($this->singleCustomerTitle instanceof PropelCollection) {
|
||||
$this->singleCustomerTitle->clearIterator();
|
||||
}
|
||||
$this->singleCustomerTitle = null;
|
||||
$this->aCustomer = null;
|
||||
$this->aCustomerTitle = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@ use \PropelPDO;
|
||||
use Thelia\Model\Address;
|
||||
use Thelia\Model\AddressPeer;
|
||||
use Thelia\Model\CustomerPeer;
|
||||
use Thelia\Model\CustomerTitlePeer;
|
||||
use Thelia\Model\map\AddressTableMap;
|
||||
|
||||
/**
|
||||
@@ -25,7 +26,7 @@ abstract class BaseAddressPeer
|
||||
{
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'mydb';
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'address';
|
||||
@@ -438,9 +439,6 @@ abstract class BaseAddressPeer
|
||||
*/
|
||||
public static function clearRelatedInstancePool()
|
||||
{
|
||||
// Invalidate objects in CustomerPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CustomerPeer::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -537,6 +535,637 @@ abstract class BaseAddressPeer
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related Customer 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 doCountJoinCustomer(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(AddressPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AddressPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AddressPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AddressPeer::CUSTOMER_ID, CustomerPeer::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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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(AddressPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AddressPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AddressPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AddressPeer::CUSTOMER_TITLE_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 Address objects pre-filled with their Customer 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 Address objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinCustomer(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(AddressPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AddressPeer::addSelectColumns($criteria);
|
||||
$startcol = AddressPeer::NUM_HYDRATE_COLUMNS;
|
||||
CustomerPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AddressPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AddressPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AddressPeer::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 = AddressPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AddressPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if $obj1 already loaded
|
||||
|
||||
$key2 = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = CustomerPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = CustomerPeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol);
|
||||
CustomerPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 already loaded
|
||||
|
||||
// Add the $obj1 (Address) to $obj2 (Customer)
|
||||
$obj2->addAddress($obj1);
|
||||
|
||||
} // if joined row was not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of Address 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 Address 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(AddressPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AddressPeer::addSelectColumns($criteria);
|
||||
$startcol = AddressPeer::NUM_HYDRATE_COLUMNS;
|
||||
CustomerTitlePeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AddressPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AddressPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AddressPeer::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 = AddressPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AddressPeer::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 (Address) to $obj2 (CustomerTitle)
|
||||
$obj2->addAddress($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(AddressPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AddressPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AddressPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AddressPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
|
||||
|
||||
$criteria->addJoin(AddressPeer::CUSTOMER_TITLE_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 Address 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 Address 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(AddressPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AddressPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AddressPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
CustomerPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + CustomerPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
CustomerTitlePeer::addSelectColumns($criteria);
|
||||
$startcol4 = $startcol3 + CustomerTitlePeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AddressPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
|
||||
|
||||
$criteria->addJoin(AddressPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AddressPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AddressPeer::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 = AddressPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AddressPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if obj1 already loaded
|
||||
|
||||
// Add objects for joined Customer rows
|
||||
|
||||
$key2 = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = CustomerPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = CustomerPeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol2);
|
||||
CustomerPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 loaded
|
||||
|
||||
// Add the $obj1 (Address) to the collection in $obj2 (Customer)
|
||||
$obj2->addAddress($obj1);
|
||||
} // if joined row not null
|
||||
|
||||
// Add objects for joined CustomerTitle rows
|
||||
|
||||
$key3 = CustomerTitlePeer::getPrimaryKeyHashFromRow($row, $startcol3);
|
||||
if ($key3 !== null) {
|
||||
$obj3 = CustomerTitlePeer::getInstanceFromPool($key3);
|
||||
if (!$obj3) {
|
||||
|
||||
$cls = CustomerTitlePeer::getOMClass();
|
||||
|
||||
$obj3 = new $cls();
|
||||
$obj3->hydrate($row, $startcol3);
|
||||
CustomerTitlePeer::addInstanceToPool($obj3, $key3);
|
||||
} // if obj3 loaded
|
||||
|
||||
// Add the $obj1 (Address) to the collection in $obj3 (CustomerTitle)
|
||||
$obj3->addAddress($obj1);
|
||||
} // if joined row not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related Customer 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 doCountJoinAllExceptCustomer(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(AddressPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AddressPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AddressPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AddressPeer::CUSTOMER_TITLE_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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 doCountJoinAllExceptCustomerTitle(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(AddressPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AddressPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AddressPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AddressPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AddressPeer::CUSTOMER_ID, CustomerPeer::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 Address objects pre-filled with all related objects except Customer.
|
||||
*
|
||||
* @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 Address objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAllExceptCustomer(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
// $criteria->getDbName() will return the same object if not set to another value
|
||||
// so == check is okay and faster
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(AddressPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AddressPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AddressPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
CustomerTitlePeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + CustomerTitlePeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AddressPeer::CUSTOMER_TITLE_ID, CustomerTitlePeer::ID, $join_behavior);
|
||||
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AddressPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AddressPeer::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 = AddressPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AddressPeer::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 already loaded
|
||||
|
||||
// Add the $obj1 (Address) to the collection in $obj2 (CustomerTitle)
|
||||
$obj2->addAddress($obj1);
|
||||
|
||||
} // if joined row is not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of Address objects pre-filled with all related objects except CustomerTitle.
|
||||
*
|
||||
* @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 Address objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAllExceptCustomerTitle(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
// $criteria->getDbName() will return the same object if not set to another value
|
||||
// so == check is okay and faster
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(AddressPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AddressPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AddressPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
CustomerPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + CustomerPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AddressPeer::CUSTOMER_ID, CustomerPeer::ID, $join_behavior);
|
||||
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AddressPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AddressPeer::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 = AddressPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AddressPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if obj1 already loaded
|
||||
|
||||
// Add objects for joined Customer rows
|
||||
|
||||
$key2 = CustomerPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = CustomerPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = CustomerPeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol2);
|
||||
CustomerPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if $obj2 already loaded
|
||||
|
||||
// Add the $obj1 (Address) to the collection in $obj2 (Customer)
|
||||
$obj2->addAddress($obj1);
|
||||
|
||||
} // if joined row is 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.
|
||||
@@ -670,7 +1299,6 @@ abstract class BaseAddressPeer
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += AddressPeer::doOnDeleteCascade(new Criteria(AddressPeer::DATABASE_NAME), $con);
|
||||
$affectedRows += BasePeer::doDeleteAll(AddressPeer::TABLE_NAME, $con, AddressPeer::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
|
||||
@@ -704,14 +1332,24 @@ abstract class BaseAddressPeer
|
||||
}
|
||||
|
||||
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.
|
||||
AddressPeer::clearInstancePool();
|
||||
// rename for clarity
|
||||
$criteria = clone $values;
|
||||
} elseif ($values instanceof Address) { // it's a model object
|
||||
// invalidate the cache for this single object
|
||||
AddressPeer::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(AddressPeer::DATABASE_NAME);
|
||||
$criteria->add(AddressPeer::ID, (array) $values, Criteria::IN);
|
||||
// invalidate the cache for this object(s)
|
||||
foreach ((array) $values as $singleval) {
|
||||
AddressPeer::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
@@ -724,23 +1362,6 @@ abstract class BaseAddressPeer
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
// cloning the Criteria in case it's modified by doSelect() or doSelectStmt()
|
||||
$c = clone $criteria;
|
||||
$affectedRows += AddressPeer::doOnDeleteCascade($c, $con);
|
||||
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
if ($values instanceof Criteria) {
|
||||
AddressPeer::clearInstancePool();
|
||||
} elseif ($values instanceof Address) { // it's a model object
|
||||
AddressPeer::removeInstanceFromPool($values);
|
||||
} else { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) {
|
||||
AddressPeer::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||
AddressPeer::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
@@ -752,39 +1373,6 @@ abstract class BaseAddressPeer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
|
||||
* feature (like MySQL or SQLite).
|
||||
*
|
||||
* This method is not very speedy because it must perform a query first to get
|
||||
* the implicated records and then perform the deletes by calling those Peer classes.
|
||||
*
|
||||
* This method should be used within a transaction if possible.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param PropelPDO $con
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
|
||||
{
|
||||
// initialize var to track total num of affected rows
|
||||
$affectedRows = 0;
|
||||
|
||||
// first find the objects that are implicated by the $criteria
|
||||
$objects = AddressPeer::doSelect($criteria, $con);
|
||||
foreach ($objects as $obj) {
|
||||
|
||||
|
||||
// delete related Customer objects
|
||||
$criteria = new Criteria(CustomerPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(CustomerPeer::ID, $obj->getCustomerId());
|
||||
$affectedRows += CustomerPeer::doDelete($criteria, $con);
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates all modified columns of given Address object.
|
||||
* If parameter $columns is either a single column name or an array of column names
|
||||
|
||||
@@ -117,7 +117,7 @@ abstract class BaseAddressQuery extends ModelCriteria
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'mydb', $modelName = 'Thelia\\Model\\Address', $modelAlias = null)
|
||||
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Address', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
@@ -349,6 +349,8 @@ abstract class BaseAddressQuery extends ModelCriteria
|
||||
* $query->filterByCustomerId(array('min' => 12)); // WHERE customer_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCustomer()
|
||||
*
|
||||
* @param mixed $customerId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -390,6 +392,8 @@ abstract class BaseAddressQuery extends ModelCriteria
|
||||
* $query->filterByCustomerTitleId(array('min' => 12)); // WHERE customer_title_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCustomerTitle()
|
||||
*
|
||||
* @param mixed $customerTitleId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -812,7 +816,7 @@ abstract class BaseAddressQuery extends ModelCriteria
|
||||
/**
|
||||
* Filter the query by a related Customer object
|
||||
*
|
||||
* @param Customer|PropelObjectCollection $customer the related object to use as filter
|
||||
* @param Customer|PropelObjectCollection $customer The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return AddressQuery The current query, for fluid interface
|
||||
@@ -824,10 +828,12 @@ abstract class BaseAddressQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AddressPeer::CUSTOMER_ID, $customer->getId(), $comparison);
|
||||
} elseif ($customer instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->useCustomerQuery()
|
||||
->filterByPrimaryKeys($customer->getPrimaryKeys())
|
||||
->endUse();
|
||||
->addUsingAlias(AddressPeer::CUSTOMER_ID, $customer->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCustomer() only accepts arguments of type Customer or PropelCollection');
|
||||
}
|
||||
@@ -886,7 +892,7 @@ abstract class BaseAddressQuery extends ModelCriteria
|
||||
/**
|
||||
* Filter the query by a related CustomerTitle object
|
||||
*
|
||||
* @param CustomerTitle|PropelObjectCollection $customerTitle the related object to use as filter
|
||||
* @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 AddressQuery The current query, for fluid interface
|
||||
@@ -898,10 +904,12 @@ abstract class BaseAddressQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AddressPeer::CUSTOMER_TITLE_ID, $customerTitle->getId(), $comparison);
|
||||
} elseif ($customerTitle instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->useCustomerTitleQuery()
|
||||
->filterByPrimaryKeys($customerTitle->getPrimaryKeys())
|
||||
->endUse();
|
||||
->addUsingAlias(AddressPeer::CUSTOMER_TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCustomerTitle() only accepts arguments of type CustomerTitle or PropelCollection');
|
||||
}
|
||||
@@ -915,7 +923,7 @@ abstract class BaseAddressQuery extends ModelCriteria
|
||||
*
|
||||
* @return AddressQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CustomerTitle');
|
||||
@@ -950,7 +958,7 @@ abstract class BaseAddressQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\CustomerTitleQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCustomerTitle($relationAlias, $joinType)
|
||||
|
||||
@@ -10,8 +10,10 @@ use \Exception;
|
||||
use \PDO;
|
||||
use \Persistent;
|
||||
use \Propel;
|
||||
use \PropelCollection;
|
||||
use \PropelDateTime;
|
||||
use \PropelException;
|
||||
use \PropelObjectCollection;
|
||||
use \PropelPDO;
|
||||
use Thelia\Model\Admin;
|
||||
use Thelia\Model\AdminGroup;
|
||||
@@ -102,9 +104,10 @@ abstract class BaseAdmin extends BaseObject implements Persistent
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var AdminGroup
|
||||
* @var PropelObjectCollection|AdminGroup[] Collection to store aggregation of AdminGroup objects.
|
||||
*/
|
||||
protected $aAdminGroup;
|
||||
protected $collAdminGroups;
|
||||
protected $collAdminGroupsPartial;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -120,6 +123,12 @@ abstract class BaseAdmin extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $adminGroupsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
@@ -281,10 +290,6 @@ abstract class BaseAdmin extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AdminPeer::ID;
|
||||
}
|
||||
|
||||
if ($this->aAdminGroup !== null && $this->aAdminGroup->getAdminId() !== $v) {
|
||||
$this->aAdminGroup = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setId()
|
||||
@@ -533,9 +538,6 @@ abstract class BaseAdmin extends BaseObject implements Persistent
|
||||
public function ensureConsistency()
|
||||
{
|
||||
|
||||
if ($this->aAdminGroup !== null && $this->id !== $this->aAdminGroup->getAdminId()) {
|
||||
$this->aAdminGroup = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -575,7 +577,8 @@ abstract class BaseAdmin extends BaseObject implements Persistent
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->aAdminGroup = null;
|
||||
$this->collAdminGroups = null;
|
||||
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -689,18 +692,6 @@ abstract class BaseAdmin extends BaseObject implements Persistent
|
||||
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->aAdminGroup !== null) {
|
||||
if ($this->aAdminGroup->isModified() || $this->aAdminGroup->isNew()) {
|
||||
$affectedRows += $this->aAdminGroup->save($con);
|
||||
}
|
||||
$this->setAdminGroup($this->aAdminGroup);
|
||||
}
|
||||
|
||||
if ($this->isNew() || $this->isModified()) {
|
||||
// persist changes
|
||||
if ($this->isNew()) {
|
||||
@@ -712,6 +703,24 @@ abstract class BaseAdmin extends BaseObject implements Persistent
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->adminGroupsScheduledForDeletion !== null) {
|
||||
if (!$this->adminGroupsScheduledForDeletion->isEmpty()) {
|
||||
foreach ($this->adminGroupsScheduledForDeletion as $adminGroup) {
|
||||
// need to save related object because we set the relation to null
|
||||
$adminGroup->save($con);
|
||||
}
|
||||
$this->adminGroupsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collAdminGroups !== null) {
|
||||
foreach ($this->collAdminGroups as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted()) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -897,23 +906,19 @@ abstract class BaseAdmin extends BaseObject implements Persistent
|
||||
$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->aAdminGroup !== null) {
|
||||
if (!$this->aAdminGroup->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aAdminGroup->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($retval = AdminPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
if ($this->collAdminGroups !== null) {
|
||||
foreach ($this->collAdminGroups as $referrerFK) {
|
||||
if (!$referrerFK->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
@@ -1016,8 +1021,8 @@ abstract class BaseAdmin extends BaseObject implements Persistent
|
||||
$keys[8] => $this->getUpdatedAt(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->aAdminGroup) {
|
||||
$result['AdminGroup'] = $this->aAdminGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->collAdminGroups) {
|
||||
$result['AdminGroups'] = $this->collAdminGroups->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1212,9 +1217,10 @@ abstract class BaseAdmin extends BaseObject implements Persistent
|
||||
// store object hash to prevent cycle
|
||||
$this->startCopy = true;
|
||||
|
||||
$relObj = $this->getAdminGroup();
|
||||
if ($relObj) {
|
||||
$copyObj->setAdminGroup($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));
|
||||
}
|
||||
}
|
||||
|
||||
//unflag object copy
|
||||
@@ -1267,51 +1273,252 @@ abstract class BaseAdmin extends BaseObject implements Persistent
|
||||
return self::$peer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a AdminGroup object.
|
||||
* Initializes a collection based on the name of a relation.
|
||||
* Avoids crafting an 'init[$relationName]s' method name
|
||||
* that wouldn't work when StandardEnglishPluralizer is used.
|
||||
*
|
||||
* @param AdminGroup $v
|
||||
* @return Admin The current object (for fluent API support)
|
||||
* @param string $relationName The name of the relation to initialize
|
||||
* @return void
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
if ('AdminGroup' == $relationName) {
|
||||
$this->initAdminGroups();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collAdminGroups 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 addAdminGroups()
|
||||
*/
|
||||
public function clearAdminGroups()
|
||||
{
|
||||
$this->collAdminGroups = null; // important to set this to null since that means it is uninitialized
|
||||
$this->collAdminGroupsPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* reset is the collAdminGroups collection loaded partially
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function resetPartialAdminGroups($v = true)
|
||||
{
|
||||
$this->collAdminGroupsPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collAdminGroups collection.
|
||||
*
|
||||
* By default this just sets the collAdminGroups collection to an empty array (like clearcollAdminGroups());
|
||||
* 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 initAdminGroups($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collAdminGroups && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collAdminGroups = new PropelObjectCollection();
|
||||
$this->collAdminGroups->setModel('AdminGroup');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of AdminGroup 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 Admin is new, it will return
|
||||
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return PropelObjectCollection|AdminGroup[] List of AdminGroup objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setAdminGroup(AdminGroup $v = null)
|
||||
public function getAdminGroups($criteria = null, PropelPDO $con = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setId(NULL);
|
||||
$partial = $this->collAdminGroupsPartial && !$this->isNew();
|
||||
if (null === $this->collAdminGroups || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAdminGroups) {
|
||||
// return empty collection
|
||||
$this->initAdminGroups();
|
||||
} else {
|
||||
$collAdminGroups = AdminGroupQuery::create(null, $criteria)
|
||||
->filterByAdmin($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collAdminGroupsPartial && count($collAdminGroups)) {
|
||||
$this->initAdminGroups(false);
|
||||
|
||||
foreach($collAdminGroups as $obj) {
|
||||
if (false == $this->collAdminGroups->contains($obj)) {
|
||||
$this->collAdminGroups->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAdminGroupsPartial = true;
|
||||
}
|
||||
|
||||
return $collAdminGroups;
|
||||
}
|
||||
|
||||
if($partial && $this->collAdminGroups) {
|
||||
foreach($this->collAdminGroups as $obj) {
|
||||
if($obj->isNew()) {
|
||||
$collAdminGroups[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAdminGroups = $collAdminGroups;
|
||||
$this->collAdminGroupsPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collAdminGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of AdminGroup 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 $adminGroups A Propel collection.
|
||||
* @param PropelPDO $con Optional connection object
|
||||
*/
|
||||
public function setAdminGroups(PropelCollection $adminGroups, PropelPDO $con = null)
|
||||
{
|
||||
$this->adminGroupsScheduledForDeletion = $this->getAdminGroups(new Criteria(), $con)->diff($adminGroups);
|
||||
|
||||
foreach ($this->adminGroupsScheduledForDeletion as $adminGroupRemoved) {
|
||||
$adminGroupRemoved->setAdmin(null);
|
||||
}
|
||||
|
||||
$this->collAdminGroups = null;
|
||||
foreach ($adminGroups as $adminGroup) {
|
||||
$this->addAdminGroup($adminGroup);
|
||||
}
|
||||
|
||||
$this->collAdminGroups = $adminGroups;
|
||||
$this->collAdminGroupsPartial = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related AdminGroup objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param PropelPDO $con
|
||||
* @return int Count of related AdminGroup objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countAdminGroups(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||
{
|
||||
$partial = $this->collAdminGroupsPartial && !$this->isNew();
|
||||
if (null === $this->collAdminGroups || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAdminGroups) {
|
||||
return 0;
|
||||
} else {
|
||||
if($partial && !$criteria) {
|
||||
return count($this->getAdminGroups());
|
||||
}
|
||||
$query = AdminGroupQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByAdmin($this)
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
$this->setId($v->getAdminId());
|
||||
return count($this->collAdminGroups);
|
||||
}
|
||||
}
|
||||
|
||||
$this->aAdminGroup = $v;
|
||||
|
||||
// Add binding for other direction of this 1:1 relationship.
|
||||
if ($v !== null) {
|
||||
$v->setAdmin($this);
|
||||
/**
|
||||
* Method called to associate a AdminGroup object to this object
|
||||
* through the AdminGroup foreign key attribute.
|
||||
*
|
||||
* @param AdminGroup $l AdminGroup
|
||||
* @return Admin The current object (for fluent API support)
|
||||
*/
|
||||
public function addAdminGroup(AdminGroup $l)
|
||||
{
|
||||
if ($this->collAdminGroups === null) {
|
||||
$this->initAdminGroups();
|
||||
$this->collAdminGroupsPartial = true;
|
||||
}
|
||||
if (!$this->collAdminGroups->contains($l)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddAdminGroup($l);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AdminGroup $adminGroup The adminGroup object to add.
|
||||
*/
|
||||
protected function doAddAdminGroup($adminGroup)
|
||||
{
|
||||
$this->collAdminGroups[]= $adminGroup;
|
||||
$adminGroup->setAdmin($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the associated AdminGroup object
|
||||
*
|
||||
* @param PropelPDO $con Optional Connection object.
|
||||
* @return AdminGroup The associated AdminGroup object.
|
||||
* @throws PropelException
|
||||
* @param AdminGroup $adminGroup The adminGroup object to remove.
|
||||
*/
|
||||
public function getAdminGroup(PropelPDO $con = null)
|
||||
public function removeAdminGroup($adminGroup)
|
||||
{
|
||||
if ($this->aAdminGroup === null && ($this->id !== null)) {
|
||||
$this->aAdminGroup = AdminGroupQuery::create()
|
||||
->filterByAdmin($this) // here
|
||||
->findOne($con);
|
||||
// Because this foreign key represents a one-to-one relationship, we will create a bi-directional association.
|
||||
$this->aAdminGroup->setAdmin($this);
|
||||
if ($this->getAdminGroups()->contains($adminGroup)) {
|
||||
$this->collAdminGroups->remove($this->collAdminGroups->search($adminGroup));
|
||||
if (null === $this->adminGroupsScheduledForDeletion) {
|
||||
$this->adminGroupsScheduledForDeletion = clone $this->collAdminGroups;
|
||||
$this->adminGroupsScheduledForDeletion->clear();
|
||||
}
|
||||
$this->adminGroupsScheduledForDeletion[]= $adminGroup;
|
||||
$adminGroup->setAdmin(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->aAdminGroup;
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this Admin is new, it will return
|
||||
* an empty collection; or if this Admin has previously
|
||||
* been saved, it will retrieve related AdminGroups from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in Admin.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return PropelObjectCollection|AdminGroup[] List of AdminGroup objects
|
||||
*/
|
||||
public function getAdminGroupsJoinGroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = AdminGroupQuery::create(null, $criteria);
|
||||
$query->joinWith('Group', $join_behavior);
|
||||
|
||||
return $this->getAdminGroups($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1348,9 +1555,17 @@ abstract class BaseAdmin extends BaseObject implements Persistent
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->collAdminGroups) {
|
||||
foreach ($this->collAdminGroups as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
$this->aAdminGroup = null;
|
||||
if ($this->collAdminGroups instanceof PropelCollection) {
|
||||
$this->collAdminGroups->clearIterator();
|
||||
}
|
||||
$this->collAdminGroups = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,10 +10,8 @@ use \Exception;
|
||||
use \PDO;
|
||||
use \Persistent;
|
||||
use \Propel;
|
||||
use \PropelCollection;
|
||||
use \PropelDateTime;
|
||||
use \PropelException;
|
||||
use \PropelObjectCollection;
|
||||
use \PropelPDO;
|
||||
use Thelia\Model\Admin;
|
||||
use Thelia\Model\AdminGroup;
|
||||
@@ -82,14 +80,14 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var Admin one-to-one related Admin object
|
||||
* @var Group
|
||||
*/
|
||||
protected $singleAdmin;
|
||||
protected $aGroup;
|
||||
|
||||
/**
|
||||
* @var Group one-to-one related Group object
|
||||
* @var Admin
|
||||
*/
|
||||
protected $singleGroup;
|
||||
protected $aAdmin;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -105,18 +103,6 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $adminsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $groupsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
@@ -259,6 +245,10 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AdminGroupPeer::GROUP_ID;
|
||||
}
|
||||
|
||||
if ($this->aGroup !== null && $this->aGroup->getId() !== $v) {
|
||||
$this->aGroup = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setGroupId()
|
||||
@@ -280,6 +270,10 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AdminGroupPeer::ADMIN_ID;
|
||||
}
|
||||
|
||||
if ($this->aAdmin !== null && $this->aAdmin->getId() !== $v) {
|
||||
$this->aAdmin = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setAdminId()
|
||||
@@ -398,6 +392,12 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
public function ensureConsistency()
|
||||
{
|
||||
|
||||
if ($this->aGroup !== null && $this->group_id !== $this->aGroup->getId()) {
|
||||
$this->aGroup = null;
|
||||
}
|
||||
if ($this->aAdmin !== null && $this->admin_id !== $this->aAdmin->getId()) {
|
||||
$this->aAdmin = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -437,10 +437,8 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->singleAdmin = null;
|
||||
|
||||
$this->singleGroup = null;
|
||||
|
||||
$this->aGroup = null;
|
||||
$this->aAdmin = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -554,6 +552,25 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
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->aAdmin !== null) {
|
||||
if ($this->aAdmin->isModified() || $this->aAdmin->isNew()) {
|
||||
$affectedRows += $this->aAdmin->save($con);
|
||||
}
|
||||
$this->setAdmin($this->aAdmin);
|
||||
}
|
||||
|
||||
if ($this->isNew() || $this->isModified()) {
|
||||
// persist changes
|
||||
if ($this->isNew()) {
|
||||
@@ -565,36 +582,6 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->adminsScheduledForDeletion !== null) {
|
||||
if (!$this->adminsScheduledForDeletion->isEmpty()) {
|
||||
AdminQuery::create()
|
||||
->filterByPrimaryKeys($this->adminsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->adminsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleAdmin !== null) {
|
||||
if (!$this->singleAdmin->isDeleted()) {
|
||||
$affectedRows += $this->singleAdmin->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->groupsScheduledForDeletion !== null) {
|
||||
if (!$this->groupsScheduledForDeletion->isEmpty()) {
|
||||
GroupQuery::create()
|
||||
->filterByPrimaryKeys($this->groupsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->groupsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleGroup !== null) {
|
||||
if (!$this->singleGroup->isDeleted()) {
|
||||
$affectedRows += $this->singleGroup->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -756,23 +743,29 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
$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 ($this->aAdmin !== null) {
|
||||
if (!$this->aAdmin->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aAdmin->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($retval = AdminGroupPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
if ($this->singleAdmin !== null) {
|
||||
if (!$this->singleAdmin->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleAdmin->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleGroup !== null) {
|
||||
if (!$this->singleGroup->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleGroup->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
@@ -859,11 +852,11 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
$keys[4] => $this->getUpdatedAt(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->singleAdmin) {
|
||||
$result['Admin'] = $this->singleAdmin->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aGroup) {
|
||||
$result['Group'] = $this->aGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
if (null !== $this->singleGroup) {
|
||||
$result['Group'] = $this->singleGroup->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aAdmin) {
|
||||
$result['Admin'] = $this->aAdmin->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1034,16 +1027,6 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
// store object hash to prevent cycle
|
||||
$this->startCopy = true;
|
||||
|
||||
$relObj = $this->getAdmin();
|
||||
if ($relObj) {
|
||||
$copyObj->setAdmin($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
$relObj = $this->getGroup();
|
||||
if ($relObj) {
|
||||
$copyObj->setGroup($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
//unflag object copy
|
||||
$this->startCopy = false;
|
||||
} // if ($deepCopy)
|
||||
@@ -1094,91 +1077,108 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
return self::$peer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a collection based on the name of a relation.
|
||||
* Avoids crafting an 'init[$relationName]s' method name
|
||||
* that wouldn't work when StandardEnglishPluralizer is used.
|
||||
* Declares an association between this object and a Group object.
|
||||
*
|
||||
* @param string $relationName The name of the relation to initialize
|
||||
* @return void
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single Admin object, which is related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return Admin
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAdmin(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleAdmin === null && !$this->isNew()) {
|
||||
$this->singleAdmin = AdminQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
}
|
||||
|
||||
return $this->singleAdmin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single Admin object as related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param Admin $v Admin
|
||||
* @return AdminGroup The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setAdmin(Admin $v = null)
|
||||
{
|
||||
$this->singleAdmin = $v;
|
||||
|
||||
// Make sure that that the passed-in Admin isn't already associated with this object
|
||||
if ($v !== null && $v->getAdminGroup() === null) {
|
||||
$v->setAdminGroup($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single Group object, which is related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return Group
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getGroup(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleGroup === null && !$this->isNew()) {
|
||||
$this->singleGroup = GroupQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
}
|
||||
|
||||
return $this->singleGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single Group object as related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param Group $v Group
|
||||
* @param Group $v
|
||||
* @return AdminGroup The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setGroup(Group $v = null)
|
||||
{
|
||||
$this->singleGroup = $v;
|
||||
|
||||
// Make sure that that the passed-in Group isn't already associated with this object
|
||||
if ($v !== null && $v->getAdminGroup() === null) {
|
||||
$v->setAdminGroup($this);
|
||||
if ($v === null) {
|
||||
$this->setGroupId(NULL);
|
||||
} else {
|
||||
$this->setGroupId($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->addAdminGroup($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->group_id !== null)) {
|
||||
$this->aGroup = GroupQuery::create()->findPk($this->group_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->addAdminGroups($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a Admin object.
|
||||
*
|
||||
* @param Admin $v
|
||||
* @return AdminGroup The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setAdmin(Admin $v = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setAdminId(NULL);
|
||||
} else {
|
||||
$this->setAdminId($v->getId());
|
||||
}
|
||||
|
||||
$this->aAdmin = $v;
|
||||
|
||||
// Add binding for other direction of this n:n relationship.
|
||||
// If this object has already been added to the Admin object, it will not be re-added.
|
||||
if ($v !== null) {
|
||||
$v->addAdminGroup($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated Admin object
|
||||
*
|
||||
* @param PropelPDO $con Optional Connection object.
|
||||
* @return Admin The associated Admin object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAdmin(PropelPDO $con = null)
|
||||
{
|
||||
if ($this->aAdmin === null && ($this->admin_id !== null)) {
|
||||
$this->aAdmin = AdminQuery::create()->findPk($this->admin_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->aAdmin->addAdminGroups($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aAdmin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
@@ -1209,22 +1209,10 @@ abstract class BaseAdminGroup extends BaseObject implements Persistent
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->singleAdmin) {
|
||||
$this->singleAdmin->clearAllReferences($deep);
|
||||
}
|
||||
if ($this->singleGroup) {
|
||||
$this->singleGroup->clearAllReferences($deep);
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
if ($this->singleAdmin instanceof PropelCollection) {
|
||||
$this->singleAdmin->clearIterator();
|
||||
}
|
||||
$this->singleAdmin = null;
|
||||
if ($this->singleGroup instanceof PropelCollection) {
|
||||
$this->singleGroup->clearIterator();
|
||||
}
|
||||
$this->singleGroup = null;
|
||||
$this->aGroup = null;
|
||||
$this->aAdmin = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@ abstract class BaseAdminGroupPeer
|
||||
{
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'mydb';
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'admin_group';
|
||||
@@ -384,12 +384,6 @@ abstract class BaseAdminGroupPeer
|
||||
*/
|
||||
public static function clearRelatedInstancePool()
|
||||
{
|
||||
// Invalidate objects in AdminPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
AdminPeer::clearInstancePool();
|
||||
// Invalidate objects in GroupPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
GroupPeer::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -486,6 +480,637 @@ abstract class BaseAdminGroupPeer
|
||||
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(AdminGroupPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AdminGroupPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AdminGroupPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AdminGroupPeer::GROUP_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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related Admin 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 doCountJoinAdmin(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(AdminGroupPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AdminGroupPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AdminGroupPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AdminGroupPeer::ADMIN_ID, AdminPeer::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 AdminGroup 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 AdminGroup 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(AdminGroupPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AdminGroupPeer::addSelectColumns($criteria);
|
||||
$startcol = AdminGroupPeer::NUM_HYDRATE_COLUMNS;
|
||||
GroupPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AdminGroupPeer::GROUP_ID, GroupPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AdminGroupPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AdminGroupPeer::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 = AdminGroupPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AdminGroupPeer::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 (AdminGroup) to $obj2 (Group)
|
||||
$obj2->addAdminGroup($obj1);
|
||||
|
||||
} // if joined row was not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of AdminGroup objects pre-filled with their Admin 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 AdminGroup objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAdmin(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(AdminGroupPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AdminGroupPeer::addSelectColumns($criteria);
|
||||
$startcol = AdminGroupPeer::NUM_HYDRATE_COLUMNS;
|
||||
AdminPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AdminGroupPeer::ADMIN_ID, AdminPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AdminGroupPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AdminGroupPeer::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 = AdminGroupPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AdminGroupPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if $obj1 already loaded
|
||||
|
||||
$key2 = AdminPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = AdminPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = AdminPeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol);
|
||||
AdminPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 already loaded
|
||||
|
||||
// Add the $obj1 (AdminGroup) to $obj2 (Admin)
|
||||
$obj2->addAdminGroup($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(AdminGroupPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AdminGroupPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AdminGroupPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AdminGroupPeer::GROUP_ID, GroupPeer::ID, $join_behavior);
|
||||
|
||||
$criteria->addJoin(AdminGroupPeer::ADMIN_ID, AdminPeer::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 AdminGroup 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 AdminGroup 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(AdminGroupPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AdminGroupPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AdminGroupPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
GroupPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + GroupPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
AdminPeer::addSelectColumns($criteria);
|
||||
$startcol4 = $startcol3 + AdminPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AdminGroupPeer::GROUP_ID, GroupPeer::ID, $join_behavior);
|
||||
|
||||
$criteria->addJoin(AdminGroupPeer::ADMIN_ID, AdminPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AdminGroupPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AdminGroupPeer::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 = AdminGroupPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AdminGroupPeer::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 (AdminGroup) to the collection in $obj2 (Group)
|
||||
$obj2->addAdminGroup($obj1);
|
||||
} // if joined row not null
|
||||
|
||||
// Add objects for joined Admin rows
|
||||
|
||||
$key3 = AdminPeer::getPrimaryKeyHashFromRow($row, $startcol3);
|
||||
if ($key3 !== null) {
|
||||
$obj3 = AdminPeer::getInstanceFromPool($key3);
|
||||
if (!$obj3) {
|
||||
|
||||
$cls = AdminPeer::getOMClass();
|
||||
|
||||
$obj3 = new $cls();
|
||||
$obj3->hydrate($row, $startcol3);
|
||||
AdminPeer::addInstanceToPool($obj3, $key3);
|
||||
} // if obj3 loaded
|
||||
|
||||
// Add the $obj1 (AdminGroup) to the collection in $obj3 (Admin)
|
||||
$obj3->addAdminGroup($obj1);
|
||||
} // if joined row not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 doCountJoinAllExceptGroup(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(AdminGroupPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AdminGroupPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AdminGroupPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AdminGroupPeer::ADMIN_ID, AdminPeer::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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related Admin 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 doCountJoinAllExceptAdmin(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(AdminGroupPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AdminGroupPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AdminGroupPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AdminGroupPeer::GROUP_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 AdminGroup objects pre-filled with all related objects except Group.
|
||||
*
|
||||
* @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 AdminGroup objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAllExceptGroup(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
// $criteria->getDbName() will return the same object if not set to another value
|
||||
// so == check is okay and faster
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(AdminGroupPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AdminGroupPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AdminGroupPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
AdminPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + AdminPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AdminGroupPeer::ADMIN_ID, AdminPeer::ID, $join_behavior);
|
||||
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AdminGroupPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AdminGroupPeer::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 = AdminGroupPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AdminGroupPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if obj1 already loaded
|
||||
|
||||
// Add objects for joined Admin rows
|
||||
|
||||
$key2 = AdminPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = AdminPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = AdminPeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol2);
|
||||
AdminPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if $obj2 already loaded
|
||||
|
||||
// Add the $obj1 (AdminGroup) to the collection in $obj2 (Admin)
|
||||
$obj2->addAdminGroup($obj1);
|
||||
|
||||
} // if joined row is not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of AdminGroup objects pre-filled with all related objects except Admin.
|
||||
*
|
||||
* @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 AdminGroup objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAllExceptAdmin(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
// $criteria->getDbName() will return the same object if not set to another value
|
||||
// so == check is okay and faster
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(AdminGroupPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AdminGroupPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AdminGroupPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
GroupPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + GroupPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AdminGroupPeer::GROUP_ID, GroupPeer::ID, $join_behavior);
|
||||
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AdminGroupPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AdminGroupPeer::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 = AdminGroupPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AdminGroupPeer::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 already loaded
|
||||
|
||||
// Add the $obj1 (AdminGroup) to the collection in $obj2 (Group)
|
||||
$obj2->addAdminGroup($obj1);
|
||||
|
||||
} // if joined row is 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.
|
||||
@@ -619,7 +1244,6 @@ abstract class BaseAdminGroupPeer
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += AdminGroupPeer::doOnDeleteCascade(new Criteria(AdminGroupPeer::DATABASE_NAME), $con);
|
||||
$affectedRows += BasePeer::doDeleteAll(AdminGroupPeer::TABLE_NAME, $con, AdminGroupPeer::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
|
||||
@@ -653,14 +1277,24 @@ abstract class BaseAdminGroupPeer
|
||||
}
|
||||
|
||||
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.
|
||||
AdminGroupPeer::clearInstancePool();
|
||||
// rename for clarity
|
||||
$criteria = clone $values;
|
||||
} elseif ($values instanceof AdminGroup) { // it's a model object
|
||||
// invalidate the cache for this single object
|
||||
AdminGroupPeer::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(AdminGroupPeer::DATABASE_NAME);
|
||||
$criteria->add(AdminGroupPeer::ID, (array) $values, Criteria::IN);
|
||||
// invalidate the cache for this object(s)
|
||||
foreach ((array) $values as $singleval) {
|
||||
AdminGroupPeer::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
@@ -673,23 +1307,6 @@ abstract class BaseAdminGroupPeer
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
// cloning the Criteria in case it's modified by doSelect() or doSelectStmt()
|
||||
$c = clone $criteria;
|
||||
$affectedRows += AdminGroupPeer::doOnDeleteCascade($c, $con);
|
||||
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
if ($values instanceof Criteria) {
|
||||
AdminGroupPeer::clearInstancePool();
|
||||
} elseif ($values instanceof AdminGroup) { // it's a model object
|
||||
AdminGroupPeer::removeInstanceFromPool($values);
|
||||
} else { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) {
|
||||
AdminGroupPeer::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||
AdminGroupPeer::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
@@ -701,45 +1318,6 @@ abstract class BaseAdminGroupPeer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
|
||||
* feature (like MySQL or SQLite).
|
||||
*
|
||||
* This method is not very speedy because it must perform a query first to get
|
||||
* the implicated records and then perform the deletes by calling those Peer classes.
|
||||
*
|
||||
* This method should be used within a transaction if possible.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param PropelPDO $con
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
|
||||
{
|
||||
// initialize var to track total num of affected rows
|
||||
$affectedRows = 0;
|
||||
|
||||
// first find the objects that are implicated by the $criteria
|
||||
$objects = AdminGroupPeer::doSelect($criteria, $con);
|
||||
foreach ($objects as $obj) {
|
||||
|
||||
|
||||
// delete related Admin objects
|
||||
$criteria = new Criteria(AdminPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(AdminPeer::ID, $obj->getAdminId());
|
||||
$affectedRows += AdminPeer::doDelete($criteria, $con);
|
||||
|
||||
// delete related Group objects
|
||||
$criteria = new Criteria(GroupPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(GroupPeer::ID, $obj->getGroupId());
|
||||
$affectedRows += GroupPeer::doDelete($criteria, $con);
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates all modified columns of given AdminGroup object.
|
||||
* If parameter $columns is either a single column name or an array of column names
|
||||
|
||||
@@ -39,14 +39,14 @@ use Thelia\Model\Group;
|
||||
* @method AdminGroupQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method AdminGroupQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method AdminGroupQuery leftJoinAdmin($relationAlias = null) Adds a LEFT JOIN clause to the query using the Admin relation
|
||||
* @method AdminGroupQuery rightJoinAdmin($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Admin relation
|
||||
* @method AdminGroupQuery innerJoinAdmin($relationAlias = null) Adds a INNER JOIN clause to the query using the Admin relation
|
||||
*
|
||||
* @method AdminGroupQuery leftJoinGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the Group relation
|
||||
* @method AdminGroupQuery rightJoinGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Group relation
|
||||
* @method AdminGroupQuery innerJoinGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the Group relation
|
||||
*
|
||||
* @method AdminGroupQuery leftJoinAdmin($relationAlias = null) Adds a LEFT JOIN clause to the query using the Admin relation
|
||||
* @method AdminGroupQuery rightJoinAdmin($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Admin relation
|
||||
* @method AdminGroupQuery innerJoinAdmin($relationAlias = null) Adds a INNER JOIN clause to the query using the Admin relation
|
||||
*
|
||||
* @method AdminGroup findOne(PropelPDO $con = null) Return the first AdminGroup matching the query
|
||||
* @method AdminGroup findOneOrCreate(PropelPDO $con = null) Return the first AdminGroup matching the query, or a new AdminGroup object populated from the query conditions when no match is found
|
||||
*
|
||||
@@ -73,7 +73,7 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'mydb', $modelName = 'Thelia\\Model\\AdminGroup', $modelAlias = null)
|
||||
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AdminGroup', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
@@ -276,6 +276,8 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
|
||||
* $query->filterByGroupId(array('min' => 12)); // WHERE group_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByGroup()
|
||||
*
|
||||
* @param mixed $groupId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -317,6 +319,8 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
|
||||
* $query->filterByAdminId(array('min' => 12)); // WHERE admin_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByAdmin()
|
||||
*
|
||||
* @param mixed $adminId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -434,84 +438,10 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(AdminGroupPeer::UPDATED_AT, $updatedAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Admin object
|
||||
*
|
||||
* @param Admin|PropelObjectCollection $admin the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return AdminGroupQuery The current query, for fluid interface
|
||||
* @throws PropelException - if the provided filter is invalid.
|
||||
*/
|
||||
public function filterByAdmin($admin, $comparison = null)
|
||||
{
|
||||
if ($admin instanceof Admin) {
|
||||
return $this
|
||||
->addUsingAlias(AdminGroupPeer::ADMIN_ID, $admin->getId(), $comparison);
|
||||
} elseif ($admin instanceof PropelObjectCollection) {
|
||||
return $this
|
||||
->useAdminQuery()
|
||||
->filterByPrimaryKeys($admin->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByAdmin() only accepts arguments of type Admin or PropelCollection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Admin relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return AdminGroupQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAdmin($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Admin');
|
||||
|
||||
// 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, 'Admin');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Admin relation Admin 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\AdminQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAdminQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAdmin($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Admin', '\Thelia\Model\AdminQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Group object
|
||||
*
|
||||
* @param Group|PropelObjectCollection $group the related object to use as filter
|
||||
* @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 AdminGroupQuery The current query, for fluid interface
|
||||
@@ -523,10 +453,12 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AdminGroupPeer::GROUP_ID, $group->getId(), $comparison);
|
||||
} elseif ($group instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->useGroupQuery()
|
||||
->filterByPrimaryKeys($group->getPrimaryKeys())
|
||||
->endUse();
|
||||
->addUsingAlias(AdminGroupPeer::GROUP_ID, $group->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByGroup() only accepts arguments of type Group or PropelCollection');
|
||||
}
|
||||
@@ -540,7 +472,7 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
|
||||
*
|
||||
* @return AdminGroupQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinGroup($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Group');
|
||||
@@ -575,13 +507,89 @@ abstract class BaseAdminGroupQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\GroupQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useGroupQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useGroupQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinGroup($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Group', '\Thelia\Model\GroupQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Admin object
|
||||
*
|
||||
* @param Admin|PropelObjectCollection $admin The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return AdminGroupQuery The current query, for fluid interface
|
||||
* @throws PropelException - if the provided filter is invalid.
|
||||
*/
|
||||
public function filterByAdmin($admin, $comparison = null)
|
||||
{
|
||||
if ($admin instanceof Admin) {
|
||||
return $this
|
||||
->addUsingAlias(AdminGroupPeer::ADMIN_ID, $admin->getId(), $comparison);
|
||||
} elseif ($admin instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AdminGroupPeer::ADMIN_ID, $admin->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByAdmin() only accepts arguments of type Admin or PropelCollection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Admin relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return AdminGroupQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAdmin($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Admin');
|
||||
|
||||
// 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, 'Admin');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Admin relation Admin 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\AdminQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAdminQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAdmin($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Admin', '\Thelia\Model\AdminQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
|
||||
@@ -24,7 +24,7 @@ abstract class BaseAdminLogPeer
|
||||
{
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'mydb';
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'admin_log';
|
||||
|
||||
@@ -73,7 +73,7 @@ abstract class BaseAdminLogQuery extends ModelCriteria
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'mydb', $modelName = 'Thelia\\Model\\AdminLog', $modelAlias = null)
|
||||
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AdminLog', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class BaseAdminPeer
|
||||
{
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'mydb';
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'admin';
|
||||
@@ -403,6 +403,9 @@ abstract class BaseAdminPeer
|
||||
*/
|
||||
public static function clearRelatedInstancePool()
|
||||
{
|
||||
// Invalidate objects in AdminGroupPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
AdminGroupPeer::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -499,245 +502,6 @@ abstract class BaseAdminPeer
|
||||
return array($obj, $col);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related AdminGroup 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 doCountJoinAdminGroup(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(AdminPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AdminPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AdminPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AdminPeer::ID, AdminGroupPeer::ADMIN_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 Admin objects pre-filled with their AdminGroup 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 Admin objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAdminGroup(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(AdminPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AdminPeer::addSelectColumns($criteria);
|
||||
$startcol = AdminPeer::NUM_HYDRATE_COLUMNS;
|
||||
AdminGroupPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AdminPeer::ID, AdminGroupPeer::ADMIN_ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AdminPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AdminPeer::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 = AdminPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AdminPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if $obj1 already loaded
|
||||
|
||||
$key2 = AdminGroupPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = AdminGroupPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = AdminGroupPeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol);
|
||||
AdminGroupPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 already loaded
|
||||
|
||||
// Add the $obj1 (Admin) to $obj2 (AdminGroup)
|
||||
// one to one relationship
|
||||
$obj1->setAdminGroup($obj2);
|
||||
|
||||
} // 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(AdminPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AdminPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AdminPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AdminPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AdminPeer::ID, AdminGroupPeer::ADMIN_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 Admin 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 Admin 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(AdminPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AdminPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AdminPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
AdminGroupPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + AdminGroupPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AdminPeer::ID, AdminGroupPeer::ADMIN_ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AdminPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AdminPeer::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 = AdminPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AdminPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if obj1 already loaded
|
||||
|
||||
// Add objects for joined AdminGroup rows
|
||||
|
||||
$key2 = AdminGroupPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = AdminGroupPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = AdminGroupPeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol2);
|
||||
AdminGroupPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 loaded
|
||||
|
||||
// Add the $obj1 (Admin) to the collection in $obj2 (AdminGroup)
|
||||
$obj1->setAdminGroup($obj2);
|
||||
} // 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.
|
||||
|
||||
@@ -84,7 +84,7 @@ abstract class BaseAdminQuery extends ModelCriteria
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'mydb', $modelName = 'Thelia\\Model\\Admin', $modelAlias = null)
|
||||
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Admin', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
@@ -260,8 +260,6 @@ abstract class BaseAdminQuery extends ModelCriteria
|
||||
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByAdminGroup()
|
||||
*
|
||||
* @param mixed $id The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -542,7 +540,7 @@ abstract class BaseAdminQuery extends ModelCriteria
|
||||
/**
|
||||
* Filter the query by a related AdminGroup object
|
||||
*
|
||||
* @param AdminGroup|PropelObjectCollection $adminGroup The related object(s) to use as filter
|
||||
* @param AdminGroup|PropelObjectCollection $adminGroup the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return AdminQuery The current query, for fluid interface
|
||||
@@ -554,12 +552,10 @@ abstract class BaseAdminQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AdminPeer::ID, $adminGroup->getAdminId(), $comparison);
|
||||
} elseif ($adminGroup instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AdminPeer::ID, $adminGroup->toKeyValue('PrimaryKey', 'AdminId'), $comparison);
|
||||
->useAdminGroupQuery()
|
||||
->filterByPrimaryKeys($adminGroup->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByAdminGroup() only accepts arguments of type AdminGroup or PropelCollection');
|
||||
}
|
||||
@@ -573,7 +569,7 @@ abstract class BaseAdminQuery extends ModelCriteria
|
||||
*
|
||||
* @return AdminQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAdminGroup($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinAdminGroup($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('AdminGroup');
|
||||
@@ -608,7 +604,7 @@ abstract class BaseAdminQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\AdminGroupQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAdminGroupQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useAdminGroupQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAdminGroup($relationAlias, $joinType)
|
||||
|
||||
@@ -10,8 +10,10 @@ use \Exception;
|
||||
use \PDO;
|
||||
use \Persistent;
|
||||
use \Propel;
|
||||
use \PropelCollection;
|
||||
use \PropelDateTime;
|
||||
use \PropelException;
|
||||
use \PropelObjectCollection;
|
||||
use \PropelPDO;
|
||||
use Thelia\Model\Area;
|
||||
use Thelia\Model\AreaPeer;
|
||||
@@ -80,14 +82,16 @@ abstract class BaseArea extends BaseObject implements Persistent
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var Country
|
||||
* @var PropelObjectCollection|Country[] Collection to store aggregation of Country objects.
|
||||
*/
|
||||
protected $aCountry;
|
||||
protected $collCountrys;
|
||||
protected $collCountrysPartial;
|
||||
|
||||
/**
|
||||
* @var Delivzone
|
||||
* @var PropelObjectCollection|Delivzone[] Collection to store aggregation of Delivzone objects.
|
||||
*/
|
||||
protected $aDelivzone;
|
||||
protected $collDelivzones;
|
||||
protected $collDelivzonesPartial;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -103,6 +107,18 @@ abstract class BaseArea extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $countrysScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $delivzonesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
@@ -224,14 +240,6 @@ abstract class BaseArea extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AreaPeer::ID;
|
||||
}
|
||||
|
||||
if ($this->aCountry !== null && $this->aCountry->getAreaId() !== $v) {
|
||||
$this->aCountry = null;
|
||||
}
|
||||
|
||||
if ($this->aDelivzone !== null && $this->aDelivzone->getAreaId() !== $v) {
|
||||
$this->aDelivzone = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setId()
|
||||
@@ -392,12 +400,6 @@ abstract class BaseArea extends BaseObject implements Persistent
|
||||
public function ensureConsistency()
|
||||
{
|
||||
|
||||
if ($this->aCountry !== null && $this->id !== $this->aCountry->getAreaId()) {
|
||||
$this->aCountry = null;
|
||||
}
|
||||
if ($this->aDelivzone !== null && $this->id !== $this->aDelivzone->getAreaId()) {
|
||||
$this->aDelivzone = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -437,8 +439,10 @@ abstract class BaseArea extends BaseObject implements Persistent
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->aCountry = null;
|
||||
$this->aDelivzone = null;
|
||||
$this->collCountrys = null;
|
||||
|
||||
$this->collDelivzones = null;
|
||||
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -552,25 +556,6 @@ abstract class BaseArea extends BaseObject implements Persistent
|
||||
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->aDelivzone !== null) {
|
||||
if ($this->aDelivzone->isModified() || $this->aDelivzone->isNew()) {
|
||||
$affectedRows += $this->aDelivzone->save($con);
|
||||
}
|
||||
$this->setDelivzone($this->aDelivzone);
|
||||
}
|
||||
|
||||
if ($this->isNew() || $this->isModified()) {
|
||||
// persist changes
|
||||
if ($this->isNew()) {
|
||||
@@ -582,6 +567,42 @@ abstract class BaseArea extends BaseObject implements Persistent
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->countrysScheduledForDeletion !== null) {
|
||||
if (!$this->countrysScheduledForDeletion->isEmpty()) {
|
||||
foreach ($this->countrysScheduledForDeletion as $country) {
|
||||
// need to save related object because we set the relation to null
|
||||
$country->save($con);
|
||||
}
|
||||
$this->countrysScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collCountrys !== null) {
|
||||
foreach ($this->collCountrys as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted()) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->delivzonesScheduledForDeletion !== null) {
|
||||
if (!$this->delivzonesScheduledForDeletion->isEmpty()) {
|
||||
foreach ($this->delivzonesScheduledForDeletion as $delivzone) {
|
||||
// need to save related object because we set the relation to null
|
||||
$delivzone->save($con);
|
||||
}
|
||||
$this->delivzonesScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collDelivzones !== null) {
|
||||
foreach ($this->collDelivzones as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted()) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -743,29 +764,27 @@ abstract class BaseArea extends BaseObject implements Persistent
|
||||
$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 ($this->aDelivzone !== null) {
|
||||
if (!$this->aDelivzone->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aDelivzone->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($retval = AreaPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
if ($this->collCountrys !== null) {
|
||||
foreach ($this->collCountrys as $referrerFK) {
|
||||
if (!$referrerFK->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collDelivzones !== null) {
|
||||
foreach ($this->collDelivzones as $referrerFK) {
|
||||
if (!$referrerFK->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
@@ -852,11 +871,11 @@ abstract class BaseArea extends BaseObject implements Persistent
|
||||
$keys[4] => $this->getUpdatedAt(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->aCountry) {
|
||||
$result['Country'] = $this->aCountry->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->collCountrys) {
|
||||
$result['Countrys'] = $this->collCountrys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->aDelivzone) {
|
||||
$result['Delivzone'] = $this->aDelivzone->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->collDelivzones) {
|
||||
$result['Delivzones'] = $this->collDelivzones->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1027,14 +1046,16 @@ abstract class BaseArea extends BaseObject implements Persistent
|
||||
// store object hash to prevent cycle
|
||||
$this->startCopy = true;
|
||||
|
||||
$relObj = $this->getCountry();
|
||||
if ($relObj) {
|
||||
$copyObj->setCountry($relObj->copy($deepCopy));
|
||||
foreach ($this->getCountrys() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addCountry($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
$relObj = $this->getDelivzone();
|
||||
if ($relObj) {
|
||||
$copyObj->setDelivzone($relObj->copy($deepCopy));
|
||||
foreach ($this->getDelivzones() as $relObj) {
|
||||
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||
$copyObj->addDelivzone($relObj->copy($deepCopy));
|
||||
}
|
||||
}
|
||||
|
||||
//unflag object copy
|
||||
@@ -1087,98 +1108,437 @@ abstract class BaseArea extends BaseObject implements Persistent
|
||||
return self::$peer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a Country object.
|
||||
* Initializes a collection based on the name of a relation.
|
||||
* Avoids crafting an 'init[$relationName]s' method name
|
||||
* that wouldn't work when StandardEnglishPluralizer is used.
|
||||
*
|
||||
* @param Country $v
|
||||
* @return Area The current object (for fluent API support)
|
||||
* @param string $relationName The name of the relation to initialize
|
||||
* @return void
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
if ('Country' == $relationName) {
|
||||
$this->initCountrys();
|
||||
}
|
||||
if ('Delivzone' == $relationName) {
|
||||
$this->initDelivzones();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collCountrys 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 addCountrys()
|
||||
*/
|
||||
public function clearCountrys()
|
||||
{
|
||||
$this->collCountrys = null; // important to set this to null since that means it is uninitialized
|
||||
$this->collCountrysPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* reset is the collCountrys collection loaded partially
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function resetPartialCountrys($v = true)
|
||||
{
|
||||
$this->collCountrysPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collCountrys collection.
|
||||
*
|
||||
* By default this just sets the collCountrys collection to an empty array (like clearcollCountrys());
|
||||
* 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 initCountrys($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collCountrys && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collCountrys = new PropelObjectCollection();
|
||||
$this->collCountrys->setModel('Country');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of Country 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 Area 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|Country[] List of Country objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setCountry(Country $v = null)
|
||||
public function getCountrys($criteria = null, PropelPDO $con = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setId(NULL);
|
||||
$partial = $this->collCountrysPartial && !$this->isNew();
|
||||
if (null === $this->collCountrys || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collCountrys) {
|
||||
// return empty collection
|
||||
$this->initCountrys();
|
||||
} else {
|
||||
$collCountrys = CountryQuery::create(null, $criteria)
|
||||
->filterByArea($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collCountrysPartial && count($collCountrys)) {
|
||||
$this->initCountrys(false);
|
||||
|
||||
foreach($collCountrys as $obj) {
|
||||
if (false == $this->collCountrys->contains($obj)) {
|
||||
$this->collCountrys->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCountrysPartial = true;
|
||||
}
|
||||
|
||||
return $collCountrys;
|
||||
}
|
||||
|
||||
if($partial && $this->collCountrys) {
|
||||
foreach($this->collCountrys as $obj) {
|
||||
if($obj->isNew()) {
|
||||
$collCountrys[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collCountrys = $collCountrys;
|
||||
$this->collCountrysPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collCountrys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of Country 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 $countrys A Propel collection.
|
||||
* @param PropelPDO $con Optional connection object
|
||||
*/
|
||||
public function setCountrys(PropelCollection $countrys, PropelPDO $con = null)
|
||||
{
|
||||
$this->countrysScheduledForDeletion = $this->getCountrys(new Criteria(), $con)->diff($countrys);
|
||||
|
||||
foreach ($this->countrysScheduledForDeletion as $countryRemoved) {
|
||||
$countryRemoved->setArea(null);
|
||||
}
|
||||
|
||||
$this->collCountrys = null;
|
||||
foreach ($countrys as $country) {
|
||||
$this->addCountry($country);
|
||||
}
|
||||
|
||||
$this->collCountrys = $countrys;
|
||||
$this->collCountrysPartial = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related Country objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param PropelPDO $con
|
||||
* @return int Count of related Country objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countCountrys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||
{
|
||||
$partial = $this->collCountrysPartial && !$this->isNew();
|
||||
if (null === $this->collCountrys || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collCountrys) {
|
||||
return 0;
|
||||
} else {
|
||||
if($partial && !$criteria) {
|
||||
return count($this->getCountrys());
|
||||
}
|
||||
$query = CountryQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByArea($this)
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
$this->setId($v->getAreaId());
|
||||
return count($this->collCountrys);
|
||||
}
|
||||
}
|
||||
|
||||
$this->aCountry = $v;
|
||||
|
||||
// Add binding for other direction of this 1:1 relationship.
|
||||
if ($v !== null) {
|
||||
$v->setArea($this);
|
||||
/**
|
||||
* Method called to associate a Country object to this object
|
||||
* through the Country foreign key attribute.
|
||||
*
|
||||
* @param Country $l Country
|
||||
* @return Area The current object (for fluent API support)
|
||||
*/
|
||||
public function addCountry(Country $l)
|
||||
{
|
||||
if ($this->collCountrys === null) {
|
||||
$this->initCountrys();
|
||||
$this->collCountrysPartial = true;
|
||||
}
|
||||
if (!$this->collCountrys->contains($l)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddCountry($l);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated Country object
|
||||
*
|
||||
* @param PropelPDO $con Optional Connection object.
|
||||
* @return Country The associated Country object.
|
||||
* @throws PropelException
|
||||
* @param Country $country The country object to add.
|
||||
*/
|
||||
public function getCountry(PropelPDO $con = null)
|
||||
protected function doAddCountry($country)
|
||||
{
|
||||
if ($this->aCountry === null && ($this->id !== null)) {
|
||||
$this->aCountry = CountryQuery::create()
|
||||
->filterByArea($this) // here
|
||||
->findOne($con);
|
||||
// Because this foreign key represents a one-to-one relationship, we will create a bi-directional association.
|
||||
$this->aCountry->setArea($this);
|
||||
}
|
||||
|
||||
return $this->aCountry;
|
||||
$this->collCountrys[]= $country;
|
||||
$country->setArea($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a Delivzone object.
|
||||
* @param Country $country The country object to remove.
|
||||
*/
|
||||
public function removeCountry($country)
|
||||
{
|
||||
if ($this->getCountrys()->contains($country)) {
|
||||
$this->collCountrys->remove($this->collCountrys->search($country));
|
||||
if (null === $this->countrysScheduledForDeletion) {
|
||||
$this->countrysScheduledForDeletion = clone $this->collCountrys;
|
||||
$this->countrysScheduledForDeletion->clear();
|
||||
}
|
||||
$this->countrysScheduledForDeletion[]= $country;
|
||||
$country->setArea(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collDelivzones collection
|
||||
*
|
||||
* @param Delivzone $v
|
||||
* @return Area The current object (for fluent API support)
|
||||
* 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 addDelivzones()
|
||||
*/
|
||||
public function clearDelivzones()
|
||||
{
|
||||
$this->collDelivzones = null; // important to set this to null since that means it is uninitialized
|
||||
$this->collDelivzonesPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* reset is the collDelivzones collection loaded partially
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function resetPartialDelivzones($v = true)
|
||||
{
|
||||
$this->collDelivzonesPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collDelivzones collection.
|
||||
*
|
||||
* By default this just sets the collDelivzones collection to an empty array (like clearcollDelivzones());
|
||||
* 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 initDelivzones($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collDelivzones && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collDelivzones = new PropelObjectCollection();
|
||||
$this->collDelivzones->setModel('Delivzone');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of Delivzone 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 Area 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|Delivzone[] List of Delivzone objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setDelivzone(Delivzone $v = null)
|
||||
public function getDelivzones($criteria = null, PropelPDO $con = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setId(NULL);
|
||||
$partial = $this->collDelivzonesPartial && !$this->isNew();
|
||||
if (null === $this->collDelivzones || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collDelivzones) {
|
||||
// return empty collection
|
||||
$this->initDelivzones();
|
||||
} else {
|
||||
$collDelivzones = DelivzoneQuery::create(null, $criteria)
|
||||
->filterByArea($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collDelivzonesPartial && count($collDelivzones)) {
|
||||
$this->initDelivzones(false);
|
||||
|
||||
foreach($collDelivzones as $obj) {
|
||||
if (false == $this->collDelivzones->contains($obj)) {
|
||||
$this->collDelivzones->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collDelivzonesPartial = true;
|
||||
}
|
||||
|
||||
return $collDelivzones;
|
||||
}
|
||||
|
||||
if($partial && $this->collDelivzones) {
|
||||
foreach($this->collDelivzones as $obj) {
|
||||
if($obj->isNew()) {
|
||||
$collDelivzones[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collDelivzones = $collDelivzones;
|
||||
$this->collDelivzonesPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collDelivzones;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of Delivzone 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 $delivzones A Propel collection.
|
||||
* @param PropelPDO $con Optional connection object
|
||||
*/
|
||||
public function setDelivzones(PropelCollection $delivzones, PropelPDO $con = null)
|
||||
{
|
||||
$this->delivzonesScheduledForDeletion = $this->getDelivzones(new Criteria(), $con)->diff($delivzones);
|
||||
|
||||
foreach ($this->delivzonesScheduledForDeletion as $delivzoneRemoved) {
|
||||
$delivzoneRemoved->setArea(null);
|
||||
}
|
||||
|
||||
$this->collDelivzones = null;
|
||||
foreach ($delivzones as $delivzone) {
|
||||
$this->addDelivzone($delivzone);
|
||||
}
|
||||
|
||||
$this->collDelivzones = $delivzones;
|
||||
$this->collDelivzonesPartial = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related Delivzone objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param PropelPDO $con
|
||||
* @return int Count of related Delivzone objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countDelivzones(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||
{
|
||||
$partial = $this->collDelivzonesPartial && !$this->isNew();
|
||||
if (null === $this->collDelivzones || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collDelivzones) {
|
||||
return 0;
|
||||
} else {
|
||||
if($partial && !$criteria) {
|
||||
return count($this->getDelivzones());
|
||||
}
|
||||
$query = DelivzoneQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByArea($this)
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
$this->setId($v->getAreaId());
|
||||
return count($this->collDelivzones);
|
||||
}
|
||||
}
|
||||
|
||||
$this->aDelivzone = $v;
|
||||
|
||||
// Add binding for other direction of this 1:1 relationship.
|
||||
if ($v !== null) {
|
||||
$v->setArea($this);
|
||||
/**
|
||||
* Method called to associate a Delivzone object to this object
|
||||
* through the Delivzone foreign key attribute.
|
||||
*
|
||||
* @param Delivzone $l Delivzone
|
||||
* @return Area The current object (for fluent API support)
|
||||
*/
|
||||
public function addDelivzone(Delivzone $l)
|
||||
{
|
||||
if ($this->collDelivzones === null) {
|
||||
$this->initDelivzones();
|
||||
$this->collDelivzonesPartial = true;
|
||||
}
|
||||
if (!$this->collDelivzones->contains($l)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddDelivzone($l);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Delivzone $delivzone The delivzone object to add.
|
||||
*/
|
||||
protected function doAddDelivzone($delivzone)
|
||||
{
|
||||
$this->collDelivzones[]= $delivzone;
|
||||
$delivzone->setArea($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the associated Delivzone object
|
||||
*
|
||||
* @param PropelPDO $con Optional Connection object.
|
||||
* @return Delivzone The associated Delivzone object.
|
||||
* @throws PropelException
|
||||
* @param Delivzone $delivzone The delivzone object to remove.
|
||||
*/
|
||||
public function getDelivzone(PropelPDO $con = null)
|
||||
public function removeDelivzone($delivzone)
|
||||
{
|
||||
if ($this->aDelivzone === null && ($this->id !== null)) {
|
||||
$this->aDelivzone = DelivzoneQuery::create()
|
||||
->filterByArea($this) // here
|
||||
->findOne($con);
|
||||
// Because this foreign key represents a one-to-one relationship, we will create a bi-directional association.
|
||||
$this->aDelivzone->setArea($this);
|
||||
if ($this->getDelivzones()->contains($delivzone)) {
|
||||
$this->collDelivzones->remove($this->collDelivzones->search($delivzone));
|
||||
if (null === $this->delivzonesScheduledForDeletion) {
|
||||
$this->delivzonesScheduledForDeletion = clone $this->collDelivzones;
|
||||
$this->delivzonesScheduledForDeletion->clear();
|
||||
}
|
||||
$this->delivzonesScheduledForDeletion[]= $delivzone;
|
||||
$delivzone->setArea(null);
|
||||
}
|
||||
|
||||
return $this->aDelivzone;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1211,10 +1571,26 @@ abstract class BaseArea extends BaseObject implements Persistent
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->collCountrys) {
|
||||
foreach ($this->collCountrys as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collDelivzones) {
|
||||
foreach ($this->collDelivzones as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
$this->aCountry = null;
|
||||
$this->aDelivzone = null;
|
||||
if ($this->collCountrys instanceof PropelCollection) {
|
||||
$this->collCountrys->clearIterator();
|
||||
}
|
||||
$this->collCountrys = null;
|
||||
if ($this->collDelivzones instanceof PropelCollection) {
|
||||
$this->collDelivzones->clearIterator();
|
||||
}
|
||||
$this->collDelivzones = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@ abstract class BaseAreaPeer
|
||||
{
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'mydb';
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'area';
|
||||
@@ -384,6 +384,12 @@ abstract class BaseAreaPeer
|
||||
*/
|
||||
public static function clearRelatedInstancePool()
|
||||
{
|
||||
// Invalidate objects in CountryPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CountryPeer::clearInstancePool();
|
||||
// Invalidate objects in DelivzonePeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
DelivzonePeer::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -480,639 +486,6 @@ abstract class BaseAreaPeer
|
||||
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(AreaPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AreaPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AreaPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AreaPeer::ID, CountryPeer::AREA_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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related Delivzone 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 doCountJoinDelivzone(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(AreaPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AreaPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AreaPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AreaPeer::ID, DelivzonePeer::AREA_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 Area 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 Area 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(AreaPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AreaPeer::addSelectColumns($criteria);
|
||||
$startcol = AreaPeer::NUM_HYDRATE_COLUMNS;
|
||||
CountryPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AreaPeer::ID, CountryPeer::AREA_ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AreaPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AreaPeer::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 = AreaPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AreaPeer::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 (Area) to $obj2 (Country)
|
||||
// one to one relationship
|
||||
$obj1->setCountry($obj2);
|
||||
|
||||
} // if joined row was not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of Area objects pre-filled with their Delivzone 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 Area objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinDelivzone(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(AreaPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AreaPeer::addSelectColumns($criteria);
|
||||
$startcol = AreaPeer::NUM_HYDRATE_COLUMNS;
|
||||
DelivzonePeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AreaPeer::ID, DelivzonePeer::AREA_ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AreaPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AreaPeer::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 = AreaPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AreaPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if $obj1 already loaded
|
||||
|
||||
$key2 = DelivzonePeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = DelivzonePeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = DelivzonePeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol);
|
||||
DelivzonePeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 already loaded
|
||||
|
||||
// Add the $obj1 (Area) to $obj2 (Delivzone)
|
||||
// one to one relationship
|
||||
$obj1->setDelivzone($obj2);
|
||||
|
||||
} // 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(AreaPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AreaPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AreaPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AreaPeer::ID, CountryPeer::AREA_ID, $join_behavior);
|
||||
|
||||
$criteria->addJoin(AreaPeer::ID, DelivzonePeer::AREA_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 Area 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 Area 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(AreaPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AreaPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AreaPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
CountryPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + CountryPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
DelivzonePeer::addSelectColumns($criteria);
|
||||
$startcol4 = $startcol3 + DelivzonePeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AreaPeer::ID, CountryPeer::AREA_ID, $join_behavior);
|
||||
|
||||
$criteria->addJoin(AreaPeer::ID, DelivzonePeer::AREA_ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AreaPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AreaPeer::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 = AreaPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AreaPeer::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 (Area) to the collection in $obj2 (Country)
|
||||
$obj1->setCountry($obj2);
|
||||
} // if joined row not null
|
||||
|
||||
// Add objects for joined Delivzone rows
|
||||
|
||||
$key3 = DelivzonePeer::getPrimaryKeyHashFromRow($row, $startcol3);
|
||||
if ($key3 !== null) {
|
||||
$obj3 = DelivzonePeer::getInstanceFromPool($key3);
|
||||
if (!$obj3) {
|
||||
|
||||
$cls = DelivzonePeer::getOMClass();
|
||||
|
||||
$obj3 = new $cls();
|
||||
$obj3->hydrate($row, $startcol3);
|
||||
DelivzonePeer::addInstanceToPool($obj3, $key3);
|
||||
} // if obj3 loaded
|
||||
|
||||
// Add the $obj1 (Area) to the collection in $obj3 (Delivzone)
|
||||
$obj1->setDelivzone($obj3);
|
||||
} // if joined row not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 doCountJoinAllExceptCountry(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(AreaPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AreaPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AreaPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AreaPeer::ID, DelivzonePeer::AREA_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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related Delivzone 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 doCountJoinAllExceptDelivzone(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(AreaPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AreaPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AreaPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AreaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AreaPeer::ID, CountryPeer::AREA_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 Area objects pre-filled with all related objects except Country.
|
||||
*
|
||||
* @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 Area objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAllExceptCountry(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
// $criteria->getDbName() will return the same object if not set to another value
|
||||
// so == check is okay and faster
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(AreaPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AreaPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AreaPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
DelivzonePeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + DelivzonePeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AreaPeer::ID, DelivzonePeer::AREA_ID, $join_behavior);
|
||||
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AreaPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AreaPeer::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 = AreaPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AreaPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if obj1 already loaded
|
||||
|
||||
// Add objects for joined Delivzone rows
|
||||
|
||||
$key2 = DelivzonePeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = DelivzonePeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = DelivzonePeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol2);
|
||||
DelivzonePeer::addInstanceToPool($obj2, $key2);
|
||||
} // if $obj2 already loaded
|
||||
|
||||
// Add the $obj1 (Area) to the collection in $obj2 (Delivzone)
|
||||
$obj1->setDelivzone($obj2);
|
||||
|
||||
} // if joined row is not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of Area objects pre-filled with all related objects except Delivzone.
|
||||
*
|
||||
* @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 Area objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAllExceptDelivzone(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
// $criteria->getDbName() will return the same object if not set to another value
|
||||
// so == check is okay and faster
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(AreaPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AreaPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AreaPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
CountryPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + CountryPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AreaPeer::ID, CountryPeer::AREA_ID, $join_behavior);
|
||||
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AreaPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AreaPeer::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 = AreaPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AreaPeer::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 already loaded
|
||||
|
||||
// Add the $obj1 (Area) to the collection in $obj2 (Country)
|
||||
$obj1->setCountry($obj2);
|
||||
|
||||
} // if joined row is 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.
|
||||
|
||||
@@ -73,7 +73,7 @@ abstract class BaseAreaQuery extends ModelCriteria
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'mydb', $modelName = 'Thelia\\Model\\Area', $modelAlias = null)
|
||||
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\Area', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
@@ -249,10 +249,6 @@ abstract class BaseAreaQuery extends ModelCriteria
|
||||
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCountry()
|
||||
*
|
||||
* @see filterByDelivzone()
|
||||
*
|
||||
* @param mixed $id The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -429,7 +425,7 @@ abstract class BaseAreaQuery extends ModelCriteria
|
||||
/**
|
||||
* Filter the query by a related Country object
|
||||
*
|
||||
* @param Country|PropelObjectCollection $country The related object(s) to use as filter
|
||||
* @param Country|PropelObjectCollection $country the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return AreaQuery The current query, for fluid interface
|
||||
@@ -441,12 +437,10 @@ abstract class BaseAreaQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AreaPeer::ID, $country->getAreaId(), $comparison);
|
||||
} elseif ($country instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AreaPeer::ID, $country->toKeyValue('PrimaryKey', 'AreaId'), $comparison);
|
||||
->useCountryQuery()
|
||||
->filterByPrimaryKeys($country->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByCountry() only accepts arguments of type Country or PropelCollection');
|
||||
}
|
||||
@@ -460,7 +454,7 @@ abstract class BaseAreaQuery extends ModelCriteria
|
||||
*
|
||||
* @return AreaQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinCountry($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Country');
|
||||
@@ -495,7 +489,7 @@ abstract class BaseAreaQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\CountryQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useCountryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCountry($relationAlias, $joinType)
|
||||
@@ -505,7 +499,7 @@ abstract class BaseAreaQuery extends ModelCriteria
|
||||
/**
|
||||
* Filter the query by a related Delivzone object
|
||||
*
|
||||
* @param Delivzone|PropelObjectCollection $delivzone The related object(s) to use as filter
|
||||
* @param Delivzone|PropelObjectCollection $delivzone the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return AreaQuery The current query, for fluid interface
|
||||
@@ -517,12 +511,10 @@ abstract class BaseAreaQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AreaPeer::ID, $delivzone->getAreaId(), $comparison);
|
||||
} elseif ($delivzone instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AreaPeer::ID, $delivzone->toKeyValue('PrimaryKey', 'AreaId'), $comparison);
|
||||
->useDelivzoneQuery()
|
||||
->filterByPrimaryKeys($delivzone->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByDelivzone() only accepts arguments of type Delivzone or PropelCollection');
|
||||
}
|
||||
@@ -536,7 +528,7 @@ abstract class BaseAreaQuery extends ModelCriteria
|
||||
*
|
||||
* @return AreaQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinDelivzone($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinDelivzone($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Delivzone');
|
||||
@@ -571,7 +563,7 @@ abstract class BaseAreaQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\DelivzoneQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useDelivzoneQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useDelivzoneQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinDelivzone($relationAlias, $joinType)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -84,19 +84,21 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var AttributeAvDesc
|
||||
* @var Attribute
|
||||
*/
|
||||
protected $aAttributeAvDesc;
|
||||
protected $aAttribute;
|
||||
|
||||
/**
|
||||
* @var AttributeCombination
|
||||
* @var PropelObjectCollection|AttributeAvDesc[] Collection to store aggregation of AttributeAvDesc objects.
|
||||
*/
|
||||
protected $aAttributeCombination;
|
||||
protected $collAttributeAvDescs;
|
||||
protected $collAttributeAvDescsPartial;
|
||||
|
||||
/**
|
||||
* @var Attribute one-to-one related Attribute object
|
||||
* @var PropelObjectCollection|AttributeCombination[] Collection to store aggregation of AttributeCombination objects.
|
||||
*/
|
||||
protected $singleAttribute;
|
||||
protected $collAttributeCombinations;
|
||||
protected $collAttributeCombinationsPartial;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -116,7 +118,13 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $attributesScheduledForDeletion = null;
|
||||
protected $attributeAvDescsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $attributeCombinationsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
@@ -239,14 +247,6 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AttributeAvPeer::ID;
|
||||
}
|
||||
|
||||
if ($this->aAttributeAvDesc !== null && $this->aAttributeAvDesc->getAttributeAvId() !== $v) {
|
||||
$this->aAttributeAvDesc = null;
|
||||
}
|
||||
|
||||
if ($this->aAttributeCombination !== null && $this->aAttributeCombination->getAttributeAvId() !== $v) {
|
||||
$this->aAttributeCombination = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setId()
|
||||
@@ -268,6 +268,10 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AttributeAvPeer::ATTRIBUTE_ID;
|
||||
}
|
||||
|
||||
if ($this->aAttribute !== null && $this->aAttribute->getId() !== $v) {
|
||||
$this->aAttribute = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setAttributeId()
|
||||
@@ -407,11 +411,8 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
public function ensureConsistency()
|
||||
{
|
||||
|
||||
if ($this->aAttributeAvDesc !== null && $this->id !== $this->aAttributeAvDesc->getAttributeAvId()) {
|
||||
$this->aAttributeAvDesc = null;
|
||||
}
|
||||
if ($this->aAttributeCombination !== null && $this->id !== $this->aAttributeCombination->getAttributeAvId()) {
|
||||
$this->aAttributeCombination = null;
|
||||
if ($this->aAttribute !== null && $this->attribute_id !== $this->aAttribute->getId()) {
|
||||
$this->aAttribute = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
@@ -452,9 +453,10 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->aAttributeAvDesc = null;
|
||||
$this->aAttributeCombination = null;
|
||||
$this->singleAttribute = null;
|
||||
$this->aAttribute = null;
|
||||
$this->collAttributeAvDescs = null;
|
||||
|
||||
$this->collAttributeCombinations = null;
|
||||
|
||||
} // if (deep)
|
||||
}
|
||||
@@ -574,18 +576,11 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
// method. This object relates to these object(s) by a
|
||||
// foreign key reference.
|
||||
|
||||
if ($this->aAttributeAvDesc !== null) {
|
||||
if ($this->aAttributeAvDesc->isModified() || $this->aAttributeAvDesc->isNew()) {
|
||||
$affectedRows += $this->aAttributeAvDesc->save($con);
|
||||
if ($this->aAttribute !== null) {
|
||||
if ($this->aAttribute->isModified() || $this->aAttribute->isNew()) {
|
||||
$affectedRows += $this->aAttribute->save($con);
|
||||
}
|
||||
$this->setAttributeAvDesc($this->aAttributeAvDesc);
|
||||
}
|
||||
|
||||
if ($this->aAttributeCombination !== null) {
|
||||
if ($this->aAttributeCombination->isModified() || $this->aAttributeCombination->isNew()) {
|
||||
$affectedRows += $this->aAttributeCombination->save($con);
|
||||
}
|
||||
$this->setAttributeCombination($this->aAttributeCombination);
|
||||
$this->setAttribute($this->aAttribute);
|
||||
}
|
||||
|
||||
if ($this->isNew() || $this->isModified()) {
|
||||
@@ -599,18 +594,37 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->attributesScheduledForDeletion !== null) {
|
||||
if (!$this->attributesScheduledForDeletion->isEmpty()) {
|
||||
AttributeQuery::create()
|
||||
->filterByPrimaryKeys($this->attributesScheduledForDeletion->getPrimaryKeys(false))
|
||||
if ($this->attributeAvDescsScheduledForDeletion !== null) {
|
||||
if (!$this->attributeAvDescsScheduledForDeletion->isEmpty()) {
|
||||
AttributeAvDescQuery::create()
|
||||
->filterByPrimaryKeys($this->attributeAvDescsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->attributesScheduledForDeletion = null;
|
||||
$this->attributeAvDescsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleAttribute !== null) {
|
||||
if (!$this->singleAttribute->isDeleted()) {
|
||||
$affectedRows += $this->singleAttribute->save($con);
|
||||
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()
|
||||
->filterByPrimaryKeys($this->attributeCombinationsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->attributeCombinationsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collAttributeCombinations !== null) {
|
||||
foreach ($this->collAttributeCombinations as $referrerFK) {
|
||||
if (!$referrerFK->isDeleted()) {
|
||||
$affectedRows += $referrerFK->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -780,15 +794,9 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
// method. This object relates to these object(s) by a
|
||||
// foreign key reference.
|
||||
|
||||
if ($this->aAttributeAvDesc !== null) {
|
||||
if (!$this->aAttributeAvDesc->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aAttributeAvDesc->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->aAttributeCombination !== null) {
|
||||
if (!$this->aAttributeCombination->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aAttributeCombination->getValidationFailures());
|
||||
if ($this->aAttribute !== null) {
|
||||
if (!$this->aAttribute->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aAttribute->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,9 +806,19 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
}
|
||||
|
||||
|
||||
if ($this->singleAttribute !== null) {
|
||||
if (!$this->singleAttribute->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleAttribute->getValidationFailures());
|
||||
if ($this->collAttributeAvDescs !== null) {
|
||||
foreach ($this->collAttributeAvDescs as $referrerFK) {
|
||||
if (!$referrerFK->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->collAttributeCombinations !== null) {
|
||||
foreach ($this->collAttributeCombinations as $referrerFK) {
|
||||
if (!$referrerFK->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -890,14 +908,14 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
$keys[4] => $this->getUpdatedAt(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->aAttributeAvDesc) {
|
||||
$result['AttributeAvDesc'] = $this->aAttributeAvDesc->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aAttribute) {
|
||||
$result['Attribute'] = $this->aAttribute->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
if (null !== $this->aAttributeCombination) {
|
||||
$result['AttributeCombination'] = $this->aAttributeCombination->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->collAttributeAvDescs) {
|
||||
$result['AttributeAvDescs'] = $this->collAttributeAvDescs->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
if (null !== $this->singleAttribute) {
|
||||
$result['Attribute'] = $this->singleAttribute->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->collAttributeCombinations) {
|
||||
$result['AttributeCombinations'] = $this->collAttributeCombinations->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1068,19 +1086,16 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
// store object hash to prevent cycle
|
||||
$this->startCopy = true;
|
||||
|
||||
$relObj = $this->getAttribute();
|
||||
if ($relObj) {
|
||||
$copyObj->setAttribute($relObj->copy($deepCopy));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
$relObj = $this->getAttributeAvDesc();
|
||||
if ($relObj) {
|
||||
$copyObj->setAttributeAvDesc($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
$relObj = $this->getAttributeCombination();
|
||||
if ($relObj) {
|
||||
$copyObj->setAttributeCombination($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));
|
||||
}
|
||||
}
|
||||
|
||||
//unflag object copy
|
||||
@@ -1134,25 +1149,26 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a AttributeAvDesc object.
|
||||
* Declares an association between this object and a Attribute object.
|
||||
*
|
||||
* @param AttributeAvDesc $v
|
||||
* @param Attribute $v
|
||||
* @return AttributeAv The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setAttributeAvDesc(AttributeAvDesc $v = null)
|
||||
public function setAttribute(Attribute $v = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setId(NULL);
|
||||
$this->setAttributeId(NULL);
|
||||
} else {
|
||||
$this->setId($v->getAttributeAvId());
|
||||
$this->setAttributeId($v->getId());
|
||||
}
|
||||
|
||||
$this->aAttributeAvDesc = $v;
|
||||
$this->aAttribute = $v;
|
||||
|
||||
// Add binding for other direction of this 1:1 relationship.
|
||||
// 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->setAttributeAv($this);
|
||||
$v->addAttributeAv($this);
|
||||
}
|
||||
|
||||
|
||||
@@ -1161,70 +1177,26 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated AttributeAvDesc object
|
||||
* Get the associated Attribute object
|
||||
*
|
||||
* @param PropelPDO $con Optional Connection object.
|
||||
* @return AttributeAvDesc The associated AttributeAvDesc object.
|
||||
* @return Attribute The associated Attribute object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAttributeAvDesc(PropelPDO $con = null)
|
||||
public function getAttribute(PropelPDO $con = null)
|
||||
{
|
||||
if ($this->aAttributeAvDesc === null && ($this->id !== null)) {
|
||||
$this->aAttributeAvDesc = AttributeAvDescQuery::create()
|
||||
->filterByAttributeAv($this) // here
|
||||
->findOne($con);
|
||||
// Because this foreign key represents a one-to-one relationship, we will create a bi-directional association.
|
||||
$this->aAttributeAvDesc->setAttributeAv($this);
|
||||
if ($this->aAttribute === null && ($this->attribute_id !== null)) {
|
||||
$this->aAttribute = AttributeQuery::create()->findPk($this->attribute_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->addAttributeAvs($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aAttributeAvDesc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a AttributeCombination object.
|
||||
*
|
||||
* @param AttributeCombination $v
|
||||
* @return AttributeAv The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setAttributeCombination(AttributeCombination $v = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setId(NULL);
|
||||
} else {
|
||||
$this->setId($v->getAttributeAvId());
|
||||
}
|
||||
|
||||
$this->aAttributeCombination = $v;
|
||||
|
||||
// Add binding for other direction of this 1:1 relationship.
|
||||
if ($v !== null) {
|
||||
$v->setAttributeAv($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated AttributeCombination object
|
||||
*
|
||||
* @param PropelPDO $con Optional Connection object.
|
||||
* @return AttributeCombination The associated AttributeCombination object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAttributeCombination(PropelPDO $con = null)
|
||||
{
|
||||
if ($this->aAttributeCombination === null && ($this->id !== null)) {
|
||||
$this->aAttributeCombination = AttributeCombinationQuery::create()
|
||||
->filterByAttributeAv($this) // here
|
||||
->findOne($con);
|
||||
// Because this foreign key represents a one-to-one relationship, we will create a bi-directional association.
|
||||
$this->aAttributeCombination->setAttributeAv($this);
|
||||
}
|
||||
|
||||
return $this->aAttributeCombination;
|
||||
return $this->aAttribute;
|
||||
}
|
||||
|
||||
|
||||
@@ -1238,44 +1210,478 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
if ('AttributeAvDesc' == $relationName) {
|
||||
$this->initAttributeAvDescs();
|
||||
}
|
||||
if ('AttributeCombination' == $relationName) {
|
||||
$this->initAttributeCombinations();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single Attribute object, which is related to this object by a one-to-one relationship.
|
||||
* 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 Attribute
|
||||
* @return PropelObjectCollection|AttributeAvDesc[] List of AttributeAvDesc objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAttribute(PropelPDO $con = null)
|
||||
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);
|
||||
|
||||
if ($this->singleAttribute === null && !$this->isNew()) {
|
||||
$this->singleAttribute = AttributeQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
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->singleAttribute;
|
||||
return $this->collAttributeAvDescs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single Attribute object as related to this object by a one-to-one relationship.
|
||||
* 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 Attribute $v Attribute
|
||||
* @return AttributeAv The current object (for fluent API support)
|
||||
* @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 setAttribute(Attribute $v = null)
|
||||
public function countAttributeAvDescs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||
{
|
||||
$this->singleAttribute = $v;
|
||||
$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();
|
||||
}
|
||||
|
||||
// Make sure that that the passed-in Attribute isn't already associated with this object
|
||||
if ($v !== null && $v->getAttributeAv() === null) {
|
||||
$v->setAttributeAv($this);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears out the collAttributeCombinations 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 addAttributeCombinations()
|
||||
*/
|
||||
public function clearAttributeCombinations()
|
||||
{
|
||||
$this->collAttributeCombinations = null; // important to set this to null since that means it is uninitialized
|
||||
$this->collAttributeCombinationsPartial = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* reset is the collAttributeCombinations collection loaded partially
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function resetPartialAttributeCombinations($v = true)
|
||||
{
|
||||
$this->collAttributeCombinationsPartial = $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the collAttributeCombinations collection.
|
||||
*
|
||||
* By default this just sets the collAttributeCombinations collection to an empty array (like clearcollAttributeCombinations());
|
||||
* 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 initAttributeCombinations($overrideExisting = true)
|
||||
{
|
||||
if (null !== $this->collAttributeCombinations && !$overrideExisting) {
|
||||
return;
|
||||
}
|
||||
$this->collAttributeCombinations = new PropelObjectCollection();
|
||||
$this->collAttributeCombinations->setModel('AttributeCombination');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of AttributeCombination 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|AttributeCombination[] List of AttributeCombination objects
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAttributeCombinations($criteria = null, PropelPDO $con = null)
|
||||
{
|
||||
$partial = $this->collAttributeCombinationsPartial && !$this->isNew();
|
||||
if (null === $this->collAttributeCombinations || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAttributeCombinations) {
|
||||
// return empty collection
|
||||
$this->initAttributeCombinations();
|
||||
} else {
|
||||
$collAttributeCombinations = AttributeCombinationQuery::create(null, $criteria)
|
||||
->filterByAttributeAv($this)
|
||||
->find($con);
|
||||
if (null !== $criteria) {
|
||||
if (false !== $this->collAttributeCombinationsPartial && count($collAttributeCombinations)) {
|
||||
$this->initAttributeCombinations(false);
|
||||
|
||||
foreach($collAttributeCombinations as $obj) {
|
||||
if (false == $this->collAttributeCombinations->contains($obj)) {
|
||||
$this->collAttributeCombinations->append($obj);
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAttributeCombinationsPartial = true;
|
||||
}
|
||||
|
||||
return $collAttributeCombinations;
|
||||
}
|
||||
|
||||
if($partial && $this->collAttributeCombinations) {
|
||||
foreach($this->collAttributeCombinations as $obj) {
|
||||
if($obj->isNew()) {
|
||||
$collAttributeCombinations[] = $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->collAttributeCombinations = $collAttributeCombinations;
|
||||
$this->collAttributeCombinationsPartial = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->collAttributeCombinations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a collection of AttributeCombination 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 $attributeCombinations A Propel collection.
|
||||
* @param PropelPDO $con Optional connection object
|
||||
*/
|
||||
public function setAttributeCombinations(PropelCollection $attributeCombinations, PropelPDO $con = null)
|
||||
{
|
||||
$this->attributeCombinationsScheduledForDeletion = $this->getAttributeCombinations(new Criteria(), $con)->diff($attributeCombinations);
|
||||
|
||||
foreach ($this->attributeCombinationsScheduledForDeletion as $attributeCombinationRemoved) {
|
||||
$attributeCombinationRemoved->setAttributeAv(null);
|
||||
}
|
||||
|
||||
$this->collAttributeCombinations = null;
|
||||
foreach ($attributeCombinations as $attributeCombination) {
|
||||
$this->addAttributeCombination($attributeCombination);
|
||||
}
|
||||
|
||||
$this->collAttributeCombinations = $attributeCombinations;
|
||||
$this->collAttributeCombinationsPartial = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of related AttributeCombination objects.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct
|
||||
* @param PropelPDO $con
|
||||
* @return int Count of related AttributeCombination objects.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function countAttributeCombinations(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||
{
|
||||
$partial = $this->collAttributeCombinationsPartial && !$this->isNew();
|
||||
if (null === $this->collAttributeCombinations || null !== $criteria || $partial) {
|
||||
if ($this->isNew() && null === $this->collAttributeCombinations) {
|
||||
return 0;
|
||||
} else {
|
||||
if($partial && !$criteria) {
|
||||
return count($this->getAttributeCombinations());
|
||||
}
|
||||
$query = AttributeCombinationQuery::create(null, $criteria);
|
||||
if ($distinct) {
|
||||
$query->distinct();
|
||||
}
|
||||
|
||||
return $query
|
||||
->filterByAttributeAv($this)
|
||||
->count($con);
|
||||
}
|
||||
} else {
|
||||
return count($this->collAttributeCombinations);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called to associate a AttributeCombination object to this object
|
||||
* through the AttributeCombination foreign key attribute.
|
||||
*
|
||||
* @param AttributeCombination $l AttributeCombination
|
||||
* @return AttributeAv The current object (for fluent API support)
|
||||
*/
|
||||
public function addAttributeCombination(AttributeCombination $l)
|
||||
{
|
||||
if ($this->collAttributeCombinations === null) {
|
||||
$this->initAttributeCombinations();
|
||||
$this->collAttributeCombinationsPartial = true;
|
||||
}
|
||||
if (!$this->collAttributeCombinations->contains($l)) { // only add it if the **same** object is not already associated
|
||||
$this->doAddAttributeCombination($l);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AttributeCombination $attributeCombination The attributeCombination object to add.
|
||||
*/
|
||||
protected function doAddAttributeCombination($attributeCombination)
|
||||
{
|
||||
$this->collAttributeCombinations[]= $attributeCombination;
|
||||
$attributeCombination->setAttributeAv($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AttributeCombination $attributeCombination The attributeCombination object to remove.
|
||||
*/
|
||||
public function removeAttributeCombination($attributeCombination)
|
||||
{
|
||||
if ($this->getAttributeCombinations()->contains($attributeCombination)) {
|
||||
$this->collAttributeCombinations->remove($this->collAttributeCombinations->search($attributeCombination));
|
||||
if (null === $this->attributeCombinationsScheduledForDeletion) {
|
||||
$this->attributeCombinationsScheduledForDeletion = clone $this->collAttributeCombinations;
|
||||
$this->attributeCombinationsScheduledForDeletion->clear();
|
||||
}
|
||||
$this->attributeCombinationsScheduledForDeletion[]= $attributeCombination;
|
||||
$attributeCombination->setAttributeAv(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this AttributeAv is new, it will return
|
||||
* an empty collection; or if this AttributeAv has previously
|
||||
* been saved, it will retrieve related AttributeCombinations from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in AttributeAv.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return PropelObjectCollection|AttributeCombination[] List of AttributeCombination objects
|
||||
*/
|
||||
public function getAttributeCombinationsJoinAttribute($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = AttributeCombinationQuery::create(null, $criteria);
|
||||
$query->joinWith('Attribute', $join_behavior);
|
||||
|
||||
return $this->getAttributeCombinations($query, $con);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If this collection has already been initialized with
|
||||
* an identical criteria, it returns the collection.
|
||||
* Otherwise if this AttributeAv is new, it will return
|
||||
* an empty collection; or if this AttributeAv has previously
|
||||
* been saved, it will retrieve related AttributeCombinations from storage.
|
||||
*
|
||||
* This method is protected by default in order to keep the public
|
||||
* api reasonable. You can provide public methods for those you
|
||||
* actually need in AttributeAv.
|
||||
*
|
||||
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||
* @return PropelObjectCollection|AttributeCombination[] List of AttributeCombination objects
|
||||
*/
|
||||
public function getAttributeCombinationsJoinCombination($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$query = AttributeCombinationQuery::create(null, $criteria);
|
||||
$query->joinWith('Combination', $join_behavior);
|
||||
|
||||
return $this->getAttributeCombinations($query, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
@@ -1306,17 +1712,27 @@ abstract class BaseAttributeAv extends BaseObject implements Persistent
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->singleAttribute) {
|
||||
$this->singleAttribute->clearAllReferences($deep);
|
||||
if ($this->collAttributeAvDescs) {
|
||||
foreach ($this->collAttributeAvDescs as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
if ($this->collAttributeCombinations) {
|
||||
foreach ($this->collAttributeCombinations as $o) {
|
||||
$o->clearAllReferences($deep);
|
||||
}
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
if ($this->singleAttribute instanceof PropelCollection) {
|
||||
$this->singleAttribute->clearIterator();
|
||||
if ($this->collAttributeAvDescs instanceof PropelCollection) {
|
||||
$this->collAttributeAvDescs->clearIterator();
|
||||
}
|
||||
$this->singleAttribute = null;
|
||||
$this->aAttributeAvDesc = null;
|
||||
$this->aAttributeCombination = null;
|
||||
$this->collAttributeAvDescs = null;
|
||||
if ($this->collAttributeCombinations instanceof PropelCollection) {
|
||||
$this->collAttributeCombinations->clearIterator();
|
||||
}
|
||||
$this->collAttributeCombinations = null;
|
||||
$this->aAttribute = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,10 +10,8 @@ use \Exception;
|
||||
use \PDO;
|
||||
use \Persistent;
|
||||
use \Propel;
|
||||
use \PropelCollection;
|
||||
use \PropelDateTime;
|
||||
use \PropelException;
|
||||
use \PropelObjectCollection;
|
||||
use \PropelPDO;
|
||||
use Thelia\Model\AttributeAv;
|
||||
use Thelia\Model\AttributeAvDesc;
|
||||
@@ -98,9 +96,9 @@ abstract class BaseAttributeAvDesc extends BaseObject implements Persistent
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var AttributeAv one-to-one related AttributeAv object
|
||||
* @var AttributeAv
|
||||
*/
|
||||
protected $singleAttributeAv;
|
||||
protected $aAttributeAv;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -116,12 +114,6 @@ abstract class BaseAttributeAvDesc extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $attributeAvsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
@@ -294,6 +286,10 @@ abstract class BaseAttributeAvDesc extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AttributeAvDescPeer::ATTRIBUTE_AV_ID;
|
||||
}
|
||||
|
||||
if ($this->aAttributeAv !== null && $this->aAttributeAv->getId() !== $v) {
|
||||
$this->aAttributeAv = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setAttributeAvId()
|
||||
@@ -499,6 +495,9 @@ abstract class BaseAttributeAvDesc extends BaseObject implements Persistent
|
||||
public function ensureConsistency()
|
||||
{
|
||||
|
||||
if ($this->aAttributeAv !== null && $this->attribute_av_id !== $this->aAttributeAv->getId()) {
|
||||
$this->aAttributeAv = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -538,8 +537,7 @@ abstract class BaseAttributeAvDesc extends BaseObject implements Persistent
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->singleAttributeAv = null;
|
||||
|
||||
$this->aAttributeAv = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -653,6 +651,18 @@ abstract class BaseAttributeAvDesc extends BaseObject implements Persistent
|
||||
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()) {
|
||||
@@ -664,21 +674,6 @@ abstract class BaseAttributeAvDesc extends BaseObject implements Persistent
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->attributeAvsScheduledForDeletion !== null) {
|
||||
if (!$this->attributeAvsScheduledForDeletion->isEmpty()) {
|
||||
AttributeAvQuery::create()
|
||||
->filterByPrimaryKeys($this->attributeAvsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->attributeAvsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleAttributeAv !== null) {
|
||||
if (!$this->singleAttributeAv->isDeleted()) {
|
||||
$affectedRows += $this->singleAttributeAv->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -858,17 +853,23 @@ abstract class BaseAttributeAvDesc extends BaseObject implements Persistent
|
||||
$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 = AttributeAvDescPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
if ($this->singleAttributeAv !== null) {
|
||||
if (!$this->singleAttributeAv->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleAttributeAv->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
@@ -967,8 +968,8 @@ abstract class BaseAttributeAvDesc extends BaseObject implements Persistent
|
||||
$keys[7] => $this->getUpdatedAt(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->singleAttributeAv) {
|
||||
$result['AttributeAv'] = $this->singleAttributeAv->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aAttributeAv) {
|
||||
$result['AttributeAv'] = $this->aAttributeAv->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1157,11 +1158,6 @@ abstract class BaseAttributeAvDesc extends BaseObject implements Persistent
|
||||
// store object hash to prevent cycle
|
||||
$this->startCopy = true;
|
||||
|
||||
$relObj = $this->getAttributeAv();
|
||||
if ($relObj) {
|
||||
$copyObj->setAttributeAv($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
//unflag object copy
|
||||
$this->startCopy = false;
|
||||
} // if ($deepCopy)
|
||||
@@ -1212,55 +1208,57 @@ abstract class BaseAttributeAvDesc extends BaseObject implements Persistent
|
||||
return self::$peer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a collection based on the name of a relation.
|
||||
* Avoids crafting an 'init[$relationName]s' method name
|
||||
* that wouldn't work when StandardEnglishPluralizer is used.
|
||||
* Declares an association between this object and a AttributeAv object.
|
||||
*
|
||||
* @param string $relationName The name of the relation to initialize
|
||||
* @return void
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single AttributeAv object, which is related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return AttributeAv
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAttributeAv(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleAttributeAv === null && !$this->isNew()) {
|
||||
$this->singleAttributeAv = AttributeAvQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
}
|
||||
|
||||
return $this->singleAttributeAv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single AttributeAv object as related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param AttributeAv $v AttributeAv
|
||||
* @param AttributeAv $v
|
||||
* @return AttributeAvDesc The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setAttributeAv(AttributeAv $v = null)
|
||||
{
|
||||
$this->singleAttributeAv = $v;
|
||||
|
||||
// Make sure that that the passed-in AttributeAv isn't already associated with this object
|
||||
if ($v !== null && $v->getAttributeAvDesc() === null) {
|
||||
$v->setAttributeAvDesc($this);
|
||||
if ($v === null) {
|
||||
$this->setAttributeAvId(NULL);
|
||||
} else {
|
||||
$this->setAttributeAvId($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->addAttributeAvDesc($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->attribute_av_id !== null)) {
|
||||
$this->aAttributeAv = AttributeAvQuery::create()->findPk($this->attribute_av_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->addAttributeAvDescs($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aAttributeAv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
@@ -1294,15 +1292,9 @@ abstract class BaseAttributeAvDesc extends BaseObject implements Persistent
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->singleAttributeAv) {
|
||||
$this->singleAttributeAv->clearAllReferences($deep);
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
if ($this->singleAttributeAv instanceof PropelCollection) {
|
||||
$this->singleAttributeAv->clearIterator();
|
||||
}
|
||||
$this->singleAttributeAv = null;
|
||||
$this->aAttributeAv = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class BaseAttributeAvDescPeer
|
||||
{
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'mydb';
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'attribute_av_desc';
|
||||
@@ -398,9 +398,6 @@ abstract class BaseAttributeAvDescPeer
|
||||
*/
|
||||
public static function clearRelatedInstancePool()
|
||||
{
|
||||
// Invalidate objects in AttributeAvPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
AttributeAvPeer::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -497,6 +494,244 @@ abstract class BaseAttributeAvDescPeer
|
||||
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(AttributeAvDescPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AttributeAvDescPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AttributeAvDescPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AttributeAvDescPeer::ATTRIBUTE_AV_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 AttributeAvDesc 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 AttributeAvDesc 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(AttributeAvDescPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AttributeAvDescPeer::addSelectColumns($criteria);
|
||||
$startcol = AttributeAvDescPeer::NUM_HYDRATE_COLUMNS;
|
||||
AttributeAvPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AttributeAvDescPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AttributeAvDescPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AttributeAvDescPeer::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 = AttributeAvDescPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AttributeAvDescPeer::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 (AttributeAvDesc) to $obj2 (AttributeAv)
|
||||
$obj2->addAttributeAvDesc($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(AttributeAvDescPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AttributeAvDescPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AttributeAvDescPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AttributeAvDescPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AttributeAvDescPeer::ATTRIBUTE_AV_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 AttributeAvDesc 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 AttributeAvDesc 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(AttributeAvDescPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AttributeAvDescPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AttributeAvDescPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
AttributeAvPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + AttributeAvPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AttributeAvDescPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AttributeAvDescPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AttributeAvDescPeer::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 = AttributeAvDescPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AttributeAvDescPeer::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 (AttributeAvDesc) to the collection in $obj2 (AttributeAv)
|
||||
$obj2->addAttributeAvDesc($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.
|
||||
@@ -630,7 +865,6 @@ abstract class BaseAttributeAvDescPeer
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += AttributeAvDescPeer::doOnDeleteCascade(new Criteria(AttributeAvDescPeer::DATABASE_NAME), $con);
|
||||
$affectedRows += BasePeer::doDeleteAll(AttributeAvDescPeer::TABLE_NAME, $con, AttributeAvDescPeer::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
|
||||
@@ -664,14 +898,24 @@ abstract class BaseAttributeAvDescPeer
|
||||
}
|
||||
|
||||
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.
|
||||
AttributeAvDescPeer::clearInstancePool();
|
||||
// rename for clarity
|
||||
$criteria = clone $values;
|
||||
} elseif ($values instanceof AttributeAvDesc) { // it's a model object
|
||||
// invalidate the cache for this single object
|
||||
AttributeAvDescPeer::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(AttributeAvDescPeer::DATABASE_NAME);
|
||||
$criteria->add(AttributeAvDescPeer::ID, (array) $values, Criteria::IN);
|
||||
// invalidate the cache for this object(s)
|
||||
foreach ((array) $values as $singleval) {
|
||||
AttributeAvDescPeer::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
@@ -684,23 +928,6 @@ abstract class BaseAttributeAvDescPeer
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
// cloning the Criteria in case it's modified by doSelect() or doSelectStmt()
|
||||
$c = clone $criteria;
|
||||
$affectedRows += AttributeAvDescPeer::doOnDeleteCascade($c, $con);
|
||||
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
if ($values instanceof Criteria) {
|
||||
AttributeAvDescPeer::clearInstancePool();
|
||||
} elseif ($values instanceof AttributeAvDesc) { // it's a model object
|
||||
AttributeAvDescPeer::removeInstanceFromPool($values);
|
||||
} else { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) {
|
||||
AttributeAvDescPeer::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||
AttributeAvDescPeer::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
@@ -712,39 +939,6 @@ abstract class BaseAttributeAvDescPeer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
|
||||
* feature (like MySQL or SQLite).
|
||||
*
|
||||
* This method is not very speedy because it must perform a query first to get
|
||||
* the implicated records and then perform the deletes by calling those Peer classes.
|
||||
*
|
||||
* This method should be used within a transaction if possible.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param PropelPDO $con
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
|
||||
{
|
||||
// initialize var to track total num of affected rows
|
||||
$affectedRows = 0;
|
||||
|
||||
// first find the objects that are implicated by the $criteria
|
||||
$objects = AttributeAvDescPeer::doSelect($criteria, $con);
|
||||
foreach ($objects as $obj) {
|
||||
|
||||
|
||||
// delete related AttributeAv objects
|
||||
$criteria = new Criteria(AttributeAvPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(AttributeAvPeer::ID, $obj->getAttributeAvId());
|
||||
$affectedRows += AttributeAvPeer::doDelete($criteria, $con);
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates all modified columns of given AttributeAvDesc object.
|
||||
* If parameter $columns is either a single column name or an array of column names
|
||||
|
||||
@@ -80,7 +80,7 @@ abstract class BaseAttributeAvDescQuery extends ModelCriteria
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'mydb', $modelName = 'Thelia\\Model\\AttributeAvDesc', $modelAlias = null)
|
||||
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AttributeAvDesc', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
@@ -283,6 +283,8 @@ abstract class BaseAttributeAvDescQuery extends ModelCriteria
|
||||
* $query->filterByAttributeAvId(array('min' => 12)); // WHERE attribute_av_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByAttributeAv()
|
||||
*
|
||||
* @param mixed $attributeAvId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -519,7 +521,7 @@ abstract class BaseAttributeAvDescQuery extends ModelCriteria
|
||||
/**
|
||||
* Filter the query by a related AttributeAv object
|
||||
*
|
||||
* @param AttributeAv|PropelObjectCollection $attributeAv the related object to use as filter
|
||||
* @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 AttributeAvDescQuery The current query, for fluid interface
|
||||
@@ -531,10 +533,12 @@ abstract class BaseAttributeAvDescQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $attributeAv->getId(), $comparison);
|
||||
} elseif ($attributeAv instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->useAttributeAvQuery()
|
||||
->filterByPrimaryKeys($attributeAv->getPrimaryKeys())
|
||||
->endUse();
|
||||
->addUsingAlias(AttributeAvDescPeer::ATTRIBUTE_AV_ID, $attributeAv->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByAttributeAv() only accepts arguments of type AttributeAv or PropelCollection');
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ abstract class BaseAttributeAvPeer
|
||||
{
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'mydb';
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'attribute_av';
|
||||
@@ -385,9 +385,12 @@ abstract class BaseAttributeAvPeer
|
||||
*/
|
||||
public static function clearRelatedInstancePool()
|
||||
{
|
||||
// Invalidate objects in AttributePeer instance pool,
|
||||
// Invalidate objects in AttributeAvDescPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
AttributePeer::clearInstancePool();
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -486,7 +489,7 @@ abstract class BaseAttributeAvPeer
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related AttributeAvDesc table
|
||||
* 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.
|
||||
@@ -494,7 +497,7 @@ abstract class BaseAttributeAvPeer
|
||||
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||
* @return int Number of matching rows.
|
||||
*/
|
||||
public static function doCountJoinAttributeAvDesc(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
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;
|
||||
@@ -521,7 +524,7 @@ abstract class BaseAttributeAvPeer
|
||||
$con = Propel::getConnection(AttributeAvPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AttributeAvPeer::ID, AttributeAvDescPeer::ATTRIBUTE_AV_ID, $join_behavior);
|
||||
$criteria->addJoin(AttributeAvPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doCount($criteria, $con);
|
||||
|
||||
@@ -537,58 +540,7 @@ abstract class BaseAttributeAvPeer
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related AttributeCombination 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 doCountJoinAttributeCombination(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(AttributeAvPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AttributeAvPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AttributeAvPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AttributeAvPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AttributeAvPeer::ID, AttributeCombinationPeer::ATTRIBUTE_AV_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 AttributeAv objects pre-filled with their AttributeAvDesc objects.
|
||||
* Selects a collection of AttributeAv 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
|
||||
@@ -596,7 +548,7 @@ abstract class BaseAttributeAvPeer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAttributeAvDesc(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
public static function doSelectJoinAttribute(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
@@ -607,9 +559,9 @@ abstract class BaseAttributeAvPeer
|
||||
|
||||
AttributeAvPeer::addSelectColumns($criteria);
|
||||
$startcol = AttributeAvPeer::NUM_HYDRATE_COLUMNS;
|
||||
AttributeAvDescPeer::addSelectColumns($criteria);
|
||||
AttributePeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AttributeAvPeer::ID, AttributeAvDescPeer::ATTRIBUTE_AV_ID, $join_behavior);
|
||||
$criteria->addJoin(AttributeAvPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
@@ -629,89 +581,20 @@ abstract class BaseAttributeAvPeer
|
||||
AttributeAvPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if $obj1 already loaded
|
||||
|
||||
$key2 = AttributeAvDescPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||
$key2 = AttributePeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = AttributeAvDescPeer::getInstanceFromPool($key2);
|
||||
$obj2 = AttributePeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = AttributeAvDescPeer::getOMClass();
|
||||
$cls = AttributePeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol);
|
||||
AttributeAvDescPeer::addInstanceToPool($obj2, $key2);
|
||||
AttributePeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 already loaded
|
||||
|
||||
// Add the $obj1 (AttributeAv) to $obj2 (AttributeAvDesc)
|
||||
// one to one relationship
|
||||
$obj1->setAttributeAvDesc($obj2);
|
||||
|
||||
} // if joined row was not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of AttributeAv objects pre-filled with their AttributeCombination 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 AttributeAv objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAttributeCombination(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(AttributeAvPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AttributeAvPeer::addSelectColumns($criteria);
|
||||
$startcol = AttributeAvPeer::NUM_HYDRATE_COLUMNS;
|
||||
AttributeCombinationPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AttributeAvPeer::ID, AttributeCombinationPeer::ATTRIBUTE_AV_ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AttributeAvPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AttributeAvPeer::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 = AttributeAvPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AttributeAvPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if $obj1 already loaded
|
||||
|
||||
$key2 = AttributeCombinationPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = AttributeCombinationPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = AttributeCombinationPeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol);
|
||||
AttributeCombinationPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 already loaded
|
||||
|
||||
// Add the $obj1 (AttributeAv) to $obj2 (AttributeCombination)
|
||||
// one to one relationship
|
||||
$obj1->setAttributeCombination($obj2);
|
||||
// Add the $obj1 (AttributeAv) to $obj2 (Attribute)
|
||||
$obj2->addAttributeAv($obj1);
|
||||
|
||||
} // if joined row was not null
|
||||
|
||||
@@ -759,9 +642,7 @@ abstract class BaseAttributeAvPeer
|
||||
$con = Propel::getConnection(AttributeAvPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AttributeAvPeer::ID, AttributeAvDescPeer::ATTRIBUTE_AV_ID, $join_behavior);
|
||||
|
||||
$criteria->addJoin(AttributeAvPeer::ID, AttributeCombinationPeer::ATTRIBUTE_AV_ID, $join_behavior);
|
||||
$criteria->addJoin(AttributeAvPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doCount($criteria, $con);
|
||||
|
||||
@@ -797,15 +678,10 @@ abstract class BaseAttributeAvPeer
|
||||
AttributeAvPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AttributeAvPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
AttributeAvDescPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + AttributeAvDescPeer::NUM_HYDRATE_COLUMNS;
|
||||
AttributePeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + AttributePeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
AttributeCombinationPeer::addSelectColumns($criteria);
|
||||
$startcol4 = $startcol3 + AttributeCombinationPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AttributeAvPeer::ID, AttributeAvDescPeer::ATTRIBUTE_AV_ID, $join_behavior);
|
||||
|
||||
$criteria->addJoin(AttributeAvPeer::ID, AttributeCombinationPeer::ATTRIBUTE_AV_ID, $join_behavior);
|
||||
$criteria->addJoin(AttributeAvPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
@@ -824,292 +700,24 @@ abstract class BaseAttributeAvPeer
|
||||
AttributeAvPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if obj1 already loaded
|
||||
|
||||
// Add objects for joined AttributeAvDesc rows
|
||||
// Add objects for joined Attribute rows
|
||||
|
||||
$key2 = AttributeAvDescPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||
$key2 = AttributePeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = AttributeAvDescPeer::getInstanceFromPool($key2);
|
||||
$obj2 = AttributePeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = AttributeAvDescPeer::getOMClass();
|
||||
$cls = AttributePeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol2);
|
||||
AttributeAvDescPeer::addInstanceToPool($obj2, $key2);
|
||||
AttributePeer::addInstanceToPool($obj2, $key2);
|
||||
} // if obj2 loaded
|
||||
|
||||
// Add the $obj1 (AttributeAv) to the collection in $obj2 (AttributeAvDesc)
|
||||
$obj1->setAttributeAvDesc($obj2);
|
||||
// Add the $obj1 (AttributeAv) to the collection in $obj2 (Attribute)
|
||||
$obj2->addAttributeAv($obj1);
|
||||
} // if joined row not null
|
||||
|
||||
// Add objects for joined AttributeCombination rows
|
||||
|
||||
$key3 = AttributeCombinationPeer::getPrimaryKeyHashFromRow($row, $startcol3);
|
||||
if ($key3 !== null) {
|
||||
$obj3 = AttributeCombinationPeer::getInstanceFromPool($key3);
|
||||
if (!$obj3) {
|
||||
|
||||
$cls = AttributeCombinationPeer::getOMClass();
|
||||
|
||||
$obj3 = new $cls();
|
||||
$obj3->hydrate($row, $startcol3);
|
||||
AttributeCombinationPeer::addInstanceToPool($obj3, $key3);
|
||||
} // if obj3 loaded
|
||||
|
||||
// Add the $obj1 (AttributeAv) to the collection in $obj3 (AttributeCombination)
|
||||
$obj1->setAttributeCombination($obj3);
|
||||
} // if joined row not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related AttributeAvDesc 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 doCountJoinAllExceptAttributeAvDesc(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(AttributeAvPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AttributeAvPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AttributeAvPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AttributeAvPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AttributeAvPeer::ID, AttributeCombinationPeer::ATTRIBUTE_AV_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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related AttributeCombination 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 doCountJoinAllExceptAttributeCombination(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(AttributeAvPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AttributeAvPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AttributeAvPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AttributeAvPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AttributeAvPeer::ID, AttributeAvDescPeer::ATTRIBUTE_AV_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 AttributeAv objects pre-filled with all related objects except AttributeAvDesc.
|
||||
*
|
||||
* @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 AttributeAv objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAllExceptAttributeAvDesc(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
// $criteria->getDbName() will return the same object if not set to another value
|
||||
// so == check is okay and faster
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(AttributeAvPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AttributeAvPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AttributeAvPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
AttributeCombinationPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + AttributeCombinationPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AttributeAvPeer::ID, AttributeCombinationPeer::ATTRIBUTE_AV_ID, $join_behavior);
|
||||
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AttributeAvPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AttributeAvPeer::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 = AttributeAvPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AttributeAvPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if obj1 already loaded
|
||||
|
||||
// Add objects for joined AttributeCombination rows
|
||||
|
||||
$key2 = AttributeCombinationPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = AttributeCombinationPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = AttributeCombinationPeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol2);
|
||||
AttributeCombinationPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if $obj2 already loaded
|
||||
|
||||
// Add the $obj1 (AttributeAv) to the collection in $obj2 (AttributeCombination)
|
||||
$obj1->setAttributeCombination($obj2);
|
||||
|
||||
} // if joined row is not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of AttributeAv objects pre-filled with all related objects except AttributeCombination.
|
||||
*
|
||||
* @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 AttributeAv objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAllExceptAttributeCombination(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
// $criteria->getDbName() will return the same object if not set to another value
|
||||
// so == check is okay and faster
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(AttributeAvPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AttributeAvPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AttributeAvPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
AttributeAvDescPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + AttributeAvDescPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AttributeAvPeer::ID, AttributeAvDescPeer::ATTRIBUTE_AV_ID, $join_behavior);
|
||||
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AttributeAvPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AttributeAvPeer::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 = AttributeAvPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AttributeAvPeer::addInstanceToPool($obj1, $key1);
|
||||
} // if obj1 already loaded
|
||||
|
||||
// Add objects for joined AttributeAvDesc rows
|
||||
|
||||
$key2 = AttributeAvDescPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||
if ($key2 !== null) {
|
||||
$obj2 = AttributeAvDescPeer::getInstanceFromPool($key2);
|
||||
if (!$obj2) {
|
||||
|
||||
$cls = AttributeAvDescPeer::getOMClass();
|
||||
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($row, $startcol2);
|
||||
AttributeAvDescPeer::addInstanceToPool($obj2, $key2);
|
||||
} // if $obj2 already loaded
|
||||
|
||||
// Add the $obj1 (AttributeAv) to the collection in $obj2 (AttributeAvDesc)
|
||||
$obj1->setAttributeAvDesc($obj2);
|
||||
|
||||
} // if joined row is not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
@@ -1250,7 +858,6 @@ abstract class BaseAttributeAvPeer
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += AttributeAvPeer::doOnDeleteCascade(new Criteria(AttributeAvPeer::DATABASE_NAME), $con);
|
||||
$affectedRows += BasePeer::doDeleteAll(AttributeAvPeer::TABLE_NAME, $con, AttributeAvPeer::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
|
||||
@@ -1284,14 +891,24 @@ abstract class BaseAttributeAvPeer
|
||||
}
|
||||
|
||||
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.
|
||||
AttributeAvPeer::clearInstancePool();
|
||||
// rename for clarity
|
||||
$criteria = clone $values;
|
||||
} elseif ($values instanceof AttributeAv) { // it's a model object
|
||||
// invalidate the cache for this single object
|
||||
AttributeAvPeer::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(AttributeAvPeer::DATABASE_NAME);
|
||||
$criteria->add(AttributeAvPeer::ID, (array) $values, Criteria::IN);
|
||||
// invalidate the cache for this object(s)
|
||||
foreach ((array) $values as $singleval) {
|
||||
AttributeAvPeer::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
@@ -1304,23 +921,6 @@ abstract class BaseAttributeAvPeer
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
// cloning the Criteria in case it's modified by doSelect() or doSelectStmt()
|
||||
$c = clone $criteria;
|
||||
$affectedRows += AttributeAvPeer::doOnDeleteCascade($c, $con);
|
||||
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
if ($values instanceof Criteria) {
|
||||
AttributeAvPeer::clearInstancePool();
|
||||
} elseif ($values instanceof AttributeAv) { // it's a model object
|
||||
AttributeAvPeer::removeInstanceFromPool($values);
|
||||
} else { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) {
|
||||
AttributeAvPeer::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||
AttributeAvPeer::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
@@ -1332,39 +932,6 @@ abstract class BaseAttributeAvPeer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
|
||||
* feature (like MySQL or SQLite).
|
||||
*
|
||||
* This method is not very speedy because it must perform a query first to get
|
||||
* the implicated records and then perform the deletes by calling those Peer classes.
|
||||
*
|
||||
* This method should be used within a transaction if possible.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param PropelPDO $con
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
|
||||
{
|
||||
// initialize var to track total num of affected rows
|
||||
$affectedRows = 0;
|
||||
|
||||
// first find the objects that are implicated by the $criteria
|
||||
$objects = AttributeAvPeer::doSelect($criteria, $con);
|
||||
foreach ($objects as $obj) {
|
||||
|
||||
|
||||
// delete related Attribute objects
|
||||
$criteria = new Criteria(AttributePeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(AttributePeer::ID, $obj->getAttributeId());
|
||||
$affectedRows += AttributePeer::doDelete($criteria, $con);
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates all modified columns of given AttributeAv object.
|
||||
* If parameter $columns is either a single column name or an array of column names
|
||||
|
||||
@@ -40,6 +40,10 @@ use Thelia\Model\AttributeCombination;
|
||||
* @method AttributeAvQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method AttributeAvQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method AttributeAvQuery leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation
|
||||
* @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
|
||||
@@ -48,10 +52,6 @@ use Thelia\Model\AttributeCombination;
|
||||
* @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 leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation
|
||||
* @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 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
|
||||
*
|
||||
@@ -78,7 +78,7 @@ abstract class BaseAttributeAvQuery extends ModelCriteria
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'mydb', $modelName = 'Thelia\\Model\\AttributeAv', $modelAlias = null)
|
||||
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AttributeAv', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
@@ -254,10 +254,6 @@ abstract class BaseAttributeAvQuery extends ModelCriteria
|
||||
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByAttributeAvDesc()
|
||||
*
|
||||
* @see filterByAttributeCombination()
|
||||
*
|
||||
* @param mixed $id The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -285,6 +281,8 @@ abstract class BaseAttributeAvQuery extends ModelCriteria
|
||||
* $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByAttribute()
|
||||
*
|
||||
* @param mixed $attributeId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -443,10 +441,86 @@ abstract class BaseAttributeAvQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(AttributeAvPeer::UPDATED_AT, $updatedAt, $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 AttributeAvQuery 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(AttributeAvPeer::ATTRIBUTE_ID, $attribute->getId(), $comparison);
|
||||
} elseif ($attribute instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AttributeAvPeer::ATTRIBUTE_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 AttributeAvQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Attribute');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Attribute');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Attribute relation Attribute object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AttributeQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAttribute($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related AttributeAvDesc object
|
||||
*
|
||||
* @param AttributeAvDesc|PropelObjectCollection $attributeAvDesc The related object(s) to use as filter
|
||||
* @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
|
||||
@@ -458,12 +532,10 @@ abstract class BaseAttributeAvQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AttributeAvPeer::ID, $attributeAvDesc->getAttributeAvId(), $comparison);
|
||||
} elseif ($attributeAvDesc instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AttributeAvPeer::ID, $attributeAvDesc->toKeyValue('PrimaryKey', 'AttributeAvId'), $comparison);
|
||||
->useAttributeAvDescQuery()
|
||||
->filterByPrimaryKeys($attributeAvDesc->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByAttributeAvDesc() only accepts arguments of type AttributeAvDesc or PropelCollection');
|
||||
}
|
||||
@@ -522,7 +594,7 @@ abstract class BaseAttributeAvQuery extends ModelCriteria
|
||||
/**
|
||||
* Filter the query by a related AttributeCombination object
|
||||
*
|
||||
* @param AttributeCombination|PropelObjectCollection $attributeCombination The related object(s) to use as filter
|
||||
* @param AttributeCombination|PropelObjectCollection $attributeCombination 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
|
||||
@@ -534,12 +606,10 @@ abstract class BaseAttributeAvQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AttributeAvPeer::ID, $attributeCombination->getAttributeAvId(), $comparison);
|
||||
} elseif ($attributeCombination instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AttributeAvPeer::ID, $attributeCombination->toKeyValue('AttributeAvId', 'AttributeAvId'), $comparison);
|
||||
->useAttributeCombinationQuery()
|
||||
->filterByPrimaryKeys($attributeCombination->getPrimaryKeys())
|
||||
->endUse();
|
||||
} else {
|
||||
throw new PropelException('filterByAttributeCombination() only accepts arguments of type AttributeCombination or PropelCollection');
|
||||
}
|
||||
@@ -595,80 +665,6 @@ abstract class BaseAttributeAvQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'AttributeCombination', '\Thelia\Model\AttributeCombinationQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Attribute object
|
||||
*
|
||||
* @param Attribute|PropelObjectCollection $attribute 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 filterByAttribute($attribute, $comparison = null)
|
||||
{
|
||||
if ($attribute instanceof Attribute) {
|
||||
return $this
|
||||
->addUsingAlias(AttributeAvPeer::ATTRIBUTE_ID, $attribute->getId(), $comparison);
|
||||
} elseif ($attribute instanceof PropelObjectCollection) {
|
||||
return $this
|
||||
->useAttributeQuery()
|
||||
->filterByPrimaryKeys($attribute->getPrimaryKeys())
|
||||
->endUse();
|
||||
} 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 AttributeAvQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Attribute');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Attribute');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Attribute relation Attribute object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AttributeQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAttribute($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
|
||||
@@ -10,10 +10,8 @@ use \Exception;
|
||||
use \PDO;
|
||||
use \Persistent;
|
||||
use \Propel;
|
||||
use \PropelCollection;
|
||||
use \PropelDateTime;
|
||||
use \PropelException;
|
||||
use \PropelObjectCollection;
|
||||
use \PropelPDO;
|
||||
use Thelia\Model\Attribute;
|
||||
use Thelia\Model\AttributeCategory;
|
||||
@@ -82,14 +80,14 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var Attribute one-to-one related Attribute object
|
||||
* @var Category
|
||||
*/
|
||||
protected $singleAttribute;
|
||||
protected $aCategory;
|
||||
|
||||
/**
|
||||
* @var Category one-to-one related Category object
|
||||
* @var Attribute
|
||||
*/
|
||||
protected $singleCategory;
|
||||
protected $aAttribute;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -105,18 +103,6 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $attributesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $categorysScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
@@ -259,6 +245,10 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AttributeCategoryPeer::CATEGORY_ID;
|
||||
}
|
||||
|
||||
if ($this->aCategory !== null && $this->aCategory->getId() !== $v) {
|
||||
$this->aCategory = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setCategoryId()
|
||||
@@ -280,6 +270,10 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AttributeCategoryPeer::ATTRIBUTE_ID;
|
||||
}
|
||||
|
||||
if ($this->aAttribute !== null && $this->aAttribute->getId() !== $v) {
|
||||
$this->aAttribute = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setAttributeId()
|
||||
@@ -398,6 +392,12 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
public function ensureConsistency()
|
||||
{
|
||||
|
||||
if ($this->aCategory !== null && $this->category_id !== $this->aCategory->getId()) {
|
||||
$this->aCategory = null;
|
||||
}
|
||||
if ($this->aAttribute !== null && $this->attribute_id !== $this->aAttribute->getId()) {
|
||||
$this->aAttribute = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -437,10 +437,8 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->singleAttribute = null;
|
||||
|
||||
$this->singleCategory = null;
|
||||
|
||||
$this->aCategory = null;
|
||||
$this->aAttribute = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -554,6 +552,25 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
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->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()) {
|
||||
@@ -565,36 +582,6 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->attributesScheduledForDeletion !== null) {
|
||||
if (!$this->attributesScheduledForDeletion->isEmpty()) {
|
||||
AttributeQuery::create()
|
||||
->filterByPrimaryKeys($this->attributesScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->attributesScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleAttribute !== null) {
|
||||
if (!$this->singleAttribute->isDeleted()) {
|
||||
$affectedRows += $this->singleAttribute->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->categorysScheduledForDeletion !== null) {
|
||||
if (!$this->categorysScheduledForDeletion->isEmpty()) {
|
||||
CategoryQuery::create()
|
||||
->filterByPrimaryKeys($this->categorysScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->categorysScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleCategory !== null) {
|
||||
if (!$this->singleCategory->isDeleted()) {
|
||||
$affectedRows += $this->singleCategory->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -756,23 +743,29 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
$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 ($this->aAttribute !== null) {
|
||||
if (!$this->aAttribute->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aAttribute->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($retval = AttributeCategoryPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
if ($this->singleAttribute !== null) {
|
||||
if (!$this->singleAttribute->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleAttribute->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleCategory !== null) {
|
||||
if (!$this->singleCategory->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleCategory->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
@@ -859,11 +852,11 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
$keys[4] => $this->getUpdatedAt(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->singleAttribute) {
|
||||
$result['Attribute'] = $this->singleAttribute->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aCategory) {
|
||||
$result['Category'] = $this->aCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
if (null !== $this->singleCategory) {
|
||||
$result['Category'] = $this->singleCategory->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aAttribute) {
|
||||
$result['Attribute'] = $this->aAttribute->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1034,16 +1027,6 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
// store object hash to prevent cycle
|
||||
$this->startCopy = true;
|
||||
|
||||
$relObj = $this->getAttribute();
|
||||
if ($relObj) {
|
||||
$copyObj->setAttribute($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
$relObj = $this->getCategory();
|
||||
if ($relObj) {
|
||||
$copyObj->setCategory($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
//unflag object copy
|
||||
$this->startCopy = false;
|
||||
} // if ($deepCopy)
|
||||
@@ -1094,91 +1077,108 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
return self::$peer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a collection based on the name of a relation.
|
||||
* Avoids crafting an 'init[$relationName]s' method name
|
||||
* that wouldn't work when StandardEnglishPluralizer is used.
|
||||
* Declares an association between this object and a Category object.
|
||||
*
|
||||
* @param string $relationName The name of the relation to initialize
|
||||
* @return void
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single Attribute object, which is related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return Attribute
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAttribute(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleAttribute === null && !$this->isNew()) {
|
||||
$this->singleAttribute = AttributeQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
}
|
||||
|
||||
return $this->singleAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single Attribute object as related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param Attribute $v Attribute
|
||||
* @return AttributeCategory The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setAttribute(Attribute $v = null)
|
||||
{
|
||||
$this->singleAttribute = $v;
|
||||
|
||||
// Make sure that that the passed-in Attribute isn't already associated with this object
|
||||
if ($v !== null && $v->getAttributeCategory() === null) {
|
||||
$v->setAttributeCategory($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single Category object, which is related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return Category
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCategory(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleCategory === null && !$this->isNew()) {
|
||||
$this->singleCategory = CategoryQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
}
|
||||
|
||||
return $this->singleCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single Category object as related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param Category $v Category
|
||||
* @param Category $v
|
||||
* @return AttributeCategory The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setCategory(Category $v = null)
|
||||
{
|
||||
$this->singleCategory = $v;
|
||||
|
||||
// Make sure that that the passed-in Category isn't already associated with this object
|
||||
if ($v !== null && $v->getAttributeCategory() === null) {
|
||||
$v->setAttributeCategory($this);
|
||||
if ($v === null) {
|
||||
$this->setCategoryId(NULL);
|
||||
} else {
|
||||
$this->setCategoryId($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->addAttributeCategory($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->category_id !== null)) {
|
||||
$this->aCategory = CategoryQuery::create()->findPk($this->category_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->addAttributeCategorys($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares an association between this object and a Attribute object.
|
||||
*
|
||||
* @param Attribute $v
|
||||
* @return AttributeCategory The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setAttribute(Attribute $v = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setAttributeId(NULL);
|
||||
} else {
|
||||
$this->setAttributeId($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->addAttributeCategory($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->attribute_id !== null)) {
|
||||
$this->aAttribute = AttributeQuery::create()->findPk($this->attribute_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->addAttributeCategorys($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
@@ -1209,22 +1209,10 @@ abstract class BaseAttributeCategory extends BaseObject implements Persistent
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->singleAttribute) {
|
||||
$this->singleAttribute->clearAllReferences($deep);
|
||||
}
|
||||
if ($this->singleCategory) {
|
||||
$this->singleCategory->clearAllReferences($deep);
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
if ($this->singleAttribute instanceof PropelCollection) {
|
||||
$this->singleAttribute->clearIterator();
|
||||
}
|
||||
$this->singleAttribute = null;
|
||||
if ($this->singleCategory instanceof PropelCollection) {
|
||||
$this->singleCategory->clearIterator();
|
||||
}
|
||||
$this->singleCategory = null;
|
||||
$this->aCategory = null;
|
||||
$this->aAttribute = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@ abstract class BaseAttributeCategoryPeer
|
||||
{
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'mydb';
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'attribute_category';
|
||||
@@ -384,12 +384,6 @@ abstract class BaseAttributeCategoryPeer
|
||||
*/
|
||||
public static function clearRelatedInstancePool()
|
||||
{
|
||||
// Invalidate objects in AttributePeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
AttributePeer::clearInstancePool();
|
||||
// Invalidate objects in CategoryPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CategoryPeer::clearInstancePool();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -486,6 +480,637 @@ abstract class BaseAttributeCategoryPeer
|
||||
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(AttributeCategoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AttributeCategoryPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AttributeCategoryPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AttributeCategoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AttributeCategoryPeer::CATEGORY_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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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(AttributeCategoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AttributeCategoryPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AttributeCategoryPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AttributeCategoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AttributeCategoryPeer::ATTRIBUTE_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 AttributeCategory 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 AttributeCategory 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(AttributeCategoryPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AttributeCategoryPeer::addSelectColumns($criteria);
|
||||
$startcol = AttributeCategoryPeer::NUM_HYDRATE_COLUMNS;
|
||||
CategoryPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AttributeCategoryPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AttributeCategoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AttributeCategoryPeer::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 = AttributeCategoryPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AttributeCategoryPeer::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 (AttributeCategory) to $obj2 (Category)
|
||||
$obj2->addAttributeCategory($obj1);
|
||||
|
||||
} // if joined row was not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of AttributeCategory 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 AttributeCategory 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(AttributeCategoryPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AttributeCategoryPeer::addSelectColumns($criteria);
|
||||
$startcol = AttributeCategoryPeer::NUM_HYDRATE_COLUMNS;
|
||||
AttributePeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(AttributeCategoryPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AttributeCategoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AttributeCategoryPeer::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 = AttributeCategoryPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AttributeCategoryPeer::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 (AttributeCategory) to $obj2 (Attribute)
|
||||
$obj2->addAttributeCategory($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(AttributeCategoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AttributeCategoryPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AttributeCategoryPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AttributeCategoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AttributeCategoryPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
|
||||
|
||||
$criteria->addJoin(AttributeCategoryPeer::ATTRIBUTE_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 AttributeCategory 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 AttributeCategory 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(AttributeCategoryPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AttributeCategoryPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AttributeCategoryPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
CategoryPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + CategoryPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
AttributePeer::addSelectColumns($criteria);
|
||||
$startcol4 = $startcol3 + AttributePeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AttributeCategoryPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
|
||||
|
||||
$criteria->addJoin(AttributeCategoryPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AttributeCategoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AttributeCategoryPeer::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 = AttributeCategoryPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AttributeCategoryPeer::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 (AttributeCategory) to the collection in $obj2 (Category)
|
||||
$obj2->addAttributeCategory($obj1);
|
||||
} // if joined row not null
|
||||
|
||||
// Add objects for joined Attribute rows
|
||||
|
||||
$key3 = AttributePeer::getPrimaryKeyHashFromRow($row, $startcol3);
|
||||
if ($key3 !== null) {
|
||||
$obj3 = AttributePeer::getInstanceFromPool($key3);
|
||||
if (!$obj3) {
|
||||
|
||||
$cls = AttributePeer::getOMClass();
|
||||
|
||||
$obj3 = new $cls();
|
||||
$obj3->hydrate($row, $startcol3);
|
||||
AttributePeer::addInstanceToPool($obj3, $key3);
|
||||
} // if obj3 loaded
|
||||
|
||||
// Add the $obj1 (AttributeCategory) to the collection in $obj3 (Attribute)
|
||||
$obj3->addAttributeCategory($obj1);
|
||||
} // if joined row not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 doCountJoinAllExceptCategory(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(AttributeCategoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AttributeCategoryPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AttributeCategoryPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AttributeCategoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AttributeCategoryPeer::ATTRIBUTE_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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 doCountJoinAllExceptAttribute(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(AttributeCategoryPeer::TABLE_NAME);
|
||||
|
||||
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->setDistinct();
|
||||
}
|
||||
|
||||
if (!$criteria->hasSelectClause()) {
|
||||
AttributeCategoryPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AttributeCategoryPeer::DATABASE_NAME);
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(AttributeCategoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(AttributeCategoryPeer::CATEGORY_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 AttributeCategory objects pre-filled with all related objects except Category.
|
||||
*
|
||||
* @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 AttributeCategory objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAllExceptCategory(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
// $criteria->getDbName() will return the same object if not set to another value
|
||||
// so == check is okay and faster
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(AttributeCategoryPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AttributeCategoryPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AttributeCategoryPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
AttributePeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + AttributePeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AttributeCategoryPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
|
||||
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AttributeCategoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AttributeCategoryPeer::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 = AttributeCategoryPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AttributeCategoryPeer::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 already loaded
|
||||
|
||||
// Add the $obj1 (AttributeCategory) to the collection in $obj2 (Attribute)
|
||||
$obj2->addAttributeCategory($obj1);
|
||||
|
||||
} // if joined row is not null
|
||||
|
||||
$results[] = $obj1;
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of AttributeCategory objects pre-filled with all related objects except Attribute.
|
||||
*
|
||||
* @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 AttributeCategory objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAllExceptAttribute(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
// $criteria->getDbName() will return the same object if not set to another value
|
||||
// so == check is okay and faster
|
||||
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||
$criteria->setDbName(AttributeCategoryPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
AttributeCategoryPeer::addSelectColumns($criteria);
|
||||
$startcol2 = AttributeCategoryPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
CategoryPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + CategoryPeer::NUM_HYDRATE_COLUMNS;
|
||||
|
||||
$criteria->addJoin(AttributeCategoryPeer::CATEGORY_ID, CategoryPeer::ID, $join_behavior);
|
||||
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
||||
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||
$key1 = AttributeCategoryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||
if (null !== ($obj1 = AttributeCategoryPeer::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 = AttributeCategoryPeer::getOMClass();
|
||||
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($row);
|
||||
AttributeCategoryPeer::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 already loaded
|
||||
|
||||
// Add the $obj1 (AttributeCategory) to the collection in $obj2 (Category)
|
||||
$obj2->addAttributeCategory($obj1);
|
||||
|
||||
} // if joined row is 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.
|
||||
@@ -619,7 +1244,6 @@ abstract class BaseAttributeCategoryPeer
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
$affectedRows += AttributeCategoryPeer::doOnDeleteCascade(new Criteria(AttributeCategoryPeer::DATABASE_NAME), $con);
|
||||
$affectedRows += BasePeer::doDeleteAll(AttributeCategoryPeer::TABLE_NAME, $con, AttributeCategoryPeer::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
|
||||
@@ -653,14 +1277,24 @@ abstract class BaseAttributeCategoryPeer
|
||||
}
|
||||
|
||||
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.
|
||||
AttributeCategoryPeer::clearInstancePool();
|
||||
// rename for clarity
|
||||
$criteria = clone $values;
|
||||
} elseif ($values instanceof AttributeCategory) { // it's a model object
|
||||
// invalidate the cache for this single object
|
||||
AttributeCategoryPeer::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(AttributeCategoryPeer::DATABASE_NAME);
|
||||
$criteria->add(AttributeCategoryPeer::ID, (array) $values, Criteria::IN);
|
||||
// invalidate the cache for this object(s)
|
||||
foreach ((array) $values as $singleval) {
|
||||
AttributeCategoryPeer::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
@@ -673,23 +1307,6 @@ abstract class BaseAttributeCategoryPeer
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->beginTransaction();
|
||||
|
||||
// cloning the Criteria in case it's modified by doSelect() or doSelectStmt()
|
||||
$c = clone $criteria;
|
||||
$affectedRows += AttributeCategoryPeer::doOnDeleteCascade($c, $con);
|
||||
|
||||
// Because this db requires some delete cascade/set null emulation, we have to
|
||||
// clear the cached instance *after* the emulation has happened (since
|
||||
// instances get re-added by the select statement contained therein).
|
||||
if ($values instanceof Criteria) {
|
||||
AttributeCategoryPeer::clearInstancePool();
|
||||
} elseif ($values instanceof AttributeCategory) { // it's a model object
|
||||
AttributeCategoryPeer::removeInstanceFromPool($values);
|
||||
} else { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) {
|
||||
AttributeCategoryPeer::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||
AttributeCategoryPeer::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
@@ -701,45 +1318,6 @@ abstract class BaseAttributeCategoryPeer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
|
||||
* feature (like MySQL or SQLite).
|
||||
*
|
||||
* This method is not very speedy because it must perform a query first to get
|
||||
* the implicated records and then perform the deletes by calling those Peer classes.
|
||||
*
|
||||
* This method should be used within a transaction if possible.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param PropelPDO $con
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
|
||||
{
|
||||
// initialize var to track total num of affected rows
|
||||
$affectedRows = 0;
|
||||
|
||||
// first find the objects that are implicated by the $criteria
|
||||
$objects = AttributeCategoryPeer::doSelect($criteria, $con);
|
||||
foreach ($objects as $obj) {
|
||||
|
||||
|
||||
// delete related Attribute objects
|
||||
$criteria = new Criteria(AttributePeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(AttributePeer::ID, $obj->getAttributeId());
|
||||
$affectedRows += AttributePeer::doDelete($criteria, $con);
|
||||
|
||||
// delete related Category objects
|
||||
$criteria = new Criteria(CategoryPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(CategoryPeer::ID, $obj->getCategoryId());
|
||||
$affectedRows += CategoryPeer::doDelete($criteria, $con);
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates all modified columns of given AttributeCategory object.
|
||||
* If parameter $columns is either a single column name or an array of column names
|
||||
|
||||
@@ -39,14 +39,14 @@ use Thelia\Model\Category;
|
||||
* @method AttributeCategoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method AttributeCategoryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method AttributeCategoryQuery leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation
|
||||
* @method AttributeCategoryQuery rightJoinAttribute($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Attribute relation
|
||||
* @method AttributeCategoryQuery innerJoinAttribute($relationAlias = null) Adds a INNER JOIN clause to the query using the Attribute relation
|
||||
*
|
||||
* @method AttributeCategoryQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation
|
||||
* @method AttributeCategoryQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation
|
||||
* @method AttributeCategoryQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation
|
||||
*
|
||||
* @method AttributeCategoryQuery leftJoinAttribute($relationAlias = null) Adds a LEFT JOIN clause to the query using the Attribute relation
|
||||
* @method AttributeCategoryQuery rightJoinAttribute($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Attribute relation
|
||||
* @method AttributeCategoryQuery innerJoinAttribute($relationAlias = null) Adds a INNER JOIN clause to the query using the Attribute relation
|
||||
*
|
||||
* @method AttributeCategory findOne(PropelPDO $con = null) Return the first AttributeCategory matching the query
|
||||
* @method AttributeCategory findOneOrCreate(PropelPDO $con = null) Return the first AttributeCategory matching the query, or a new AttributeCategory object populated from the query conditions when no match is found
|
||||
*
|
||||
@@ -73,7 +73,7 @@ abstract class BaseAttributeCategoryQuery extends ModelCriteria
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'mydb', $modelName = 'Thelia\\Model\\AttributeCategory', $modelAlias = null)
|
||||
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AttributeCategory', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
@@ -276,6 +276,8 @@ abstract class BaseAttributeCategoryQuery extends ModelCriteria
|
||||
* $query->filterByCategoryId(array('min' => 12)); // WHERE category_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCategory()
|
||||
*
|
||||
* @param mixed $categoryId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -317,6 +319,8 @@ abstract class BaseAttributeCategoryQuery extends ModelCriteria
|
||||
* $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByAttribute()
|
||||
*
|
||||
* @param mixed $attributeId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -434,84 +438,10 @@ abstract class BaseAttributeCategoryQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(AttributeCategoryPeer::UPDATED_AT, $updatedAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Attribute object
|
||||
*
|
||||
* @param Attribute|PropelObjectCollection $attribute the related object to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return AttributeCategoryQuery 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(AttributeCategoryPeer::ATTRIBUTE_ID, $attribute->getId(), $comparison);
|
||||
} elseif ($attribute instanceof PropelObjectCollection) {
|
||||
return $this
|
||||
->useAttributeQuery()
|
||||
->filterByPrimaryKeys($attribute->getPrimaryKeys())
|
||||
->endUse();
|
||||
} 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 AttributeCategoryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Attribute');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Attribute');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Attribute relation Attribute object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AttributeQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAttribute($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related Category object
|
||||
*
|
||||
* @param Category|PropelObjectCollection $category the related object to use as filter
|
||||
* @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 AttributeCategoryQuery The current query, for fluid interface
|
||||
@@ -523,10 +453,12 @@ abstract class BaseAttributeCategoryQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AttributeCategoryPeer::CATEGORY_ID, $category->getId(), $comparison);
|
||||
} elseif ($category instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->useCategoryQuery()
|
||||
->filterByPrimaryKeys($category->getPrimaryKeys())
|
||||
->endUse();
|
||||
->addUsingAlias(AttributeCategoryPeer::CATEGORY_ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCategory() only accepts arguments of type Category or PropelCollection');
|
||||
}
|
||||
@@ -582,6 +514,82 @@ abstract class BaseAttributeCategoryQuery extends ModelCriteria
|
||||
->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 AttributeCategoryQuery 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(AttributeCategoryPeer::ATTRIBUTE_ID, $attribute->getId(), $comparison);
|
||||
} elseif ($attribute instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AttributeCategoryPeer::ATTRIBUTE_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 AttributeCategoryQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinAttribute($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Attribute');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Attribute');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Attribute relation Attribute object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AttributeQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAttributeQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinAttribute($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Attribute', '\Thelia\Model\AttributeQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
|
||||
@@ -10,10 +10,8 @@ use \Exception;
|
||||
use \PDO;
|
||||
use \Persistent;
|
||||
use \Propel;
|
||||
use \PropelCollection;
|
||||
use \PropelDateTime;
|
||||
use \PropelException;
|
||||
use \PropelObjectCollection;
|
||||
use \PropelPDO;
|
||||
use Thelia\Model\Attribute;
|
||||
use Thelia\Model\AttributeAv;
|
||||
@@ -90,19 +88,19 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var Attribute one-to-one related Attribute object
|
||||
* @var Attribute
|
||||
*/
|
||||
protected $singleAttribute;
|
||||
protected $aAttribute;
|
||||
|
||||
/**
|
||||
* @var AttributeAv one-to-one related AttributeAv object
|
||||
* @var AttributeAv
|
||||
*/
|
||||
protected $singleAttributeAv;
|
||||
protected $aAttributeAv;
|
||||
|
||||
/**
|
||||
* @var Combination one-to-one related Combination object
|
||||
* @var Combination
|
||||
*/
|
||||
protected $singleCombination;
|
||||
protected $aCombination;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -118,24 +116,6 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $attributesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $attributeAvsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $combinationsScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
@@ -288,6 +268,10 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AttributeCombinationPeer::ATTRIBUTE_ID;
|
||||
}
|
||||
|
||||
if ($this->aAttribute !== null && $this->aAttribute->getId() !== $v) {
|
||||
$this->aAttribute = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setAttributeId()
|
||||
@@ -309,6 +293,10 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AttributeCombinationPeer::COMBINATION_ID;
|
||||
}
|
||||
|
||||
if ($this->aCombination !== null && $this->aCombination->getId() !== $v) {
|
||||
$this->aCombination = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setCombinationId()
|
||||
@@ -330,6 +318,10 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AttributeCombinationPeer::ATTRIBUTE_AV_ID;
|
||||
}
|
||||
|
||||
if ($this->aAttributeAv !== null && $this->aAttributeAv->getId() !== $v) {
|
||||
$this->aAttributeAv = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setAttributeAvId()
|
||||
@@ -449,6 +441,15 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
public function ensureConsistency()
|
||||
{
|
||||
|
||||
if ($this->aAttribute !== null && $this->attribute_id !== $this->aAttribute->getId()) {
|
||||
$this->aAttribute = null;
|
||||
}
|
||||
if ($this->aCombination !== null && $this->combination_id !== $this->aCombination->getId()) {
|
||||
$this->aCombination = null;
|
||||
}
|
||||
if ($this->aAttributeAv !== null && $this->attribute_av_id !== $this->aAttributeAv->getId()) {
|
||||
$this->aAttributeAv = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -488,12 +489,9 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->singleAttribute = null;
|
||||
|
||||
$this->singleAttributeAv = null;
|
||||
|
||||
$this->singleCombination = null;
|
||||
|
||||
$this->aAttribute = null;
|
||||
$this->aAttributeAv = null;
|
||||
$this->aCombination = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -607,6 +605,32 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
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->aAttributeAv !== null) {
|
||||
if ($this->aAttributeAv->isModified() || $this->aAttributeAv->isNew()) {
|
||||
$affectedRows += $this->aAttributeAv->save($con);
|
||||
}
|
||||
$this->setAttributeAv($this->aAttributeAv);
|
||||
}
|
||||
|
||||
if ($this->aCombination !== null) {
|
||||
if ($this->aCombination->isModified() || $this->aCombination->isNew()) {
|
||||
$affectedRows += $this->aCombination->save($con);
|
||||
}
|
||||
$this->setCombination($this->aCombination);
|
||||
}
|
||||
|
||||
if ($this->isNew() || $this->isModified()) {
|
||||
// persist changes
|
||||
if ($this->isNew()) {
|
||||
@@ -618,51 +642,6 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->attributesScheduledForDeletion !== null) {
|
||||
if (!$this->attributesScheduledForDeletion->isEmpty()) {
|
||||
AttributeQuery::create()
|
||||
->filterByPrimaryKeys($this->attributesScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->attributesScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleAttribute !== null) {
|
||||
if (!$this->singleAttribute->isDeleted()) {
|
||||
$affectedRows += $this->singleAttribute->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->attributeAvsScheduledForDeletion !== null) {
|
||||
if (!$this->attributeAvsScheduledForDeletion->isEmpty()) {
|
||||
AttributeAvQuery::create()
|
||||
->filterByPrimaryKeys($this->attributeAvsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->attributeAvsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleAttributeAv !== null) {
|
||||
if (!$this->singleAttributeAv->isDeleted()) {
|
||||
$affectedRows += $this->singleAttributeAv->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->combinationsScheduledForDeletion !== null) {
|
||||
if (!$this->combinationsScheduledForDeletion->isEmpty()) {
|
||||
CombinationQuery::create()
|
||||
->filterByPrimaryKeys($this->combinationsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->combinationsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleCombination !== null) {
|
||||
if (!$this->singleCombination->isDeleted()) {
|
||||
$affectedRows += $this->singleCombination->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -830,29 +809,35 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
$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 ($this->aAttributeAv !== null) {
|
||||
if (!$this->aAttributeAv->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aAttributeAv->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->aCombination !== null) {
|
||||
if (!$this->aCombination->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->aCombination->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (($retval = AttributeCombinationPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
if ($this->singleAttribute !== null) {
|
||||
if (!$this->singleAttribute->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleAttribute->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleAttributeAv !== null) {
|
||||
if (!$this->singleAttributeAv->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleAttributeAv->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleCombination !== null) {
|
||||
if (!$this->singleCombination->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleCombination->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
@@ -943,14 +928,14 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
$keys[5] => $this->getUpdatedAt(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->singleAttribute) {
|
||||
$result['Attribute'] = $this->singleAttribute->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aAttribute) {
|
||||
$result['Attribute'] = $this->aAttribute->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
if (null !== $this->singleAttributeAv) {
|
||||
$result['AttributeAv'] = $this->singleAttributeAv->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aAttributeAv) {
|
||||
$result['AttributeAv'] = $this->aAttributeAv->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
if (null !== $this->singleCombination) {
|
||||
$result['Combination'] = $this->singleCombination->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aCombination) {
|
||||
$result['Combination'] = $this->aCombination->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1140,21 +1125,6 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
// store object hash to prevent cycle
|
||||
$this->startCopy = true;
|
||||
|
||||
$relObj = $this->getAttribute();
|
||||
if ($relObj) {
|
||||
$copyObj->setAttribute($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
$relObj = $this->getAttributeAv();
|
||||
if ($relObj) {
|
||||
$copyObj->setAttributeAv($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
$relObj = $this->getCombination();
|
||||
if ($relObj) {
|
||||
$copyObj->setCombination($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
//unflag object copy
|
||||
$this->startCopy = false;
|
||||
} // if ($deepCopy)
|
||||
@@ -1205,127 +1175,159 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
return self::$peer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a collection based on the name of a relation.
|
||||
* Avoids crafting an 'init[$relationName]s' method name
|
||||
* that wouldn't work when StandardEnglishPluralizer is used.
|
||||
* Declares an association between this object and a Attribute object.
|
||||
*
|
||||
* @param string $relationName The name of the relation to initialize
|
||||
* @return void
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single Attribute object, which is related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return Attribute
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAttribute(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleAttribute === null && !$this->isNew()) {
|
||||
$this->singleAttribute = AttributeQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
}
|
||||
|
||||
return $this->singleAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single Attribute object as related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param Attribute $v Attribute
|
||||
* @param Attribute $v
|
||||
* @return AttributeCombination The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setAttribute(Attribute $v = null)
|
||||
{
|
||||
$this->singleAttribute = $v;
|
||||
|
||||
// Make sure that that the passed-in Attribute isn't already associated with this object
|
||||
if ($v !== null && $v->getAttributeCombination() === null) {
|
||||
$v->setAttributeCombination($this);
|
||||
if ($v === null) {
|
||||
$this->setAttributeId(NULL);
|
||||
} else {
|
||||
$this->setAttributeId($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->addAttributeCombination($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a single AttributeAv object, which is related to this object by a one-to-one relationship.
|
||||
* Get the associated Attribute object
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return AttributeAv
|
||||
* @param PropelPDO $con Optional Connection object.
|
||||
* @return Attribute The associated Attribute object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAttributeAv(PropelPDO $con = null)
|
||||
public function getAttribute(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleAttributeAv === null && !$this->isNew()) {
|
||||
$this->singleAttributeAv = AttributeAvQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
if ($this->aAttribute === null && ($this->attribute_id !== null)) {
|
||||
$this->aAttribute = AttributeQuery::create()->findPk($this->attribute_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->addAttributeCombinations($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->singleAttributeAv;
|
||||
return $this->aAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single AttributeAv object as related to this object by a one-to-one relationship.
|
||||
* Declares an association between this object and a AttributeAv object.
|
||||
*
|
||||
* @param AttributeAv $v AttributeAv
|
||||
* @param AttributeAv $v
|
||||
* @return AttributeCombination The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setAttributeAv(AttributeAv $v = null)
|
||||
{
|
||||
$this->singleAttributeAv = $v;
|
||||
|
||||
// Make sure that that the passed-in AttributeAv isn't already associated with this object
|
||||
if ($v !== null && $v->getAttributeCombination() === null) {
|
||||
$v->setAttributeCombination($this);
|
||||
if ($v === null) {
|
||||
$this->setAttributeAvId(NULL);
|
||||
} else {
|
||||
$this->setAttributeAvId($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->addAttributeCombination($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a single Combination object, which is related to this object by a one-to-one relationship.
|
||||
* Get the associated AttributeAv object
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return Combination
|
||||
* @param PropelPDO $con Optional Connection object.
|
||||
* @return AttributeAv The associated AttributeAv object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCombination(PropelPDO $con = null)
|
||||
public function getAttributeAv(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleCombination === null && !$this->isNew()) {
|
||||
$this->singleCombination = CombinationQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
if ($this->aAttributeAv === null && ($this->attribute_av_id !== null)) {
|
||||
$this->aAttributeAv = AttributeAvQuery::create()->findPk($this->attribute_av_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->addAttributeCombinations($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->singleCombination;
|
||||
return $this->aAttributeAv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single Combination object as related to this object by a one-to-one relationship.
|
||||
* Declares an association between this object and a Combination object.
|
||||
*
|
||||
* @param Combination $v Combination
|
||||
* @param Combination $v
|
||||
* @return AttributeCombination The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setCombination(Combination $v = null)
|
||||
{
|
||||
$this->singleCombination = $v;
|
||||
|
||||
// Make sure that that the passed-in Combination isn't already associated with this object
|
||||
if ($v !== null && $v->getAttributeCombination() === null) {
|
||||
$v->setAttributeCombination($this);
|
||||
if ($v === null) {
|
||||
$this->setCombinationId(NULL);
|
||||
} else {
|
||||
$this->setCombinationId($v->getId());
|
||||
}
|
||||
|
||||
$this->aCombination = $v;
|
||||
|
||||
// Add binding for other direction of this n:n relationship.
|
||||
// If this object has already been added to the Combination object, it will not be re-added.
|
||||
if ($v !== null) {
|
||||
$v->addAttributeCombination($this);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the associated Combination object
|
||||
*
|
||||
* @param PropelPDO $con Optional Connection object.
|
||||
* @return Combination The associated Combination object.
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getCombination(PropelPDO $con = null)
|
||||
{
|
||||
if ($this->aCombination === null && ($this->combination_id !== null)) {
|
||||
$this->aCombination = CombinationQuery::create()->findPk($this->combination_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->aCombination->addAttributeCombinations($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aCombination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
@@ -1357,29 +1359,11 @@ abstract class BaseAttributeCombination extends BaseObject implements Persistent
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->singleAttribute) {
|
||||
$this->singleAttribute->clearAllReferences($deep);
|
||||
}
|
||||
if ($this->singleAttributeAv) {
|
||||
$this->singleAttributeAv->clearAllReferences($deep);
|
||||
}
|
||||
if ($this->singleCombination) {
|
||||
$this->singleCombination->clearAllReferences($deep);
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
if ($this->singleAttribute instanceof PropelCollection) {
|
||||
$this->singleAttribute->clearIterator();
|
||||
}
|
||||
$this->singleAttribute = null;
|
||||
if ($this->singleAttributeAv instanceof PropelCollection) {
|
||||
$this->singleAttributeAv->clearIterator();
|
||||
}
|
||||
$this->singleAttributeAv = null;
|
||||
if ($this->singleCombination instanceof PropelCollection) {
|
||||
$this->singleCombination->clearIterator();
|
||||
}
|
||||
$this->singleCombination = null;
|
||||
$this->aAttribute = null;
|
||||
$this->aAttributeAv = null;
|
||||
$this->aCombination = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -82,7 +82,7 @@ abstract class BaseAttributeCombinationQuery extends ModelCriteria
|
||||
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||
*/
|
||||
public function __construct($dbName = 'mydb', $modelName = 'Thelia\\Model\\AttributeCombination', $modelAlias = null)
|
||||
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AttributeCombination', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
@@ -306,6 +306,8 @@ abstract class BaseAttributeCombinationQuery extends ModelCriteria
|
||||
* $query->filterByAttributeId(array('min' => 12)); // WHERE attribute_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByAttribute()
|
||||
*
|
||||
* @param mixed $attributeId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -333,6 +335,8 @@ abstract class BaseAttributeCombinationQuery extends ModelCriteria
|
||||
* $query->filterByCombinationId(array('min' => 12)); // WHERE combination_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCombination()
|
||||
*
|
||||
* @param mixed $combinationId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -360,6 +364,8 @@ abstract class BaseAttributeCombinationQuery extends ModelCriteria
|
||||
* $query->filterByAttributeAvId(array('min' => 12)); // WHERE attribute_av_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByAttributeAv()
|
||||
*
|
||||
* @param mixed $attributeAvId The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
@@ -466,7 +472,7 @@ abstract class BaseAttributeCombinationQuery extends ModelCriteria
|
||||
/**
|
||||
* Filter the query by a related Attribute object
|
||||
*
|
||||
* @param Attribute|PropelObjectCollection $attribute the related object to use as filter
|
||||
* @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 AttributeCombinationQuery The current query, for fluid interface
|
||||
@@ -478,10 +484,12 @@ abstract class BaseAttributeCombinationQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_ID, $attribute->getId(), $comparison);
|
||||
} elseif ($attribute instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->useAttributeQuery()
|
||||
->filterByPrimaryKeys($attribute->getPrimaryKeys())
|
||||
->endUse();
|
||||
->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_ID, $attribute->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByAttribute() only accepts arguments of type Attribute or PropelCollection');
|
||||
}
|
||||
@@ -540,7 +548,7 @@ abstract class BaseAttributeCombinationQuery extends ModelCriteria
|
||||
/**
|
||||
* Filter the query by a related AttributeAv object
|
||||
*
|
||||
* @param AttributeAv|PropelObjectCollection $attributeAv the related object to use as filter
|
||||
* @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 AttributeCombinationQuery The current query, for fluid interface
|
||||
@@ -552,10 +560,12 @@ abstract class BaseAttributeCombinationQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $attributeAv->getId(), $comparison);
|
||||
} elseif ($attributeAv instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->useAttributeAvQuery()
|
||||
->filterByPrimaryKeys($attributeAv->getPrimaryKeys())
|
||||
->endUse();
|
||||
->addUsingAlias(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $attributeAv->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByAttributeAv() only accepts arguments of type AttributeAv or PropelCollection');
|
||||
}
|
||||
@@ -614,7 +624,7 @@ abstract class BaseAttributeCombinationQuery extends ModelCriteria
|
||||
/**
|
||||
* Filter the query by a related Combination object
|
||||
*
|
||||
* @param Combination|PropelObjectCollection $combination the related object to use as filter
|
||||
* @param Combination|PropelObjectCollection $combination The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return AttributeCombinationQuery The current query, for fluid interface
|
||||
@@ -626,10 +636,12 @@ abstract class BaseAttributeCombinationQuery extends ModelCriteria
|
||||
return $this
|
||||
->addUsingAlias(AttributeCombinationPeer::COMBINATION_ID, $combination->getId(), $comparison);
|
||||
} elseif ($combination instanceof PropelObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->useCombinationQuery()
|
||||
->filterByPrimaryKeys($combination->getPrimaryKeys())
|
||||
->endUse();
|
||||
->addUsingAlias(AttributeCombinationPeer::COMBINATION_ID, $combination->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCombination() only accepts arguments of type Combination or PropelCollection');
|
||||
}
|
||||
|
||||
@@ -10,10 +10,8 @@ use \Exception;
|
||||
use \PDO;
|
||||
use \Persistent;
|
||||
use \Propel;
|
||||
use \PropelCollection;
|
||||
use \PropelDateTime;
|
||||
use \PropelException;
|
||||
use \PropelObjectCollection;
|
||||
use \PropelPDO;
|
||||
use Thelia\Model\Attribute;
|
||||
use Thelia\Model\AttributeDesc;
|
||||
@@ -98,9 +96,9 @@ abstract class BaseAttributeDesc extends BaseObject implements Persistent
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* @var Attribute one-to-one related Attribute object
|
||||
* @var Attribute
|
||||
*/
|
||||
protected $singleAttribute;
|
||||
protected $aAttribute;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
@@ -116,12 +114,6 @@ abstract class BaseAttributeDesc extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
/**
|
||||
* An array of objects scheduled for deletion.
|
||||
* @var PropelObjectCollection
|
||||
*/
|
||||
protected $attributesScheduledForDeletion = null;
|
||||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
@@ -315,6 +307,10 @@ abstract class BaseAttributeDesc extends BaseObject implements Persistent
|
||||
$this->modifiedColumns[] = AttributeDescPeer::ATTRIBUTE_ID;
|
||||
}
|
||||
|
||||
if ($this->aAttribute !== null && $this->aAttribute->getId() !== $v) {
|
||||
$this->aAttribute = null;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setAttributeId()
|
||||
@@ -499,6 +495,9 @@ abstract class BaseAttributeDesc extends BaseObject implements Persistent
|
||||
public function ensureConsistency()
|
||||
{
|
||||
|
||||
if ($this->aAttribute !== null && $this->attribute_id !== $this->aAttribute->getId()) {
|
||||
$this->aAttribute = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
||||
/**
|
||||
@@ -538,8 +537,7 @@ abstract class BaseAttributeDesc extends BaseObject implements Persistent
|
||||
|
||||
if ($deep) { // also de-associate any related objects?
|
||||
|
||||
$this->singleAttribute = null;
|
||||
|
||||
$this->aAttribute = null;
|
||||
} // if (deep)
|
||||
}
|
||||
|
||||
@@ -653,6 +651,18 @@ abstract class BaseAttributeDesc extends BaseObject implements Persistent
|
||||
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()) {
|
||||
@@ -664,21 +674,6 @@ abstract class BaseAttributeDesc extends BaseObject implements Persistent
|
||||
$this->resetModified();
|
||||
}
|
||||
|
||||
if ($this->attributesScheduledForDeletion !== null) {
|
||||
if (!$this->attributesScheduledForDeletion->isEmpty()) {
|
||||
AttributeQuery::create()
|
||||
->filterByPrimaryKeys($this->attributesScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
$this->attributesScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->singleAttribute !== null) {
|
||||
if (!$this->singleAttribute->isDeleted()) {
|
||||
$affectedRows += $this->singleAttribute->save($con);
|
||||
}
|
||||
}
|
||||
|
||||
$this->alreadyInSave = false;
|
||||
|
||||
}
|
||||
@@ -858,17 +853,23 @@ abstract class BaseAttributeDesc extends BaseObject implements Persistent
|
||||
$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 = AttributeDescPeer::doValidate($this, $columns)) !== true) {
|
||||
$failureMap = array_merge($failureMap, $retval);
|
||||
}
|
||||
|
||||
|
||||
if ($this->singleAttribute !== null) {
|
||||
if (!$this->singleAttribute->validate($columns)) {
|
||||
$failureMap = array_merge($failureMap, $this->singleAttribute->getValidationFailures());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->alreadyInValidation = false;
|
||||
}
|
||||
@@ -967,8 +968,8 @@ abstract class BaseAttributeDesc extends BaseObject implements Persistent
|
||||
$keys[7] => $this->getUpdatedAt(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->singleAttribute) {
|
||||
$result['Attribute'] = $this->singleAttribute->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
if (null !== $this->aAttribute) {
|
||||
$result['Attribute'] = $this->aAttribute->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1157,11 +1158,6 @@ abstract class BaseAttributeDesc extends BaseObject implements Persistent
|
||||
// store object hash to prevent cycle
|
||||
$this->startCopy = true;
|
||||
|
||||
$relObj = $this->getAttribute();
|
||||
if ($relObj) {
|
||||
$copyObj->setAttribute($relObj->copy($deepCopy));
|
||||
}
|
||||
|
||||
//unflag object copy
|
||||
$this->startCopy = false;
|
||||
} // if ($deepCopy)
|
||||
@@ -1212,55 +1208,57 @@ abstract class BaseAttributeDesc extends BaseObject implements Persistent
|
||||
return self::$peer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a collection based on the name of a relation.
|
||||
* Avoids crafting an 'init[$relationName]s' method name
|
||||
* that wouldn't work when StandardEnglishPluralizer is used.
|
||||
* Declares an association between this object and a Attribute object.
|
||||
*
|
||||
* @param string $relationName The name of the relation to initialize
|
||||
* @return void
|
||||
*/
|
||||
public function initRelation($relationName)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single Attribute object, which is related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param PropelPDO $con optional connection object
|
||||
* @return Attribute
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getAttribute(PropelPDO $con = null)
|
||||
{
|
||||
|
||||
if ($this->singleAttribute === null && !$this->isNew()) {
|
||||
$this->singleAttribute = AttributeQuery::create()->findPk($this->getPrimaryKey(), $con);
|
||||
}
|
||||
|
||||
return $this->singleAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a single Attribute object as related to this object by a one-to-one relationship.
|
||||
*
|
||||
* @param Attribute $v Attribute
|
||||
* @param Attribute $v
|
||||
* @return AttributeDesc The current object (for fluent API support)
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function setAttribute(Attribute $v = null)
|
||||
{
|
||||
$this->singleAttribute = $v;
|
||||
|
||||
// Make sure that that the passed-in Attribute isn't already associated with this object
|
||||
if ($v !== null && $v->getAttributeDesc() === null) {
|
||||
$v->setAttributeDesc($this);
|
||||
if ($v === null) {
|
||||
$this->setAttributeId(NULL);
|
||||
} else {
|
||||
$this->setAttributeId($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->addAttributeDesc($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->attribute_id !== null)) {
|
||||
$this->aAttribute = AttributeQuery::create()->findPk($this->attribute_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->addAttributeDescs($this);
|
||||
*/
|
||||
}
|
||||
|
||||
return $this->aAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the current object and sets all attributes to their default values
|
||||
*/
|
||||
@@ -1294,15 +1292,9 @@ abstract class BaseAttributeDesc extends BaseObject implements Persistent
|
||||
public function clearAllReferences($deep = false)
|
||||
{
|
||||
if ($deep) {
|
||||
if ($this->singleAttribute) {
|
||||
$this->singleAttribute->clearAllReferences($deep);
|
||||
}
|
||||
} // if ($deep)
|
||||
|
||||
if ($this->singleAttribute instanceof PropelCollection) {
|
||||
$this->singleAttribute->clearIterator();
|
||||
}
|
||||
$this->singleAttribute = null;
|
||||
$this->aAttribute = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user