use propel versionnable behavior
This commit is contained in:
21
core/lib/Thelia/Model/CategoryVersion.php
Normal file
21
core/lib/Thelia/Model/CategoryVersion.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseCategoryVersion;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'category_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class CategoryVersion extends BaseCategoryVersion
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/CategoryVersionPeer.php
Normal file
21
core/lib/Thelia/Model/CategoryVersionPeer.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseCategoryVersionPeer;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'category_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class CategoryVersionPeer extends BaseCategoryVersionPeer
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/CategoryVersionQuery.php
Normal file
21
core/lib/Thelia/Model/CategoryVersionQuery.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseCategoryVersionQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'category_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class CategoryVersionQuery extends BaseCategoryVersionQuery
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/ContentVersion.php
Normal file
21
core/lib/Thelia/Model/ContentVersion.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseContentVersion;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'content_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class ContentVersion extends BaseContentVersion
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/ContentVersionPeer.php
Normal file
21
core/lib/Thelia/Model/ContentVersionPeer.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseContentVersionPeer;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'content_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class ContentVersionPeer extends BaseContentVersionPeer
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/ContentVersionQuery.php
Normal file
21
core/lib/Thelia/Model/ContentVersionQuery.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseContentVersionQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'content_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class ContentVersionQuery extends BaseContentVersionQuery
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/FolderVersion.php
Normal file
21
core/lib/Thelia/Model/FolderVersion.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseFolderVersion;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'folder_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class FolderVersion extends BaseFolderVersion
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/FolderVersionPeer.php
Normal file
21
core/lib/Thelia/Model/FolderVersionPeer.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseFolderVersionPeer;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'folder_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class FolderVersionPeer extends BaseFolderVersionPeer
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/FolderVersionQuery.php
Normal file
21
core/lib/Thelia/Model/FolderVersionQuery.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseFolderVersionQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'folder_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class FolderVersionQuery extends BaseFolderVersionQuery
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/MessageVersion.php
Normal file
21
core/lib/Thelia/Model/MessageVersion.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseMessageVersion;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'message_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class MessageVersion extends BaseMessageVersion
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/MessageVersionPeer.php
Normal file
21
core/lib/Thelia/Model/MessageVersionPeer.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseMessageVersionPeer;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'message_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class MessageVersionPeer extends BaseMessageVersionPeer
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/MessageVersionQuery.php
Normal file
21
core/lib/Thelia/Model/MessageVersionQuery.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseMessageVersionQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'message_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class MessageVersionQuery extends BaseMessageVersionQuery
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/ProductVersion.php
Normal file
21
core/lib/Thelia/Model/ProductVersion.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseProductVersion;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'product_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class ProductVersion extends BaseProductVersion
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/ProductVersionPeer.php
Normal file
21
core/lib/Thelia/Model/ProductVersionPeer.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseProductVersionPeer;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'product_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class ProductVersionPeer extends BaseProductVersionPeer
|
||||||
|
{
|
||||||
|
}
|
||||||
21
core/lib/Thelia/Model/ProductVersionQuery.php
Normal file
21
core/lib/Thelia/Model/ProductVersionQuery.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Model\om\BaseProductVersionQuery;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'product_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* You should add additional methods to this class to meet the
|
||||||
|
* application requirements. This class will only be generated as
|
||||||
|
* long as it does not already exist in the output directory.
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model
|
||||||
|
*/
|
||||||
|
class ProductVersionQuery extends BaseProductVersionQuery
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -49,6 +49,9 @@ class CategoryTableMap extends TableMap
|
|||||||
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
|
||||||
|
$this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
|
||||||
// validators
|
// validators
|
||||||
} // initialize()
|
} // initialize()
|
||||||
|
|
||||||
@@ -65,6 +68,7 @@ class CategoryTableMap extends TableMap
|
|||||||
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'Documents');
|
$this->addRelation('Document', 'Thelia\\Model\\Document', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'Documents');
|
||||||
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'category_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
||||||
$this->addRelation('CategoryI18n', 'Thelia\\Model\\CategoryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryI18ns');
|
$this->addRelation('CategoryI18n', 'Thelia\\Model\\CategoryI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryI18ns');
|
||||||
|
$this->addRelation('CategoryVersion', 'Thelia\\Model\\CategoryVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CategoryVersions');
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,6 +82,7 @@ class CategoryTableMap extends TableMap
|
|||||||
return array(
|
return array(
|
||||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
|
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
|
||||||
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
|
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
|
||||||
|
'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
|
||||||
);
|
);
|
||||||
} // getBehaviors()
|
} // getBehaviors()
|
||||||
|
|
||||||
|
|||||||
66
core/lib/Thelia/Model/map/CategoryVersionTableMap.php
Normal file
66
core/lib/Thelia/Model/map/CategoryVersionTableMap.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\map;
|
||||||
|
|
||||||
|
use \RelationMap;
|
||||||
|
use \TableMap;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'category_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This map class is used by Propel to do runtime db structure discovery.
|
||||||
|
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||||
|
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||||
|
* (i.e. if it's a text column type).
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model.map
|
||||||
|
*/
|
||||||
|
class CategoryVersionTableMap extends TableMap
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'Thelia.Model.map.CategoryVersionTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the table attributes, columns and validators
|
||||||
|
* Relations are not initialized by this method since they are lazy loaded
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
// attributes
|
||||||
|
$this->setName('category_version');
|
||||||
|
$this->setPhpName('CategoryVersion');
|
||||||
|
$this->setClassname('Thelia\\Model\\CategoryVersion');
|
||||||
|
$this->setPackage('Thelia.Model');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
// columns
|
||||||
|
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'category', 'ID', 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);
|
||||||
|
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||||
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
|
||||||
|
$this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
|
||||||
|
// validators
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
$this->addRelation('Category', 'Thelia\\Model\\Category', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
} // CategoryVersionTableMap
|
||||||
@@ -47,6 +47,9 @@ class ContentTableMap extends TableMap
|
|||||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
|
||||||
|
$this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
|
||||||
// validators
|
// validators
|
||||||
} // initialize()
|
} // initialize()
|
||||||
|
|
||||||
@@ -61,6 +64,7 @@ class ContentTableMap extends TableMap
|
|||||||
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
||||||
$this->addRelation('ContentFolder', 'Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentFolders');
|
$this->addRelation('ContentFolder', 'Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'content_id', ), 'CASCADE', 'RESTRICT', 'ContentFolders');
|
||||||
$this->addRelation('ContentI18n', 'Thelia\\Model\\ContentI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentI18ns');
|
$this->addRelation('ContentI18n', 'Thelia\\Model\\ContentI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentI18ns');
|
||||||
|
$this->addRelation('ContentVersion', 'Thelia\\Model\\ContentVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ContentVersions');
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,6 +78,7 @@ class ContentTableMap extends TableMap
|
|||||||
return array(
|
return array(
|
||||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
|
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
|
||||||
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
|
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
|
||||||
|
'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
|
||||||
);
|
);
|
||||||
} // getBehaviors()
|
} // getBehaviors()
|
||||||
|
|
||||||
|
|||||||
64
core/lib/Thelia/Model/map/ContentVersionTableMap.php
Normal file
64
core/lib/Thelia/Model/map/ContentVersionTableMap.php
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\map;
|
||||||
|
|
||||||
|
use \RelationMap;
|
||||||
|
use \TableMap;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'content_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This map class is used by Propel to do runtime db structure discovery.
|
||||||
|
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||||
|
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||||
|
* (i.e. if it's a text column type).
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model.map
|
||||||
|
*/
|
||||||
|
class ContentVersionTableMap extends TableMap
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'Thelia.Model.map.ContentVersionTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the table attributes, columns and validators
|
||||||
|
* Relations are not initialized by this method since they are lazy loaded
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
// attributes
|
||||||
|
$this->setName('content_version');
|
||||||
|
$this->setPhpName('ContentVersion');
|
||||||
|
$this->setClassname('Thelia\\Model\\ContentVersion');
|
||||||
|
$this->setPackage('Thelia.Model');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
// columns
|
||||||
|
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'content', 'ID', 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', false, null, null);
|
||||||
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
|
||||||
|
$this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
|
||||||
|
// validators
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
$this->addRelation('Content', 'Thelia\\Model\\Content', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
} // ContentVersionTableMap
|
||||||
@@ -49,6 +49,9 @@ class FolderTableMap extends TableMap
|
|||||||
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
$this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null);
|
||||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
|
||||||
|
$this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
|
||||||
// validators
|
// validators
|
||||||
} // initialize()
|
} // initialize()
|
||||||
|
|
||||||
@@ -62,6 +65,7 @@ class FolderTableMap extends TableMap
|
|||||||
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
||||||
$this->addRelation('ContentFolder', 'Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'ContentFolders');
|
$this->addRelation('ContentFolder', 'Thelia\\Model\\ContentFolder', RelationMap::ONE_TO_MANY, array('id' => 'folder_id', ), 'CASCADE', 'RESTRICT', 'ContentFolders');
|
||||||
$this->addRelation('FolderI18n', 'Thelia\\Model\\FolderI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'FolderI18ns');
|
$this->addRelation('FolderI18n', 'Thelia\\Model\\FolderI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'FolderI18ns');
|
||||||
|
$this->addRelation('FolderVersion', 'Thelia\\Model\\FolderVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'FolderVersions');
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,6 +79,7 @@ class FolderTableMap extends TableMap
|
|||||||
return array(
|
return array(
|
||||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
|
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
|
||||||
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
|
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
|
||||||
|
'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
|
||||||
);
|
);
|
||||||
} // getBehaviors()
|
} // getBehaviors()
|
||||||
|
|
||||||
|
|||||||
66
core/lib/Thelia/Model/map/FolderVersionTableMap.php
Normal file
66
core/lib/Thelia/Model/map/FolderVersionTableMap.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\map;
|
||||||
|
|
||||||
|
use \RelationMap;
|
||||||
|
use \TableMap;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'folder_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This map class is used by Propel to do runtime db structure discovery.
|
||||||
|
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||||
|
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||||
|
* (i.e. if it's a text column type).
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model.map
|
||||||
|
*/
|
||||||
|
class FolderVersionTableMap extends TableMap
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'Thelia.Model.map.FolderVersionTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the table attributes, columns and validators
|
||||||
|
* Relations are not initialized by this method since they are lazy loaded
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
// attributes
|
||||||
|
$this->setName('folder_version');
|
||||||
|
$this->setPhpName('FolderVersion');
|
||||||
|
$this->setClassname('Thelia\\Model\\FolderVersion');
|
||||||
|
$this->setPackage('Thelia.Model');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
// columns
|
||||||
|
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'folder', 'ID', 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);
|
||||||
|
$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);
|
||||||
|
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
|
||||||
|
$this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
|
||||||
|
// validators
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
$this->addRelation('Folder', 'Thelia\\Model\\Folder', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
} // FolderVersionTableMap
|
||||||
@@ -48,6 +48,9 @@ class MessageTableMap extends TableMap
|
|||||||
$this->addColumn('REF', 'Ref', 'VARCHAR', false, 255, null);
|
$this->addColumn('REF', 'Ref', 'VARCHAR', false, 255, null);
|
||||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
|
||||||
|
$this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
|
||||||
// validators
|
// validators
|
||||||
} // initialize()
|
} // initialize()
|
||||||
|
|
||||||
@@ -57,6 +60,7 @@ class MessageTableMap extends TableMap
|
|||||||
public function buildRelations()
|
public function buildRelations()
|
||||||
{
|
{
|
||||||
$this->addRelation('MessageI18n', 'Thelia\\Model\\MessageI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'MessageI18ns');
|
$this->addRelation('MessageI18n', 'Thelia\\Model\\MessageI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'MessageI18ns');
|
||||||
|
$this->addRelation('MessageVersion', 'Thelia\\Model\\MessageVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'MessageVersions');
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,6 +74,7 @@ class MessageTableMap extends TableMap
|
|||||||
return array(
|
return array(
|
||||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
|
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
|
||||||
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, description_html', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
|
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, description_html', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
|
||||||
|
'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
|
||||||
);
|
);
|
||||||
} // getBehaviors()
|
} // getBehaviors()
|
||||||
|
|
||||||
|
|||||||
65
core/lib/Thelia/Model/map/MessageVersionTableMap.php
Normal file
65
core/lib/Thelia/Model/map/MessageVersionTableMap.php
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\map;
|
||||||
|
|
||||||
|
use \RelationMap;
|
||||||
|
use \TableMap;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'message_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This map class is used by Propel to do runtime db structure discovery.
|
||||||
|
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||||
|
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||||
|
* (i.e. if it's a text column type).
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model.map
|
||||||
|
*/
|
||||||
|
class MessageVersionTableMap extends TableMap
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'Thelia.Model.map.MessageVersionTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the table attributes, columns and validators
|
||||||
|
* Relations are not initialized by this method since they are lazy loaded
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
// attributes
|
||||||
|
$this->setName('message_version');
|
||||||
|
$this->setPhpName('MessageVersion');
|
||||||
|
$this->setClassname('Thelia\\Model\\MessageVersion');
|
||||||
|
$this->setPackage('Thelia.Model');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
// columns
|
||||||
|
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'message', 'ID', true, null, null);
|
||||||
|
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
|
||||||
|
$this->addColumn('SECURED', 'Secured', 'TINYINT', false, null, null);
|
||||||
|
$this->addColumn('REF', 'Ref', 'VARCHAR', false, 255, null);
|
||||||
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
|
||||||
|
$this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
|
||||||
|
// validators
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
$this->addRelation('Message', 'Thelia\\Model\\Message', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
} // MessageVersionTableMap
|
||||||
@@ -56,6 +56,9 @@ class ProductTableMap extends TableMap
|
|||||||
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
|
||||||
|
$this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
|
||||||
// validators
|
// validators
|
||||||
} // initialize()
|
} // initialize()
|
||||||
|
|
||||||
@@ -75,6 +78,7 @@ class ProductTableMap extends TableMap
|
|||||||
$this->addRelation('AccessoryRelatedByAccessory', 'Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'accessory', ), 'CASCADE', 'RESTRICT', 'AccessorysRelatedByAccessory');
|
$this->addRelation('AccessoryRelatedByAccessory', 'Thelia\\Model\\Accessory', RelationMap::ONE_TO_MANY, array('id' => 'accessory', ), 'CASCADE', 'RESTRICT', 'AccessorysRelatedByAccessory');
|
||||||
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
$this->addRelation('Rewriting', 'Thelia\\Model\\Rewriting', RelationMap::ONE_TO_MANY, array('id' => 'product_id', ), 'CASCADE', 'RESTRICT', 'Rewritings');
|
||||||
$this->addRelation('ProductI18n', 'Thelia\\Model\\ProductI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductI18ns');
|
$this->addRelation('ProductI18n', 'Thelia\\Model\\ProductI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductI18ns');
|
||||||
|
$this->addRelation('ProductVersion', 'Thelia\\Model\\ProductVersion', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'ProductVersions');
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,6 +92,7 @@ class ProductTableMap extends TableMap
|
|||||||
return array(
|
return array(
|
||||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
|
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', 'disable_updated_at' => 'false', ),
|
||||||
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
|
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description, chapo, postscriptum', 'locale_column' => 'locale', 'default_locale' => '', 'locale_alias' => '', ),
|
||||||
|
'versionable' => array('version_column' => 'version', 'version_table' => '', 'log_created_at' => 'true', 'log_created_by' => 'true', 'log_comment' => 'false', 'version_created_at_column' => 'version_created_at', 'version_created_by_column' => 'version_created_by', 'version_comment_column' => 'version_comment', ),
|
||||||
);
|
);
|
||||||
} // getBehaviors()
|
} // getBehaviors()
|
||||||
|
|
||||||
|
|||||||
73
core/lib/Thelia/Model/map/ProductVersionTableMap.php
Normal file
73
core/lib/Thelia/Model/map/ProductVersionTableMap.php
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\map;
|
||||||
|
|
||||||
|
use \RelationMap;
|
||||||
|
use \TableMap;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'product_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This map class is used by Propel to do runtime db structure discovery.
|
||||||
|
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||||
|
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||||
|
* (i.e. if it's a text column type).
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model.map
|
||||||
|
*/
|
||||||
|
class ProductVersionTableMap extends TableMap
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'Thelia.Model.map.ProductVersionTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the table attributes, columns and validators
|
||||||
|
* Relations are not initialized by this method since they are lazy loaded
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
// attributes
|
||||||
|
$this->setName('product_version');
|
||||||
|
$this->setPhpName('ProductVersion');
|
||||||
|
$this->setClassname('Thelia\\Model\\ProductVersion');
|
||||||
|
$this->setPackage('Thelia.Model');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
// columns
|
||||||
|
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'product', 'ID', true, null, null);
|
||||||
|
$this->addColumn('TAX_RULE_ID', 'TaxRuleId', 'INTEGER', 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);
|
||||||
|
$this->addColumn('ECOTAX', 'Ecotax', 'FLOAT', false, null, null);
|
||||||
|
$this->addColumn('NEWNESS', 'Newness', 'TINYINT', false, null, 0);
|
||||||
|
$this->addColumn('PROMO', 'Promo', 'TINYINT', false, null, 0);
|
||||||
|
$this->addColumn('STOCK', 'Stock', 'INTEGER', false, null, 0);
|
||||||
|
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
|
||||||
|
$this->addColumn('WEIGHT', 'Weight', 'FLOAT', false, null, null);
|
||||||
|
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||||
|
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
|
||||||
|
$this->addColumn('VERSION_CREATED_AT', 'VersionCreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
|
$this->addColumn('VERSION_CREATED_BY', 'VersionCreatedBy', 'VARCHAR', false, 100, null);
|
||||||
|
// validators
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
$this->addRelation('Product', 'Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', null);
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
} // ProductVersionTableMap
|
||||||
@@ -22,6 +22,9 @@ use Thelia\Model\CategoryI18n;
|
|||||||
use Thelia\Model\CategoryI18nQuery;
|
use Thelia\Model\CategoryI18nQuery;
|
||||||
use Thelia\Model\CategoryPeer;
|
use Thelia\Model\CategoryPeer;
|
||||||
use Thelia\Model\CategoryQuery;
|
use Thelia\Model\CategoryQuery;
|
||||||
|
use Thelia\Model\CategoryVersion;
|
||||||
|
use Thelia\Model\CategoryVersionPeer;
|
||||||
|
use Thelia\Model\CategoryVersionQuery;
|
||||||
use Thelia\Model\ContentAssoc;
|
use Thelia\Model\ContentAssoc;
|
||||||
use Thelia\Model\ContentAssocQuery;
|
use Thelia\Model\ContentAssocQuery;
|
||||||
use Thelia\Model\Document;
|
use Thelia\Model\Document;
|
||||||
@@ -105,6 +108,25 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $updated_at;
|
protected $updated_at;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version field.
|
||||||
|
* Note: this column has a database default value of: 0
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version_created_at field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $version_created_at;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version_created_by field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $version_created_by;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var PropelObjectCollection|ProductCategory[] Collection to store aggregation of ProductCategory objects.
|
* @var PropelObjectCollection|ProductCategory[] Collection to store aggregation of ProductCategory objects.
|
||||||
*/
|
*/
|
||||||
@@ -153,6 +175,12 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
protected $collCategoryI18ns;
|
protected $collCategoryI18ns;
|
||||||
protected $collCategoryI18nsPartial;
|
protected $collCategoryI18nsPartial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PropelObjectCollection|CategoryVersion[] Collection to store aggregation of CategoryVersion objects.
|
||||||
|
*/
|
||||||
|
protected $collCategoryVersions;
|
||||||
|
protected $collCategoryVersionsPartial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to prevent endless save loop, if this object is referenced
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
* by another object which falls in this transaction.
|
* by another object which falls in this transaction.
|
||||||
@@ -181,6 +209,14 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $currentTranslations;
|
protected $currentTranslations;
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $enforceVersion = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var PropelObjectCollection
|
* @var PropelObjectCollection
|
||||||
@@ -229,6 +265,33 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $categoryI18nsScheduledForDeletion = null;
|
protected $categoryI18nsScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of objects scheduled for deletion.
|
||||||
|
* @var PropelObjectCollection
|
||||||
|
*/
|
||||||
|
protected $categoryVersionsScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies default values to this object.
|
||||||
|
* This method should be called from the object's constructor (or
|
||||||
|
* equivalent initialization method).
|
||||||
|
* @see __construct()
|
||||||
|
*/
|
||||||
|
public function applyDefaultValues()
|
||||||
|
{
|
||||||
|
$this->version = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseCategory object.
|
||||||
|
* @see applyDefaults()
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->applyDefaultValues();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [id] column value.
|
* Get the [id] column value.
|
||||||
*
|
*
|
||||||
@@ -353,6 +416,63 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [version] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getVersion()
|
||||||
|
{
|
||||||
|
return $this->version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [optionally formatted] temporal [version_created_at] column value.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||||
|
* If format is null, then the raw DateTime object will be returned.
|
||||||
|
* @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
|
||||||
|
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||||
|
*/
|
||||||
|
public function getVersionCreatedAt($format = 'Y-m-d H:i:s')
|
||||||
|
{
|
||||||
|
if ($this->version_created_at === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version_created_at === '0000-00-00 00:00:00') {
|
||||||
|
// while technically this is not a default value of null,
|
||||||
|
// this seems to be closest in meaning.
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$dt = new DateTime($this->version_created_at);
|
||||||
|
} catch (Exception $x) {
|
||||||
|
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->version_created_at, true), $x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($format === null) {
|
||||||
|
// Because propel.useDateTimeClass is true, we return a DateTime object.
|
||||||
|
return $dt;
|
||||||
|
} elseif (strpos($format, '%') !== false) {
|
||||||
|
return strftime($format, $dt->format('U'));
|
||||||
|
} else {
|
||||||
|
return $dt->format($format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [version_created_by] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVersionCreatedBy()
|
||||||
|
{
|
||||||
|
return $this->version_created_by;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [id] column.
|
* Set the value of [id] column.
|
||||||
*
|
*
|
||||||
@@ -504,6 +624,71 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
return $this;
|
return $this;
|
||||||
} // setUpdatedAt()
|
} // setUpdatedAt()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [version] column.
|
||||||
|
*
|
||||||
|
* @param int $v new value
|
||||||
|
* @return Category The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersion($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version !== $v) {
|
||||||
|
$this->version = $v;
|
||||||
|
$this->modifiedColumns[] = CategoryPeer::VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersion()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of [version_created_at] column to a normalized version of the date/time value specified.
|
||||||
|
*
|
||||||
|
* @param mixed $v string, integer (timestamp), or DateTime value.
|
||||||
|
* Empty strings are treated as null.
|
||||||
|
* @return Category The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersionCreatedAt($v)
|
||||||
|
{
|
||||||
|
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
|
||||||
|
if ($this->version_created_at !== null || $dt !== null) {
|
||||||
|
$currentDateAsString = ($this->version_created_at !== null && $tmpDt = new DateTime($this->version_created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
|
||||||
|
$newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
|
||||||
|
if ($currentDateAsString !== $newDateAsString) {
|
||||||
|
$this->version_created_at = $newDateAsString;
|
||||||
|
$this->modifiedColumns[] = CategoryPeer::VERSION_CREATED_AT;
|
||||||
|
}
|
||||||
|
} // if either are not null
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersionCreatedAt()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [version_created_by] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return Category The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersionCreatedBy($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version_created_by !== $v) {
|
||||||
|
$this->version_created_by = $v;
|
||||||
|
$this->modifiedColumns[] = CategoryPeer::VERSION_CREATED_BY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersionCreatedBy()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the columns in this object are only set to default values.
|
* Indicates whether the columns in this object are only set to default values.
|
||||||
*
|
*
|
||||||
@@ -514,6 +699,10 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function hasOnlyDefaultValues()
|
public function hasOnlyDefaultValues()
|
||||||
{
|
{
|
||||||
|
if ($this->version !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// otherwise, everything was equal, so return true
|
// otherwise, everything was equal, so return true
|
||||||
return true;
|
return true;
|
||||||
} // hasOnlyDefaultValues()
|
} // hasOnlyDefaultValues()
|
||||||
@@ -543,6 +732,9 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
$this->position = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
|
$this->position = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
|
||||||
$this->created_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
|
$this->created_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
|
||||||
$this->updated_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
|
$this->updated_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
|
||||||
|
$this->version = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
|
||||||
|
$this->version_created_at = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
|
||||||
|
$this->version_created_by = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
@@ -551,7 +743,7 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
$this->ensureConsistency();
|
$this->ensureConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $startcol + 7; // 7 = CategoryPeer::NUM_HYDRATE_COLUMNS.
|
return $startcol + 10; // 10 = CategoryPeer::NUM_HYDRATE_COLUMNS.
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating Category object", $e);
|
throw new PropelException("Error populating Category object", $e);
|
||||||
@@ -629,6 +821,8 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
|
|
||||||
$this->collCategoryI18ns = null;
|
$this->collCategoryI18ns = null;
|
||||||
|
|
||||||
|
$this->collCategoryVersions = null;
|
||||||
|
|
||||||
} // if (deep)
|
} // if (deep)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -699,6 +893,14 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
$isInsert = $this->isNew();
|
$isInsert = $this->isNew();
|
||||||
try {
|
try {
|
||||||
$ret = $this->preSave($con);
|
$ret = $this->preSave($con);
|
||||||
|
// versionable behavior
|
||||||
|
if ($this->isVersioningNecessary()) {
|
||||||
|
$this->setVersion($this->isNew() ? 1 : $this->getLastVersionNumber($con) + 1);
|
||||||
|
if (!$this->isColumnModified(CategoryPeer::VERSION_CREATED_AT)) {
|
||||||
|
$this->setVersionCreatedAt(time());
|
||||||
|
}
|
||||||
|
$createVersion = true; // for postSave hook
|
||||||
|
}
|
||||||
if ($isInsert) {
|
if ($isInsert) {
|
||||||
$ret = $ret && $this->preInsert($con);
|
$ret = $ret && $this->preInsert($con);
|
||||||
// timestampable behavior
|
// timestampable behavior
|
||||||
@@ -723,6 +925,10 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
$this->postUpdate($con);
|
$this->postUpdate($con);
|
||||||
}
|
}
|
||||||
$this->postSave($con);
|
$this->postSave($con);
|
||||||
|
// versionable behavior
|
||||||
|
if (isset($createVersion)) {
|
||||||
|
$this->addVersion($con);
|
||||||
|
}
|
||||||
CategoryPeer::addInstanceToPool($this);
|
CategoryPeer::addInstanceToPool($this);
|
||||||
} else {
|
} else {
|
||||||
$affectedRows = 0;
|
$affectedRows = 0;
|
||||||
@@ -904,6 +1110,23 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->categoryVersionsScheduledForDeletion !== null) {
|
||||||
|
if (!$this->categoryVersionsScheduledForDeletion->isEmpty()) {
|
||||||
|
CategoryVersionQuery::create()
|
||||||
|
->filterByPrimaryKeys($this->categoryVersionsScheduledForDeletion->getPrimaryKeys(false))
|
||||||
|
->delete($con);
|
||||||
|
$this->categoryVersionsScheduledForDeletion = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->collCategoryVersions !== null) {
|
||||||
|
foreach ($this->collCategoryVersions as $referrerFK) {
|
||||||
|
if (!$referrerFK->isDeleted()) {
|
||||||
|
$affectedRows += $referrerFK->save($con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -951,6 +1174,15 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
if ($this->isColumnModified(CategoryPeer::UPDATED_AT)) {
|
if ($this->isColumnModified(CategoryPeer::UPDATED_AT)) {
|
||||||
$modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
|
$modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
|
||||||
}
|
}
|
||||||
|
if ($this->isColumnModified(CategoryPeer::VERSION)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION`';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(CategoryPeer::VERSION_CREATED_AT)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(CategoryPeer::VERSION_CREATED_BY)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`';
|
||||||
|
}
|
||||||
|
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'INSERT INTO `category` (%s) VALUES (%s)',
|
'INSERT INTO `category` (%s) VALUES (%s)',
|
||||||
@@ -983,6 +1215,15 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
case '`UPDATED_AT`':
|
case '`UPDATED_AT`':
|
||||||
$stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
|
$stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
|
||||||
break;
|
break;
|
||||||
|
case '`VERSION`':
|
||||||
|
$stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
|
||||||
|
break;
|
||||||
|
case '`VERSION_CREATED_AT`':
|
||||||
|
$stmt->bindValue($identifier, $this->version_created_at, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
|
case '`VERSION_CREATED_BY`':
|
||||||
|
$stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
@@ -1146,6 +1387,14 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->collCategoryVersions !== null) {
|
||||||
|
foreach ($this->collCategoryVersions as $referrerFK) {
|
||||||
|
if (!$referrerFK->validate($columns)) {
|
||||||
|
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
}
|
}
|
||||||
@@ -1202,6 +1451,15 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
case 6:
|
case 6:
|
||||||
return $this->getUpdatedAt();
|
return $this->getUpdatedAt();
|
||||||
break;
|
break;
|
||||||
|
case 7:
|
||||||
|
return $this->getVersion();
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
return $this->getVersionCreatedAt();
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
return $this->getVersionCreatedBy();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
break;
|
break;
|
||||||
@@ -1238,6 +1496,9 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
$keys[4] => $this->getPosition(),
|
$keys[4] => $this->getPosition(),
|
||||||
$keys[5] => $this->getCreatedAt(),
|
$keys[5] => $this->getCreatedAt(),
|
||||||
$keys[6] => $this->getUpdatedAt(),
|
$keys[6] => $this->getUpdatedAt(),
|
||||||
|
$keys[7] => $this->getVersion(),
|
||||||
|
$keys[8] => $this->getVersionCreatedAt(),
|
||||||
|
$keys[9] => $this->getVersionCreatedBy(),
|
||||||
);
|
);
|
||||||
if ($includeForeignObjects) {
|
if ($includeForeignObjects) {
|
||||||
if (null !== $this->collProductCategorys) {
|
if (null !== $this->collProductCategorys) {
|
||||||
@@ -1264,6 +1525,9 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
if (null !== $this->collCategoryI18ns) {
|
if (null !== $this->collCategoryI18ns) {
|
||||||
$result['CategoryI18ns'] = $this->collCategoryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['CategoryI18ns'] = $this->collCategoryI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
|
if (null !== $this->collCategoryVersions) {
|
||||||
|
$result['CategoryVersions'] = $this->collCategoryVersions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -1319,6 +1583,15 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
case 6:
|
case 6:
|
||||||
$this->setUpdatedAt($value);
|
$this->setUpdatedAt($value);
|
||||||
break;
|
break;
|
||||||
|
case 7:
|
||||||
|
$this->setVersion($value);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
$this->setVersionCreatedAt($value);
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
$this->setVersionCreatedBy($value);
|
||||||
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1350,6 +1623,9 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
||||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
||||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
||||||
|
if (array_key_exists($keys[7], $arr)) $this->setVersion($arr[$keys[7]]);
|
||||||
|
if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedAt($arr[$keys[8]]);
|
||||||
|
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedBy($arr[$keys[9]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1368,6 +1644,9 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
if ($this->isColumnModified(CategoryPeer::POSITION)) $criteria->add(CategoryPeer::POSITION, $this->position);
|
if ($this->isColumnModified(CategoryPeer::POSITION)) $criteria->add(CategoryPeer::POSITION, $this->position);
|
||||||
if ($this->isColumnModified(CategoryPeer::CREATED_AT)) $criteria->add(CategoryPeer::CREATED_AT, $this->created_at);
|
if ($this->isColumnModified(CategoryPeer::CREATED_AT)) $criteria->add(CategoryPeer::CREATED_AT, $this->created_at);
|
||||||
if ($this->isColumnModified(CategoryPeer::UPDATED_AT)) $criteria->add(CategoryPeer::UPDATED_AT, $this->updated_at);
|
if ($this->isColumnModified(CategoryPeer::UPDATED_AT)) $criteria->add(CategoryPeer::UPDATED_AT, $this->updated_at);
|
||||||
|
if ($this->isColumnModified(CategoryPeer::VERSION)) $criteria->add(CategoryPeer::VERSION, $this->version);
|
||||||
|
if ($this->isColumnModified(CategoryPeer::VERSION_CREATED_AT)) $criteria->add(CategoryPeer::VERSION_CREATED_AT, $this->version_created_at);
|
||||||
|
if ($this->isColumnModified(CategoryPeer::VERSION_CREATED_BY)) $criteria->add(CategoryPeer::VERSION_CREATED_BY, $this->version_created_by);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
@@ -1437,6 +1716,9 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
$copyObj->setPosition($this->getPosition());
|
$copyObj->setPosition($this->getPosition());
|
||||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||||
|
$copyObj->setVersion($this->getVersion());
|
||||||
|
$copyObj->setVersionCreatedAt($this->getVersionCreatedAt());
|
||||||
|
$copyObj->setVersionCreatedBy($this->getVersionCreatedBy());
|
||||||
|
|
||||||
if ($deepCopy && !$this->startCopy) {
|
if ($deepCopy && !$this->startCopy) {
|
||||||
// important: temporarily setNew(false) because this affects the behavior of
|
// important: temporarily setNew(false) because this affects the behavior of
|
||||||
@@ -1493,6 +1775,12 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->getCategoryVersions() as $relObj) {
|
||||||
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
|
$copyObj->addCategoryVersion($relObj->copy($deepCopy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//unflag object copy
|
//unflag object copy
|
||||||
$this->startCopy = false;
|
$this->startCopy = false;
|
||||||
} // if ($deepCopy)
|
} // if ($deepCopy)
|
||||||
@@ -1578,6 +1866,9 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
if ('CategoryI18n' == $relationName) {
|
if ('CategoryI18n' == $relationName) {
|
||||||
$this->initCategoryI18ns();
|
$this->initCategoryI18ns();
|
||||||
}
|
}
|
||||||
|
if ('CategoryVersion' == $relationName) {
|
||||||
|
$this->initCategoryVersions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3590,6 +3881,213 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears out the collCategoryVersions 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 addCategoryVersions()
|
||||||
|
*/
|
||||||
|
public function clearCategoryVersions()
|
||||||
|
{
|
||||||
|
$this->collCategoryVersions = null; // important to set this to null since that means it is uninitialized
|
||||||
|
$this->collCategoryVersionsPartial = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reset is the collCategoryVersions collection loaded partially
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function resetPartialCategoryVersions($v = true)
|
||||||
|
{
|
||||||
|
$this->collCategoryVersionsPartial = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the collCategoryVersions collection.
|
||||||
|
*
|
||||||
|
* By default this just sets the collCategoryVersions collection to an empty array (like clearcollCategoryVersions());
|
||||||
|
* 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 initCategoryVersions($overrideExisting = true)
|
||||||
|
{
|
||||||
|
if (null !== $this->collCategoryVersions && !$overrideExisting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->collCategoryVersions = new PropelObjectCollection();
|
||||||
|
$this->collCategoryVersions->setModel('CategoryVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an array of CategoryVersion objects which contain a foreign key that references this object.
|
||||||
|
*
|
||||||
|
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||||
|
* Otherwise the results are fetched from the database the first time, then cached.
|
||||||
|
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||||
|
* If this Category is new, it will return
|
||||||
|
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param PropelPDO $con optional connection object
|
||||||
|
* @return PropelObjectCollection|CategoryVersion[] List of CategoryVersion objects
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function getCategoryVersions($criteria = null, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collCategoryVersionsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collCategoryVersions || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collCategoryVersions) {
|
||||||
|
// return empty collection
|
||||||
|
$this->initCategoryVersions();
|
||||||
|
} else {
|
||||||
|
$collCategoryVersions = CategoryVersionQuery::create(null, $criteria)
|
||||||
|
->filterByCategory($this)
|
||||||
|
->find($con);
|
||||||
|
if (null !== $criteria) {
|
||||||
|
if (false !== $this->collCategoryVersionsPartial && count($collCategoryVersions)) {
|
||||||
|
$this->initCategoryVersions(false);
|
||||||
|
|
||||||
|
foreach($collCategoryVersions as $obj) {
|
||||||
|
if (false == $this->collCategoryVersions->contains($obj)) {
|
||||||
|
$this->collCategoryVersions->append($obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCategoryVersionsPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $collCategoryVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($partial && $this->collCategoryVersions) {
|
||||||
|
foreach($this->collCategoryVersions as $obj) {
|
||||||
|
if($obj->isNew()) {
|
||||||
|
$collCategoryVersions[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCategoryVersions = $collCategoryVersions;
|
||||||
|
$this->collCategoryVersionsPartial = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->collCategoryVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a collection of CategoryVersion 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 $categoryVersions A Propel collection.
|
||||||
|
* @param PropelPDO $con Optional connection object
|
||||||
|
*/
|
||||||
|
public function setCategoryVersions(PropelCollection $categoryVersions, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$this->categoryVersionsScheduledForDeletion = $this->getCategoryVersions(new Criteria(), $con)->diff($categoryVersions);
|
||||||
|
|
||||||
|
foreach ($this->categoryVersionsScheduledForDeletion as $categoryVersionRemoved) {
|
||||||
|
$categoryVersionRemoved->setCategory(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCategoryVersions = null;
|
||||||
|
foreach ($categoryVersions as $categoryVersion) {
|
||||||
|
$this->addCategoryVersion($categoryVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collCategoryVersions = $categoryVersions;
|
||||||
|
$this->collCategoryVersionsPartial = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of related CategoryVersion objects.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @return int Count of related CategoryVersion objects.
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function countCategoryVersions(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collCategoryVersionsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collCategoryVersions || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collCategoryVersions) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
if($partial && !$criteria) {
|
||||||
|
return count($this->getCategoryVersions());
|
||||||
|
}
|
||||||
|
$query = CategoryVersionQuery::create(null, $criteria);
|
||||||
|
if ($distinct) {
|
||||||
|
$query->distinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query
|
||||||
|
->filterByCategory($this)
|
||||||
|
->count($con);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return count($this->collCategoryVersions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called to associate a CategoryVersion object to this object
|
||||||
|
* through the CategoryVersion foreign key attribute.
|
||||||
|
*
|
||||||
|
* @param CategoryVersion $l CategoryVersion
|
||||||
|
* @return Category The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function addCategoryVersion(CategoryVersion $l)
|
||||||
|
{
|
||||||
|
if ($this->collCategoryVersions === null) {
|
||||||
|
$this->initCategoryVersions();
|
||||||
|
$this->collCategoryVersionsPartial = true;
|
||||||
|
}
|
||||||
|
if (!$this->collCategoryVersions->contains($l)) { // only add it if the **same** object is not already associated
|
||||||
|
$this->doAddCategoryVersion($l);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CategoryVersion $categoryVersion The categoryVersion object to add.
|
||||||
|
*/
|
||||||
|
protected function doAddCategoryVersion($categoryVersion)
|
||||||
|
{
|
||||||
|
$this->collCategoryVersions[]= $categoryVersion;
|
||||||
|
$categoryVersion->setCategory($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CategoryVersion $categoryVersion The categoryVersion object to remove.
|
||||||
|
*/
|
||||||
|
public function removeCategoryVersion($categoryVersion)
|
||||||
|
{
|
||||||
|
if ($this->getCategoryVersions()->contains($categoryVersion)) {
|
||||||
|
$this->collCategoryVersions->remove($this->collCategoryVersions->search($categoryVersion));
|
||||||
|
if (null === $this->categoryVersionsScheduledForDeletion) {
|
||||||
|
$this->categoryVersionsScheduledForDeletion = clone $this->collCategoryVersions;
|
||||||
|
$this->categoryVersionsScheduledForDeletion->clear();
|
||||||
|
}
|
||||||
|
$this->categoryVersionsScheduledForDeletion[]= $categoryVersion;
|
||||||
|
$categoryVersion->setCategory(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the current object and sets all attributes to their default values
|
* Clears the current object and sets all attributes to their default values
|
||||||
*/
|
*/
|
||||||
@@ -3602,9 +4100,13 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
$this->position = null;
|
$this->position = null;
|
||||||
$this->created_at = null;
|
$this->created_at = null;
|
||||||
$this->updated_at = null;
|
$this->updated_at = null;
|
||||||
|
$this->version = null;
|
||||||
|
$this->version_created_at = null;
|
||||||
|
$this->version_created_by = null;
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
$this->clearAllReferences();
|
$this->clearAllReferences();
|
||||||
|
$this->applyDefaultValues();
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
$this->setNew(true);
|
$this->setNew(true);
|
||||||
$this->setDeleted(false);
|
$this->setDeleted(false);
|
||||||
@@ -3662,6 +4164,11 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->collCategoryVersions) {
|
||||||
|
foreach ($this->collCategoryVersions as $o) {
|
||||||
|
$o->clearAllReferences($deep);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // if ($deep)
|
} // if ($deep)
|
||||||
|
|
||||||
// i18n behavior
|
// i18n behavior
|
||||||
@@ -3700,6 +4207,10 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
$this->collCategoryI18ns->clearIterator();
|
$this->collCategoryI18ns->clearIterator();
|
||||||
}
|
}
|
||||||
$this->collCategoryI18ns = null;
|
$this->collCategoryI18ns = null;
|
||||||
|
if ($this->collCategoryVersions instanceof PropelCollection) {
|
||||||
|
$this->collCategoryVersions->clearIterator();
|
||||||
|
}
|
||||||
|
$this->collCategoryVersions = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3931,4 +4442,297 @@ abstract class BaseCategory extends BaseObject implements Persistent
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enforce a new Version of this object upon next save.
|
||||||
|
*
|
||||||
|
* @return Category
|
||||||
|
*/
|
||||||
|
public function enforceVersioning()
|
||||||
|
{
|
||||||
|
$this->enforceVersion = true;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current state must be recorded as a version
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con An optional PropelPDO connection to use.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isVersioningNecessary($con = null)
|
||||||
|
{
|
||||||
|
if ($this->alreadyInSave) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->enforceVersion) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CategoryPeer::isVersioningEnabled() && ($this->isNew() || $this->isModified() || $this->isDeleted())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a version of the current object and saves it.
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return CategoryVersion A version object
|
||||||
|
*/
|
||||||
|
public function addVersion($con = null)
|
||||||
|
{
|
||||||
|
$this->enforceVersion = false;
|
||||||
|
|
||||||
|
$version = new CategoryVersion();
|
||||||
|
$version->setId($this->getId());
|
||||||
|
$version->setParent($this->getParent());
|
||||||
|
$version->setLink($this->getLink());
|
||||||
|
$version->setVisible($this->getVisible());
|
||||||
|
$version->setPosition($this->getPosition());
|
||||||
|
$version->setCreatedAt($this->getCreatedAt());
|
||||||
|
$version->setUpdatedAt($this->getUpdatedAt());
|
||||||
|
$version->setVersion($this->getVersion());
|
||||||
|
$version->setVersionCreatedAt($this->getVersionCreatedAt());
|
||||||
|
$version->setVersionCreatedBy($this->getVersionCreatedBy());
|
||||||
|
$version->setCategory($this);
|
||||||
|
$version->save($con);
|
||||||
|
|
||||||
|
return $version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the properties of the curent object to the value they had at a specific version
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber The version number to read
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return Category The current object (for fluent API support)
|
||||||
|
* @throws PropelException - if no object with the given version can be found.
|
||||||
|
*/
|
||||||
|
public function toVersion($versionNumber, $con = null)
|
||||||
|
{
|
||||||
|
$version = $this->getOneVersion($versionNumber, $con);
|
||||||
|
if (!$version) {
|
||||||
|
throw new PropelException(sprintf('No Category object found with version %d', $version));
|
||||||
|
}
|
||||||
|
$this->populateFromVersion($version, $con);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the properties of the curent object to the value they had at a specific version
|
||||||
|
*
|
||||||
|
* @param CategoryVersion $version The version object to use
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $loadedObjects objects thats been loaded in a chain of populateFromVersion calls on referrer or fk objects.
|
||||||
|
*
|
||||||
|
* @return Category The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function populateFromVersion($version, $con = null, &$loadedObjects = array())
|
||||||
|
{
|
||||||
|
|
||||||
|
$loadedObjects['Category'][$version->getId()][$version->getVersion()] = $this;
|
||||||
|
$this->setId($version->getId());
|
||||||
|
$this->setParent($version->getParent());
|
||||||
|
$this->setLink($version->getLink());
|
||||||
|
$this->setVisible($version->getVisible());
|
||||||
|
$this->setPosition($version->getPosition());
|
||||||
|
$this->setCreatedAt($version->getCreatedAt());
|
||||||
|
$this->setUpdatedAt($version->getUpdatedAt());
|
||||||
|
$this->setVersion($version->getVersion());
|
||||||
|
$this->setVersionCreatedAt($version->getVersionCreatedAt());
|
||||||
|
$this->setVersionCreatedBy($version->getVersionCreatedBy());
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the latest persisted version number for the current object
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getLastVersionNumber($con = null)
|
||||||
|
{
|
||||||
|
$v = CategoryVersionQuery::create()
|
||||||
|
->filterByCategory($this)
|
||||||
|
->orderByVersion('desc')
|
||||||
|
->findOne($con);
|
||||||
|
if (!$v) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $v->getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current object is the latest one
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isLastVersion($con = null)
|
||||||
|
{
|
||||||
|
return $this->getLastVersionNumber($con) == $this->getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a version object for this entity and a version number
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber The version number to read
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return CategoryVersion A version object
|
||||||
|
*/
|
||||||
|
public function getOneVersion($versionNumber, $con = null)
|
||||||
|
{
|
||||||
|
return CategoryVersionQuery::create()
|
||||||
|
->filterByCategory($this)
|
||||||
|
->filterByVersion($versionNumber)
|
||||||
|
->findOne($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all the versions of this object, in incremental order
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return PropelObjectCollection A list of CategoryVersion objects
|
||||||
|
*/
|
||||||
|
public function getAllVersions($con = null)
|
||||||
|
{
|
||||||
|
$criteria = new Criteria();
|
||||||
|
$criteria->addAscendingOrderByColumn(CategoryVersionPeer::VERSION);
|
||||||
|
|
||||||
|
return $this->getCategoryVersions($criteria, $con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the current object with another of its version.
|
||||||
|
* <code>
|
||||||
|
* print_r($book->compareVersion(1));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns)
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
public function compareVersion($versionNumber, $keys = 'columns', $con = null, $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersion = $this->toArray();
|
||||||
|
$toVersion = $this->getOneVersion($versionNumber, $con)->toArray();
|
||||||
|
|
||||||
|
return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares two versions of the current object.
|
||||||
|
* <code>
|
||||||
|
* print_r($book->compareVersions(1, 2));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param integer $fromVersionNumber
|
||||||
|
* @param integer $toVersionNumber
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns)
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
public function compareVersions($fromVersionNumber, $toVersionNumber, $keys = 'columns', $con = null, $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersion = $this->getOneVersion($fromVersionNumber, $con)->toArray();
|
||||||
|
$toVersion = $this->getOneVersion($toVersionNumber, $con)->toArray();
|
||||||
|
|
||||||
|
return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes the diff between two versions.
|
||||||
|
* <code>
|
||||||
|
* print_r($this->computeDiff(1, 2));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param array $fromVersion An array representing the original version.
|
||||||
|
* @param array $toVersion An array representing the destination version.
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns).
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
protected function computeDiff($fromVersion, $toVersion, $keys = 'columns', $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersionNumber = $fromVersion['Version'];
|
||||||
|
$toVersionNumber = $toVersion['Version'];
|
||||||
|
$ignoredColumns = array_merge(array(
|
||||||
|
'Version',
|
||||||
|
'VersionCreatedAt',
|
||||||
|
'VersionCreatedBy',
|
||||||
|
), $ignoredColumns);
|
||||||
|
$diff = array();
|
||||||
|
foreach ($fromVersion as $key => $value) {
|
||||||
|
if (in_array($key, $ignoredColumns)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($toVersion[$key] != $value) {
|
||||||
|
switch ($keys) {
|
||||||
|
case 'versions':
|
||||||
|
$diff[$fromVersionNumber][$key] = $value;
|
||||||
|
$diff[$toVersionNumber][$key] = $toVersion[$key];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$diff[$key] = array(
|
||||||
|
$fromVersionNumber => $value,
|
||||||
|
$toVersionNumber => $toVersion[$key],
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $diff;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* retrieve the last $number versions.
|
||||||
|
*
|
||||||
|
* @param integer $number the number of record to return.
|
||||||
|
* @param CategoryVersionQuery|Criteria $criteria Additional criteria to filter.
|
||||||
|
* @param PropelPDO $con An optional connection to use.
|
||||||
|
*
|
||||||
|
* @return PropelCollection|CategoryVersion[] List of CategoryVersion objects
|
||||||
|
*/
|
||||||
|
public function getLastVersions($number = 10, $criteria = null, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$criteria = CategoryVersionQuery::create(null, $criteria);
|
||||||
|
$criteria->addDescendingOrderByColumn(CategoryVersionPeer::VERSION);
|
||||||
|
$criteria->limit($number);
|
||||||
|
|
||||||
|
return $this->getCategoryVersions($criteria, $con);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use Thelia\Model\AttributeCategoryPeer;
|
|||||||
use Thelia\Model\Category;
|
use Thelia\Model\Category;
|
||||||
use Thelia\Model\CategoryI18nPeer;
|
use Thelia\Model\CategoryI18nPeer;
|
||||||
use Thelia\Model\CategoryPeer;
|
use Thelia\Model\CategoryPeer;
|
||||||
|
use Thelia\Model\CategoryVersionPeer;
|
||||||
use Thelia\Model\ContentAssocPeer;
|
use Thelia\Model\ContentAssocPeer;
|
||||||
use Thelia\Model\DocumentPeer;
|
use Thelia\Model\DocumentPeer;
|
||||||
use Thelia\Model\FeatureCategoryPeer;
|
use Thelia\Model\FeatureCategoryPeer;
|
||||||
@@ -44,13 +45,13 @@ abstract class BaseCategoryPeer
|
|||||||
const TM_CLASS = 'CategoryTableMap';
|
const TM_CLASS = 'CategoryTableMap';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 7;
|
const NUM_COLUMNS = 10;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
||||||
const NUM_HYDRATE_COLUMNS = 7;
|
const NUM_HYDRATE_COLUMNS = 10;
|
||||||
|
|
||||||
/** the column name for the ID field */
|
/** the column name for the ID field */
|
||||||
const ID = 'category.ID';
|
const ID = 'category.ID';
|
||||||
@@ -73,6 +74,15 @@ abstract class BaseCategoryPeer
|
|||||||
/** the column name for the UPDATED_AT field */
|
/** the column name for the UPDATED_AT field */
|
||||||
const UPDATED_AT = 'category.UPDATED_AT';
|
const UPDATED_AT = 'category.UPDATED_AT';
|
||||||
|
|
||||||
|
/** the column name for the VERSION field */
|
||||||
|
const VERSION = 'category.VERSION';
|
||||||
|
|
||||||
|
/** the column name for the VERSION_CREATED_AT field */
|
||||||
|
const VERSION_CREATED_AT = 'category.VERSION_CREATED_AT';
|
||||||
|
|
||||||
|
/** the column name for the VERSION_CREATED_BY field */
|
||||||
|
const VERSION_CREATED_BY = 'category.VERSION_CREATED_BY';
|
||||||
|
|
||||||
/** The default string format for model objects of the related table **/
|
/** The default string format for model objects of the related table **/
|
||||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||||
|
|
||||||
@@ -92,6 +102,13 @@ abstract class BaseCategoryPeer
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const DEFAULT_LOCALE = 'en_EN';
|
const DEFAULT_LOCALE = 'en_EN';
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the versioning is enabled
|
||||||
|
*/
|
||||||
|
static $isVersioningEnabled = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* holds an array of fieldnames
|
* holds an array of fieldnames
|
||||||
*
|
*
|
||||||
@@ -99,12 +116,12 @@ abstract class BaseCategoryPeer
|
|||||||
* e.g. CategoryPeer::$fieldNames[CategoryPeer::TYPE_PHPNAME][0] = 'Id'
|
* e.g. CategoryPeer::$fieldNames[CategoryPeer::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
protected static $fieldNames = array (
|
protected static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('Id', 'Parent', 'Link', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', ),
|
BasePeer::TYPE_PHPNAME => array ('Id', 'Parent', 'Link', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'parent', 'link', 'visible', 'position', 'createdAt', 'updatedAt', ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'parent', 'link', 'visible', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
|
||||||
BasePeer::TYPE_COLNAME => array (CategoryPeer::ID, CategoryPeer::PARENT, CategoryPeer::LINK, CategoryPeer::VISIBLE, CategoryPeer::POSITION, CategoryPeer::CREATED_AT, CategoryPeer::UPDATED_AT, ),
|
BasePeer::TYPE_COLNAME => array (CategoryPeer::ID, CategoryPeer::PARENT, CategoryPeer::LINK, CategoryPeer::VISIBLE, CategoryPeer::POSITION, CategoryPeer::CREATED_AT, CategoryPeer::UPDATED_AT, CategoryPeer::VERSION, CategoryPeer::VERSION_CREATED_AT, CategoryPeer::VERSION_CREATED_BY, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PARENT', 'LINK', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PARENT', 'LINK', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id', 'parent', 'link', 'visible', 'position', 'created_at', 'updated_at', ),
|
BasePeer::TYPE_FIELDNAME => array ('id', 'parent', 'link', 'visible', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,12 +131,12 @@ abstract class BaseCategoryPeer
|
|||||||
* e.g. CategoryPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
* e.g. CategoryPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
protected static $fieldKeys = array (
|
protected static $fieldKeys = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Parent' => 1, 'Link' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
|
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Parent' => 1, 'Link' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, 'Version' => 7, 'VersionCreatedAt' => 8, 'VersionCreatedBy' => 9, ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, 'version' => 7, 'versionCreatedAt' => 8, 'versionCreatedBy' => 9, ),
|
||||||
BasePeer::TYPE_COLNAME => array (CategoryPeer::ID => 0, CategoryPeer::PARENT => 1, CategoryPeer::LINK => 2, CategoryPeer::VISIBLE => 3, CategoryPeer::POSITION => 4, CategoryPeer::CREATED_AT => 5, CategoryPeer::UPDATED_AT => 6, ),
|
BasePeer::TYPE_COLNAME => array (CategoryPeer::ID => 0, CategoryPeer::PARENT => 1, CategoryPeer::LINK => 2, CategoryPeer::VISIBLE => 3, CategoryPeer::POSITION => 4, CategoryPeer::CREATED_AT => 5, CategoryPeer::UPDATED_AT => 6, CategoryPeer::VERSION => 7, CategoryPeer::VERSION_CREATED_AT => 8, CategoryPeer::VERSION_CREATED_BY => 9, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PARENT' => 1, 'LINK' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PARENT' => 1, 'LINK' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, 'VERSION' => 7, 'VERSION_CREATED_AT' => 8, 'VERSION_CREATED_BY' => 9, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ),
|
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, 'version' => 7, 'version_created_at' => 8, 'version_created_by' => 9, ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -200,6 +217,9 @@ abstract class BaseCategoryPeer
|
|||||||
$criteria->addSelectColumn(CategoryPeer::POSITION);
|
$criteria->addSelectColumn(CategoryPeer::POSITION);
|
||||||
$criteria->addSelectColumn(CategoryPeer::CREATED_AT);
|
$criteria->addSelectColumn(CategoryPeer::CREATED_AT);
|
||||||
$criteria->addSelectColumn(CategoryPeer::UPDATED_AT);
|
$criteria->addSelectColumn(CategoryPeer::UPDATED_AT);
|
||||||
|
$criteria->addSelectColumn(CategoryPeer::VERSION);
|
||||||
|
$criteria->addSelectColumn(CategoryPeer::VERSION_CREATED_AT);
|
||||||
|
$criteria->addSelectColumn(CategoryPeer::VERSION_CREATED_BY);
|
||||||
} else {
|
} else {
|
||||||
$criteria->addSelectColumn($alias . '.ID');
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
$criteria->addSelectColumn($alias . '.PARENT');
|
$criteria->addSelectColumn($alias . '.PARENT');
|
||||||
@@ -208,6 +228,9 @@ abstract class BaseCategoryPeer
|
|||||||
$criteria->addSelectColumn($alias . '.POSITION');
|
$criteria->addSelectColumn($alias . '.POSITION');
|
||||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION_CREATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION_CREATED_BY');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,6 +454,9 @@ abstract class BaseCategoryPeer
|
|||||||
// Invalidate objects in CategoryI18nPeer instance pool,
|
// Invalidate objects in CategoryI18nPeer instance pool,
|
||||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
CategoryI18nPeer::clearInstancePool();
|
CategoryI18nPeer::clearInstancePool();
|
||||||
|
// Invalidate objects in CategoryVersionPeer instance pool,
|
||||||
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
|
CategoryVersionPeer::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -824,6 +850,34 @@ abstract class BaseCategoryPeer
|
|||||||
return $objs;
|
return $objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether versioning is enabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function isVersioningEnabled()
|
||||||
|
{
|
||||||
|
return self::$isVersioningEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables versioning
|
||||||
|
*/
|
||||||
|
public static function enableVersioning()
|
||||||
|
{
|
||||||
|
self::$isVersioningEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables versioning
|
||||||
|
*/
|
||||||
|
public static function disableVersioning()
|
||||||
|
{
|
||||||
|
self::$isVersioningEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
} // BaseCategoryPeer
|
} // BaseCategoryPeer
|
||||||
|
|
||||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use Thelia\Model\Category;
|
|||||||
use Thelia\Model\CategoryI18n;
|
use Thelia\Model\CategoryI18n;
|
||||||
use Thelia\Model\CategoryPeer;
|
use Thelia\Model\CategoryPeer;
|
||||||
use Thelia\Model\CategoryQuery;
|
use Thelia\Model\CategoryQuery;
|
||||||
|
use Thelia\Model\CategoryVersion;
|
||||||
use Thelia\Model\ContentAssoc;
|
use Thelia\Model\ContentAssoc;
|
||||||
use Thelia\Model\Document;
|
use Thelia\Model\Document;
|
||||||
use Thelia\Model\FeatureCategory;
|
use Thelia\Model\FeatureCategory;
|
||||||
@@ -36,6 +37,9 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method CategoryQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
* @method CategoryQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||||
* @method CategoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
* @method CategoryQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
* @method CategoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
* @method CategoryQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
|
* @method CategoryQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||||
|
* @method CategoryQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
||||||
|
* @method CategoryQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method CategoryQuery groupById() Group by the id column
|
* @method CategoryQuery groupById() Group by the id column
|
||||||
* @method CategoryQuery groupByParent() Group by the parent column
|
* @method CategoryQuery groupByParent() Group by the parent column
|
||||||
@@ -44,6 +48,9 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method CategoryQuery groupByPosition() Group by the position column
|
* @method CategoryQuery groupByPosition() Group by the position column
|
||||||
* @method CategoryQuery groupByCreatedAt() Group by the created_at column
|
* @method CategoryQuery groupByCreatedAt() Group by the created_at column
|
||||||
* @method CategoryQuery groupByUpdatedAt() Group by the updated_at column
|
* @method CategoryQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
|
* @method CategoryQuery groupByVersion() Group by the version column
|
||||||
|
* @method CategoryQuery groupByVersionCreatedAt() Group by the version_created_at column
|
||||||
|
* @method CategoryQuery groupByVersionCreatedBy() Group by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method CategoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
* @method CategoryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
* @method CategoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
* @method CategoryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
@@ -81,6 +88,10 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method CategoryQuery rightJoinCategoryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryI18n relation
|
* @method CategoryQuery rightJoinCategoryI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryI18n relation
|
||||||
* @method CategoryQuery innerJoinCategoryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryI18n relation
|
* @method CategoryQuery innerJoinCategoryI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryI18n relation
|
||||||
*
|
*
|
||||||
|
* @method CategoryQuery leftJoinCategoryVersion($relationAlias = null) Adds a LEFT JOIN clause to the query using the CategoryVersion relation
|
||||||
|
* @method CategoryQuery rightJoinCategoryVersion($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CategoryVersion relation
|
||||||
|
* @method CategoryQuery innerJoinCategoryVersion($relationAlias = null) Adds a INNER JOIN clause to the query using the CategoryVersion relation
|
||||||
|
*
|
||||||
* @method Category findOne(PropelPDO $con = null) Return the first Category matching the query
|
* @method Category findOne(PropelPDO $con = null) Return the first Category matching the query
|
||||||
* @method Category findOneOrCreate(PropelPDO $con = null) Return the first Category matching the query, or a new Category object populated from the query conditions when no match is found
|
* @method Category findOneOrCreate(PropelPDO $con = null) Return the first Category matching the query, or a new Category object populated from the query conditions when no match is found
|
||||||
*
|
*
|
||||||
@@ -91,6 +102,9 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method Category findOneByPosition(int $position) Return the first Category filtered by the position column
|
* @method Category findOneByPosition(int $position) Return the first Category filtered by the position column
|
||||||
* @method Category findOneByCreatedAt(string $created_at) Return the first Category filtered by the created_at column
|
* @method Category findOneByCreatedAt(string $created_at) Return the first Category filtered by the created_at column
|
||||||
* @method Category findOneByUpdatedAt(string $updated_at) Return the first Category filtered by the updated_at column
|
* @method Category findOneByUpdatedAt(string $updated_at) Return the first Category filtered by the updated_at column
|
||||||
|
* @method Category findOneByVersion(int $version) Return the first Category filtered by the version column
|
||||||
|
* @method Category findOneByVersionCreatedAt(string $version_created_at) Return the first Category filtered by the version_created_at column
|
||||||
|
* @method Category findOneByVersionCreatedBy(string $version_created_by) Return the first Category filtered by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method array findById(int $id) Return Category objects filtered by the id column
|
* @method array findById(int $id) Return Category objects filtered by the id column
|
||||||
* @method array findByParent(int $parent) Return Category objects filtered by the parent column
|
* @method array findByParent(int $parent) Return Category objects filtered by the parent column
|
||||||
@@ -99,6 +113,9 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method array findByPosition(int $position) Return Category objects filtered by the position column
|
* @method array findByPosition(int $position) Return Category objects filtered by the position column
|
||||||
* @method array findByCreatedAt(string $created_at) Return Category objects filtered by the created_at column
|
* @method array findByCreatedAt(string $created_at) Return Category objects filtered by the created_at column
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return Category objects filtered by the updated_at column
|
* @method array findByUpdatedAt(string $updated_at) Return Category objects filtered by the updated_at column
|
||||||
|
* @method array findByVersion(int $version) Return Category objects filtered by the version column
|
||||||
|
* @method array findByVersionCreatedAt(string $version_created_at) Return Category objects filtered by the version_created_at column
|
||||||
|
* @method array findByVersionCreatedBy(string $version_created_by) Return Category objects filtered by the version_created_by column
|
||||||
*
|
*
|
||||||
* @package propel.generator.Thelia.Model.om
|
* @package propel.generator.Thelia.Model.om
|
||||||
*/
|
*/
|
||||||
@@ -188,7 +205,7 @@ abstract class BaseCategoryQuery extends ModelCriteria
|
|||||||
*/
|
*/
|
||||||
protected function findPkSimple($key, $con)
|
protected function findPkSimple($key, $con)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT `ID`, `PARENT`, `LINK`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `category` WHERE `ID` = :p0';
|
$sql = 'SELECT `ID`, `PARENT`, `LINK`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `category` WHERE `ID` = :p0';
|
||||||
try {
|
try {
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||||
@@ -542,6 +559,119 @@ abstract class BaseCategoryQuery extends ModelCriteria
|
|||||||
return $this->addUsingAlias(CategoryPeer::UPDATED_AT, $updatedAt, $comparison);
|
return $this->addUsingAlias(CategoryPeer::UPDATED_AT, $updatedAt, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersion(1234); // WHERE version = 1234
|
||||||
|
* $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
|
||||||
|
* $query->filterByVersion(array('min' => 12)); // WHERE version > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $version The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersion($version = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($version)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($version['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($version['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryPeer::VERSION, $version['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryPeer::VERSION, $version, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $versionCreatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($versionCreatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($versionCreatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($versionCreatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_by column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
||||||
|
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $versionCreatedBy The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($versionCreatedBy)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
|
||||||
|
$versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related ProductCategory object
|
* Filter the query by a related ProductCategory object
|
||||||
*
|
*
|
||||||
@@ -1134,6 +1264,80 @@ abstract class BaseCategoryQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'CategoryI18n', '\Thelia\Model\CategoryI18nQuery');
|
->useQuery($relationAlias ? $relationAlias : 'CategoryI18n', '\Thelia\Model\CategoryI18nQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related CategoryVersion object
|
||||||
|
*
|
||||||
|
* @param CategoryVersion|PropelObjectCollection $categoryVersion the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryQuery The current query, for fluid interface
|
||||||
|
* @throws PropelException - if the provided filter is invalid.
|
||||||
|
*/
|
||||||
|
public function filterByCategoryVersion($categoryVersion, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($categoryVersion instanceof CategoryVersion) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CategoryPeer::ID, $categoryVersion->getId(), $comparison);
|
||||||
|
} elseif ($categoryVersion instanceof PropelObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useCategoryVersionQuery()
|
||||||
|
->filterByPrimaryKeys($categoryVersion->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByCategoryVersion() only accepts arguments of type CategoryVersion or PropelCollection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the CategoryVersion relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return CategoryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCategoryVersion($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('CategoryVersion');
|
||||||
|
|
||||||
|
// 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, 'CategoryVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the CategoryVersion relation CategoryVersion 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\CategoryVersionQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCategoryVersionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCategoryVersion($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CategoryVersion', '\Thelia\Model\CategoryVersionQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
|
|||||||
1482
core/lib/Thelia/Model/om/BaseCategoryVersion.php
Normal file
1482
core/lib/Thelia/Model/om/BaseCategoryVersion.php
Normal file
File diff suppressed because it is too large
Load Diff
1029
core/lib/Thelia/Model/om/BaseCategoryVersionPeer.php
Normal file
1029
core/lib/Thelia/Model/om/BaseCategoryVersionPeer.php
Normal file
File diff suppressed because it is too large
Load Diff
730
core/lib/Thelia/Model/om/BaseCategoryVersionQuery.php
Normal file
730
core/lib/Thelia/Model/om/BaseCategoryVersionQuery.php
Normal file
@@ -0,0 +1,730 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\om;
|
||||||
|
|
||||||
|
use \Criteria;
|
||||||
|
use \Exception;
|
||||||
|
use \ModelCriteria;
|
||||||
|
use \ModelJoin;
|
||||||
|
use \PDO;
|
||||||
|
use \Propel;
|
||||||
|
use \PropelCollection;
|
||||||
|
use \PropelException;
|
||||||
|
use \PropelObjectCollection;
|
||||||
|
use \PropelPDO;
|
||||||
|
use Thelia\Model\Category;
|
||||||
|
use Thelia\Model\CategoryVersion;
|
||||||
|
use Thelia\Model\CategoryVersionPeer;
|
||||||
|
use Thelia\Model\CategoryVersionQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'category_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method CategoryVersionQuery orderById($order = Criteria::ASC) Order by the id column
|
||||||
|
* @method CategoryVersionQuery orderByParent($order = Criteria::ASC) Order by the parent column
|
||||||
|
* @method CategoryVersionQuery orderByLink($order = Criteria::ASC) Order by the link column
|
||||||
|
* @method CategoryVersionQuery orderByVisible($order = Criteria::ASC) Order by the visible column
|
||||||
|
* @method CategoryVersionQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||||
|
* @method CategoryVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
|
* @method CategoryVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
|
* @method CategoryVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||||
|
* @method CategoryVersionQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
||||||
|
* @method CategoryVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
||||||
|
*
|
||||||
|
* @method CategoryVersionQuery groupById() Group by the id column
|
||||||
|
* @method CategoryVersionQuery groupByParent() Group by the parent column
|
||||||
|
* @method CategoryVersionQuery groupByLink() Group by the link column
|
||||||
|
* @method CategoryVersionQuery groupByVisible() Group by the visible column
|
||||||
|
* @method CategoryVersionQuery groupByPosition() Group by the position column
|
||||||
|
* @method CategoryVersionQuery groupByCreatedAt() Group by the created_at column
|
||||||
|
* @method CategoryVersionQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
|
* @method CategoryVersionQuery groupByVersion() Group by the version column
|
||||||
|
* @method CategoryVersionQuery groupByVersionCreatedAt() Group by the version_created_at column
|
||||||
|
* @method CategoryVersionQuery groupByVersionCreatedBy() Group by the version_created_by column
|
||||||
|
*
|
||||||
|
* @method CategoryVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method CategoryVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method CategoryVersionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method CategoryVersionQuery leftJoinCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the Category relation
|
||||||
|
* @method CategoryVersionQuery rightJoinCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Category relation
|
||||||
|
* @method CategoryVersionQuery innerJoinCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the Category relation
|
||||||
|
*
|
||||||
|
* @method CategoryVersion findOne(PropelPDO $con = null) Return the first CategoryVersion matching the query
|
||||||
|
* @method CategoryVersion findOneOrCreate(PropelPDO $con = null) Return the first CategoryVersion matching the query, or a new CategoryVersion object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method CategoryVersion findOneById(int $id) Return the first CategoryVersion filtered by the id column
|
||||||
|
* @method CategoryVersion findOneByParent(int $parent) Return the first CategoryVersion filtered by the parent column
|
||||||
|
* @method CategoryVersion findOneByLink(string $link) Return the first CategoryVersion filtered by the link column
|
||||||
|
* @method CategoryVersion findOneByVisible(int $visible) Return the first CategoryVersion filtered by the visible column
|
||||||
|
* @method CategoryVersion findOneByPosition(int $position) Return the first CategoryVersion filtered by the position column
|
||||||
|
* @method CategoryVersion findOneByCreatedAt(string $created_at) Return the first CategoryVersion filtered by the created_at column
|
||||||
|
* @method CategoryVersion findOneByUpdatedAt(string $updated_at) Return the first CategoryVersion filtered by the updated_at column
|
||||||
|
* @method CategoryVersion findOneByVersion(int $version) Return the first CategoryVersion filtered by the version column
|
||||||
|
* @method CategoryVersion findOneByVersionCreatedAt(string $version_created_at) Return the first CategoryVersion filtered by the version_created_at column
|
||||||
|
* @method CategoryVersion findOneByVersionCreatedBy(string $version_created_by) Return the first CategoryVersion filtered by the version_created_by column
|
||||||
|
*
|
||||||
|
* @method array findById(int $id) Return CategoryVersion objects filtered by the id column
|
||||||
|
* @method array findByParent(int $parent) Return CategoryVersion objects filtered by the parent column
|
||||||
|
* @method array findByLink(string $link) Return CategoryVersion objects filtered by the link column
|
||||||
|
* @method array findByVisible(int $visible) Return CategoryVersion objects filtered by the visible column
|
||||||
|
* @method array findByPosition(int $position) Return CategoryVersion objects filtered by the position column
|
||||||
|
* @method array findByCreatedAt(string $created_at) Return CategoryVersion objects filtered by the created_at column
|
||||||
|
* @method array findByUpdatedAt(string $updated_at) Return CategoryVersion objects filtered by the updated_at column
|
||||||
|
* @method array findByVersion(int $version) Return CategoryVersion objects filtered by the version column
|
||||||
|
* @method array findByVersionCreatedAt(string $version_created_at) Return CategoryVersion objects filtered by the version_created_at column
|
||||||
|
* @method array findByVersionCreatedBy(string $version_created_by) Return CategoryVersion objects filtered by the version_created_by column
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCategoryVersionQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseCategoryVersionQuery object.
|
||||||
|
*
|
||||||
|
* @param string $dbName The dabase name
|
||||||
|
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||||
|
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||||
|
*/
|
||||||
|
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\CategoryVersion', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new CategoryVersionQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param CategoryVersionQuery|Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof CategoryVersionQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new CategoryVersionQuery();
|
||||||
|
if (null !== $modelAlias) {
|
||||||
|
$query->setModelAlias($modelAlias);
|
||||||
|
}
|
||||||
|
if ($criteria instanceof Criteria) {
|
||||||
|
$query->mergeWith($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
* Propel uses the instance pool to skip the database if the object exists.
|
||||||
|
* Go fast if the query is untouched.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* $obj = $c->findPk(array(12, 34), $con);
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param array $key Primary key to use for the query
|
||||||
|
A Primary key composition: [$id, $version]
|
||||||
|
* @param PropelPDO $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return CategoryVersion|CategoryVersion[]|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPk($key, $con = null)
|
||||||
|
{
|
||||||
|
if ($key === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((null !== ($obj = CategoryVersionPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
|
||||||
|
// the object is alredy in the instance pool
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(CategoryVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||||
|
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||||
|
|| $this->map || $this->having || $this->joins) {
|
||||||
|
return $this->findPkComplex($key, $con);
|
||||||
|
} else {
|
||||||
|
return $this->findPkSimple($key, $con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key using raw SQL to go fast.
|
||||||
|
* Bypass doSelect() and the object formatter by using generated code.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param PropelPDO $con A connection object
|
||||||
|
*
|
||||||
|
* @return CategoryVersion A model object, or null if the key is not found
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
protected function findPkSimple($key, $con)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT `ID`, `PARENT`, `LINK`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `category_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
|
||||||
|
try {
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||||
|
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||||
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
|
||||||
|
}
|
||||||
|
$obj = null;
|
||||||
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$obj = new CategoryVersion();
|
||||||
|
$obj->hydrate($row);
|
||||||
|
CategoryVersionPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param PropelPDO $con A connection object
|
||||||
|
*
|
||||||
|
* @return CategoryVersion|CategoryVersion[]|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
protected function findPkComplex($key, $con)
|
||||||
|
{
|
||||||
|
// As the query uses a PK condition, no limit(1) is necessary.
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$stmt = $criteria
|
||||||
|
->filterByPrimaryKey($key)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find objects by primary key
|
||||||
|
* <code>
|
||||||
|
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
||||||
|
* </code>
|
||||||
|
* @param array $keys Primary keys to use for the query
|
||||||
|
* @param PropelPDO $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return PropelObjectCollection|CategoryVersion[]|mixed the list of results, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPks($keys, $con = null)
|
||||||
|
{
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$stmt = $criteria
|
||||||
|
->filterByPrimaryKeys($keys)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->format($stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by primary key
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKey($key)
|
||||||
|
{
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::ID, $key[0], Criteria::EQUAL);
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::VERSION, $key[1], Criteria::EQUAL);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a list of primary keys
|
||||||
|
*
|
||||||
|
* @param array $keys The list of primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKeys($keys)
|
||||||
|
{
|
||||||
|
if (empty($keys)) {
|
||||||
|
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||||
|
}
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$cton0 = $this->getNewCriterion(CategoryVersionPeer::ID, $key[0], Criteria::EQUAL);
|
||||||
|
$cton1 = $this->getNewCriterion(CategoryVersionPeer::VERSION, $key[1], Criteria::EQUAL);
|
||||||
|
$cton0->addAnd($cton1);
|
||||||
|
$this->addOr($cton0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterById(1234); // WHERE id = 1234
|
||||||
|
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||||
|
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @see filterByCategory()
|
||||||
|
*
|
||||||
|
* @param mixed $id The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterById($id = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($id) && null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryVersionPeer::ID, $id, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the parent column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByParent(1234); // WHERE parent = 1234
|
||||||
|
* $query->filterByParent(array(12, 34)); // WHERE parent IN (12, 34)
|
||||||
|
* $query->filterByParent(array('min' => 12)); // WHERE parent > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $parent The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByParent($parent = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($parent)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($parent['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::PARENT, $parent['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($parent['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::PARENT, $parent['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryVersionPeer::PARENT, $parent, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the link column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByLink('fooValue'); // WHERE link = 'fooValue'
|
||||||
|
* $query->filterByLink('%fooValue%'); // WHERE link LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $link The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByLink($link = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($link)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $link)) {
|
||||||
|
$link = str_replace('*', '%', $link);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryVersionPeer::LINK, $link, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the visible column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVisible(1234); // WHERE visible = 1234
|
||||||
|
* $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
|
||||||
|
* $query->filterByVisible(array('min' => 12)); // WHERE visible > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $visible The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVisible($visible = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($visible)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($visible['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($visible['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryVersionPeer::VISIBLE, $visible, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the position column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByPosition(1234); // WHERE position = 1234
|
||||||
|
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
|
||||||
|
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $position The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPosition($position = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($position)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($position['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($position['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryVersionPeer::POSITION, $position, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||||
|
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||||
|
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $createdAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($createdAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($createdAt['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($createdAt['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryVersionPeer::CREATED_AT, $createdAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the updated_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||||
|
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||||
|
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $updatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($updatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($updatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($updatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryVersionPeer::UPDATED_AT, $updatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersion(1234); // WHERE version = 1234
|
||||||
|
* $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
|
||||||
|
* $query->filterByVersion(array('min' => 12)); // WHERE version > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $version The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersion($version = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($version) && null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryVersionPeer::VERSION, $version, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $versionCreatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($versionCreatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($versionCreatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($versionCreatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(CategoryVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryVersionPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_by column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
||||||
|
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $versionCreatedBy The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($versionCreatedBy)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
|
||||||
|
$versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(CategoryVersionPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related Category object
|
||||||
|
*
|
||||||
|
* @param Category|PropelObjectCollection $category The related object(s) to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
* @throws PropelException - if the provided filter is invalid.
|
||||||
|
*/
|
||||||
|
public function filterByCategory($category, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($category instanceof Category) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CategoryVersionPeer::ID, $category->getId(), $comparison);
|
||||||
|
} elseif ($category instanceof PropelObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CategoryVersionPeer::ID, $category->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByCategory() only accepts arguments of type Category or PropelCollection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the Category relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCategory($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('Category');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if ($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'Category');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the Category relation Category object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\CategoryQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCategory($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'Category', '\Thelia\Model\CategoryQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exclude object from result
|
||||||
|
*
|
||||||
|
* @param CategoryVersion $categoryVersion Object to remove from the list of results
|
||||||
|
*
|
||||||
|
* @return CategoryVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function prune($categoryVersion = null)
|
||||||
|
{
|
||||||
|
if ($categoryVersion) {
|
||||||
|
$this->addCond('pruneCond0', $this->getAliasedColName(CategoryVersionPeer::ID), $categoryVersion->getId(), Criteria::NOT_EQUAL);
|
||||||
|
$this->addCond('pruneCond1', $this->getAliasedColName(CategoryVersionPeer::VERSION), $categoryVersion->getVersion(), Criteria::NOT_EQUAL);
|
||||||
|
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -24,6 +24,9 @@ use Thelia\Model\ContentI18n;
|
|||||||
use Thelia\Model\ContentI18nQuery;
|
use Thelia\Model\ContentI18nQuery;
|
||||||
use Thelia\Model\ContentPeer;
|
use Thelia\Model\ContentPeer;
|
||||||
use Thelia\Model\ContentQuery;
|
use Thelia\Model\ContentQuery;
|
||||||
|
use Thelia\Model\ContentVersion;
|
||||||
|
use Thelia\Model\ContentVersionPeer;
|
||||||
|
use Thelia\Model\ContentVersionQuery;
|
||||||
use Thelia\Model\Document;
|
use Thelia\Model\Document;
|
||||||
use Thelia\Model\DocumentQuery;
|
use Thelia\Model\DocumentQuery;
|
||||||
use Thelia\Model\Image;
|
use Thelia\Model\Image;
|
||||||
@@ -89,6 +92,25 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $updated_at;
|
protected $updated_at;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version field.
|
||||||
|
* Note: this column has a database default value of: 0
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version_created_at field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $version_created_at;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version_created_by field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $version_created_by;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var PropelObjectCollection|ContentAssoc[] Collection to store aggregation of ContentAssoc objects.
|
* @var PropelObjectCollection|ContentAssoc[] Collection to store aggregation of ContentAssoc objects.
|
||||||
*/
|
*/
|
||||||
@@ -125,6 +147,12 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
protected $collContentI18ns;
|
protected $collContentI18ns;
|
||||||
protected $collContentI18nsPartial;
|
protected $collContentI18nsPartial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PropelObjectCollection|ContentVersion[] Collection to store aggregation of ContentVersion objects.
|
||||||
|
*/
|
||||||
|
protected $collContentVersions;
|
||||||
|
protected $collContentVersionsPartial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to prevent endless save loop, if this object is referenced
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
* by another object which falls in this transaction.
|
* by another object which falls in this transaction.
|
||||||
@@ -153,6 +181,14 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $currentTranslations;
|
protected $currentTranslations;
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $enforceVersion = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var PropelObjectCollection
|
* @var PropelObjectCollection
|
||||||
@@ -189,6 +225,33 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $contentI18nsScheduledForDeletion = null;
|
protected $contentI18nsScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of objects scheduled for deletion.
|
||||||
|
* @var PropelObjectCollection
|
||||||
|
*/
|
||||||
|
protected $contentVersionsScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies default values to this object.
|
||||||
|
* This method should be called from the object's constructor (or
|
||||||
|
* equivalent initialization method).
|
||||||
|
* @see __construct()
|
||||||
|
*/
|
||||||
|
public function applyDefaultValues()
|
||||||
|
{
|
||||||
|
$this->version = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseContent object.
|
||||||
|
* @see applyDefaults()
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->applyDefaultValues();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [id] column value.
|
* Get the [id] column value.
|
||||||
*
|
*
|
||||||
@@ -293,6 +356,63 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [version] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getVersion()
|
||||||
|
{
|
||||||
|
return $this->version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [optionally formatted] temporal [version_created_at] column value.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||||
|
* If format is null, then the raw DateTime object will be returned.
|
||||||
|
* @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
|
||||||
|
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||||
|
*/
|
||||||
|
public function getVersionCreatedAt($format = 'Y-m-d H:i:s')
|
||||||
|
{
|
||||||
|
if ($this->version_created_at === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version_created_at === '0000-00-00 00:00:00') {
|
||||||
|
// while technically this is not a default value of null,
|
||||||
|
// this seems to be closest in meaning.
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$dt = new DateTime($this->version_created_at);
|
||||||
|
} catch (Exception $x) {
|
||||||
|
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->version_created_at, true), $x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($format === null) {
|
||||||
|
// Because propel.useDateTimeClass is true, we return a DateTime object.
|
||||||
|
return $dt;
|
||||||
|
} elseif (strpos($format, '%') !== false) {
|
||||||
|
return strftime($format, $dt->format('U'));
|
||||||
|
} else {
|
||||||
|
return $dt->format($format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [version_created_by] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVersionCreatedBy()
|
||||||
|
{
|
||||||
|
return $this->version_created_by;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [id] column.
|
* Set the value of [id] column.
|
||||||
*
|
*
|
||||||
@@ -402,6 +522,71 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
return $this;
|
return $this;
|
||||||
} // setUpdatedAt()
|
} // setUpdatedAt()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [version] column.
|
||||||
|
*
|
||||||
|
* @param int $v new value
|
||||||
|
* @return Content The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersion($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version !== $v) {
|
||||||
|
$this->version = $v;
|
||||||
|
$this->modifiedColumns[] = ContentPeer::VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersion()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of [version_created_at] column to a normalized version of the date/time value specified.
|
||||||
|
*
|
||||||
|
* @param mixed $v string, integer (timestamp), or DateTime value.
|
||||||
|
* Empty strings are treated as null.
|
||||||
|
* @return Content The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersionCreatedAt($v)
|
||||||
|
{
|
||||||
|
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
|
||||||
|
if ($this->version_created_at !== null || $dt !== null) {
|
||||||
|
$currentDateAsString = ($this->version_created_at !== null && $tmpDt = new DateTime($this->version_created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
|
||||||
|
$newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
|
||||||
|
if ($currentDateAsString !== $newDateAsString) {
|
||||||
|
$this->version_created_at = $newDateAsString;
|
||||||
|
$this->modifiedColumns[] = ContentPeer::VERSION_CREATED_AT;
|
||||||
|
}
|
||||||
|
} // if either are not null
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersionCreatedAt()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [version_created_by] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return Content The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersionCreatedBy($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version_created_by !== $v) {
|
||||||
|
$this->version_created_by = $v;
|
||||||
|
$this->modifiedColumns[] = ContentPeer::VERSION_CREATED_BY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersionCreatedBy()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the columns in this object are only set to default values.
|
* Indicates whether the columns in this object are only set to default values.
|
||||||
*
|
*
|
||||||
@@ -412,6 +597,10 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function hasOnlyDefaultValues()
|
public function hasOnlyDefaultValues()
|
||||||
{
|
{
|
||||||
|
if ($this->version !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// otherwise, everything was equal, so return true
|
// otherwise, everything was equal, so return true
|
||||||
return true;
|
return true;
|
||||||
} // hasOnlyDefaultValues()
|
} // hasOnlyDefaultValues()
|
||||||
@@ -439,6 +628,9 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
$this->position = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
|
$this->position = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
|
||||||
$this->created_at = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
|
$this->created_at = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
|
||||||
$this->updated_at = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
|
$this->updated_at = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
|
||||||
|
$this->version = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
|
||||||
|
$this->version_created_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
|
||||||
|
$this->version_created_by = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
@@ -447,7 +639,7 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
$this->ensureConsistency();
|
$this->ensureConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $startcol + 5; // 5 = ContentPeer::NUM_HYDRATE_COLUMNS.
|
return $startcol + 8; // 8 = ContentPeer::NUM_HYDRATE_COLUMNS.
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating Content object", $e);
|
throw new PropelException("Error populating Content object", $e);
|
||||||
@@ -521,6 +713,8 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
|
|
||||||
$this->collContentI18ns = null;
|
$this->collContentI18ns = null;
|
||||||
|
|
||||||
|
$this->collContentVersions = null;
|
||||||
|
|
||||||
} // if (deep)
|
} // if (deep)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -591,6 +785,14 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
$isInsert = $this->isNew();
|
$isInsert = $this->isNew();
|
||||||
try {
|
try {
|
||||||
$ret = $this->preSave($con);
|
$ret = $this->preSave($con);
|
||||||
|
// versionable behavior
|
||||||
|
if ($this->isVersioningNecessary()) {
|
||||||
|
$this->setVersion($this->isNew() ? 1 : $this->getLastVersionNumber($con) + 1);
|
||||||
|
if (!$this->isColumnModified(ContentPeer::VERSION_CREATED_AT)) {
|
||||||
|
$this->setVersionCreatedAt(time());
|
||||||
|
}
|
||||||
|
$createVersion = true; // for postSave hook
|
||||||
|
}
|
||||||
if ($isInsert) {
|
if ($isInsert) {
|
||||||
$ret = $ret && $this->preInsert($con);
|
$ret = $ret && $this->preInsert($con);
|
||||||
// timestampable behavior
|
// timestampable behavior
|
||||||
@@ -615,6 +817,10 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
$this->postUpdate($con);
|
$this->postUpdate($con);
|
||||||
}
|
}
|
||||||
$this->postSave($con);
|
$this->postSave($con);
|
||||||
|
// versionable behavior
|
||||||
|
if (isset($createVersion)) {
|
||||||
|
$this->addVersion($con);
|
||||||
|
}
|
||||||
ContentPeer::addInstanceToPool($this);
|
ContentPeer::addInstanceToPool($this);
|
||||||
} else {
|
} else {
|
||||||
$affectedRows = 0;
|
$affectedRows = 0;
|
||||||
@@ -762,6 +968,23 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->contentVersionsScheduledForDeletion !== null) {
|
||||||
|
if (!$this->contentVersionsScheduledForDeletion->isEmpty()) {
|
||||||
|
ContentVersionQuery::create()
|
||||||
|
->filterByPrimaryKeys($this->contentVersionsScheduledForDeletion->getPrimaryKeys(false))
|
||||||
|
->delete($con);
|
||||||
|
$this->contentVersionsScheduledForDeletion = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->collContentVersions !== null) {
|
||||||
|
foreach ($this->collContentVersions as $referrerFK) {
|
||||||
|
if (!$referrerFK->isDeleted()) {
|
||||||
|
$affectedRows += $referrerFK->save($con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -803,6 +1026,15 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
if ($this->isColumnModified(ContentPeer::UPDATED_AT)) {
|
if ($this->isColumnModified(ContentPeer::UPDATED_AT)) {
|
||||||
$modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
|
$modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
|
||||||
}
|
}
|
||||||
|
if ($this->isColumnModified(ContentPeer::VERSION)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION`';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(ContentPeer::VERSION_CREATED_AT)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(ContentPeer::VERSION_CREATED_BY)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`';
|
||||||
|
}
|
||||||
|
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'INSERT INTO `content` (%s) VALUES (%s)',
|
'INSERT INTO `content` (%s) VALUES (%s)',
|
||||||
@@ -829,6 +1061,15 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
case '`UPDATED_AT`':
|
case '`UPDATED_AT`':
|
||||||
$stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
|
$stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
|
||||||
break;
|
break;
|
||||||
|
case '`VERSION`':
|
||||||
|
$stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
|
||||||
|
break;
|
||||||
|
case '`VERSION_CREATED_AT`':
|
||||||
|
$stmt->bindValue($identifier, $this->version_created_at, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
|
case '`VERSION_CREATED_BY`':
|
||||||
|
$stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
@@ -976,6 +1217,14 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->collContentVersions !== null) {
|
||||||
|
foreach ($this->collContentVersions as $referrerFK) {
|
||||||
|
if (!$referrerFK->validate($columns)) {
|
||||||
|
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
}
|
}
|
||||||
@@ -1026,6 +1275,15 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
case 4:
|
case 4:
|
||||||
return $this->getUpdatedAt();
|
return $this->getUpdatedAt();
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
return $this->getVersion();
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
return $this->getVersionCreatedAt();
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
return $this->getVersionCreatedBy();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
break;
|
break;
|
||||||
@@ -1060,6 +1318,9 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
$keys[2] => $this->getPosition(),
|
$keys[2] => $this->getPosition(),
|
||||||
$keys[3] => $this->getCreatedAt(),
|
$keys[3] => $this->getCreatedAt(),
|
||||||
$keys[4] => $this->getUpdatedAt(),
|
$keys[4] => $this->getUpdatedAt(),
|
||||||
|
$keys[5] => $this->getVersion(),
|
||||||
|
$keys[6] => $this->getVersionCreatedAt(),
|
||||||
|
$keys[7] => $this->getVersionCreatedBy(),
|
||||||
);
|
);
|
||||||
if ($includeForeignObjects) {
|
if ($includeForeignObjects) {
|
||||||
if (null !== $this->collContentAssocs) {
|
if (null !== $this->collContentAssocs) {
|
||||||
@@ -1080,6 +1341,9 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
if (null !== $this->collContentI18ns) {
|
if (null !== $this->collContentI18ns) {
|
||||||
$result['ContentI18ns'] = $this->collContentI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['ContentI18ns'] = $this->collContentI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
|
if (null !== $this->collContentVersions) {
|
||||||
|
$result['ContentVersions'] = $this->collContentVersions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -1129,6 +1393,15 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
case 4:
|
case 4:
|
||||||
$this->setUpdatedAt($value);
|
$this->setUpdatedAt($value);
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
$this->setVersion($value);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
$this->setVersionCreatedAt($value);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
$this->setVersionCreatedBy($value);
|
||||||
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1158,6 +1431,9 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
if (array_key_exists($keys[2], $arr)) $this->setPosition($arr[$keys[2]]);
|
if (array_key_exists($keys[2], $arr)) $this->setPosition($arr[$keys[2]]);
|
||||||
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
|
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
|
||||||
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
|
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
|
||||||
|
if (array_key_exists($keys[5], $arr)) $this->setVersion($arr[$keys[5]]);
|
||||||
|
if (array_key_exists($keys[6], $arr)) $this->setVersionCreatedAt($arr[$keys[6]]);
|
||||||
|
if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedBy($arr[$keys[7]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1174,6 +1450,9 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
if ($this->isColumnModified(ContentPeer::POSITION)) $criteria->add(ContentPeer::POSITION, $this->position);
|
if ($this->isColumnModified(ContentPeer::POSITION)) $criteria->add(ContentPeer::POSITION, $this->position);
|
||||||
if ($this->isColumnModified(ContentPeer::CREATED_AT)) $criteria->add(ContentPeer::CREATED_AT, $this->created_at);
|
if ($this->isColumnModified(ContentPeer::CREATED_AT)) $criteria->add(ContentPeer::CREATED_AT, $this->created_at);
|
||||||
if ($this->isColumnModified(ContentPeer::UPDATED_AT)) $criteria->add(ContentPeer::UPDATED_AT, $this->updated_at);
|
if ($this->isColumnModified(ContentPeer::UPDATED_AT)) $criteria->add(ContentPeer::UPDATED_AT, $this->updated_at);
|
||||||
|
if ($this->isColumnModified(ContentPeer::VERSION)) $criteria->add(ContentPeer::VERSION, $this->version);
|
||||||
|
if ($this->isColumnModified(ContentPeer::VERSION_CREATED_AT)) $criteria->add(ContentPeer::VERSION_CREATED_AT, $this->version_created_at);
|
||||||
|
if ($this->isColumnModified(ContentPeer::VERSION_CREATED_BY)) $criteria->add(ContentPeer::VERSION_CREATED_BY, $this->version_created_by);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
@@ -1241,6 +1520,9 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
$copyObj->setPosition($this->getPosition());
|
$copyObj->setPosition($this->getPosition());
|
||||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||||
|
$copyObj->setVersion($this->getVersion());
|
||||||
|
$copyObj->setVersionCreatedAt($this->getVersionCreatedAt());
|
||||||
|
$copyObj->setVersionCreatedBy($this->getVersionCreatedBy());
|
||||||
|
|
||||||
if ($deepCopy && !$this->startCopy) {
|
if ($deepCopy && !$this->startCopy) {
|
||||||
// important: temporarily setNew(false) because this affects the behavior of
|
// important: temporarily setNew(false) because this affects the behavior of
|
||||||
@@ -1285,6 +1567,12 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->getContentVersions() as $relObj) {
|
||||||
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
|
$copyObj->addContentVersion($relObj->copy($deepCopy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//unflag object copy
|
//unflag object copy
|
||||||
$this->startCopy = false;
|
$this->startCopy = false;
|
||||||
} // if ($deepCopy)
|
} // if ($deepCopy)
|
||||||
@@ -1364,6 +1652,9 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
if ('ContentI18n' == $relationName) {
|
if ('ContentI18n' == $relationName) {
|
||||||
$this->initContentI18ns();
|
$this->initContentI18ns();
|
||||||
}
|
}
|
||||||
|
if ('ContentVersion' == $relationName) {
|
||||||
|
$this->initContentVersions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2912,6 +3203,213 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears out the collContentVersions 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 addContentVersions()
|
||||||
|
*/
|
||||||
|
public function clearContentVersions()
|
||||||
|
{
|
||||||
|
$this->collContentVersions = null; // important to set this to null since that means it is uninitialized
|
||||||
|
$this->collContentVersionsPartial = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reset is the collContentVersions collection loaded partially
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function resetPartialContentVersions($v = true)
|
||||||
|
{
|
||||||
|
$this->collContentVersionsPartial = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the collContentVersions collection.
|
||||||
|
*
|
||||||
|
* By default this just sets the collContentVersions collection to an empty array (like clearcollContentVersions());
|
||||||
|
* 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 initContentVersions($overrideExisting = true)
|
||||||
|
{
|
||||||
|
if (null !== $this->collContentVersions && !$overrideExisting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->collContentVersions = new PropelObjectCollection();
|
||||||
|
$this->collContentVersions->setModel('ContentVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an array of ContentVersion objects which contain a foreign key that references this object.
|
||||||
|
*
|
||||||
|
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||||
|
* Otherwise the results are fetched from the database the first time, then cached.
|
||||||
|
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||||
|
* If this Content is new, it will return
|
||||||
|
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param PropelPDO $con optional connection object
|
||||||
|
* @return PropelObjectCollection|ContentVersion[] List of ContentVersion objects
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function getContentVersions($criteria = null, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collContentVersionsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collContentVersions || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collContentVersions) {
|
||||||
|
// return empty collection
|
||||||
|
$this->initContentVersions();
|
||||||
|
} else {
|
||||||
|
$collContentVersions = ContentVersionQuery::create(null, $criteria)
|
||||||
|
->filterByContent($this)
|
||||||
|
->find($con);
|
||||||
|
if (null !== $criteria) {
|
||||||
|
if (false !== $this->collContentVersionsPartial && count($collContentVersions)) {
|
||||||
|
$this->initContentVersions(false);
|
||||||
|
|
||||||
|
foreach($collContentVersions as $obj) {
|
||||||
|
if (false == $this->collContentVersions->contains($obj)) {
|
||||||
|
$this->collContentVersions->append($obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collContentVersionsPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $collContentVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($partial && $this->collContentVersions) {
|
||||||
|
foreach($this->collContentVersions as $obj) {
|
||||||
|
if($obj->isNew()) {
|
||||||
|
$collContentVersions[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collContentVersions = $collContentVersions;
|
||||||
|
$this->collContentVersionsPartial = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->collContentVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a collection of ContentVersion 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 $contentVersions A Propel collection.
|
||||||
|
* @param PropelPDO $con Optional connection object
|
||||||
|
*/
|
||||||
|
public function setContentVersions(PropelCollection $contentVersions, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$this->contentVersionsScheduledForDeletion = $this->getContentVersions(new Criteria(), $con)->diff($contentVersions);
|
||||||
|
|
||||||
|
foreach ($this->contentVersionsScheduledForDeletion as $contentVersionRemoved) {
|
||||||
|
$contentVersionRemoved->setContent(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collContentVersions = null;
|
||||||
|
foreach ($contentVersions as $contentVersion) {
|
||||||
|
$this->addContentVersion($contentVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collContentVersions = $contentVersions;
|
||||||
|
$this->collContentVersionsPartial = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of related ContentVersion objects.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @return int Count of related ContentVersion objects.
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function countContentVersions(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collContentVersionsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collContentVersions || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collContentVersions) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
if($partial && !$criteria) {
|
||||||
|
return count($this->getContentVersions());
|
||||||
|
}
|
||||||
|
$query = ContentVersionQuery::create(null, $criteria);
|
||||||
|
if ($distinct) {
|
||||||
|
$query->distinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query
|
||||||
|
->filterByContent($this)
|
||||||
|
->count($con);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return count($this->collContentVersions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called to associate a ContentVersion object to this object
|
||||||
|
* through the ContentVersion foreign key attribute.
|
||||||
|
*
|
||||||
|
* @param ContentVersion $l ContentVersion
|
||||||
|
* @return Content The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function addContentVersion(ContentVersion $l)
|
||||||
|
{
|
||||||
|
if ($this->collContentVersions === null) {
|
||||||
|
$this->initContentVersions();
|
||||||
|
$this->collContentVersionsPartial = true;
|
||||||
|
}
|
||||||
|
if (!$this->collContentVersions->contains($l)) { // only add it if the **same** object is not already associated
|
||||||
|
$this->doAddContentVersion($l);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ContentVersion $contentVersion The contentVersion object to add.
|
||||||
|
*/
|
||||||
|
protected function doAddContentVersion($contentVersion)
|
||||||
|
{
|
||||||
|
$this->collContentVersions[]= $contentVersion;
|
||||||
|
$contentVersion->setContent($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ContentVersion $contentVersion The contentVersion object to remove.
|
||||||
|
*/
|
||||||
|
public function removeContentVersion($contentVersion)
|
||||||
|
{
|
||||||
|
if ($this->getContentVersions()->contains($contentVersion)) {
|
||||||
|
$this->collContentVersions->remove($this->collContentVersions->search($contentVersion));
|
||||||
|
if (null === $this->contentVersionsScheduledForDeletion) {
|
||||||
|
$this->contentVersionsScheduledForDeletion = clone $this->collContentVersions;
|
||||||
|
$this->contentVersionsScheduledForDeletion->clear();
|
||||||
|
}
|
||||||
|
$this->contentVersionsScheduledForDeletion[]= $contentVersion;
|
||||||
|
$contentVersion->setContent(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the current object and sets all attributes to their default values
|
* Clears the current object and sets all attributes to their default values
|
||||||
*/
|
*/
|
||||||
@@ -2922,9 +3420,13 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
$this->position = null;
|
$this->position = null;
|
||||||
$this->created_at = null;
|
$this->created_at = null;
|
||||||
$this->updated_at = null;
|
$this->updated_at = null;
|
||||||
|
$this->version = null;
|
||||||
|
$this->version_created_at = null;
|
||||||
|
$this->version_created_by = null;
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
$this->clearAllReferences();
|
$this->clearAllReferences();
|
||||||
|
$this->applyDefaultValues();
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
$this->setNew(true);
|
$this->setNew(true);
|
||||||
$this->setDeleted(false);
|
$this->setDeleted(false);
|
||||||
@@ -2972,6 +3474,11 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->collContentVersions) {
|
||||||
|
foreach ($this->collContentVersions as $o) {
|
||||||
|
$o->clearAllReferences($deep);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // if ($deep)
|
} // if ($deep)
|
||||||
|
|
||||||
// i18n behavior
|
// i18n behavior
|
||||||
@@ -3002,6 +3509,10 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
$this->collContentI18ns->clearIterator();
|
$this->collContentI18ns->clearIterator();
|
||||||
}
|
}
|
||||||
$this->collContentI18ns = null;
|
$this->collContentI18ns = null;
|
||||||
|
if ($this->collContentVersions instanceof PropelCollection) {
|
||||||
|
$this->collContentVersions->clearIterator();
|
||||||
|
}
|
||||||
|
$this->collContentVersions = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3233,4 +3744,293 @@ abstract class BaseContent extends BaseObject implements Persistent
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enforce a new Version of this object upon next save.
|
||||||
|
*
|
||||||
|
* @return Content
|
||||||
|
*/
|
||||||
|
public function enforceVersioning()
|
||||||
|
{
|
||||||
|
$this->enforceVersion = true;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current state must be recorded as a version
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con An optional PropelPDO connection to use.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isVersioningNecessary($con = null)
|
||||||
|
{
|
||||||
|
if ($this->alreadyInSave) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->enforceVersion) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ContentPeer::isVersioningEnabled() && ($this->isNew() || $this->isModified() || $this->isDeleted())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a version of the current object and saves it.
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return ContentVersion A version object
|
||||||
|
*/
|
||||||
|
public function addVersion($con = null)
|
||||||
|
{
|
||||||
|
$this->enforceVersion = false;
|
||||||
|
|
||||||
|
$version = new ContentVersion();
|
||||||
|
$version->setId($this->getId());
|
||||||
|
$version->setVisible($this->getVisible());
|
||||||
|
$version->setPosition($this->getPosition());
|
||||||
|
$version->setCreatedAt($this->getCreatedAt());
|
||||||
|
$version->setUpdatedAt($this->getUpdatedAt());
|
||||||
|
$version->setVersion($this->getVersion());
|
||||||
|
$version->setVersionCreatedAt($this->getVersionCreatedAt());
|
||||||
|
$version->setVersionCreatedBy($this->getVersionCreatedBy());
|
||||||
|
$version->setContent($this);
|
||||||
|
$version->save($con);
|
||||||
|
|
||||||
|
return $version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the properties of the curent object to the value they had at a specific version
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber The version number to read
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return Content The current object (for fluent API support)
|
||||||
|
* @throws PropelException - if no object with the given version can be found.
|
||||||
|
*/
|
||||||
|
public function toVersion($versionNumber, $con = null)
|
||||||
|
{
|
||||||
|
$version = $this->getOneVersion($versionNumber, $con);
|
||||||
|
if (!$version) {
|
||||||
|
throw new PropelException(sprintf('No Content object found with version %d', $version));
|
||||||
|
}
|
||||||
|
$this->populateFromVersion($version, $con);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the properties of the curent object to the value they had at a specific version
|
||||||
|
*
|
||||||
|
* @param ContentVersion $version The version object to use
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $loadedObjects objects thats been loaded in a chain of populateFromVersion calls on referrer or fk objects.
|
||||||
|
*
|
||||||
|
* @return Content The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function populateFromVersion($version, $con = null, &$loadedObjects = array())
|
||||||
|
{
|
||||||
|
|
||||||
|
$loadedObjects['Content'][$version->getId()][$version->getVersion()] = $this;
|
||||||
|
$this->setId($version->getId());
|
||||||
|
$this->setVisible($version->getVisible());
|
||||||
|
$this->setPosition($version->getPosition());
|
||||||
|
$this->setCreatedAt($version->getCreatedAt());
|
||||||
|
$this->setUpdatedAt($version->getUpdatedAt());
|
||||||
|
$this->setVersion($version->getVersion());
|
||||||
|
$this->setVersionCreatedAt($version->getVersionCreatedAt());
|
||||||
|
$this->setVersionCreatedBy($version->getVersionCreatedBy());
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the latest persisted version number for the current object
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getLastVersionNumber($con = null)
|
||||||
|
{
|
||||||
|
$v = ContentVersionQuery::create()
|
||||||
|
->filterByContent($this)
|
||||||
|
->orderByVersion('desc')
|
||||||
|
->findOne($con);
|
||||||
|
if (!$v) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $v->getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current object is the latest one
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isLastVersion($con = null)
|
||||||
|
{
|
||||||
|
return $this->getLastVersionNumber($con) == $this->getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a version object for this entity and a version number
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber The version number to read
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return ContentVersion A version object
|
||||||
|
*/
|
||||||
|
public function getOneVersion($versionNumber, $con = null)
|
||||||
|
{
|
||||||
|
return ContentVersionQuery::create()
|
||||||
|
->filterByContent($this)
|
||||||
|
->filterByVersion($versionNumber)
|
||||||
|
->findOne($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all the versions of this object, in incremental order
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return PropelObjectCollection A list of ContentVersion objects
|
||||||
|
*/
|
||||||
|
public function getAllVersions($con = null)
|
||||||
|
{
|
||||||
|
$criteria = new Criteria();
|
||||||
|
$criteria->addAscendingOrderByColumn(ContentVersionPeer::VERSION);
|
||||||
|
|
||||||
|
return $this->getContentVersions($criteria, $con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the current object with another of its version.
|
||||||
|
* <code>
|
||||||
|
* print_r($book->compareVersion(1));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns)
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
public function compareVersion($versionNumber, $keys = 'columns', $con = null, $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersion = $this->toArray();
|
||||||
|
$toVersion = $this->getOneVersion($versionNumber, $con)->toArray();
|
||||||
|
|
||||||
|
return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares two versions of the current object.
|
||||||
|
* <code>
|
||||||
|
* print_r($book->compareVersions(1, 2));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param integer $fromVersionNumber
|
||||||
|
* @param integer $toVersionNumber
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns)
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
public function compareVersions($fromVersionNumber, $toVersionNumber, $keys = 'columns', $con = null, $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersion = $this->getOneVersion($fromVersionNumber, $con)->toArray();
|
||||||
|
$toVersion = $this->getOneVersion($toVersionNumber, $con)->toArray();
|
||||||
|
|
||||||
|
return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes the diff between two versions.
|
||||||
|
* <code>
|
||||||
|
* print_r($this->computeDiff(1, 2));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param array $fromVersion An array representing the original version.
|
||||||
|
* @param array $toVersion An array representing the destination version.
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns).
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
protected function computeDiff($fromVersion, $toVersion, $keys = 'columns', $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersionNumber = $fromVersion['Version'];
|
||||||
|
$toVersionNumber = $toVersion['Version'];
|
||||||
|
$ignoredColumns = array_merge(array(
|
||||||
|
'Version',
|
||||||
|
'VersionCreatedAt',
|
||||||
|
'VersionCreatedBy',
|
||||||
|
), $ignoredColumns);
|
||||||
|
$diff = array();
|
||||||
|
foreach ($fromVersion as $key => $value) {
|
||||||
|
if (in_array($key, $ignoredColumns)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($toVersion[$key] != $value) {
|
||||||
|
switch ($keys) {
|
||||||
|
case 'versions':
|
||||||
|
$diff[$fromVersionNumber][$key] = $value;
|
||||||
|
$diff[$toVersionNumber][$key] = $toVersion[$key];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$diff[$key] = array(
|
||||||
|
$fromVersionNumber => $value,
|
||||||
|
$toVersionNumber => $toVersion[$key],
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $diff;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* retrieve the last $number versions.
|
||||||
|
*
|
||||||
|
* @param integer $number the number of record to return.
|
||||||
|
* @param ContentVersionQuery|Criteria $criteria Additional criteria to filter.
|
||||||
|
* @param PropelPDO $con An optional connection to use.
|
||||||
|
*
|
||||||
|
* @return PropelCollection|ContentVersion[] List of ContentVersion objects
|
||||||
|
*/
|
||||||
|
public function getLastVersions($number = 10, $criteria = null, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$criteria = ContentVersionQuery::create(null, $criteria);
|
||||||
|
$criteria->addDescendingOrderByColumn(ContentVersionPeer::VERSION);
|
||||||
|
$criteria->limit($number);
|
||||||
|
|
||||||
|
return $this->getContentVersions($criteria, $con);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use Thelia\Model\ContentAssocPeer;
|
|||||||
use Thelia\Model\ContentFolderPeer;
|
use Thelia\Model\ContentFolderPeer;
|
||||||
use Thelia\Model\ContentI18nPeer;
|
use Thelia\Model\ContentI18nPeer;
|
||||||
use Thelia\Model\ContentPeer;
|
use Thelia\Model\ContentPeer;
|
||||||
|
use Thelia\Model\ContentVersionPeer;
|
||||||
use Thelia\Model\DocumentPeer;
|
use Thelia\Model\DocumentPeer;
|
||||||
use Thelia\Model\ImagePeer;
|
use Thelia\Model\ImagePeer;
|
||||||
use Thelia\Model\RewritingPeer;
|
use Thelia\Model\RewritingPeer;
|
||||||
@@ -42,13 +43,13 @@ abstract class BaseContentPeer
|
|||||||
const TM_CLASS = 'ContentTableMap';
|
const TM_CLASS = 'ContentTableMap';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 5;
|
const NUM_COLUMNS = 8;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
||||||
const NUM_HYDRATE_COLUMNS = 5;
|
const NUM_HYDRATE_COLUMNS = 8;
|
||||||
|
|
||||||
/** the column name for the ID field */
|
/** the column name for the ID field */
|
||||||
const ID = 'content.ID';
|
const ID = 'content.ID';
|
||||||
@@ -65,6 +66,15 @@ abstract class BaseContentPeer
|
|||||||
/** the column name for the UPDATED_AT field */
|
/** the column name for the UPDATED_AT field */
|
||||||
const UPDATED_AT = 'content.UPDATED_AT';
|
const UPDATED_AT = 'content.UPDATED_AT';
|
||||||
|
|
||||||
|
/** the column name for the VERSION field */
|
||||||
|
const VERSION = 'content.VERSION';
|
||||||
|
|
||||||
|
/** the column name for the VERSION_CREATED_AT field */
|
||||||
|
const VERSION_CREATED_AT = 'content.VERSION_CREATED_AT';
|
||||||
|
|
||||||
|
/** the column name for the VERSION_CREATED_BY field */
|
||||||
|
const VERSION_CREATED_BY = 'content.VERSION_CREATED_BY';
|
||||||
|
|
||||||
/** The default string format for model objects of the related table **/
|
/** The default string format for model objects of the related table **/
|
||||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||||
|
|
||||||
@@ -84,6 +94,13 @@ abstract class BaseContentPeer
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const DEFAULT_LOCALE = 'en_EN';
|
const DEFAULT_LOCALE = 'en_EN';
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the versioning is enabled
|
||||||
|
*/
|
||||||
|
static $isVersioningEnabled = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* holds an array of fieldnames
|
* holds an array of fieldnames
|
||||||
*
|
*
|
||||||
@@ -91,12 +108,12 @@ abstract class BaseContentPeer
|
|||||||
* e.g. ContentPeer::$fieldNames[ContentPeer::TYPE_PHPNAME][0] = 'Id'
|
* e.g. ContentPeer::$fieldNames[ContentPeer::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
protected static $fieldNames = array (
|
protected static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('Id', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', ),
|
BasePeer::TYPE_PHPNAME => array ('Id', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'visible', 'position', 'createdAt', 'updatedAt', ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'visible', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
|
||||||
BasePeer::TYPE_COLNAME => array (ContentPeer::ID, ContentPeer::VISIBLE, ContentPeer::POSITION, ContentPeer::CREATED_AT, ContentPeer::UPDATED_AT, ),
|
BasePeer::TYPE_COLNAME => array (ContentPeer::ID, ContentPeer::VISIBLE, ContentPeer::POSITION, ContentPeer::CREATED_AT, ContentPeer::UPDATED_AT, ContentPeer::VERSION, ContentPeer::VERSION_CREATED_AT, ContentPeer::VERSION_CREATED_BY, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id', 'visible', 'position', 'created_at', 'updated_at', ),
|
BasePeer::TYPE_FIELDNAME => array ('id', 'visible', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,12 +123,12 @@ abstract class BaseContentPeer
|
|||||||
* e.g. ContentPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
* e.g. ContentPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
protected static $fieldKeys = array (
|
protected static $fieldKeys = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Visible' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
|
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Visible' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, 'Version' => 5, 'VersionCreatedAt' => 6, 'VersionCreatedBy' => 7, ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'visible' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'visible' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, 'version' => 5, 'versionCreatedAt' => 6, 'versionCreatedBy' => 7, ),
|
||||||
BasePeer::TYPE_COLNAME => array (ContentPeer::ID => 0, ContentPeer::VISIBLE => 1, ContentPeer::POSITION => 2, ContentPeer::CREATED_AT => 3, ContentPeer::UPDATED_AT => 4, ),
|
BasePeer::TYPE_COLNAME => array (ContentPeer::ID => 0, ContentPeer::VISIBLE => 1, ContentPeer::POSITION => 2, ContentPeer::CREATED_AT => 3, ContentPeer::UPDATED_AT => 4, ContentPeer::VERSION => 5, ContentPeer::VERSION_CREATED_AT => 6, ContentPeer::VERSION_CREATED_BY => 7, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'VISIBLE' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'VISIBLE' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, 'VERSION' => 5, 'VERSION_CREATED_AT' => 6, 'VERSION_CREATED_BY' => 7, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'visible' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, ),
|
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'visible' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, 'version' => 5, 'version_created_at' => 6, 'version_created_by' => 7, ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -190,12 +207,18 @@ abstract class BaseContentPeer
|
|||||||
$criteria->addSelectColumn(ContentPeer::POSITION);
|
$criteria->addSelectColumn(ContentPeer::POSITION);
|
||||||
$criteria->addSelectColumn(ContentPeer::CREATED_AT);
|
$criteria->addSelectColumn(ContentPeer::CREATED_AT);
|
||||||
$criteria->addSelectColumn(ContentPeer::UPDATED_AT);
|
$criteria->addSelectColumn(ContentPeer::UPDATED_AT);
|
||||||
|
$criteria->addSelectColumn(ContentPeer::VERSION);
|
||||||
|
$criteria->addSelectColumn(ContentPeer::VERSION_CREATED_AT);
|
||||||
|
$criteria->addSelectColumn(ContentPeer::VERSION_CREATED_BY);
|
||||||
} else {
|
} else {
|
||||||
$criteria->addSelectColumn($alias . '.ID');
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
$criteria->addSelectColumn($alias . '.VISIBLE');
|
$criteria->addSelectColumn($alias . '.VISIBLE');
|
||||||
$criteria->addSelectColumn($alias . '.POSITION');
|
$criteria->addSelectColumn($alias . '.POSITION');
|
||||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION_CREATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION_CREATED_BY');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,6 +436,9 @@ abstract class BaseContentPeer
|
|||||||
// Invalidate objects in ContentI18nPeer instance pool,
|
// Invalidate objects in ContentI18nPeer instance pool,
|
||||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
ContentI18nPeer::clearInstancePool();
|
ContentI18nPeer::clearInstancePool();
|
||||||
|
// Invalidate objects in ContentVersionPeer instance pool,
|
||||||
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
|
ContentVersionPeer::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -806,6 +832,34 @@ abstract class BaseContentPeer
|
|||||||
return $objs;
|
return $objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether versioning is enabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function isVersioningEnabled()
|
||||||
|
{
|
||||||
|
return self::$isVersioningEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables versioning
|
||||||
|
*/
|
||||||
|
public static function enableVersioning()
|
||||||
|
{
|
||||||
|
self::$isVersioningEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables versioning
|
||||||
|
*/
|
||||||
|
public static function disableVersioning()
|
||||||
|
{
|
||||||
|
self::$isVersioningEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
} // BaseContentPeer
|
} // BaseContentPeer
|
||||||
|
|
||||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ use Thelia\Model\ContentFolder;
|
|||||||
use Thelia\Model\ContentI18n;
|
use Thelia\Model\ContentI18n;
|
||||||
use Thelia\Model\ContentPeer;
|
use Thelia\Model\ContentPeer;
|
||||||
use Thelia\Model\ContentQuery;
|
use Thelia\Model\ContentQuery;
|
||||||
|
use Thelia\Model\ContentVersion;
|
||||||
use Thelia\Model\Document;
|
use Thelia\Model\Document;
|
||||||
use Thelia\Model\Image;
|
use Thelia\Model\Image;
|
||||||
use Thelia\Model\Rewriting;
|
use Thelia\Model\Rewriting;
|
||||||
@@ -32,12 +33,18 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method ContentQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
* @method ContentQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||||
* @method ContentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
* @method ContentQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
* @method ContentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
* @method ContentQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
|
* @method ContentQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||||
|
* @method ContentQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
||||||
|
* @method ContentQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method ContentQuery groupById() Group by the id column
|
* @method ContentQuery groupById() Group by the id column
|
||||||
* @method ContentQuery groupByVisible() Group by the visible column
|
* @method ContentQuery groupByVisible() Group by the visible column
|
||||||
* @method ContentQuery groupByPosition() Group by the position column
|
* @method ContentQuery groupByPosition() Group by the position column
|
||||||
* @method ContentQuery groupByCreatedAt() Group by the created_at column
|
* @method ContentQuery groupByCreatedAt() Group by the created_at column
|
||||||
* @method ContentQuery groupByUpdatedAt() Group by the updated_at column
|
* @method ContentQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
|
* @method ContentQuery groupByVersion() Group by the version column
|
||||||
|
* @method ContentQuery groupByVersionCreatedAt() Group by the version_created_at column
|
||||||
|
* @method ContentQuery groupByVersionCreatedBy() Group by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method ContentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
* @method ContentQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
* @method ContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
* @method ContentQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
@@ -67,6 +74,10 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method ContentQuery rightJoinContentI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentI18n relation
|
* @method ContentQuery rightJoinContentI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentI18n relation
|
||||||
* @method ContentQuery innerJoinContentI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentI18n relation
|
* @method ContentQuery innerJoinContentI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentI18n relation
|
||||||
*
|
*
|
||||||
|
* @method ContentQuery leftJoinContentVersion($relationAlias = null) Adds a LEFT JOIN clause to the query using the ContentVersion relation
|
||||||
|
* @method ContentQuery rightJoinContentVersion($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ContentVersion relation
|
||||||
|
* @method ContentQuery innerJoinContentVersion($relationAlias = null) Adds a INNER JOIN clause to the query using the ContentVersion relation
|
||||||
|
*
|
||||||
* @method Content findOne(PropelPDO $con = null) Return the first Content matching the query
|
* @method Content findOne(PropelPDO $con = null) Return the first Content matching the query
|
||||||
* @method Content findOneOrCreate(PropelPDO $con = null) Return the first Content matching the query, or a new Content object populated from the query conditions when no match is found
|
* @method Content findOneOrCreate(PropelPDO $con = null) Return the first Content matching the query, or a new Content object populated from the query conditions when no match is found
|
||||||
*
|
*
|
||||||
@@ -75,12 +86,18 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method Content findOneByPosition(int $position) Return the first Content filtered by the position column
|
* @method Content findOneByPosition(int $position) Return the first Content filtered by the position column
|
||||||
* @method Content findOneByCreatedAt(string $created_at) Return the first Content filtered by the created_at column
|
* @method Content findOneByCreatedAt(string $created_at) Return the first Content filtered by the created_at column
|
||||||
* @method Content findOneByUpdatedAt(string $updated_at) Return the first Content filtered by the updated_at column
|
* @method Content findOneByUpdatedAt(string $updated_at) Return the first Content filtered by the updated_at column
|
||||||
|
* @method Content findOneByVersion(int $version) Return the first Content filtered by the version column
|
||||||
|
* @method Content findOneByVersionCreatedAt(string $version_created_at) Return the first Content filtered by the version_created_at column
|
||||||
|
* @method Content findOneByVersionCreatedBy(string $version_created_by) Return the first Content filtered by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method array findById(int $id) Return Content objects filtered by the id column
|
* @method array findById(int $id) Return Content objects filtered by the id column
|
||||||
* @method array findByVisible(int $visible) Return Content objects filtered by the visible column
|
* @method array findByVisible(int $visible) Return Content objects filtered by the visible column
|
||||||
* @method array findByPosition(int $position) Return Content objects filtered by the position column
|
* @method array findByPosition(int $position) Return Content objects filtered by the position column
|
||||||
* @method array findByCreatedAt(string $created_at) Return Content objects filtered by the created_at column
|
* @method array findByCreatedAt(string $created_at) Return Content objects filtered by the created_at column
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return Content objects filtered by the updated_at column
|
* @method array findByUpdatedAt(string $updated_at) Return Content objects filtered by the updated_at column
|
||||||
|
* @method array findByVersion(int $version) Return Content objects filtered by the version column
|
||||||
|
* @method array findByVersionCreatedAt(string $version_created_at) Return Content objects filtered by the version_created_at column
|
||||||
|
* @method array findByVersionCreatedBy(string $version_created_by) Return Content objects filtered by the version_created_by column
|
||||||
*
|
*
|
||||||
* @package propel.generator.Thelia.Model.om
|
* @package propel.generator.Thelia.Model.om
|
||||||
*/
|
*/
|
||||||
@@ -170,7 +187,7 @@ abstract class BaseContentQuery extends ModelCriteria
|
|||||||
*/
|
*/
|
||||||
protected function findPkSimple($key, $con)
|
protected function findPkSimple($key, $con)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT `ID`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `content` WHERE `ID` = :p0';
|
$sql = 'SELECT `ID`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `content` WHERE `ID` = :p0';
|
||||||
try {
|
try {
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||||
@@ -454,6 +471,119 @@ abstract class BaseContentQuery extends ModelCriteria
|
|||||||
return $this->addUsingAlias(ContentPeer::UPDATED_AT, $updatedAt, $comparison);
|
return $this->addUsingAlias(ContentPeer::UPDATED_AT, $updatedAt, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersion(1234); // WHERE version = 1234
|
||||||
|
* $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
|
||||||
|
* $query->filterByVersion(array('min' => 12)); // WHERE version > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $version The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersion($version = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($version)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($version['min'])) {
|
||||||
|
$this->addUsingAlias(ContentPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($version['max'])) {
|
||||||
|
$this->addUsingAlias(ContentPeer::VERSION, $version['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ContentPeer::VERSION, $version, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $versionCreatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($versionCreatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($versionCreatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(ContentPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($versionCreatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(ContentPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ContentPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_by column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
||||||
|
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $versionCreatedBy The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($versionCreatedBy)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
|
||||||
|
$versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ContentPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related ContentAssoc object
|
* Filter the query by a related ContentAssoc object
|
||||||
*
|
*
|
||||||
@@ -898,6 +1028,80 @@ abstract class BaseContentQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'ContentI18n', '\Thelia\Model\ContentI18nQuery');
|
->useQuery($relationAlias ? $relationAlias : 'ContentI18n', '\Thelia\Model\ContentI18nQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related ContentVersion object
|
||||||
|
*
|
||||||
|
* @param ContentVersion|PropelObjectCollection $contentVersion the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentQuery The current query, for fluid interface
|
||||||
|
* @throws PropelException - if the provided filter is invalid.
|
||||||
|
*/
|
||||||
|
public function filterByContentVersion($contentVersion, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($contentVersion instanceof ContentVersion) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(ContentPeer::ID, $contentVersion->getId(), $comparison);
|
||||||
|
} elseif ($contentVersion instanceof PropelObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useContentVersionQuery()
|
||||||
|
->filterByPrimaryKeys($contentVersion->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByContentVersion() only accepts arguments of type ContentVersion or PropelCollection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the ContentVersion relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ContentQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinContentVersion($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('ContentVersion');
|
||||||
|
|
||||||
|
// 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, 'ContentVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the ContentVersion relation ContentVersion 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\ContentVersionQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useContentVersionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinContentVersion($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'ContentVersion', '\Thelia\Model\ContentVersionQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
|
|||||||
1372
core/lib/Thelia/Model/om/BaseContentVersion.php
Normal file
1372
core/lib/Thelia/Model/om/BaseContentVersion.php
Normal file
File diff suppressed because it is too large
Load Diff
1019
core/lib/Thelia/Model/om/BaseContentVersionPeer.php
Normal file
1019
core/lib/Thelia/Model/om/BaseContentVersionPeer.php
Normal file
File diff suppressed because it is too large
Load Diff
652
core/lib/Thelia/Model/om/BaseContentVersionQuery.php
Normal file
652
core/lib/Thelia/Model/om/BaseContentVersionQuery.php
Normal file
@@ -0,0 +1,652 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\om;
|
||||||
|
|
||||||
|
use \Criteria;
|
||||||
|
use \Exception;
|
||||||
|
use \ModelCriteria;
|
||||||
|
use \ModelJoin;
|
||||||
|
use \PDO;
|
||||||
|
use \Propel;
|
||||||
|
use \PropelCollection;
|
||||||
|
use \PropelException;
|
||||||
|
use \PropelObjectCollection;
|
||||||
|
use \PropelPDO;
|
||||||
|
use Thelia\Model\Content;
|
||||||
|
use Thelia\Model\ContentVersion;
|
||||||
|
use Thelia\Model\ContentVersionPeer;
|
||||||
|
use Thelia\Model\ContentVersionQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'content_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method ContentVersionQuery orderById($order = Criteria::ASC) Order by the id column
|
||||||
|
* @method ContentVersionQuery orderByVisible($order = Criteria::ASC) Order by the visible column
|
||||||
|
* @method ContentVersionQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||||
|
* @method ContentVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
|
* @method ContentVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
|
* @method ContentVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||||
|
* @method ContentVersionQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
||||||
|
* @method ContentVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
||||||
|
*
|
||||||
|
* @method ContentVersionQuery groupById() Group by the id column
|
||||||
|
* @method ContentVersionQuery groupByVisible() Group by the visible column
|
||||||
|
* @method ContentVersionQuery groupByPosition() Group by the position column
|
||||||
|
* @method ContentVersionQuery groupByCreatedAt() Group by the created_at column
|
||||||
|
* @method ContentVersionQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
|
* @method ContentVersionQuery groupByVersion() Group by the version column
|
||||||
|
* @method ContentVersionQuery groupByVersionCreatedAt() Group by the version_created_at column
|
||||||
|
* @method ContentVersionQuery groupByVersionCreatedBy() Group by the version_created_by column
|
||||||
|
*
|
||||||
|
* @method ContentVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method ContentVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method ContentVersionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method ContentVersionQuery leftJoinContent($relationAlias = null) Adds a LEFT JOIN clause to the query using the Content relation
|
||||||
|
* @method ContentVersionQuery rightJoinContent($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Content relation
|
||||||
|
* @method ContentVersionQuery innerJoinContent($relationAlias = null) Adds a INNER JOIN clause to the query using the Content relation
|
||||||
|
*
|
||||||
|
* @method ContentVersion findOne(PropelPDO $con = null) Return the first ContentVersion matching the query
|
||||||
|
* @method ContentVersion findOneOrCreate(PropelPDO $con = null) Return the first ContentVersion matching the query, or a new ContentVersion object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method ContentVersion findOneById(int $id) Return the first ContentVersion filtered by the id column
|
||||||
|
* @method ContentVersion findOneByVisible(int $visible) Return the first ContentVersion filtered by the visible column
|
||||||
|
* @method ContentVersion findOneByPosition(int $position) Return the first ContentVersion filtered by the position column
|
||||||
|
* @method ContentVersion findOneByCreatedAt(string $created_at) Return the first ContentVersion filtered by the created_at column
|
||||||
|
* @method ContentVersion findOneByUpdatedAt(string $updated_at) Return the first ContentVersion filtered by the updated_at column
|
||||||
|
* @method ContentVersion findOneByVersion(int $version) Return the first ContentVersion filtered by the version column
|
||||||
|
* @method ContentVersion findOneByVersionCreatedAt(string $version_created_at) Return the first ContentVersion filtered by the version_created_at column
|
||||||
|
* @method ContentVersion findOneByVersionCreatedBy(string $version_created_by) Return the first ContentVersion filtered by the version_created_by column
|
||||||
|
*
|
||||||
|
* @method array findById(int $id) Return ContentVersion objects filtered by the id column
|
||||||
|
* @method array findByVisible(int $visible) Return ContentVersion objects filtered by the visible column
|
||||||
|
* @method array findByPosition(int $position) Return ContentVersion objects filtered by the position column
|
||||||
|
* @method array findByCreatedAt(string $created_at) Return ContentVersion objects filtered by the created_at column
|
||||||
|
* @method array findByUpdatedAt(string $updated_at) Return ContentVersion objects filtered by the updated_at column
|
||||||
|
* @method array findByVersion(int $version) Return ContentVersion objects filtered by the version column
|
||||||
|
* @method array findByVersionCreatedAt(string $version_created_at) Return ContentVersion objects filtered by the version_created_at column
|
||||||
|
* @method array findByVersionCreatedBy(string $version_created_by) Return ContentVersion objects filtered by the version_created_by column
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model.om
|
||||||
|
*/
|
||||||
|
abstract class BaseContentVersionQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseContentVersionQuery object.
|
||||||
|
*
|
||||||
|
* @param string $dbName The dabase name
|
||||||
|
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||||
|
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||||
|
*/
|
||||||
|
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\ContentVersion', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new ContentVersionQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param ContentVersionQuery|Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof ContentVersionQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new ContentVersionQuery();
|
||||||
|
if (null !== $modelAlias) {
|
||||||
|
$query->setModelAlias($modelAlias);
|
||||||
|
}
|
||||||
|
if ($criteria instanceof Criteria) {
|
||||||
|
$query->mergeWith($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
* Propel uses the instance pool to skip the database if the object exists.
|
||||||
|
* Go fast if the query is untouched.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* $obj = $c->findPk(array(12, 34), $con);
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param array $key Primary key to use for the query
|
||||||
|
A Primary key composition: [$id, $version]
|
||||||
|
* @param PropelPDO $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return ContentVersion|ContentVersion[]|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPk($key, $con = null)
|
||||||
|
{
|
||||||
|
if ($key === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((null !== ($obj = ContentVersionPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
|
||||||
|
// the object is alredy in the instance pool
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(ContentVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||||
|
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||||
|
|| $this->map || $this->having || $this->joins) {
|
||||||
|
return $this->findPkComplex($key, $con);
|
||||||
|
} else {
|
||||||
|
return $this->findPkSimple($key, $con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key using raw SQL to go fast.
|
||||||
|
* Bypass doSelect() and the object formatter by using generated code.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param PropelPDO $con A connection object
|
||||||
|
*
|
||||||
|
* @return ContentVersion A model object, or null if the key is not found
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
protected function findPkSimple($key, $con)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT `ID`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `content_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
|
||||||
|
try {
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||||
|
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||||
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
|
||||||
|
}
|
||||||
|
$obj = null;
|
||||||
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$obj = new ContentVersion();
|
||||||
|
$obj->hydrate($row);
|
||||||
|
ContentVersionPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param PropelPDO $con A connection object
|
||||||
|
*
|
||||||
|
* @return ContentVersion|ContentVersion[]|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
protected function findPkComplex($key, $con)
|
||||||
|
{
|
||||||
|
// As the query uses a PK condition, no limit(1) is necessary.
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$stmt = $criteria
|
||||||
|
->filterByPrimaryKey($key)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find objects by primary key
|
||||||
|
* <code>
|
||||||
|
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
||||||
|
* </code>
|
||||||
|
* @param array $keys Primary keys to use for the query
|
||||||
|
* @param PropelPDO $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return PropelObjectCollection|ContentVersion[]|mixed the list of results, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPks($keys, $con = null)
|
||||||
|
{
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$stmt = $criteria
|
||||||
|
->filterByPrimaryKeys($keys)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->format($stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by primary key
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKey($key)
|
||||||
|
{
|
||||||
|
$this->addUsingAlias(ContentVersionPeer::ID, $key[0], Criteria::EQUAL);
|
||||||
|
$this->addUsingAlias(ContentVersionPeer::VERSION, $key[1], Criteria::EQUAL);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a list of primary keys
|
||||||
|
*
|
||||||
|
* @param array $keys The list of primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKeys($keys)
|
||||||
|
{
|
||||||
|
if (empty($keys)) {
|
||||||
|
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||||
|
}
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$cton0 = $this->getNewCriterion(ContentVersionPeer::ID, $key[0], Criteria::EQUAL);
|
||||||
|
$cton1 = $this->getNewCriterion(ContentVersionPeer::VERSION, $key[1], Criteria::EQUAL);
|
||||||
|
$cton0->addAnd($cton1);
|
||||||
|
$this->addOr($cton0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterById(1234); // WHERE id = 1234
|
||||||
|
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||||
|
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @see filterByContent()
|
||||||
|
*
|
||||||
|
* @param mixed $id The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterById($id = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($id) && null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ContentVersionPeer::ID, $id, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the visible column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVisible(1234); // WHERE visible = 1234
|
||||||
|
* $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
|
||||||
|
* $query->filterByVisible(array('min' => 12)); // WHERE visible > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $visible The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVisible($visible = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($visible)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($visible['min'])) {
|
||||||
|
$this->addUsingAlias(ContentVersionPeer::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($visible['max'])) {
|
||||||
|
$this->addUsingAlias(ContentVersionPeer::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ContentVersionPeer::VISIBLE, $visible, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the position column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByPosition(1234); // WHERE position = 1234
|
||||||
|
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
|
||||||
|
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $position The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPosition($position = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($position)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($position['min'])) {
|
||||||
|
$this->addUsingAlias(ContentVersionPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($position['max'])) {
|
||||||
|
$this->addUsingAlias(ContentVersionPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ContentVersionPeer::POSITION, $position, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||||
|
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||||
|
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $createdAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($createdAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($createdAt['min'])) {
|
||||||
|
$this->addUsingAlias(ContentVersionPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($createdAt['max'])) {
|
||||||
|
$this->addUsingAlias(ContentVersionPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ContentVersionPeer::CREATED_AT, $createdAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the updated_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||||
|
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||||
|
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $updatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($updatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($updatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(ContentVersionPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($updatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(ContentVersionPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ContentVersionPeer::UPDATED_AT, $updatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersion(1234); // WHERE version = 1234
|
||||||
|
* $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
|
||||||
|
* $query->filterByVersion(array('min' => 12)); // WHERE version > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $version The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersion($version = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($version) && null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ContentVersionPeer::VERSION, $version, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $versionCreatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($versionCreatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($versionCreatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(ContentVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($versionCreatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(ContentVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ContentVersionPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_by column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
||||||
|
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $versionCreatedBy The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($versionCreatedBy)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
|
||||||
|
$versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ContentVersionPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related Content object
|
||||||
|
*
|
||||||
|
* @param Content|PropelObjectCollection $content The related object(s) to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
* @throws PropelException - if the provided filter is invalid.
|
||||||
|
*/
|
||||||
|
public function filterByContent($content, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($content instanceof Content) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(ContentVersionPeer::ID, $content->getId(), $comparison);
|
||||||
|
} elseif ($content instanceof PropelObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(ContentVersionPeer::ID, $content->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByContent() only accepts arguments of type Content or PropelCollection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the Content relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinContent($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('Content');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if ($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'Content');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the Content relation Content object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\ContentQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useContentQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinContent($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'Content', '\Thelia\Model\ContentQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exclude object from result
|
||||||
|
*
|
||||||
|
* @param ContentVersion $contentVersion Object to remove from the list of results
|
||||||
|
*
|
||||||
|
* @return ContentVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function prune($contentVersion = null)
|
||||||
|
{
|
||||||
|
if ($contentVersion) {
|
||||||
|
$this->addCond('pruneCond0', $this->getAliasedColName(ContentVersionPeer::ID), $contentVersion->getId(), Criteria::NOT_EQUAL);
|
||||||
|
$this->addCond('pruneCond1', $this->getAliasedColName(ContentVersionPeer::VERSION), $contentVersion->getVersion(), Criteria::NOT_EQUAL);
|
||||||
|
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -24,6 +24,9 @@ use Thelia\Model\FolderI18n;
|
|||||||
use Thelia\Model\FolderI18nQuery;
|
use Thelia\Model\FolderI18nQuery;
|
||||||
use Thelia\Model\FolderPeer;
|
use Thelia\Model\FolderPeer;
|
||||||
use Thelia\Model\FolderQuery;
|
use Thelia\Model\FolderQuery;
|
||||||
|
use Thelia\Model\FolderVersion;
|
||||||
|
use Thelia\Model\FolderVersionPeer;
|
||||||
|
use Thelia\Model\FolderVersionQuery;
|
||||||
use Thelia\Model\Image;
|
use Thelia\Model\Image;
|
||||||
use Thelia\Model\ImageQuery;
|
use Thelia\Model\ImageQuery;
|
||||||
use Thelia\Model\Rewriting;
|
use Thelia\Model\Rewriting;
|
||||||
@@ -99,6 +102,25 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $updated_at;
|
protected $updated_at;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version field.
|
||||||
|
* Note: this column has a database default value of: 0
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version_created_at field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $version_created_at;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version_created_by field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $version_created_by;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var PropelObjectCollection|Image[] Collection to store aggregation of Image objects.
|
* @var PropelObjectCollection|Image[] Collection to store aggregation of Image objects.
|
||||||
*/
|
*/
|
||||||
@@ -129,6 +151,12 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
protected $collFolderI18ns;
|
protected $collFolderI18ns;
|
||||||
protected $collFolderI18nsPartial;
|
protected $collFolderI18nsPartial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PropelObjectCollection|FolderVersion[] Collection to store aggregation of FolderVersion objects.
|
||||||
|
*/
|
||||||
|
protected $collFolderVersions;
|
||||||
|
protected $collFolderVersionsPartial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to prevent endless save loop, if this object is referenced
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
* by another object which falls in this transaction.
|
* by another object which falls in this transaction.
|
||||||
@@ -157,6 +185,14 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $currentTranslations;
|
protected $currentTranslations;
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $enforceVersion = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var PropelObjectCollection
|
* @var PropelObjectCollection
|
||||||
@@ -187,6 +223,33 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $folderI18nsScheduledForDeletion = null;
|
protected $folderI18nsScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of objects scheduled for deletion.
|
||||||
|
* @var PropelObjectCollection
|
||||||
|
*/
|
||||||
|
protected $folderVersionsScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies default values to this object.
|
||||||
|
* This method should be called from the object's constructor (or
|
||||||
|
* equivalent initialization method).
|
||||||
|
* @see __construct()
|
||||||
|
*/
|
||||||
|
public function applyDefaultValues()
|
||||||
|
{
|
||||||
|
$this->version = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseFolder object.
|
||||||
|
* @see applyDefaults()
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->applyDefaultValues();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [id] column value.
|
* Get the [id] column value.
|
||||||
*
|
*
|
||||||
@@ -311,6 +374,63 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [version] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getVersion()
|
||||||
|
{
|
||||||
|
return $this->version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [optionally formatted] temporal [version_created_at] column value.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||||
|
* If format is null, then the raw DateTime object will be returned.
|
||||||
|
* @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
|
||||||
|
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||||
|
*/
|
||||||
|
public function getVersionCreatedAt($format = 'Y-m-d H:i:s')
|
||||||
|
{
|
||||||
|
if ($this->version_created_at === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version_created_at === '0000-00-00 00:00:00') {
|
||||||
|
// while technically this is not a default value of null,
|
||||||
|
// this seems to be closest in meaning.
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$dt = new DateTime($this->version_created_at);
|
||||||
|
} catch (Exception $x) {
|
||||||
|
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->version_created_at, true), $x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($format === null) {
|
||||||
|
// Because propel.useDateTimeClass is true, we return a DateTime object.
|
||||||
|
return $dt;
|
||||||
|
} elseif (strpos($format, '%') !== false) {
|
||||||
|
return strftime($format, $dt->format('U'));
|
||||||
|
} else {
|
||||||
|
return $dt->format($format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [version_created_by] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVersionCreatedBy()
|
||||||
|
{
|
||||||
|
return $this->version_created_by;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [id] column.
|
* Set the value of [id] column.
|
||||||
*
|
*
|
||||||
@@ -462,6 +582,71 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
return $this;
|
return $this;
|
||||||
} // setUpdatedAt()
|
} // setUpdatedAt()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [version] column.
|
||||||
|
*
|
||||||
|
* @param int $v new value
|
||||||
|
* @return Folder The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersion($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version !== $v) {
|
||||||
|
$this->version = $v;
|
||||||
|
$this->modifiedColumns[] = FolderPeer::VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersion()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of [version_created_at] column to a normalized version of the date/time value specified.
|
||||||
|
*
|
||||||
|
* @param mixed $v string, integer (timestamp), or DateTime value.
|
||||||
|
* Empty strings are treated as null.
|
||||||
|
* @return Folder The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersionCreatedAt($v)
|
||||||
|
{
|
||||||
|
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
|
||||||
|
if ($this->version_created_at !== null || $dt !== null) {
|
||||||
|
$currentDateAsString = ($this->version_created_at !== null && $tmpDt = new DateTime($this->version_created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
|
||||||
|
$newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
|
||||||
|
if ($currentDateAsString !== $newDateAsString) {
|
||||||
|
$this->version_created_at = $newDateAsString;
|
||||||
|
$this->modifiedColumns[] = FolderPeer::VERSION_CREATED_AT;
|
||||||
|
}
|
||||||
|
} // if either are not null
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersionCreatedAt()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [version_created_by] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return Folder The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersionCreatedBy($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version_created_by !== $v) {
|
||||||
|
$this->version_created_by = $v;
|
||||||
|
$this->modifiedColumns[] = FolderPeer::VERSION_CREATED_BY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersionCreatedBy()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the columns in this object are only set to default values.
|
* Indicates whether the columns in this object are only set to default values.
|
||||||
*
|
*
|
||||||
@@ -472,6 +657,10 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function hasOnlyDefaultValues()
|
public function hasOnlyDefaultValues()
|
||||||
{
|
{
|
||||||
|
if ($this->version !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// otherwise, everything was equal, so return true
|
// otherwise, everything was equal, so return true
|
||||||
return true;
|
return true;
|
||||||
} // hasOnlyDefaultValues()
|
} // hasOnlyDefaultValues()
|
||||||
@@ -501,6 +690,9 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
$this->position = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
|
$this->position = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
|
||||||
$this->created_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
|
$this->created_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
|
||||||
$this->updated_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
|
$this->updated_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
|
||||||
|
$this->version = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
|
||||||
|
$this->version_created_at = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
|
||||||
|
$this->version_created_by = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
@@ -509,7 +701,7 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
$this->ensureConsistency();
|
$this->ensureConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $startcol + 7; // 7 = FolderPeer::NUM_HYDRATE_COLUMNS.
|
return $startcol + 10; // 10 = FolderPeer::NUM_HYDRATE_COLUMNS.
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating Folder object", $e);
|
throw new PropelException("Error populating Folder object", $e);
|
||||||
@@ -581,6 +773,8 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
|
|
||||||
$this->collFolderI18ns = null;
|
$this->collFolderI18ns = null;
|
||||||
|
|
||||||
|
$this->collFolderVersions = null;
|
||||||
|
|
||||||
} // if (deep)
|
} // if (deep)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,6 +845,14 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
$isInsert = $this->isNew();
|
$isInsert = $this->isNew();
|
||||||
try {
|
try {
|
||||||
$ret = $this->preSave($con);
|
$ret = $this->preSave($con);
|
||||||
|
// versionable behavior
|
||||||
|
if ($this->isVersioningNecessary()) {
|
||||||
|
$this->setVersion($this->isNew() ? 1 : $this->getLastVersionNumber($con) + 1);
|
||||||
|
if (!$this->isColumnModified(FolderPeer::VERSION_CREATED_AT)) {
|
||||||
|
$this->setVersionCreatedAt(time());
|
||||||
|
}
|
||||||
|
$createVersion = true; // for postSave hook
|
||||||
|
}
|
||||||
if ($isInsert) {
|
if ($isInsert) {
|
||||||
$ret = $ret && $this->preInsert($con);
|
$ret = $ret && $this->preInsert($con);
|
||||||
// timestampable behavior
|
// timestampable behavior
|
||||||
@@ -675,6 +877,10 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
$this->postUpdate($con);
|
$this->postUpdate($con);
|
||||||
}
|
}
|
||||||
$this->postSave($con);
|
$this->postSave($con);
|
||||||
|
// versionable behavior
|
||||||
|
if (isset($createVersion)) {
|
||||||
|
$this->addVersion($con);
|
||||||
|
}
|
||||||
FolderPeer::addInstanceToPool($this);
|
FolderPeer::addInstanceToPool($this);
|
||||||
} else {
|
} else {
|
||||||
$affectedRows = 0;
|
$affectedRows = 0;
|
||||||
@@ -804,6 +1010,23 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->folderVersionsScheduledForDeletion !== null) {
|
||||||
|
if (!$this->folderVersionsScheduledForDeletion->isEmpty()) {
|
||||||
|
FolderVersionQuery::create()
|
||||||
|
->filterByPrimaryKeys($this->folderVersionsScheduledForDeletion->getPrimaryKeys(false))
|
||||||
|
->delete($con);
|
||||||
|
$this->folderVersionsScheduledForDeletion = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->collFolderVersions !== null) {
|
||||||
|
foreach ($this->collFolderVersions as $referrerFK) {
|
||||||
|
if (!$referrerFK->isDeleted()) {
|
||||||
|
$affectedRows += $referrerFK->save($con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -851,6 +1074,15 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
if ($this->isColumnModified(FolderPeer::UPDATED_AT)) {
|
if ($this->isColumnModified(FolderPeer::UPDATED_AT)) {
|
||||||
$modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
|
$modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
|
||||||
}
|
}
|
||||||
|
if ($this->isColumnModified(FolderPeer::VERSION)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION`';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(FolderPeer::VERSION_CREATED_AT)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(FolderPeer::VERSION_CREATED_BY)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`';
|
||||||
|
}
|
||||||
|
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'INSERT INTO `folder` (%s) VALUES (%s)',
|
'INSERT INTO `folder` (%s) VALUES (%s)',
|
||||||
@@ -883,6 +1115,15 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
case '`UPDATED_AT`':
|
case '`UPDATED_AT`':
|
||||||
$stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
|
$stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
|
||||||
break;
|
break;
|
||||||
|
case '`VERSION`':
|
||||||
|
$stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
|
||||||
|
break;
|
||||||
|
case '`VERSION_CREATED_AT`':
|
||||||
|
$stmt->bindValue($identifier, $this->version_created_at, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
|
case '`VERSION_CREATED_BY`':
|
||||||
|
$stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
@@ -1022,6 +1263,14 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->collFolderVersions !== null) {
|
||||||
|
foreach ($this->collFolderVersions as $referrerFK) {
|
||||||
|
if (!$referrerFK->validate($columns)) {
|
||||||
|
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
}
|
}
|
||||||
@@ -1078,6 +1327,15 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
case 6:
|
case 6:
|
||||||
return $this->getUpdatedAt();
|
return $this->getUpdatedAt();
|
||||||
break;
|
break;
|
||||||
|
case 7:
|
||||||
|
return $this->getVersion();
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
return $this->getVersionCreatedAt();
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
return $this->getVersionCreatedBy();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
break;
|
break;
|
||||||
@@ -1114,6 +1372,9 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
$keys[4] => $this->getPosition(),
|
$keys[4] => $this->getPosition(),
|
||||||
$keys[5] => $this->getCreatedAt(),
|
$keys[5] => $this->getCreatedAt(),
|
||||||
$keys[6] => $this->getUpdatedAt(),
|
$keys[6] => $this->getUpdatedAt(),
|
||||||
|
$keys[7] => $this->getVersion(),
|
||||||
|
$keys[8] => $this->getVersionCreatedAt(),
|
||||||
|
$keys[9] => $this->getVersionCreatedBy(),
|
||||||
);
|
);
|
||||||
if ($includeForeignObjects) {
|
if ($includeForeignObjects) {
|
||||||
if (null !== $this->collImages) {
|
if (null !== $this->collImages) {
|
||||||
@@ -1131,6 +1392,9 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
if (null !== $this->collFolderI18ns) {
|
if (null !== $this->collFolderI18ns) {
|
||||||
$result['FolderI18ns'] = $this->collFolderI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['FolderI18ns'] = $this->collFolderI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
|
if (null !== $this->collFolderVersions) {
|
||||||
|
$result['FolderVersions'] = $this->collFolderVersions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -1186,6 +1450,15 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
case 6:
|
case 6:
|
||||||
$this->setUpdatedAt($value);
|
$this->setUpdatedAt($value);
|
||||||
break;
|
break;
|
||||||
|
case 7:
|
||||||
|
$this->setVersion($value);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
$this->setVersionCreatedAt($value);
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
$this->setVersionCreatedBy($value);
|
||||||
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1217,6 +1490,9 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
|
||||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
||||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
||||||
|
if (array_key_exists($keys[7], $arr)) $this->setVersion($arr[$keys[7]]);
|
||||||
|
if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedAt($arr[$keys[8]]);
|
||||||
|
if (array_key_exists($keys[9], $arr)) $this->setVersionCreatedBy($arr[$keys[9]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1235,6 +1511,9 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
if ($this->isColumnModified(FolderPeer::POSITION)) $criteria->add(FolderPeer::POSITION, $this->position);
|
if ($this->isColumnModified(FolderPeer::POSITION)) $criteria->add(FolderPeer::POSITION, $this->position);
|
||||||
if ($this->isColumnModified(FolderPeer::CREATED_AT)) $criteria->add(FolderPeer::CREATED_AT, $this->created_at);
|
if ($this->isColumnModified(FolderPeer::CREATED_AT)) $criteria->add(FolderPeer::CREATED_AT, $this->created_at);
|
||||||
if ($this->isColumnModified(FolderPeer::UPDATED_AT)) $criteria->add(FolderPeer::UPDATED_AT, $this->updated_at);
|
if ($this->isColumnModified(FolderPeer::UPDATED_AT)) $criteria->add(FolderPeer::UPDATED_AT, $this->updated_at);
|
||||||
|
if ($this->isColumnModified(FolderPeer::VERSION)) $criteria->add(FolderPeer::VERSION, $this->version);
|
||||||
|
if ($this->isColumnModified(FolderPeer::VERSION_CREATED_AT)) $criteria->add(FolderPeer::VERSION_CREATED_AT, $this->version_created_at);
|
||||||
|
if ($this->isColumnModified(FolderPeer::VERSION_CREATED_BY)) $criteria->add(FolderPeer::VERSION_CREATED_BY, $this->version_created_by);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
@@ -1304,6 +1583,9 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
$copyObj->setPosition($this->getPosition());
|
$copyObj->setPosition($this->getPosition());
|
||||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||||
|
$copyObj->setVersion($this->getVersion());
|
||||||
|
$copyObj->setVersionCreatedAt($this->getVersionCreatedAt());
|
||||||
|
$copyObj->setVersionCreatedBy($this->getVersionCreatedBy());
|
||||||
|
|
||||||
if ($deepCopy && !$this->startCopy) {
|
if ($deepCopy && !$this->startCopy) {
|
||||||
// important: temporarily setNew(false) because this affects the behavior of
|
// important: temporarily setNew(false) because this affects the behavior of
|
||||||
@@ -1342,6 +1624,12 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->getFolderVersions() as $relObj) {
|
||||||
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
|
$copyObj->addFolderVersion($relObj->copy($deepCopy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//unflag object copy
|
//unflag object copy
|
||||||
$this->startCopy = false;
|
$this->startCopy = false;
|
||||||
} // if ($deepCopy)
|
} // if ($deepCopy)
|
||||||
@@ -1418,6 +1706,9 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
if ('FolderI18n' == $relationName) {
|
if ('FolderI18n' == $relationName) {
|
||||||
$this->initFolderI18ns();
|
$this->initFolderI18ns();
|
||||||
}
|
}
|
||||||
|
if ('FolderVersion' == $relationName) {
|
||||||
|
$this->initFolderVersions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2709,6 +3000,213 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears out the collFolderVersions 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 addFolderVersions()
|
||||||
|
*/
|
||||||
|
public function clearFolderVersions()
|
||||||
|
{
|
||||||
|
$this->collFolderVersions = null; // important to set this to null since that means it is uninitialized
|
||||||
|
$this->collFolderVersionsPartial = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reset is the collFolderVersions collection loaded partially
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function resetPartialFolderVersions($v = true)
|
||||||
|
{
|
||||||
|
$this->collFolderVersionsPartial = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the collFolderVersions collection.
|
||||||
|
*
|
||||||
|
* By default this just sets the collFolderVersions collection to an empty array (like clearcollFolderVersions());
|
||||||
|
* 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 initFolderVersions($overrideExisting = true)
|
||||||
|
{
|
||||||
|
if (null !== $this->collFolderVersions && !$overrideExisting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->collFolderVersions = new PropelObjectCollection();
|
||||||
|
$this->collFolderVersions->setModel('FolderVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an array of FolderVersion objects which contain a foreign key that references this object.
|
||||||
|
*
|
||||||
|
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||||
|
* Otherwise the results are fetched from the database the first time, then cached.
|
||||||
|
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||||
|
* If this Folder is new, it will return
|
||||||
|
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param PropelPDO $con optional connection object
|
||||||
|
* @return PropelObjectCollection|FolderVersion[] List of FolderVersion objects
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function getFolderVersions($criteria = null, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collFolderVersionsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collFolderVersions || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collFolderVersions) {
|
||||||
|
// return empty collection
|
||||||
|
$this->initFolderVersions();
|
||||||
|
} else {
|
||||||
|
$collFolderVersions = FolderVersionQuery::create(null, $criteria)
|
||||||
|
->filterByFolder($this)
|
||||||
|
->find($con);
|
||||||
|
if (null !== $criteria) {
|
||||||
|
if (false !== $this->collFolderVersionsPartial && count($collFolderVersions)) {
|
||||||
|
$this->initFolderVersions(false);
|
||||||
|
|
||||||
|
foreach($collFolderVersions as $obj) {
|
||||||
|
if (false == $this->collFolderVersions->contains($obj)) {
|
||||||
|
$this->collFolderVersions->append($obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collFolderVersionsPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $collFolderVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($partial && $this->collFolderVersions) {
|
||||||
|
foreach($this->collFolderVersions as $obj) {
|
||||||
|
if($obj->isNew()) {
|
||||||
|
$collFolderVersions[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collFolderVersions = $collFolderVersions;
|
||||||
|
$this->collFolderVersionsPartial = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->collFolderVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a collection of FolderVersion 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 $folderVersions A Propel collection.
|
||||||
|
* @param PropelPDO $con Optional connection object
|
||||||
|
*/
|
||||||
|
public function setFolderVersions(PropelCollection $folderVersions, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$this->folderVersionsScheduledForDeletion = $this->getFolderVersions(new Criteria(), $con)->diff($folderVersions);
|
||||||
|
|
||||||
|
foreach ($this->folderVersionsScheduledForDeletion as $folderVersionRemoved) {
|
||||||
|
$folderVersionRemoved->setFolder(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collFolderVersions = null;
|
||||||
|
foreach ($folderVersions as $folderVersion) {
|
||||||
|
$this->addFolderVersion($folderVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collFolderVersions = $folderVersions;
|
||||||
|
$this->collFolderVersionsPartial = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of related FolderVersion objects.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @return int Count of related FolderVersion objects.
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function countFolderVersions(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collFolderVersionsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collFolderVersions || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collFolderVersions) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
if($partial && !$criteria) {
|
||||||
|
return count($this->getFolderVersions());
|
||||||
|
}
|
||||||
|
$query = FolderVersionQuery::create(null, $criteria);
|
||||||
|
if ($distinct) {
|
||||||
|
$query->distinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query
|
||||||
|
->filterByFolder($this)
|
||||||
|
->count($con);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return count($this->collFolderVersions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called to associate a FolderVersion object to this object
|
||||||
|
* through the FolderVersion foreign key attribute.
|
||||||
|
*
|
||||||
|
* @param FolderVersion $l FolderVersion
|
||||||
|
* @return Folder The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function addFolderVersion(FolderVersion $l)
|
||||||
|
{
|
||||||
|
if ($this->collFolderVersions === null) {
|
||||||
|
$this->initFolderVersions();
|
||||||
|
$this->collFolderVersionsPartial = true;
|
||||||
|
}
|
||||||
|
if (!$this->collFolderVersions->contains($l)) { // only add it if the **same** object is not already associated
|
||||||
|
$this->doAddFolderVersion($l);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FolderVersion $folderVersion The folderVersion object to add.
|
||||||
|
*/
|
||||||
|
protected function doAddFolderVersion($folderVersion)
|
||||||
|
{
|
||||||
|
$this->collFolderVersions[]= $folderVersion;
|
||||||
|
$folderVersion->setFolder($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FolderVersion $folderVersion The folderVersion object to remove.
|
||||||
|
*/
|
||||||
|
public function removeFolderVersion($folderVersion)
|
||||||
|
{
|
||||||
|
if ($this->getFolderVersions()->contains($folderVersion)) {
|
||||||
|
$this->collFolderVersions->remove($this->collFolderVersions->search($folderVersion));
|
||||||
|
if (null === $this->folderVersionsScheduledForDeletion) {
|
||||||
|
$this->folderVersionsScheduledForDeletion = clone $this->collFolderVersions;
|
||||||
|
$this->folderVersionsScheduledForDeletion->clear();
|
||||||
|
}
|
||||||
|
$this->folderVersionsScheduledForDeletion[]= $folderVersion;
|
||||||
|
$folderVersion->setFolder(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the current object and sets all attributes to their default values
|
* Clears the current object and sets all attributes to their default values
|
||||||
*/
|
*/
|
||||||
@@ -2721,9 +3219,13 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
$this->position = null;
|
$this->position = null;
|
||||||
$this->created_at = null;
|
$this->created_at = null;
|
||||||
$this->updated_at = null;
|
$this->updated_at = null;
|
||||||
|
$this->version = null;
|
||||||
|
$this->version_created_at = null;
|
||||||
|
$this->version_created_by = null;
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
$this->clearAllReferences();
|
$this->clearAllReferences();
|
||||||
|
$this->applyDefaultValues();
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
$this->setNew(true);
|
$this->setNew(true);
|
||||||
$this->setDeleted(false);
|
$this->setDeleted(false);
|
||||||
@@ -2766,6 +3268,11 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->collFolderVersions) {
|
||||||
|
foreach ($this->collFolderVersions as $o) {
|
||||||
|
$o->clearAllReferences($deep);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // if ($deep)
|
} // if ($deep)
|
||||||
|
|
||||||
// i18n behavior
|
// i18n behavior
|
||||||
@@ -2792,6 +3299,10 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
$this->collFolderI18ns->clearIterator();
|
$this->collFolderI18ns->clearIterator();
|
||||||
}
|
}
|
||||||
$this->collFolderI18ns = null;
|
$this->collFolderI18ns = null;
|
||||||
|
if ($this->collFolderVersions instanceof PropelCollection) {
|
||||||
|
$this->collFolderVersions->clearIterator();
|
||||||
|
}
|
||||||
|
$this->collFolderVersions = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3023,4 +3534,297 @@ abstract class BaseFolder extends BaseObject implements Persistent
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enforce a new Version of this object upon next save.
|
||||||
|
*
|
||||||
|
* @return Folder
|
||||||
|
*/
|
||||||
|
public function enforceVersioning()
|
||||||
|
{
|
||||||
|
$this->enforceVersion = true;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current state must be recorded as a version
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con An optional PropelPDO connection to use.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isVersioningNecessary($con = null)
|
||||||
|
{
|
||||||
|
if ($this->alreadyInSave) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->enforceVersion) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FolderPeer::isVersioningEnabled() && ($this->isNew() || $this->isModified() || $this->isDeleted())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a version of the current object and saves it.
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return FolderVersion A version object
|
||||||
|
*/
|
||||||
|
public function addVersion($con = null)
|
||||||
|
{
|
||||||
|
$this->enforceVersion = false;
|
||||||
|
|
||||||
|
$version = new FolderVersion();
|
||||||
|
$version->setId($this->getId());
|
||||||
|
$version->setParent($this->getParent());
|
||||||
|
$version->setLink($this->getLink());
|
||||||
|
$version->setVisible($this->getVisible());
|
||||||
|
$version->setPosition($this->getPosition());
|
||||||
|
$version->setCreatedAt($this->getCreatedAt());
|
||||||
|
$version->setUpdatedAt($this->getUpdatedAt());
|
||||||
|
$version->setVersion($this->getVersion());
|
||||||
|
$version->setVersionCreatedAt($this->getVersionCreatedAt());
|
||||||
|
$version->setVersionCreatedBy($this->getVersionCreatedBy());
|
||||||
|
$version->setFolder($this);
|
||||||
|
$version->save($con);
|
||||||
|
|
||||||
|
return $version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the properties of the curent object to the value they had at a specific version
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber The version number to read
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return Folder The current object (for fluent API support)
|
||||||
|
* @throws PropelException - if no object with the given version can be found.
|
||||||
|
*/
|
||||||
|
public function toVersion($versionNumber, $con = null)
|
||||||
|
{
|
||||||
|
$version = $this->getOneVersion($versionNumber, $con);
|
||||||
|
if (!$version) {
|
||||||
|
throw new PropelException(sprintf('No Folder object found with version %d', $version));
|
||||||
|
}
|
||||||
|
$this->populateFromVersion($version, $con);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the properties of the curent object to the value they had at a specific version
|
||||||
|
*
|
||||||
|
* @param FolderVersion $version The version object to use
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $loadedObjects objects thats been loaded in a chain of populateFromVersion calls on referrer or fk objects.
|
||||||
|
*
|
||||||
|
* @return Folder The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function populateFromVersion($version, $con = null, &$loadedObjects = array())
|
||||||
|
{
|
||||||
|
|
||||||
|
$loadedObjects['Folder'][$version->getId()][$version->getVersion()] = $this;
|
||||||
|
$this->setId($version->getId());
|
||||||
|
$this->setParent($version->getParent());
|
||||||
|
$this->setLink($version->getLink());
|
||||||
|
$this->setVisible($version->getVisible());
|
||||||
|
$this->setPosition($version->getPosition());
|
||||||
|
$this->setCreatedAt($version->getCreatedAt());
|
||||||
|
$this->setUpdatedAt($version->getUpdatedAt());
|
||||||
|
$this->setVersion($version->getVersion());
|
||||||
|
$this->setVersionCreatedAt($version->getVersionCreatedAt());
|
||||||
|
$this->setVersionCreatedBy($version->getVersionCreatedBy());
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the latest persisted version number for the current object
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getLastVersionNumber($con = null)
|
||||||
|
{
|
||||||
|
$v = FolderVersionQuery::create()
|
||||||
|
->filterByFolder($this)
|
||||||
|
->orderByVersion('desc')
|
||||||
|
->findOne($con);
|
||||||
|
if (!$v) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $v->getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current object is the latest one
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isLastVersion($con = null)
|
||||||
|
{
|
||||||
|
return $this->getLastVersionNumber($con) == $this->getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a version object for this entity and a version number
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber The version number to read
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return FolderVersion A version object
|
||||||
|
*/
|
||||||
|
public function getOneVersion($versionNumber, $con = null)
|
||||||
|
{
|
||||||
|
return FolderVersionQuery::create()
|
||||||
|
->filterByFolder($this)
|
||||||
|
->filterByVersion($versionNumber)
|
||||||
|
->findOne($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all the versions of this object, in incremental order
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return PropelObjectCollection A list of FolderVersion objects
|
||||||
|
*/
|
||||||
|
public function getAllVersions($con = null)
|
||||||
|
{
|
||||||
|
$criteria = new Criteria();
|
||||||
|
$criteria->addAscendingOrderByColumn(FolderVersionPeer::VERSION);
|
||||||
|
|
||||||
|
return $this->getFolderVersions($criteria, $con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the current object with another of its version.
|
||||||
|
* <code>
|
||||||
|
* print_r($book->compareVersion(1));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns)
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
public function compareVersion($versionNumber, $keys = 'columns', $con = null, $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersion = $this->toArray();
|
||||||
|
$toVersion = $this->getOneVersion($versionNumber, $con)->toArray();
|
||||||
|
|
||||||
|
return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares two versions of the current object.
|
||||||
|
* <code>
|
||||||
|
* print_r($book->compareVersions(1, 2));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param integer $fromVersionNumber
|
||||||
|
* @param integer $toVersionNumber
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns)
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
public function compareVersions($fromVersionNumber, $toVersionNumber, $keys = 'columns', $con = null, $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersion = $this->getOneVersion($fromVersionNumber, $con)->toArray();
|
||||||
|
$toVersion = $this->getOneVersion($toVersionNumber, $con)->toArray();
|
||||||
|
|
||||||
|
return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes the diff between two versions.
|
||||||
|
* <code>
|
||||||
|
* print_r($this->computeDiff(1, 2));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param array $fromVersion An array representing the original version.
|
||||||
|
* @param array $toVersion An array representing the destination version.
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns).
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
protected function computeDiff($fromVersion, $toVersion, $keys = 'columns', $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersionNumber = $fromVersion['Version'];
|
||||||
|
$toVersionNumber = $toVersion['Version'];
|
||||||
|
$ignoredColumns = array_merge(array(
|
||||||
|
'Version',
|
||||||
|
'VersionCreatedAt',
|
||||||
|
'VersionCreatedBy',
|
||||||
|
), $ignoredColumns);
|
||||||
|
$diff = array();
|
||||||
|
foreach ($fromVersion as $key => $value) {
|
||||||
|
if (in_array($key, $ignoredColumns)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($toVersion[$key] != $value) {
|
||||||
|
switch ($keys) {
|
||||||
|
case 'versions':
|
||||||
|
$diff[$fromVersionNumber][$key] = $value;
|
||||||
|
$diff[$toVersionNumber][$key] = $toVersion[$key];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$diff[$key] = array(
|
||||||
|
$fromVersionNumber => $value,
|
||||||
|
$toVersionNumber => $toVersion[$key],
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $diff;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* retrieve the last $number versions.
|
||||||
|
*
|
||||||
|
* @param integer $number the number of record to return.
|
||||||
|
* @param FolderVersionQuery|Criteria $criteria Additional criteria to filter.
|
||||||
|
* @param PropelPDO $con An optional connection to use.
|
||||||
|
*
|
||||||
|
* @return PropelCollection|FolderVersion[] List of FolderVersion objects
|
||||||
|
*/
|
||||||
|
public function getLastVersions($number = 10, $criteria = null, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$criteria = FolderVersionQuery::create(null, $criteria);
|
||||||
|
$criteria->addDescendingOrderByColumn(FolderVersionPeer::VERSION);
|
||||||
|
$criteria->limit($number);
|
||||||
|
|
||||||
|
return $this->getFolderVersions($criteria, $con);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use Thelia\Model\DocumentPeer;
|
|||||||
use Thelia\Model\Folder;
|
use Thelia\Model\Folder;
|
||||||
use Thelia\Model\FolderI18nPeer;
|
use Thelia\Model\FolderI18nPeer;
|
||||||
use Thelia\Model\FolderPeer;
|
use Thelia\Model\FolderPeer;
|
||||||
|
use Thelia\Model\FolderVersionPeer;
|
||||||
use Thelia\Model\ImagePeer;
|
use Thelia\Model\ImagePeer;
|
||||||
use Thelia\Model\RewritingPeer;
|
use Thelia\Model\RewritingPeer;
|
||||||
use Thelia\Model\map\FolderTableMap;
|
use Thelia\Model\map\FolderTableMap;
|
||||||
@@ -41,13 +42,13 @@ abstract class BaseFolderPeer
|
|||||||
const TM_CLASS = 'FolderTableMap';
|
const TM_CLASS = 'FolderTableMap';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 7;
|
const NUM_COLUMNS = 10;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
||||||
const NUM_HYDRATE_COLUMNS = 7;
|
const NUM_HYDRATE_COLUMNS = 10;
|
||||||
|
|
||||||
/** the column name for the ID field */
|
/** the column name for the ID field */
|
||||||
const ID = 'folder.ID';
|
const ID = 'folder.ID';
|
||||||
@@ -70,6 +71,15 @@ abstract class BaseFolderPeer
|
|||||||
/** the column name for the UPDATED_AT field */
|
/** the column name for the UPDATED_AT field */
|
||||||
const UPDATED_AT = 'folder.UPDATED_AT';
|
const UPDATED_AT = 'folder.UPDATED_AT';
|
||||||
|
|
||||||
|
/** the column name for the VERSION field */
|
||||||
|
const VERSION = 'folder.VERSION';
|
||||||
|
|
||||||
|
/** the column name for the VERSION_CREATED_AT field */
|
||||||
|
const VERSION_CREATED_AT = 'folder.VERSION_CREATED_AT';
|
||||||
|
|
||||||
|
/** the column name for the VERSION_CREATED_BY field */
|
||||||
|
const VERSION_CREATED_BY = 'folder.VERSION_CREATED_BY';
|
||||||
|
|
||||||
/** The default string format for model objects of the related table **/
|
/** The default string format for model objects of the related table **/
|
||||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||||
|
|
||||||
@@ -89,6 +99,13 @@ abstract class BaseFolderPeer
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const DEFAULT_LOCALE = 'en_EN';
|
const DEFAULT_LOCALE = 'en_EN';
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the versioning is enabled
|
||||||
|
*/
|
||||||
|
static $isVersioningEnabled = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* holds an array of fieldnames
|
* holds an array of fieldnames
|
||||||
*
|
*
|
||||||
@@ -96,12 +113,12 @@ abstract class BaseFolderPeer
|
|||||||
* e.g. FolderPeer::$fieldNames[FolderPeer::TYPE_PHPNAME][0] = 'Id'
|
* e.g. FolderPeer::$fieldNames[FolderPeer::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
protected static $fieldNames = array (
|
protected static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('Id', 'Parent', 'Link', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', ),
|
BasePeer::TYPE_PHPNAME => array ('Id', 'Parent', 'Link', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'parent', 'link', 'visible', 'position', 'createdAt', 'updatedAt', ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'parent', 'link', 'visible', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
|
||||||
BasePeer::TYPE_COLNAME => array (FolderPeer::ID, FolderPeer::PARENT, FolderPeer::LINK, FolderPeer::VISIBLE, FolderPeer::POSITION, FolderPeer::CREATED_AT, FolderPeer::UPDATED_AT, ),
|
BasePeer::TYPE_COLNAME => array (FolderPeer::ID, FolderPeer::PARENT, FolderPeer::LINK, FolderPeer::VISIBLE, FolderPeer::POSITION, FolderPeer::CREATED_AT, FolderPeer::UPDATED_AT, FolderPeer::VERSION, FolderPeer::VERSION_CREATED_AT, FolderPeer::VERSION_CREATED_BY, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PARENT', 'LINK', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PARENT', 'LINK', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id', 'parent', 'link', 'visible', 'position', 'created_at', 'updated_at', ),
|
BasePeer::TYPE_FIELDNAME => array ('id', 'parent', 'link', 'visible', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,12 +128,12 @@ abstract class BaseFolderPeer
|
|||||||
* e.g. FolderPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
* e.g. FolderPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
protected static $fieldKeys = array (
|
protected static $fieldKeys = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Parent' => 1, 'Link' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
|
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Parent' => 1, 'Link' => 2, 'Visible' => 3, 'Position' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, 'Version' => 7, 'VersionCreatedAt' => 8, 'VersionCreatedBy' => 9, ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'createdAt' => 5, 'updatedAt' => 6, 'version' => 7, 'versionCreatedAt' => 8, 'versionCreatedBy' => 9, ),
|
||||||
BasePeer::TYPE_COLNAME => array (FolderPeer::ID => 0, FolderPeer::PARENT => 1, FolderPeer::LINK => 2, FolderPeer::VISIBLE => 3, FolderPeer::POSITION => 4, FolderPeer::CREATED_AT => 5, FolderPeer::UPDATED_AT => 6, ),
|
BasePeer::TYPE_COLNAME => array (FolderPeer::ID => 0, FolderPeer::PARENT => 1, FolderPeer::LINK => 2, FolderPeer::VISIBLE => 3, FolderPeer::POSITION => 4, FolderPeer::CREATED_AT => 5, FolderPeer::UPDATED_AT => 6, FolderPeer::VERSION => 7, FolderPeer::VERSION_CREATED_AT => 8, FolderPeer::VERSION_CREATED_BY => 9, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PARENT' => 1, 'LINK' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PARENT' => 1, 'LINK' => 2, 'VISIBLE' => 3, 'POSITION' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, 'VERSION' => 7, 'VERSION_CREATED_AT' => 8, 'VERSION_CREATED_BY' => 9, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, ),
|
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'parent' => 1, 'link' => 2, 'visible' => 3, 'position' => 4, 'created_at' => 5, 'updated_at' => 6, 'version' => 7, 'version_created_at' => 8, 'version_created_by' => 9, ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -197,6 +214,9 @@ abstract class BaseFolderPeer
|
|||||||
$criteria->addSelectColumn(FolderPeer::POSITION);
|
$criteria->addSelectColumn(FolderPeer::POSITION);
|
||||||
$criteria->addSelectColumn(FolderPeer::CREATED_AT);
|
$criteria->addSelectColumn(FolderPeer::CREATED_AT);
|
||||||
$criteria->addSelectColumn(FolderPeer::UPDATED_AT);
|
$criteria->addSelectColumn(FolderPeer::UPDATED_AT);
|
||||||
|
$criteria->addSelectColumn(FolderPeer::VERSION);
|
||||||
|
$criteria->addSelectColumn(FolderPeer::VERSION_CREATED_AT);
|
||||||
|
$criteria->addSelectColumn(FolderPeer::VERSION_CREATED_BY);
|
||||||
} else {
|
} else {
|
||||||
$criteria->addSelectColumn($alias . '.ID');
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
$criteria->addSelectColumn($alias . '.PARENT');
|
$criteria->addSelectColumn($alias . '.PARENT');
|
||||||
@@ -205,6 +225,9 @@ abstract class BaseFolderPeer
|
|||||||
$criteria->addSelectColumn($alias . '.POSITION');
|
$criteria->addSelectColumn($alias . '.POSITION');
|
||||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION_CREATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION_CREATED_BY');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,6 +442,9 @@ abstract class BaseFolderPeer
|
|||||||
// Invalidate objects in FolderI18nPeer instance pool,
|
// Invalidate objects in FolderI18nPeer instance pool,
|
||||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
FolderI18nPeer::clearInstancePool();
|
FolderI18nPeer::clearInstancePool();
|
||||||
|
// Invalidate objects in FolderVersionPeer instance pool,
|
||||||
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
|
FolderVersionPeer::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -812,6 +838,34 @@ abstract class BaseFolderPeer
|
|||||||
return $objs;
|
return $objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether versioning is enabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function isVersioningEnabled()
|
||||||
|
{
|
||||||
|
return self::$isVersioningEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables versioning
|
||||||
|
*/
|
||||||
|
public static function enableVersioning()
|
||||||
|
{
|
||||||
|
self::$isVersioningEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables versioning
|
||||||
|
*/
|
||||||
|
public static function disableVersioning()
|
||||||
|
{
|
||||||
|
self::$isVersioningEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
} // BaseFolderPeer
|
} // BaseFolderPeer
|
||||||
|
|
||||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ use Thelia\Model\Folder;
|
|||||||
use Thelia\Model\FolderI18n;
|
use Thelia\Model\FolderI18n;
|
||||||
use Thelia\Model\FolderPeer;
|
use Thelia\Model\FolderPeer;
|
||||||
use Thelia\Model\FolderQuery;
|
use Thelia\Model\FolderQuery;
|
||||||
|
use Thelia\Model\FolderVersion;
|
||||||
use Thelia\Model\Image;
|
use Thelia\Model\Image;
|
||||||
use Thelia\Model\Rewriting;
|
use Thelia\Model\Rewriting;
|
||||||
|
|
||||||
@@ -33,6 +34,9 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method FolderQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
* @method FolderQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||||
* @method FolderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
* @method FolderQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
* @method FolderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
* @method FolderQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
|
* @method FolderQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||||
|
* @method FolderQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
||||||
|
* @method FolderQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method FolderQuery groupById() Group by the id column
|
* @method FolderQuery groupById() Group by the id column
|
||||||
* @method FolderQuery groupByParent() Group by the parent column
|
* @method FolderQuery groupByParent() Group by the parent column
|
||||||
@@ -41,6 +45,9 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method FolderQuery groupByPosition() Group by the position column
|
* @method FolderQuery groupByPosition() Group by the position column
|
||||||
* @method FolderQuery groupByCreatedAt() Group by the created_at column
|
* @method FolderQuery groupByCreatedAt() Group by the created_at column
|
||||||
* @method FolderQuery groupByUpdatedAt() Group by the updated_at column
|
* @method FolderQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
|
* @method FolderQuery groupByVersion() Group by the version column
|
||||||
|
* @method FolderQuery groupByVersionCreatedAt() Group by the version_created_at column
|
||||||
|
* @method FolderQuery groupByVersionCreatedBy() Group by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method FolderQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
* @method FolderQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
* @method FolderQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
* @method FolderQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
@@ -66,6 +73,10 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method FolderQuery rightJoinFolderI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FolderI18n relation
|
* @method FolderQuery rightJoinFolderI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FolderI18n relation
|
||||||
* @method FolderQuery innerJoinFolderI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the FolderI18n relation
|
* @method FolderQuery innerJoinFolderI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the FolderI18n relation
|
||||||
*
|
*
|
||||||
|
* @method FolderQuery leftJoinFolderVersion($relationAlias = null) Adds a LEFT JOIN clause to the query using the FolderVersion relation
|
||||||
|
* @method FolderQuery rightJoinFolderVersion($relationAlias = null) Adds a RIGHT JOIN clause to the query using the FolderVersion relation
|
||||||
|
* @method FolderQuery innerJoinFolderVersion($relationAlias = null) Adds a INNER JOIN clause to the query using the FolderVersion relation
|
||||||
|
*
|
||||||
* @method Folder findOne(PropelPDO $con = null) Return the first Folder matching the query
|
* @method Folder findOne(PropelPDO $con = null) Return the first Folder matching the query
|
||||||
* @method Folder findOneOrCreate(PropelPDO $con = null) Return the first Folder matching the query, or a new Folder object populated from the query conditions when no match is found
|
* @method Folder findOneOrCreate(PropelPDO $con = null) Return the first Folder matching the query, or a new Folder object populated from the query conditions when no match is found
|
||||||
*
|
*
|
||||||
@@ -76,6 +87,9 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method Folder findOneByPosition(int $position) Return the first Folder filtered by the position column
|
* @method Folder findOneByPosition(int $position) Return the first Folder filtered by the position column
|
||||||
* @method Folder findOneByCreatedAt(string $created_at) Return the first Folder filtered by the created_at column
|
* @method Folder findOneByCreatedAt(string $created_at) Return the first Folder filtered by the created_at column
|
||||||
* @method Folder findOneByUpdatedAt(string $updated_at) Return the first Folder filtered by the updated_at column
|
* @method Folder findOneByUpdatedAt(string $updated_at) Return the first Folder filtered by the updated_at column
|
||||||
|
* @method Folder findOneByVersion(int $version) Return the first Folder filtered by the version column
|
||||||
|
* @method Folder findOneByVersionCreatedAt(string $version_created_at) Return the first Folder filtered by the version_created_at column
|
||||||
|
* @method Folder findOneByVersionCreatedBy(string $version_created_by) Return the first Folder filtered by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method array findById(int $id) Return Folder objects filtered by the id column
|
* @method array findById(int $id) Return Folder objects filtered by the id column
|
||||||
* @method array findByParent(int $parent) Return Folder objects filtered by the parent column
|
* @method array findByParent(int $parent) Return Folder objects filtered by the parent column
|
||||||
@@ -84,6 +98,9 @@ use Thelia\Model\Rewriting;
|
|||||||
* @method array findByPosition(int $position) Return Folder objects filtered by the position column
|
* @method array findByPosition(int $position) Return Folder objects filtered by the position column
|
||||||
* @method array findByCreatedAt(string $created_at) Return Folder objects filtered by the created_at column
|
* @method array findByCreatedAt(string $created_at) Return Folder objects filtered by the created_at column
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return Folder objects filtered by the updated_at column
|
* @method array findByUpdatedAt(string $updated_at) Return Folder objects filtered by the updated_at column
|
||||||
|
* @method array findByVersion(int $version) Return Folder objects filtered by the version column
|
||||||
|
* @method array findByVersionCreatedAt(string $version_created_at) Return Folder objects filtered by the version_created_at column
|
||||||
|
* @method array findByVersionCreatedBy(string $version_created_by) Return Folder objects filtered by the version_created_by column
|
||||||
*
|
*
|
||||||
* @package propel.generator.Thelia.Model.om
|
* @package propel.generator.Thelia.Model.om
|
||||||
*/
|
*/
|
||||||
@@ -173,7 +190,7 @@ abstract class BaseFolderQuery extends ModelCriteria
|
|||||||
*/
|
*/
|
||||||
protected function findPkSimple($key, $con)
|
protected function findPkSimple($key, $con)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT `ID`, `PARENT`, `LINK`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `folder` WHERE `ID` = :p0';
|
$sql = 'SELECT `ID`, `PARENT`, `LINK`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `folder` WHERE `ID` = :p0';
|
||||||
try {
|
try {
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||||
@@ -527,6 +544,119 @@ abstract class BaseFolderQuery extends ModelCriteria
|
|||||||
return $this->addUsingAlias(FolderPeer::UPDATED_AT, $updatedAt, $comparison);
|
return $this->addUsingAlias(FolderPeer::UPDATED_AT, $updatedAt, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersion(1234); // WHERE version = 1234
|
||||||
|
* $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
|
||||||
|
* $query->filterByVersion(array('min' => 12)); // WHERE version > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $version The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersion($version = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($version)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($version['min'])) {
|
||||||
|
$this->addUsingAlias(FolderPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($version['max'])) {
|
||||||
|
$this->addUsingAlias(FolderPeer::VERSION, $version['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderPeer::VERSION, $version, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $versionCreatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($versionCreatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($versionCreatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(FolderPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($versionCreatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(FolderPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_by column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
||||||
|
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $versionCreatedBy The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($versionCreatedBy)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
|
||||||
|
$versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related Image object
|
* Filter the query by a related Image object
|
||||||
*
|
*
|
||||||
@@ -897,6 +1027,80 @@ abstract class BaseFolderQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'FolderI18n', '\Thelia\Model\FolderI18nQuery');
|
->useQuery($relationAlias ? $relationAlias : 'FolderI18n', '\Thelia\Model\FolderI18nQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related FolderVersion object
|
||||||
|
*
|
||||||
|
* @param FolderVersion|PropelObjectCollection $folderVersion the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderQuery The current query, for fluid interface
|
||||||
|
* @throws PropelException - if the provided filter is invalid.
|
||||||
|
*/
|
||||||
|
public function filterByFolderVersion($folderVersion, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($folderVersion instanceof FolderVersion) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(FolderPeer::ID, $folderVersion->getId(), $comparison);
|
||||||
|
} elseif ($folderVersion instanceof PropelObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useFolderVersionQuery()
|
||||||
|
->filterByPrimaryKeys($folderVersion->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByFolderVersion() only accepts arguments of type FolderVersion or PropelCollection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the FolderVersion relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return FolderQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinFolderVersion($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('FolderVersion');
|
||||||
|
|
||||||
|
// 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, 'FolderVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the FolderVersion relation FolderVersion 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\FolderVersionQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useFolderVersionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinFolderVersion($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'FolderVersion', '\Thelia\Model\FolderVersionQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
|
|||||||
1482
core/lib/Thelia/Model/om/BaseFolderVersion.php
Normal file
1482
core/lib/Thelia/Model/om/BaseFolderVersion.php
Normal file
File diff suppressed because it is too large
Load Diff
1029
core/lib/Thelia/Model/om/BaseFolderVersionPeer.php
Normal file
1029
core/lib/Thelia/Model/om/BaseFolderVersionPeer.php
Normal file
File diff suppressed because it is too large
Load Diff
730
core/lib/Thelia/Model/om/BaseFolderVersionQuery.php
Normal file
730
core/lib/Thelia/Model/om/BaseFolderVersionQuery.php
Normal file
@@ -0,0 +1,730 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\om;
|
||||||
|
|
||||||
|
use \Criteria;
|
||||||
|
use \Exception;
|
||||||
|
use \ModelCriteria;
|
||||||
|
use \ModelJoin;
|
||||||
|
use \PDO;
|
||||||
|
use \Propel;
|
||||||
|
use \PropelCollection;
|
||||||
|
use \PropelException;
|
||||||
|
use \PropelObjectCollection;
|
||||||
|
use \PropelPDO;
|
||||||
|
use Thelia\Model\Folder;
|
||||||
|
use Thelia\Model\FolderVersion;
|
||||||
|
use Thelia\Model\FolderVersionPeer;
|
||||||
|
use Thelia\Model\FolderVersionQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'folder_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method FolderVersionQuery orderById($order = Criteria::ASC) Order by the id column
|
||||||
|
* @method FolderVersionQuery orderByParent($order = Criteria::ASC) Order by the parent column
|
||||||
|
* @method FolderVersionQuery orderByLink($order = Criteria::ASC) Order by the link column
|
||||||
|
* @method FolderVersionQuery orderByVisible($order = Criteria::ASC) Order by the visible column
|
||||||
|
* @method FolderVersionQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||||
|
* @method FolderVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
|
* @method FolderVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
|
* @method FolderVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||||
|
* @method FolderVersionQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
||||||
|
* @method FolderVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
||||||
|
*
|
||||||
|
* @method FolderVersionQuery groupById() Group by the id column
|
||||||
|
* @method FolderVersionQuery groupByParent() Group by the parent column
|
||||||
|
* @method FolderVersionQuery groupByLink() Group by the link column
|
||||||
|
* @method FolderVersionQuery groupByVisible() Group by the visible column
|
||||||
|
* @method FolderVersionQuery groupByPosition() Group by the position column
|
||||||
|
* @method FolderVersionQuery groupByCreatedAt() Group by the created_at column
|
||||||
|
* @method FolderVersionQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
|
* @method FolderVersionQuery groupByVersion() Group by the version column
|
||||||
|
* @method FolderVersionQuery groupByVersionCreatedAt() Group by the version_created_at column
|
||||||
|
* @method FolderVersionQuery groupByVersionCreatedBy() Group by the version_created_by column
|
||||||
|
*
|
||||||
|
* @method FolderVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method FolderVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method FolderVersionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method FolderVersionQuery leftJoinFolder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Folder relation
|
||||||
|
* @method FolderVersionQuery rightJoinFolder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Folder relation
|
||||||
|
* @method FolderVersionQuery innerJoinFolder($relationAlias = null) Adds a INNER JOIN clause to the query using the Folder relation
|
||||||
|
*
|
||||||
|
* @method FolderVersion findOne(PropelPDO $con = null) Return the first FolderVersion matching the query
|
||||||
|
* @method FolderVersion findOneOrCreate(PropelPDO $con = null) Return the first FolderVersion matching the query, or a new FolderVersion object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method FolderVersion findOneById(int $id) Return the first FolderVersion filtered by the id column
|
||||||
|
* @method FolderVersion findOneByParent(int $parent) Return the first FolderVersion filtered by the parent column
|
||||||
|
* @method FolderVersion findOneByLink(string $link) Return the first FolderVersion filtered by the link column
|
||||||
|
* @method FolderVersion findOneByVisible(int $visible) Return the first FolderVersion filtered by the visible column
|
||||||
|
* @method FolderVersion findOneByPosition(int $position) Return the first FolderVersion filtered by the position column
|
||||||
|
* @method FolderVersion findOneByCreatedAt(string $created_at) Return the first FolderVersion filtered by the created_at column
|
||||||
|
* @method FolderVersion findOneByUpdatedAt(string $updated_at) Return the first FolderVersion filtered by the updated_at column
|
||||||
|
* @method FolderVersion findOneByVersion(int $version) Return the first FolderVersion filtered by the version column
|
||||||
|
* @method FolderVersion findOneByVersionCreatedAt(string $version_created_at) Return the first FolderVersion filtered by the version_created_at column
|
||||||
|
* @method FolderVersion findOneByVersionCreatedBy(string $version_created_by) Return the first FolderVersion filtered by the version_created_by column
|
||||||
|
*
|
||||||
|
* @method array findById(int $id) Return FolderVersion objects filtered by the id column
|
||||||
|
* @method array findByParent(int $parent) Return FolderVersion objects filtered by the parent column
|
||||||
|
* @method array findByLink(string $link) Return FolderVersion objects filtered by the link column
|
||||||
|
* @method array findByVisible(int $visible) Return FolderVersion objects filtered by the visible column
|
||||||
|
* @method array findByPosition(int $position) Return FolderVersion objects filtered by the position column
|
||||||
|
* @method array findByCreatedAt(string $created_at) Return FolderVersion objects filtered by the created_at column
|
||||||
|
* @method array findByUpdatedAt(string $updated_at) Return FolderVersion objects filtered by the updated_at column
|
||||||
|
* @method array findByVersion(int $version) Return FolderVersion objects filtered by the version column
|
||||||
|
* @method array findByVersionCreatedAt(string $version_created_at) Return FolderVersion objects filtered by the version_created_at column
|
||||||
|
* @method array findByVersionCreatedBy(string $version_created_by) Return FolderVersion objects filtered by the version_created_by column
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model.om
|
||||||
|
*/
|
||||||
|
abstract class BaseFolderVersionQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseFolderVersionQuery object.
|
||||||
|
*
|
||||||
|
* @param string $dbName The dabase name
|
||||||
|
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||||
|
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||||
|
*/
|
||||||
|
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\FolderVersion', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new FolderVersionQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param FolderVersionQuery|Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof FolderVersionQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new FolderVersionQuery();
|
||||||
|
if (null !== $modelAlias) {
|
||||||
|
$query->setModelAlias($modelAlias);
|
||||||
|
}
|
||||||
|
if ($criteria instanceof Criteria) {
|
||||||
|
$query->mergeWith($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
* Propel uses the instance pool to skip the database if the object exists.
|
||||||
|
* Go fast if the query is untouched.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* $obj = $c->findPk(array(12, 34), $con);
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param array $key Primary key to use for the query
|
||||||
|
A Primary key composition: [$id, $version]
|
||||||
|
* @param PropelPDO $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return FolderVersion|FolderVersion[]|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPk($key, $con = null)
|
||||||
|
{
|
||||||
|
if ($key === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((null !== ($obj = FolderVersionPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
|
||||||
|
// the object is alredy in the instance pool
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(FolderVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||||
|
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||||
|
|| $this->map || $this->having || $this->joins) {
|
||||||
|
return $this->findPkComplex($key, $con);
|
||||||
|
} else {
|
||||||
|
return $this->findPkSimple($key, $con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key using raw SQL to go fast.
|
||||||
|
* Bypass doSelect() and the object formatter by using generated code.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param PropelPDO $con A connection object
|
||||||
|
*
|
||||||
|
* @return FolderVersion A model object, or null if the key is not found
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
protected function findPkSimple($key, $con)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT `ID`, `PARENT`, `LINK`, `VISIBLE`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `folder_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
|
||||||
|
try {
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||||
|
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||||
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
|
||||||
|
}
|
||||||
|
$obj = null;
|
||||||
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$obj = new FolderVersion();
|
||||||
|
$obj->hydrate($row);
|
||||||
|
FolderVersionPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param PropelPDO $con A connection object
|
||||||
|
*
|
||||||
|
* @return FolderVersion|FolderVersion[]|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
protected function findPkComplex($key, $con)
|
||||||
|
{
|
||||||
|
// As the query uses a PK condition, no limit(1) is necessary.
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$stmt = $criteria
|
||||||
|
->filterByPrimaryKey($key)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find objects by primary key
|
||||||
|
* <code>
|
||||||
|
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
||||||
|
* </code>
|
||||||
|
* @param array $keys Primary keys to use for the query
|
||||||
|
* @param PropelPDO $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return PropelObjectCollection|FolderVersion[]|mixed the list of results, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPks($keys, $con = null)
|
||||||
|
{
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$stmt = $criteria
|
||||||
|
->filterByPrimaryKeys($keys)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->format($stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by primary key
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKey($key)
|
||||||
|
{
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::ID, $key[0], Criteria::EQUAL);
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::VERSION, $key[1], Criteria::EQUAL);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a list of primary keys
|
||||||
|
*
|
||||||
|
* @param array $keys The list of primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKeys($keys)
|
||||||
|
{
|
||||||
|
if (empty($keys)) {
|
||||||
|
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||||
|
}
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$cton0 = $this->getNewCriterion(FolderVersionPeer::ID, $key[0], Criteria::EQUAL);
|
||||||
|
$cton1 = $this->getNewCriterion(FolderVersionPeer::VERSION, $key[1], Criteria::EQUAL);
|
||||||
|
$cton0->addAnd($cton1);
|
||||||
|
$this->addOr($cton0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterById(1234); // WHERE id = 1234
|
||||||
|
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||||
|
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @see filterByFolder()
|
||||||
|
*
|
||||||
|
* @param mixed $id The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterById($id = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($id) && null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderVersionPeer::ID, $id, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the parent column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByParent(1234); // WHERE parent = 1234
|
||||||
|
* $query->filterByParent(array(12, 34)); // WHERE parent IN (12, 34)
|
||||||
|
* $query->filterByParent(array('min' => 12)); // WHERE parent > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $parent The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByParent($parent = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($parent)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($parent['min'])) {
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::PARENT, $parent['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($parent['max'])) {
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::PARENT, $parent['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderVersionPeer::PARENT, $parent, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the link column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByLink('fooValue'); // WHERE link = 'fooValue'
|
||||||
|
* $query->filterByLink('%fooValue%'); // WHERE link LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $link The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByLink($link = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($link)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $link)) {
|
||||||
|
$link = str_replace('*', '%', $link);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderVersionPeer::LINK, $link, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the visible column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVisible(1234); // WHERE visible = 1234
|
||||||
|
* $query->filterByVisible(array(12, 34)); // WHERE visible IN (12, 34)
|
||||||
|
* $query->filterByVisible(array('min' => 12)); // WHERE visible > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $visible The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVisible($visible = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($visible)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($visible['min'])) {
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::VISIBLE, $visible['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($visible['max'])) {
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::VISIBLE, $visible['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderVersionPeer::VISIBLE, $visible, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the position column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByPosition(1234); // WHERE position = 1234
|
||||||
|
* $query->filterByPosition(array(12, 34)); // WHERE position IN (12, 34)
|
||||||
|
* $query->filterByPosition(array('min' => 12)); // WHERE position > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $position The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPosition($position = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($position)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($position['min'])) {
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::POSITION, $position['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($position['max'])) {
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::POSITION, $position['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderVersionPeer::POSITION, $position, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||||
|
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||||
|
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $createdAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($createdAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($createdAt['min'])) {
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($createdAt['max'])) {
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderVersionPeer::CREATED_AT, $createdAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the updated_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||||
|
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||||
|
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $updatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($updatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($updatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($updatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderVersionPeer::UPDATED_AT, $updatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersion(1234); // WHERE version = 1234
|
||||||
|
* $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
|
||||||
|
* $query->filterByVersion(array('min' => 12)); // WHERE version > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $version The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersion($version = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($version) && null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderVersionPeer::VERSION, $version, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $versionCreatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($versionCreatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($versionCreatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($versionCreatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(FolderVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderVersionPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_by column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
||||||
|
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $versionCreatedBy The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($versionCreatedBy)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
|
||||||
|
$versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(FolderVersionPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related Folder object
|
||||||
|
*
|
||||||
|
* @param Folder|PropelObjectCollection $folder The related object(s) to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
* @throws PropelException - if the provided filter is invalid.
|
||||||
|
*/
|
||||||
|
public function filterByFolder($folder, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($folder instanceof Folder) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(FolderVersionPeer::ID, $folder->getId(), $comparison);
|
||||||
|
} elseif ($folder instanceof PropelObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(FolderVersionPeer::ID, $folder->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByFolder() only accepts arguments of type Folder or PropelCollection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the Folder relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinFolder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('Folder');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if ($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'Folder');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the Folder relation Folder object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\FolderQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useFolderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinFolder($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'Folder', '\Thelia\Model\FolderQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exclude object from result
|
||||||
|
*
|
||||||
|
* @param FolderVersion $folderVersion Object to remove from the list of results
|
||||||
|
*
|
||||||
|
* @return FolderVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function prune($folderVersion = null)
|
||||||
|
{
|
||||||
|
if ($folderVersion) {
|
||||||
|
$this->addCond('pruneCond0', $this->getAliasedColName(FolderVersionPeer::ID), $folderVersion->getId(), Criteria::NOT_EQUAL);
|
||||||
|
$this->addCond('pruneCond1', $this->getAliasedColName(FolderVersionPeer::VERSION), $folderVersion->getVersion(), Criteria::NOT_EQUAL);
|
||||||
|
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -20,6 +20,9 @@ use Thelia\Model\MessageI18n;
|
|||||||
use Thelia\Model\MessageI18nQuery;
|
use Thelia\Model\MessageI18nQuery;
|
||||||
use Thelia\Model\MessagePeer;
|
use Thelia\Model\MessagePeer;
|
||||||
use Thelia\Model\MessageQuery;
|
use Thelia\Model\MessageQuery;
|
||||||
|
use Thelia\Model\MessageVersion;
|
||||||
|
use Thelia\Model\MessageVersionPeer;
|
||||||
|
use Thelia\Model\MessageVersionQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class that represents a row from the 'message' table.
|
* Base class that represents a row from the 'message' table.
|
||||||
@@ -85,12 +88,37 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $updated_at;
|
protected $updated_at;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version field.
|
||||||
|
* Note: this column has a database default value of: 0
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version_created_at field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $version_created_at;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version_created_by field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $version_created_by;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var PropelObjectCollection|MessageI18n[] Collection to store aggregation of MessageI18n objects.
|
* @var PropelObjectCollection|MessageI18n[] Collection to store aggregation of MessageI18n objects.
|
||||||
*/
|
*/
|
||||||
protected $collMessageI18ns;
|
protected $collMessageI18ns;
|
||||||
protected $collMessageI18nsPartial;
|
protected $collMessageI18nsPartial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PropelObjectCollection|MessageVersion[] Collection to store aggregation of MessageVersion objects.
|
||||||
|
*/
|
||||||
|
protected $collMessageVersions;
|
||||||
|
protected $collMessageVersionsPartial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to prevent endless save loop, if this object is referenced
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
* by another object which falls in this transaction.
|
* by another object which falls in this transaction.
|
||||||
@@ -119,12 +147,47 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $currentTranslations;
|
protected $currentTranslations;
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $enforceVersion = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var PropelObjectCollection
|
* @var PropelObjectCollection
|
||||||
*/
|
*/
|
||||||
protected $messageI18nsScheduledForDeletion = null;
|
protected $messageI18nsScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of objects scheduled for deletion.
|
||||||
|
* @var PropelObjectCollection
|
||||||
|
*/
|
||||||
|
protected $messageVersionsScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies default values to this object.
|
||||||
|
* This method should be called from the object's constructor (or
|
||||||
|
* equivalent initialization method).
|
||||||
|
* @see __construct()
|
||||||
|
*/
|
||||||
|
public function applyDefaultValues()
|
||||||
|
{
|
||||||
|
$this->version = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseMessage object.
|
||||||
|
* @see applyDefaults()
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->applyDefaultValues();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [id] column value.
|
* Get the [id] column value.
|
||||||
*
|
*
|
||||||
@@ -239,6 +302,63 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [version] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getVersion()
|
||||||
|
{
|
||||||
|
return $this->version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [optionally formatted] temporal [version_created_at] column value.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||||
|
* If format is null, then the raw DateTime object will be returned.
|
||||||
|
* @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
|
||||||
|
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||||
|
*/
|
||||||
|
public function getVersionCreatedAt($format = 'Y-m-d H:i:s')
|
||||||
|
{
|
||||||
|
if ($this->version_created_at === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version_created_at === '0000-00-00 00:00:00') {
|
||||||
|
// while technically this is not a default value of null,
|
||||||
|
// this seems to be closest in meaning.
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$dt = new DateTime($this->version_created_at);
|
||||||
|
} catch (Exception $x) {
|
||||||
|
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->version_created_at, true), $x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($format === null) {
|
||||||
|
// Because propel.useDateTimeClass is true, we return a DateTime object.
|
||||||
|
return $dt;
|
||||||
|
} elseif (strpos($format, '%') !== false) {
|
||||||
|
return strftime($format, $dt->format('U'));
|
||||||
|
} else {
|
||||||
|
return $dt->format($format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [version_created_by] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVersionCreatedBy()
|
||||||
|
{
|
||||||
|
return $this->version_created_by;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [id] column.
|
* Set the value of [id] column.
|
||||||
*
|
*
|
||||||
@@ -369,6 +489,71 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
return $this;
|
return $this;
|
||||||
} // setUpdatedAt()
|
} // setUpdatedAt()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [version] column.
|
||||||
|
*
|
||||||
|
* @param int $v new value
|
||||||
|
* @return Message The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersion($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version !== $v) {
|
||||||
|
$this->version = $v;
|
||||||
|
$this->modifiedColumns[] = MessagePeer::VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersion()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of [version_created_at] column to a normalized version of the date/time value specified.
|
||||||
|
*
|
||||||
|
* @param mixed $v string, integer (timestamp), or DateTime value.
|
||||||
|
* Empty strings are treated as null.
|
||||||
|
* @return Message The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersionCreatedAt($v)
|
||||||
|
{
|
||||||
|
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
|
||||||
|
if ($this->version_created_at !== null || $dt !== null) {
|
||||||
|
$currentDateAsString = ($this->version_created_at !== null && $tmpDt = new DateTime($this->version_created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
|
||||||
|
$newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
|
||||||
|
if ($currentDateAsString !== $newDateAsString) {
|
||||||
|
$this->version_created_at = $newDateAsString;
|
||||||
|
$this->modifiedColumns[] = MessagePeer::VERSION_CREATED_AT;
|
||||||
|
}
|
||||||
|
} // if either are not null
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersionCreatedAt()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [version_created_by] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return Message The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersionCreatedBy($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version_created_by !== $v) {
|
||||||
|
$this->version_created_by = $v;
|
||||||
|
$this->modifiedColumns[] = MessagePeer::VERSION_CREATED_BY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersionCreatedBy()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the columns in this object are only set to default values.
|
* Indicates whether the columns in this object are only set to default values.
|
||||||
*
|
*
|
||||||
@@ -379,6 +564,10 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function hasOnlyDefaultValues()
|
public function hasOnlyDefaultValues()
|
||||||
{
|
{
|
||||||
|
if ($this->version !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// otherwise, everything was equal, so return true
|
// otherwise, everything was equal, so return true
|
||||||
return true;
|
return true;
|
||||||
} // hasOnlyDefaultValues()
|
} // hasOnlyDefaultValues()
|
||||||
@@ -407,6 +596,9 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
$this->ref = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
|
$this->ref = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
|
||||||
$this->created_at = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
|
$this->created_at = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
|
||||||
$this->updated_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
|
$this->updated_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
|
||||||
|
$this->version = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
|
||||||
|
$this->version_created_at = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
|
||||||
|
$this->version_created_by = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
@@ -415,7 +607,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
$this->ensureConsistency();
|
$this->ensureConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $startcol + 6; // 6 = MessagePeer::NUM_HYDRATE_COLUMNS.
|
return $startcol + 9; // 9 = MessagePeer::NUM_HYDRATE_COLUMNS.
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating Message object", $e);
|
throw new PropelException("Error populating Message object", $e);
|
||||||
@@ -479,6 +671,8 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
|
|
||||||
$this->collMessageI18ns = null;
|
$this->collMessageI18ns = null;
|
||||||
|
|
||||||
|
$this->collMessageVersions = null;
|
||||||
|
|
||||||
} // if (deep)
|
} // if (deep)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,6 +743,14 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
$isInsert = $this->isNew();
|
$isInsert = $this->isNew();
|
||||||
try {
|
try {
|
||||||
$ret = $this->preSave($con);
|
$ret = $this->preSave($con);
|
||||||
|
// versionable behavior
|
||||||
|
if ($this->isVersioningNecessary()) {
|
||||||
|
$this->setVersion($this->isNew() ? 1 : $this->getLastVersionNumber($con) + 1);
|
||||||
|
if (!$this->isColumnModified(MessagePeer::VERSION_CREATED_AT)) {
|
||||||
|
$this->setVersionCreatedAt(time());
|
||||||
|
}
|
||||||
|
$createVersion = true; // for postSave hook
|
||||||
|
}
|
||||||
if ($isInsert) {
|
if ($isInsert) {
|
||||||
$ret = $ret && $this->preInsert($con);
|
$ret = $ret && $this->preInsert($con);
|
||||||
// timestampable behavior
|
// timestampable behavior
|
||||||
@@ -573,6 +775,10 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
$this->postUpdate($con);
|
$this->postUpdate($con);
|
||||||
}
|
}
|
||||||
$this->postSave($con);
|
$this->postSave($con);
|
||||||
|
// versionable behavior
|
||||||
|
if (isset($createVersion)) {
|
||||||
|
$this->addVersion($con);
|
||||||
|
}
|
||||||
MessagePeer::addInstanceToPool($this);
|
MessagePeer::addInstanceToPool($this);
|
||||||
} else {
|
} else {
|
||||||
$affectedRows = 0;
|
$affectedRows = 0;
|
||||||
@@ -631,6 +837,23 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->messageVersionsScheduledForDeletion !== null) {
|
||||||
|
if (!$this->messageVersionsScheduledForDeletion->isEmpty()) {
|
||||||
|
MessageVersionQuery::create()
|
||||||
|
->filterByPrimaryKeys($this->messageVersionsScheduledForDeletion->getPrimaryKeys(false))
|
||||||
|
->delete($con);
|
||||||
|
$this->messageVersionsScheduledForDeletion = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->collMessageVersions !== null) {
|
||||||
|
foreach ($this->collMessageVersions as $referrerFK) {
|
||||||
|
if (!$referrerFK->isDeleted()) {
|
||||||
|
$affectedRows += $referrerFK->save($con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -675,6 +898,15 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
if ($this->isColumnModified(MessagePeer::UPDATED_AT)) {
|
if ($this->isColumnModified(MessagePeer::UPDATED_AT)) {
|
||||||
$modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
|
$modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
|
||||||
}
|
}
|
||||||
|
if ($this->isColumnModified(MessagePeer::VERSION)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION`';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(MessagePeer::VERSION_CREATED_AT)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(MessagePeer::VERSION_CREATED_BY)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`';
|
||||||
|
}
|
||||||
|
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'INSERT INTO `message` (%s) VALUES (%s)',
|
'INSERT INTO `message` (%s) VALUES (%s)',
|
||||||
@@ -704,6 +936,15 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
case '`UPDATED_AT`':
|
case '`UPDATED_AT`':
|
||||||
$stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
|
$stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
|
||||||
break;
|
break;
|
||||||
|
case '`VERSION`':
|
||||||
|
$stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
|
||||||
|
break;
|
||||||
|
case '`VERSION_CREATED_AT`':
|
||||||
|
$stmt->bindValue($identifier, $this->version_created_at, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
|
case '`VERSION_CREATED_BY`':
|
||||||
|
$stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
@@ -811,6 +1052,14 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->collMessageVersions !== null) {
|
||||||
|
foreach ($this->collMessageVersions as $referrerFK) {
|
||||||
|
if (!$referrerFK->validate($columns)) {
|
||||||
|
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
}
|
}
|
||||||
@@ -864,6 +1113,15 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
case 5:
|
case 5:
|
||||||
return $this->getUpdatedAt();
|
return $this->getUpdatedAt();
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
return $this->getVersion();
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
return $this->getVersionCreatedAt();
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
return $this->getVersionCreatedBy();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
break;
|
break;
|
||||||
@@ -899,11 +1157,17 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
$keys[3] => $this->getRef(),
|
$keys[3] => $this->getRef(),
|
||||||
$keys[4] => $this->getCreatedAt(),
|
$keys[4] => $this->getCreatedAt(),
|
||||||
$keys[5] => $this->getUpdatedAt(),
|
$keys[5] => $this->getUpdatedAt(),
|
||||||
|
$keys[6] => $this->getVersion(),
|
||||||
|
$keys[7] => $this->getVersionCreatedAt(),
|
||||||
|
$keys[8] => $this->getVersionCreatedBy(),
|
||||||
);
|
);
|
||||||
if ($includeForeignObjects) {
|
if ($includeForeignObjects) {
|
||||||
if (null !== $this->collMessageI18ns) {
|
if (null !== $this->collMessageI18ns) {
|
||||||
$result['MessageI18ns'] = $this->collMessageI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['MessageI18ns'] = $this->collMessageI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
|
if (null !== $this->collMessageVersions) {
|
||||||
|
$result['MessageVersions'] = $this->collMessageVersions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -956,6 +1220,15 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
case 5:
|
case 5:
|
||||||
$this->setUpdatedAt($value);
|
$this->setUpdatedAt($value);
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
$this->setVersion($value);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
$this->setVersionCreatedAt($value);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
$this->setVersionCreatedBy($value);
|
||||||
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -986,6 +1259,9 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
if (array_key_exists($keys[3], $arr)) $this->setRef($arr[$keys[3]]);
|
if (array_key_exists($keys[3], $arr)) $this->setRef($arr[$keys[3]]);
|
||||||
if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
|
if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
|
||||||
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
|
if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
|
||||||
|
if (array_key_exists($keys[6], $arr)) $this->setVersion($arr[$keys[6]]);
|
||||||
|
if (array_key_exists($keys[7], $arr)) $this->setVersionCreatedAt($arr[$keys[7]]);
|
||||||
|
if (array_key_exists($keys[8], $arr)) $this->setVersionCreatedBy($arr[$keys[8]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1003,6 +1279,9 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
if ($this->isColumnModified(MessagePeer::REF)) $criteria->add(MessagePeer::REF, $this->ref);
|
if ($this->isColumnModified(MessagePeer::REF)) $criteria->add(MessagePeer::REF, $this->ref);
|
||||||
if ($this->isColumnModified(MessagePeer::CREATED_AT)) $criteria->add(MessagePeer::CREATED_AT, $this->created_at);
|
if ($this->isColumnModified(MessagePeer::CREATED_AT)) $criteria->add(MessagePeer::CREATED_AT, $this->created_at);
|
||||||
if ($this->isColumnModified(MessagePeer::UPDATED_AT)) $criteria->add(MessagePeer::UPDATED_AT, $this->updated_at);
|
if ($this->isColumnModified(MessagePeer::UPDATED_AT)) $criteria->add(MessagePeer::UPDATED_AT, $this->updated_at);
|
||||||
|
if ($this->isColumnModified(MessagePeer::VERSION)) $criteria->add(MessagePeer::VERSION, $this->version);
|
||||||
|
if ($this->isColumnModified(MessagePeer::VERSION_CREATED_AT)) $criteria->add(MessagePeer::VERSION_CREATED_AT, $this->version_created_at);
|
||||||
|
if ($this->isColumnModified(MessagePeer::VERSION_CREATED_BY)) $criteria->add(MessagePeer::VERSION_CREATED_BY, $this->version_created_by);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
@@ -1071,6 +1350,9 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
$copyObj->setRef($this->getRef());
|
$copyObj->setRef($this->getRef());
|
||||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||||
|
$copyObj->setVersion($this->getVersion());
|
||||||
|
$copyObj->setVersionCreatedAt($this->getVersionCreatedAt());
|
||||||
|
$copyObj->setVersionCreatedBy($this->getVersionCreatedBy());
|
||||||
|
|
||||||
if ($deepCopy && !$this->startCopy) {
|
if ($deepCopy && !$this->startCopy) {
|
||||||
// important: temporarily setNew(false) because this affects the behavior of
|
// important: temporarily setNew(false) because this affects the behavior of
|
||||||
@@ -1085,6 +1367,12 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->getMessageVersions() as $relObj) {
|
||||||
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
|
$copyObj->addMessageVersion($relObj->copy($deepCopy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//unflag object copy
|
//unflag object copy
|
||||||
$this->startCopy = false;
|
$this->startCopy = false;
|
||||||
} // if ($deepCopy)
|
} // if ($deepCopy)
|
||||||
@@ -1149,6 +1437,9 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
if ('MessageI18n' == $relationName) {
|
if ('MessageI18n' == $relationName) {
|
||||||
$this->initMessageI18ns();
|
$this->initMessageI18ns();
|
||||||
}
|
}
|
||||||
|
if ('MessageVersion' == $relationName) {
|
||||||
|
$this->initMessageVersions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1362,6 +1653,213 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears out the collMessageVersions 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 addMessageVersions()
|
||||||
|
*/
|
||||||
|
public function clearMessageVersions()
|
||||||
|
{
|
||||||
|
$this->collMessageVersions = null; // important to set this to null since that means it is uninitialized
|
||||||
|
$this->collMessageVersionsPartial = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reset is the collMessageVersions collection loaded partially
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function resetPartialMessageVersions($v = true)
|
||||||
|
{
|
||||||
|
$this->collMessageVersionsPartial = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the collMessageVersions collection.
|
||||||
|
*
|
||||||
|
* By default this just sets the collMessageVersions collection to an empty array (like clearcollMessageVersions());
|
||||||
|
* 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 initMessageVersions($overrideExisting = true)
|
||||||
|
{
|
||||||
|
if (null !== $this->collMessageVersions && !$overrideExisting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->collMessageVersions = new PropelObjectCollection();
|
||||||
|
$this->collMessageVersions->setModel('MessageVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an array of MessageVersion 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 Message 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|MessageVersion[] List of MessageVersion objects
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function getMessageVersions($criteria = null, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collMessageVersionsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collMessageVersions || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collMessageVersions) {
|
||||||
|
// return empty collection
|
||||||
|
$this->initMessageVersions();
|
||||||
|
} else {
|
||||||
|
$collMessageVersions = MessageVersionQuery::create(null, $criteria)
|
||||||
|
->filterByMessage($this)
|
||||||
|
->find($con);
|
||||||
|
if (null !== $criteria) {
|
||||||
|
if (false !== $this->collMessageVersionsPartial && count($collMessageVersions)) {
|
||||||
|
$this->initMessageVersions(false);
|
||||||
|
|
||||||
|
foreach($collMessageVersions as $obj) {
|
||||||
|
if (false == $this->collMessageVersions->contains($obj)) {
|
||||||
|
$this->collMessageVersions->append($obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collMessageVersionsPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $collMessageVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($partial && $this->collMessageVersions) {
|
||||||
|
foreach($this->collMessageVersions as $obj) {
|
||||||
|
if($obj->isNew()) {
|
||||||
|
$collMessageVersions[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collMessageVersions = $collMessageVersions;
|
||||||
|
$this->collMessageVersionsPartial = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->collMessageVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a collection of MessageVersion 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 $messageVersions A Propel collection.
|
||||||
|
* @param PropelPDO $con Optional connection object
|
||||||
|
*/
|
||||||
|
public function setMessageVersions(PropelCollection $messageVersions, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$this->messageVersionsScheduledForDeletion = $this->getMessageVersions(new Criteria(), $con)->diff($messageVersions);
|
||||||
|
|
||||||
|
foreach ($this->messageVersionsScheduledForDeletion as $messageVersionRemoved) {
|
||||||
|
$messageVersionRemoved->setMessage(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collMessageVersions = null;
|
||||||
|
foreach ($messageVersions as $messageVersion) {
|
||||||
|
$this->addMessageVersion($messageVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collMessageVersions = $messageVersions;
|
||||||
|
$this->collMessageVersionsPartial = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of related MessageVersion objects.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @return int Count of related MessageVersion objects.
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function countMessageVersions(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collMessageVersionsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collMessageVersions || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collMessageVersions) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
if($partial && !$criteria) {
|
||||||
|
return count($this->getMessageVersions());
|
||||||
|
}
|
||||||
|
$query = MessageVersionQuery::create(null, $criteria);
|
||||||
|
if ($distinct) {
|
||||||
|
$query->distinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query
|
||||||
|
->filterByMessage($this)
|
||||||
|
->count($con);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return count($this->collMessageVersions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called to associate a MessageVersion object to this object
|
||||||
|
* through the MessageVersion foreign key attribute.
|
||||||
|
*
|
||||||
|
* @param MessageVersion $l MessageVersion
|
||||||
|
* @return Message The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function addMessageVersion(MessageVersion $l)
|
||||||
|
{
|
||||||
|
if ($this->collMessageVersions === null) {
|
||||||
|
$this->initMessageVersions();
|
||||||
|
$this->collMessageVersionsPartial = true;
|
||||||
|
}
|
||||||
|
if (!$this->collMessageVersions->contains($l)) { // only add it if the **same** object is not already associated
|
||||||
|
$this->doAddMessageVersion($l);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param MessageVersion $messageVersion The messageVersion object to add.
|
||||||
|
*/
|
||||||
|
protected function doAddMessageVersion($messageVersion)
|
||||||
|
{
|
||||||
|
$this->collMessageVersions[]= $messageVersion;
|
||||||
|
$messageVersion->setMessage($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param MessageVersion $messageVersion The messageVersion object to remove.
|
||||||
|
*/
|
||||||
|
public function removeMessageVersion($messageVersion)
|
||||||
|
{
|
||||||
|
if ($this->getMessageVersions()->contains($messageVersion)) {
|
||||||
|
$this->collMessageVersions->remove($this->collMessageVersions->search($messageVersion));
|
||||||
|
if (null === $this->messageVersionsScheduledForDeletion) {
|
||||||
|
$this->messageVersionsScheduledForDeletion = clone $this->collMessageVersions;
|
||||||
|
$this->messageVersionsScheduledForDeletion->clear();
|
||||||
|
}
|
||||||
|
$this->messageVersionsScheduledForDeletion[]= $messageVersion;
|
||||||
|
$messageVersion->setMessage(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the current object and sets all attributes to their default values
|
* Clears the current object and sets all attributes to their default values
|
||||||
*/
|
*/
|
||||||
@@ -1373,9 +1871,13 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
$this->ref = null;
|
$this->ref = null;
|
||||||
$this->created_at = null;
|
$this->created_at = null;
|
||||||
$this->updated_at = null;
|
$this->updated_at = null;
|
||||||
|
$this->version = null;
|
||||||
|
$this->version_created_at = null;
|
||||||
|
$this->version_created_by = null;
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
$this->clearAllReferences();
|
$this->clearAllReferences();
|
||||||
|
$this->applyDefaultValues();
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
$this->setNew(true);
|
$this->setNew(true);
|
||||||
$this->setDeleted(false);
|
$this->setDeleted(false);
|
||||||
@@ -1398,6 +1900,11 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->collMessageVersions) {
|
||||||
|
foreach ($this->collMessageVersions as $o) {
|
||||||
|
$o->clearAllReferences($deep);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // if ($deep)
|
} // if ($deep)
|
||||||
|
|
||||||
// i18n behavior
|
// i18n behavior
|
||||||
@@ -1408,6 +1915,10 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
$this->collMessageI18ns->clearIterator();
|
$this->collMessageI18ns->clearIterator();
|
||||||
}
|
}
|
||||||
$this->collMessageI18ns = null;
|
$this->collMessageI18ns = null;
|
||||||
|
if ($this->collMessageVersions instanceof PropelCollection) {
|
||||||
|
$this->collMessageVersions->clearIterator();
|
||||||
|
}
|
||||||
|
$this->collMessageVersions = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1615,4 +2126,295 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enforce a new Version of this object upon next save.
|
||||||
|
*
|
||||||
|
* @return Message
|
||||||
|
*/
|
||||||
|
public function enforceVersioning()
|
||||||
|
{
|
||||||
|
$this->enforceVersion = true;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current state must be recorded as a version
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con An optional PropelPDO connection to use.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isVersioningNecessary($con = null)
|
||||||
|
{
|
||||||
|
if ($this->alreadyInSave) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->enforceVersion) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessagePeer::isVersioningEnabled() && ($this->isNew() || $this->isModified() || $this->isDeleted())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a version of the current object and saves it.
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return MessageVersion A version object
|
||||||
|
*/
|
||||||
|
public function addVersion($con = null)
|
||||||
|
{
|
||||||
|
$this->enforceVersion = false;
|
||||||
|
|
||||||
|
$version = new MessageVersion();
|
||||||
|
$version->setId($this->getId());
|
||||||
|
$version->setCode($this->getCode());
|
||||||
|
$version->setSecured($this->getSecured());
|
||||||
|
$version->setRef($this->getRef());
|
||||||
|
$version->setCreatedAt($this->getCreatedAt());
|
||||||
|
$version->setUpdatedAt($this->getUpdatedAt());
|
||||||
|
$version->setVersion($this->getVersion());
|
||||||
|
$version->setVersionCreatedAt($this->getVersionCreatedAt());
|
||||||
|
$version->setVersionCreatedBy($this->getVersionCreatedBy());
|
||||||
|
$version->setMessage($this);
|
||||||
|
$version->save($con);
|
||||||
|
|
||||||
|
return $version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the properties of the curent object to the value they had at a specific version
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber The version number to read
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return Message The current object (for fluent API support)
|
||||||
|
* @throws PropelException - if no object with the given version can be found.
|
||||||
|
*/
|
||||||
|
public function toVersion($versionNumber, $con = null)
|
||||||
|
{
|
||||||
|
$version = $this->getOneVersion($versionNumber, $con);
|
||||||
|
if (!$version) {
|
||||||
|
throw new PropelException(sprintf('No Message object found with version %d', $version));
|
||||||
|
}
|
||||||
|
$this->populateFromVersion($version, $con);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the properties of the curent object to the value they had at a specific version
|
||||||
|
*
|
||||||
|
* @param MessageVersion $version The version object to use
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $loadedObjects objects thats been loaded in a chain of populateFromVersion calls on referrer or fk objects.
|
||||||
|
*
|
||||||
|
* @return Message The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function populateFromVersion($version, $con = null, &$loadedObjects = array())
|
||||||
|
{
|
||||||
|
|
||||||
|
$loadedObjects['Message'][$version->getId()][$version->getVersion()] = $this;
|
||||||
|
$this->setId($version->getId());
|
||||||
|
$this->setCode($version->getCode());
|
||||||
|
$this->setSecured($version->getSecured());
|
||||||
|
$this->setRef($version->getRef());
|
||||||
|
$this->setCreatedAt($version->getCreatedAt());
|
||||||
|
$this->setUpdatedAt($version->getUpdatedAt());
|
||||||
|
$this->setVersion($version->getVersion());
|
||||||
|
$this->setVersionCreatedAt($version->getVersionCreatedAt());
|
||||||
|
$this->setVersionCreatedBy($version->getVersionCreatedBy());
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the latest persisted version number for the current object
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getLastVersionNumber($con = null)
|
||||||
|
{
|
||||||
|
$v = MessageVersionQuery::create()
|
||||||
|
->filterByMessage($this)
|
||||||
|
->orderByVersion('desc')
|
||||||
|
->findOne($con);
|
||||||
|
if (!$v) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $v->getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current object is the latest one
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isLastVersion($con = null)
|
||||||
|
{
|
||||||
|
return $this->getLastVersionNumber($con) == $this->getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a version object for this entity and a version number
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber The version number to read
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return MessageVersion A version object
|
||||||
|
*/
|
||||||
|
public function getOneVersion($versionNumber, $con = null)
|
||||||
|
{
|
||||||
|
return MessageVersionQuery::create()
|
||||||
|
->filterByMessage($this)
|
||||||
|
->filterByVersion($versionNumber)
|
||||||
|
->findOne($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all the versions of this object, in incremental order
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return PropelObjectCollection A list of MessageVersion objects
|
||||||
|
*/
|
||||||
|
public function getAllVersions($con = null)
|
||||||
|
{
|
||||||
|
$criteria = new Criteria();
|
||||||
|
$criteria->addAscendingOrderByColumn(MessageVersionPeer::VERSION);
|
||||||
|
|
||||||
|
return $this->getMessageVersions($criteria, $con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the current object with another of its version.
|
||||||
|
* <code>
|
||||||
|
* print_r($book->compareVersion(1));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns)
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
public function compareVersion($versionNumber, $keys = 'columns', $con = null, $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersion = $this->toArray();
|
||||||
|
$toVersion = $this->getOneVersion($versionNumber, $con)->toArray();
|
||||||
|
|
||||||
|
return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares two versions of the current object.
|
||||||
|
* <code>
|
||||||
|
* print_r($book->compareVersions(1, 2));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param integer $fromVersionNumber
|
||||||
|
* @param integer $toVersionNumber
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns)
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
public function compareVersions($fromVersionNumber, $toVersionNumber, $keys = 'columns', $con = null, $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersion = $this->getOneVersion($fromVersionNumber, $con)->toArray();
|
||||||
|
$toVersion = $this->getOneVersion($toVersionNumber, $con)->toArray();
|
||||||
|
|
||||||
|
return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes the diff between two versions.
|
||||||
|
* <code>
|
||||||
|
* print_r($this->computeDiff(1, 2));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param array $fromVersion An array representing the original version.
|
||||||
|
* @param array $toVersion An array representing the destination version.
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns).
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
protected function computeDiff($fromVersion, $toVersion, $keys = 'columns', $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersionNumber = $fromVersion['Version'];
|
||||||
|
$toVersionNumber = $toVersion['Version'];
|
||||||
|
$ignoredColumns = array_merge(array(
|
||||||
|
'Version',
|
||||||
|
'VersionCreatedAt',
|
||||||
|
'VersionCreatedBy',
|
||||||
|
), $ignoredColumns);
|
||||||
|
$diff = array();
|
||||||
|
foreach ($fromVersion as $key => $value) {
|
||||||
|
if (in_array($key, $ignoredColumns)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($toVersion[$key] != $value) {
|
||||||
|
switch ($keys) {
|
||||||
|
case 'versions':
|
||||||
|
$diff[$fromVersionNumber][$key] = $value;
|
||||||
|
$diff[$toVersionNumber][$key] = $toVersion[$key];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$diff[$key] = array(
|
||||||
|
$fromVersionNumber => $value,
|
||||||
|
$toVersionNumber => $toVersion[$key],
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $diff;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* retrieve the last $number versions.
|
||||||
|
*
|
||||||
|
* @param integer $number the number of record to return.
|
||||||
|
* @param MessageVersionQuery|Criteria $criteria Additional criteria to filter.
|
||||||
|
* @param PropelPDO $con An optional connection to use.
|
||||||
|
*
|
||||||
|
* @return PropelCollection|MessageVersion[] List of MessageVersion objects
|
||||||
|
*/
|
||||||
|
public function getLastVersions($number = 10, $criteria = null, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$criteria = MessageVersionQuery::create(null, $criteria);
|
||||||
|
$criteria->addDescendingOrderByColumn(MessageVersionPeer::VERSION);
|
||||||
|
$criteria->limit($number);
|
||||||
|
|
||||||
|
return $this->getMessageVersions($criteria, $con);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use \PropelPDO;
|
|||||||
use Thelia\Model\Message;
|
use Thelia\Model\Message;
|
||||||
use Thelia\Model\MessageI18nPeer;
|
use Thelia\Model\MessageI18nPeer;
|
||||||
use Thelia\Model\MessagePeer;
|
use Thelia\Model\MessagePeer;
|
||||||
|
use Thelia\Model\MessageVersionPeer;
|
||||||
use Thelia\Model\map\MessageTableMap;
|
use Thelia\Model\map\MessageTableMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,13 +38,13 @@ abstract class BaseMessagePeer
|
|||||||
const TM_CLASS = 'MessageTableMap';
|
const TM_CLASS = 'MessageTableMap';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 6;
|
const NUM_COLUMNS = 9;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
||||||
const NUM_HYDRATE_COLUMNS = 6;
|
const NUM_HYDRATE_COLUMNS = 9;
|
||||||
|
|
||||||
/** the column name for the ID field */
|
/** the column name for the ID field */
|
||||||
const ID = 'message.ID';
|
const ID = 'message.ID';
|
||||||
@@ -63,6 +64,15 @@ abstract class BaseMessagePeer
|
|||||||
/** the column name for the UPDATED_AT field */
|
/** the column name for the UPDATED_AT field */
|
||||||
const UPDATED_AT = 'message.UPDATED_AT';
|
const UPDATED_AT = 'message.UPDATED_AT';
|
||||||
|
|
||||||
|
/** the column name for the VERSION field */
|
||||||
|
const VERSION = 'message.VERSION';
|
||||||
|
|
||||||
|
/** the column name for the VERSION_CREATED_AT field */
|
||||||
|
const VERSION_CREATED_AT = 'message.VERSION_CREATED_AT';
|
||||||
|
|
||||||
|
/** the column name for the VERSION_CREATED_BY field */
|
||||||
|
const VERSION_CREATED_BY = 'message.VERSION_CREATED_BY';
|
||||||
|
|
||||||
/** The default string format for model objects of the related table **/
|
/** The default string format for model objects of the related table **/
|
||||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||||
|
|
||||||
@@ -82,6 +92,13 @@ abstract class BaseMessagePeer
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const DEFAULT_LOCALE = 'en_EN';
|
const DEFAULT_LOCALE = 'en_EN';
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the versioning is enabled
|
||||||
|
*/
|
||||||
|
static $isVersioningEnabled = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* holds an array of fieldnames
|
* holds an array of fieldnames
|
||||||
*
|
*
|
||||||
@@ -89,12 +106,12 @@ abstract class BaseMessagePeer
|
|||||||
* e.g. MessagePeer::$fieldNames[MessagePeer::TYPE_PHPNAME][0] = 'Id'
|
* e.g. MessagePeer::$fieldNames[MessagePeer::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
protected static $fieldNames = array (
|
protected static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('Id', 'Code', 'Secured', 'Ref', 'CreatedAt', 'UpdatedAt', ),
|
BasePeer::TYPE_PHPNAME => array ('Id', 'Code', 'Secured', 'Ref', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'code', 'secured', 'ref', 'createdAt', 'updatedAt', ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'code', 'secured', 'ref', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
|
||||||
BasePeer::TYPE_COLNAME => array (MessagePeer::ID, MessagePeer::CODE, MessagePeer::SECURED, MessagePeer::REF, MessagePeer::CREATED_AT, MessagePeer::UPDATED_AT, ),
|
BasePeer::TYPE_COLNAME => array (MessagePeer::ID, MessagePeer::CODE, MessagePeer::SECURED, MessagePeer::REF, MessagePeer::CREATED_AT, MessagePeer::UPDATED_AT, MessagePeer::VERSION, MessagePeer::VERSION_CREATED_AT, MessagePeer::VERSION_CREATED_BY, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CODE', 'SECURED', 'REF', 'CREATED_AT', 'UPDATED_AT', ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CODE', 'SECURED', 'REF', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id', 'code', 'secured', 'ref', 'created_at', 'updated_at', ),
|
BasePeer::TYPE_FIELDNAME => array ('id', 'code', 'secured', 'ref', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,12 +121,12 @@ abstract class BaseMessagePeer
|
|||||||
* e.g. MessagePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
* e.g. MessagePeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
protected static $fieldKeys = array (
|
protected static $fieldKeys = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Code' => 1, 'Secured' => 2, 'Ref' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
|
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Code' => 1, 'Secured' => 2, 'Ref' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, 'Version' => 6, 'VersionCreatedAt' => 7, 'VersionCreatedBy' => 8, ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'createdAt' => 4, 'updatedAt' => 5, 'version' => 6, 'versionCreatedAt' => 7, 'versionCreatedBy' => 8, ),
|
||||||
BasePeer::TYPE_COLNAME => array (MessagePeer::ID => 0, MessagePeer::CODE => 1, MessagePeer::SECURED => 2, MessagePeer::REF => 3, MessagePeer::CREATED_AT => 4, MessagePeer::UPDATED_AT => 5, ),
|
BasePeer::TYPE_COLNAME => array (MessagePeer::ID => 0, MessagePeer::CODE => 1, MessagePeer::SECURED => 2, MessagePeer::REF => 3, MessagePeer::CREATED_AT => 4, MessagePeer::UPDATED_AT => 5, MessagePeer::VERSION => 6, MessagePeer::VERSION_CREATED_AT => 7, MessagePeer::VERSION_CREATED_BY => 8, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CODE' => 1, 'SECURED' => 2, 'REF' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CODE' => 1, 'SECURED' => 2, 'REF' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, 'VERSION' => 6, 'VERSION_CREATED_AT' => 7, 'VERSION_CREATED_BY' => 8, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'created_at' => 4, 'updated_at' => 5, ),
|
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'code' => 1, 'secured' => 2, 'ref' => 3, 'created_at' => 4, 'updated_at' => 5, 'version' => 6, 'version_created_at' => 7, 'version_created_by' => 8, ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -189,6 +206,9 @@ abstract class BaseMessagePeer
|
|||||||
$criteria->addSelectColumn(MessagePeer::REF);
|
$criteria->addSelectColumn(MessagePeer::REF);
|
||||||
$criteria->addSelectColumn(MessagePeer::CREATED_AT);
|
$criteria->addSelectColumn(MessagePeer::CREATED_AT);
|
||||||
$criteria->addSelectColumn(MessagePeer::UPDATED_AT);
|
$criteria->addSelectColumn(MessagePeer::UPDATED_AT);
|
||||||
|
$criteria->addSelectColumn(MessagePeer::VERSION);
|
||||||
|
$criteria->addSelectColumn(MessagePeer::VERSION_CREATED_AT);
|
||||||
|
$criteria->addSelectColumn(MessagePeer::VERSION_CREATED_BY);
|
||||||
} else {
|
} else {
|
||||||
$criteria->addSelectColumn($alias . '.ID');
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
$criteria->addSelectColumn($alias . '.CODE');
|
$criteria->addSelectColumn($alias . '.CODE');
|
||||||
@@ -196,6 +216,9 @@ abstract class BaseMessagePeer
|
|||||||
$criteria->addSelectColumn($alias . '.REF');
|
$criteria->addSelectColumn($alias . '.REF');
|
||||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION_CREATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION_CREATED_BY');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,6 +421,9 @@ abstract class BaseMessagePeer
|
|||||||
// Invalidate objects in MessageI18nPeer instance pool,
|
// Invalidate objects in MessageI18nPeer instance pool,
|
||||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
MessageI18nPeer::clearInstancePool();
|
MessageI18nPeer::clearInstancePool();
|
||||||
|
// Invalidate objects in MessageVersionPeer instance pool,
|
||||||
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
|
MessageVersionPeer::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -791,6 +817,34 @@ abstract class BaseMessagePeer
|
|||||||
return $objs;
|
return $objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether versioning is enabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function isVersioningEnabled()
|
||||||
|
{
|
||||||
|
return self::$isVersioningEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables versioning
|
||||||
|
*/
|
||||||
|
public static function enableVersioning()
|
||||||
|
{
|
||||||
|
self::$isVersioningEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables versioning
|
||||||
|
*/
|
||||||
|
public static function disableVersioning()
|
||||||
|
{
|
||||||
|
self::$isVersioningEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
} // BaseMessagePeer
|
} // BaseMessagePeer
|
||||||
|
|
||||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ use Thelia\Model\Message;
|
|||||||
use Thelia\Model\MessageI18n;
|
use Thelia\Model\MessageI18n;
|
||||||
use Thelia\Model\MessagePeer;
|
use Thelia\Model\MessagePeer;
|
||||||
use Thelia\Model\MessageQuery;
|
use Thelia\Model\MessageQuery;
|
||||||
|
use Thelia\Model\MessageVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class that represents a query for the 'message' table.
|
* Base class that represents a query for the 'message' table.
|
||||||
@@ -28,6 +29,9 @@ use Thelia\Model\MessageQuery;
|
|||||||
* @method MessageQuery orderByRef($order = Criteria::ASC) Order by the ref column
|
* @method MessageQuery orderByRef($order = Criteria::ASC) Order by the ref column
|
||||||
* @method MessageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
* @method MessageQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
* @method MessageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
* @method MessageQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
|
* @method MessageQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||||
|
* @method MessageQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
||||||
|
* @method MessageQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method MessageQuery groupById() Group by the id column
|
* @method MessageQuery groupById() Group by the id column
|
||||||
* @method MessageQuery groupByCode() Group by the code column
|
* @method MessageQuery groupByCode() Group by the code column
|
||||||
@@ -35,6 +39,9 @@ use Thelia\Model\MessageQuery;
|
|||||||
* @method MessageQuery groupByRef() Group by the ref column
|
* @method MessageQuery groupByRef() Group by the ref column
|
||||||
* @method MessageQuery groupByCreatedAt() Group by the created_at column
|
* @method MessageQuery groupByCreatedAt() Group by the created_at column
|
||||||
* @method MessageQuery groupByUpdatedAt() Group by the updated_at column
|
* @method MessageQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
|
* @method MessageQuery groupByVersion() Group by the version column
|
||||||
|
* @method MessageQuery groupByVersionCreatedAt() Group by the version_created_at column
|
||||||
|
* @method MessageQuery groupByVersionCreatedBy() Group by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method MessageQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
* @method MessageQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
* @method MessageQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
* @method MessageQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
@@ -44,6 +51,10 @@ use Thelia\Model\MessageQuery;
|
|||||||
* @method MessageQuery rightJoinMessageI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the MessageI18n relation
|
* @method MessageQuery rightJoinMessageI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the MessageI18n relation
|
||||||
* @method MessageQuery innerJoinMessageI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the MessageI18n relation
|
* @method MessageQuery innerJoinMessageI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the MessageI18n relation
|
||||||
*
|
*
|
||||||
|
* @method MessageQuery leftJoinMessageVersion($relationAlias = null) Adds a LEFT JOIN clause to the query using the MessageVersion relation
|
||||||
|
* @method MessageQuery rightJoinMessageVersion($relationAlias = null) Adds a RIGHT JOIN clause to the query using the MessageVersion relation
|
||||||
|
* @method MessageQuery innerJoinMessageVersion($relationAlias = null) Adds a INNER JOIN clause to the query using the MessageVersion relation
|
||||||
|
*
|
||||||
* @method Message findOne(PropelPDO $con = null) Return the first Message matching the query
|
* @method Message findOne(PropelPDO $con = null) Return the first Message matching the query
|
||||||
* @method Message findOneOrCreate(PropelPDO $con = null) Return the first Message matching the query, or a new Message object populated from the query conditions when no match is found
|
* @method Message findOneOrCreate(PropelPDO $con = null) Return the first Message matching the query, or a new Message object populated from the query conditions when no match is found
|
||||||
*
|
*
|
||||||
@@ -53,6 +64,9 @@ use Thelia\Model\MessageQuery;
|
|||||||
* @method Message findOneByRef(string $ref) Return the first Message filtered by the ref column
|
* @method Message findOneByRef(string $ref) Return the first Message filtered by the ref column
|
||||||
* @method Message findOneByCreatedAt(string $created_at) Return the first Message filtered by the created_at column
|
* @method Message findOneByCreatedAt(string $created_at) Return the first Message filtered by the created_at column
|
||||||
* @method Message findOneByUpdatedAt(string $updated_at) Return the first Message filtered by the updated_at column
|
* @method Message findOneByUpdatedAt(string $updated_at) Return the first Message filtered by the updated_at column
|
||||||
|
* @method Message findOneByVersion(int $version) Return the first Message filtered by the version column
|
||||||
|
* @method Message findOneByVersionCreatedAt(string $version_created_at) Return the first Message filtered by the version_created_at column
|
||||||
|
* @method Message findOneByVersionCreatedBy(string $version_created_by) Return the first Message filtered by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method array findById(int $id) Return Message objects filtered by the id column
|
* @method array findById(int $id) Return Message objects filtered by the id column
|
||||||
* @method array findByCode(string $code) Return Message objects filtered by the code column
|
* @method array findByCode(string $code) Return Message objects filtered by the code column
|
||||||
@@ -60,6 +74,9 @@ use Thelia\Model\MessageQuery;
|
|||||||
* @method array findByRef(string $ref) Return Message objects filtered by the ref column
|
* @method array findByRef(string $ref) Return Message objects filtered by the ref column
|
||||||
* @method array findByCreatedAt(string $created_at) Return Message objects filtered by the created_at column
|
* @method array findByCreatedAt(string $created_at) Return Message objects filtered by the created_at column
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return Message objects filtered by the updated_at column
|
* @method array findByUpdatedAt(string $updated_at) Return Message objects filtered by the updated_at column
|
||||||
|
* @method array findByVersion(int $version) Return Message objects filtered by the version column
|
||||||
|
* @method array findByVersionCreatedAt(string $version_created_at) Return Message objects filtered by the version_created_at column
|
||||||
|
* @method array findByVersionCreatedBy(string $version_created_by) Return Message objects filtered by the version_created_by column
|
||||||
*
|
*
|
||||||
* @package propel.generator.Thelia.Model.om
|
* @package propel.generator.Thelia.Model.om
|
||||||
*/
|
*/
|
||||||
@@ -149,7 +166,7 @@ abstract class BaseMessageQuery extends ModelCriteria
|
|||||||
*/
|
*/
|
||||||
protected function findPkSimple($key, $con)
|
protected function findPkSimple($key, $con)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT `ID`, `CODE`, `SECURED`, `REF`, `CREATED_AT`, `UPDATED_AT` FROM `message` WHERE `ID` = :p0';
|
$sql = 'SELECT `ID`, `CODE`, `SECURED`, `REF`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `message` WHERE `ID` = :p0';
|
||||||
try {
|
try {
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||||
@@ -450,6 +467,119 @@ abstract class BaseMessageQuery extends ModelCriteria
|
|||||||
return $this->addUsingAlias(MessagePeer::UPDATED_AT, $updatedAt, $comparison);
|
return $this->addUsingAlias(MessagePeer::UPDATED_AT, $updatedAt, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersion(1234); // WHERE version = 1234
|
||||||
|
* $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
|
||||||
|
* $query->filterByVersion(array('min' => 12)); // WHERE version > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $version The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersion($version = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($version)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($version['min'])) {
|
||||||
|
$this->addUsingAlias(MessagePeer::VERSION, $version['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($version['max'])) {
|
||||||
|
$this->addUsingAlias(MessagePeer::VERSION, $version['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(MessagePeer::VERSION, $version, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $versionCreatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($versionCreatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($versionCreatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(MessagePeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($versionCreatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(MessagePeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(MessagePeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_by column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
||||||
|
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $versionCreatedBy The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($versionCreatedBy)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
|
||||||
|
$versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(MessagePeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related MessageI18n object
|
* Filter the query by a related MessageI18n object
|
||||||
*
|
*
|
||||||
@@ -524,6 +654,80 @@ abstract class BaseMessageQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'MessageI18n', '\Thelia\Model\MessageI18nQuery');
|
->useQuery($relationAlias ? $relationAlias : 'MessageI18n', '\Thelia\Model\MessageI18nQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related MessageVersion object
|
||||||
|
*
|
||||||
|
* @param MessageVersion|PropelObjectCollection $messageVersion the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageQuery The current query, for fluid interface
|
||||||
|
* @throws PropelException - if the provided filter is invalid.
|
||||||
|
*/
|
||||||
|
public function filterByMessageVersion($messageVersion, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($messageVersion instanceof MessageVersion) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(MessagePeer::ID, $messageVersion->getId(), $comparison);
|
||||||
|
} elseif ($messageVersion instanceof PropelObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useMessageVersionQuery()
|
||||||
|
->filterByPrimaryKeys($messageVersion->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByMessageVersion() only accepts arguments of type MessageVersion or PropelCollection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the MessageVersion relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return MessageQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinMessageVersion($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('MessageVersion');
|
||||||
|
|
||||||
|
// 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, 'MessageVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the MessageVersion relation MessageVersion 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\MessageVersionQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useMessageVersionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinMessageVersion($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'MessageVersion', '\Thelia\Model\MessageVersionQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
|
|||||||
1427
core/lib/Thelia/Model/om/BaseMessageVersion.php
Normal file
1427
core/lib/Thelia/Model/om/BaseMessageVersion.php
Normal file
File diff suppressed because it is too large
Load Diff
1024
core/lib/Thelia/Model/om/BaseMessageVersionPeer.php
Normal file
1024
core/lib/Thelia/Model/om/BaseMessageVersionPeer.php
Normal file
File diff suppressed because it is too large
Load Diff
673
core/lib/Thelia/Model/om/BaseMessageVersionQuery.php
Normal file
673
core/lib/Thelia/Model/om/BaseMessageVersionQuery.php
Normal file
@@ -0,0 +1,673 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Thelia\Model\om;
|
||||||
|
|
||||||
|
use \Criteria;
|
||||||
|
use \Exception;
|
||||||
|
use \ModelCriteria;
|
||||||
|
use \ModelJoin;
|
||||||
|
use \PDO;
|
||||||
|
use \Propel;
|
||||||
|
use \PropelCollection;
|
||||||
|
use \PropelException;
|
||||||
|
use \PropelObjectCollection;
|
||||||
|
use \PropelPDO;
|
||||||
|
use Thelia\Model\Message;
|
||||||
|
use Thelia\Model\MessageVersion;
|
||||||
|
use Thelia\Model\MessageVersionPeer;
|
||||||
|
use Thelia\Model\MessageVersionQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'message_version' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method MessageVersionQuery orderById($order = Criteria::ASC) Order by the id column
|
||||||
|
* @method MessageVersionQuery orderByCode($order = Criteria::ASC) Order by the code column
|
||||||
|
* @method MessageVersionQuery orderBySecured($order = Criteria::ASC) Order by the secured column
|
||||||
|
* @method MessageVersionQuery orderByRef($order = Criteria::ASC) Order by the ref column
|
||||||
|
* @method MessageVersionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
|
* @method MessageVersionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
|
* @method MessageVersionQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||||
|
* @method MessageVersionQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
||||||
|
* @method MessageVersionQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
||||||
|
*
|
||||||
|
* @method MessageVersionQuery groupById() Group by the id column
|
||||||
|
* @method MessageVersionQuery groupByCode() Group by the code column
|
||||||
|
* @method MessageVersionQuery groupBySecured() Group by the secured column
|
||||||
|
* @method MessageVersionQuery groupByRef() Group by the ref column
|
||||||
|
* @method MessageVersionQuery groupByCreatedAt() Group by the created_at column
|
||||||
|
* @method MessageVersionQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
|
* @method MessageVersionQuery groupByVersion() Group by the version column
|
||||||
|
* @method MessageVersionQuery groupByVersionCreatedAt() Group by the version_created_at column
|
||||||
|
* @method MessageVersionQuery groupByVersionCreatedBy() Group by the version_created_by column
|
||||||
|
*
|
||||||
|
* @method MessageVersionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method MessageVersionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method MessageVersionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method MessageVersionQuery leftJoinMessage($relationAlias = null) Adds a LEFT JOIN clause to the query using the Message relation
|
||||||
|
* @method MessageVersionQuery rightJoinMessage($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Message relation
|
||||||
|
* @method MessageVersionQuery innerJoinMessage($relationAlias = null) Adds a INNER JOIN clause to the query using the Message relation
|
||||||
|
*
|
||||||
|
* @method MessageVersion findOne(PropelPDO $con = null) Return the first MessageVersion matching the query
|
||||||
|
* @method MessageVersion findOneOrCreate(PropelPDO $con = null) Return the first MessageVersion matching the query, or a new MessageVersion object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method MessageVersion findOneById(int $id) Return the first MessageVersion filtered by the id column
|
||||||
|
* @method MessageVersion findOneByCode(string $code) Return the first MessageVersion filtered by the code column
|
||||||
|
* @method MessageVersion findOneBySecured(int $secured) Return the first MessageVersion filtered by the secured column
|
||||||
|
* @method MessageVersion findOneByRef(string $ref) Return the first MessageVersion filtered by the ref column
|
||||||
|
* @method MessageVersion findOneByCreatedAt(string $created_at) Return the first MessageVersion filtered by the created_at column
|
||||||
|
* @method MessageVersion findOneByUpdatedAt(string $updated_at) Return the first MessageVersion filtered by the updated_at column
|
||||||
|
* @method MessageVersion findOneByVersion(int $version) Return the first MessageVersion filtered by the version column
|
||||||
|
* @method MessageVersion findOneByVersionCreatedAt(string $version_created_at) Return the first MessageVersion filtered by the version_created_at column
|
||||||
|
* @method MessageVersion findOneByVersionCreatedBy(string $version_created_by) Return the first MessageVersion filtered by the version_created_by column
|
||||||
|
*
|
||||||
|
* @method array findById(int $id) Return MessageVersion objects filtered by the id column
|
||||||
|
* @method array findByCode(string $code) Return MessageVersion objects filtered by the code column
|
||||||
|
* @method array findBySecured(int $secured) Return MessageVersion objects filtered by the secured column
|
||||||
|
* @method array findByRef(string $ref) Return MessageVersion objects filtered by the ref column
|
||||||
|
* @method array findByCreatedAt(string $created_at) Return MessageVersion objects filtered by the created_at column
|
||||||
|
* @method array findByUpdatedAt(string $updated_at) Return MessageVersion objects filtered by the updated_at column
|
||||||
|
* @method array findByVersion(int $version) Return MessageVersion objects filtered by the version column
|
||||||
|
* @method array findByVersionCreatedAt(string $version_created_at) Return MessageVersion objects filtered by the version_created_at column
|
||||||
|
* @method array findByVersionCreatedBy(string $version_created_by) Return MessageVersion objects filtered by the version_created_by column
|
||||||
|
*
|
||||||
|
* @package propel.generator.Thelia.Model.om
|
||||||
|
*/
|
||||||
|
abstract class BaseMessageVersionQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseMessageVersionQuery object.
|
||||||
|
*
|
||||||
|
* @param string $dbName The dabase name
|
||||||
|
* @param string $modelName The phpName of a model, e.g. 'Book'
|
||||||
|
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
|
||||||
|
*/
|
||||||
|
public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\MessageVersion', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new MessageVersionQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param MessageVersionQuery|Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof MessageVersionQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new MessageVersionQuery();
|
||||||
|
if (null !== $modelAlias) {
|
||||||
|
$query->setModelAlias($modelAlias);
|
||||||
|
}
|
||||||
|
if ($criteria instanceof Criteria) {
|
||||||
|
$query->mergeWith($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
* Propel uses the instance pool to skip the database if the object exists.
|
||||||
|
* Go fast if the query is untouched.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* $obj = $c->findPk(array(12, 34), $con);
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param array $key Primary key to use for the query
|
||||||
|
A Primary key composition: [$id, $version]
|
||||||
|
* @param PropelPDO $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return MessageVersion|MessageVersion[]|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPk($key, $con = null)
|
||||||
|
{
|
||||||
|
if ($key === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((null !== ($obj = MessageVersionPeer::getInstanceFromPool(serialize(array((string) $key[0], (string) $key[1]))))) && !$this->formatter) {
|
||||||
|
// the object is alredy in the instance pool
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(MessageVersionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|
||||||
|
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|
||||||
|
|| $this->map || $this->having || $this->joins) {
|
||||||
|
return $this->findPkComplex($key, $con);
|
||||||
|
} else {
|
||||||
|
return $this->findPkSimple($key, $con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key using raw SQL to go fast.
|
||||||
|
* Bypass doSelect() and the object formatter by using generated code.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param PropelPDO $con A connection object
|
||||||
|
*
|
||||||
|
* @return MessageVersion A model object, or null if the key is not found
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
protected function findPkSimple($key, $con)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT `ID`, `CODE`, `SECURED`, `REF`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `message_version` WHERE `ID` = :p0 AND `VERSION` = :p1';
|
||||||
|
try {
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
|
||||||
|
$stmt->bindValue(':p1', $key[1], PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Propel::log($e->getMessage(), Propel::LOG_ERR);
|
||||||
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
|
||||||
|
}
|
||||||
|
$obj = null;
|
||||||
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$obj = new MessageVersion();
|
||||||
|
$obj->hydrate($row);
|
||||||
|
MessageVersionPeer::addInstanceToPool($obj, serialize(array((string) $key[0], (string) $key[1])));
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find object by primary key.
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
* @param PropelPDO $con A connection object
|
||||||
|
*
|
||||||
|
* @return MessageVersion|MessageVersion[]|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
protected function findPkComplex($key, $con)
|
||||||
|
{
|
||||||
|
// As the query uses a PK condition, no limit(1) is necessary.
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$stmt = $criteria
|
||||||
|
->filterByPrimaryKey($key)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find objects by primary key
|
||||||
|
* <code>
|
||||||
|
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con);
|
||||||
|
* </code>
|
||||||
|
* @param array $keys Primary keys to use for the query
|
||||||
|
* @param PropelPDO $con an optional connection object
|
||||||
|
*
|
||||||
|
* @return PropelObjectCollection|MessageVersion[]|mixed the list of results, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPks($keys, $con = null)
|
||||||
|
{
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
$this->basePreSelect($con);
|
||||||
|
$criteria = $this->isKeepQuery() ? clone $this : $this;
|
||||||
|
$stmt = $criteria
|
||||||
|
->filterByPrimaryKeys($keys)
|
||||||
|
->doSelect($con);
|
||||||
|
|
||||||
|
return $criteria->getFormatter()->init($criteria)->format($stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by primary key
|
||||||
|
*
|
||||||
|
* @param mixed $key Primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKey($key)
|
||||||
|
{
|
||||||
|
$this->addUsingAlias(MessageVersionPeer::ID, $key[0], Criteria::EQUAL);
|
||||||
|
$this->addUsingAlias(MessageVersionPeer::VERSION, $key[1], Criteria::EQUAL);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a list of primary keys
|
||||||
|
*
|
||||||
|
* @param array $keys The list of primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKeys($keys)
|
||||||
|
{
|
||||||
|
if (empty($keys)) {
|
||||||
|
return $this->add(null, '1<>1', Criteria::CUSTOM);
|
||||||
|
}
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$cton0 = $this->getNewCriterion(MessageVersionPeer::ID, $key[0], Criteria::EQUAL);
|
||||||
|
$cton1 = $this->getNewCriterion(MessageVersionPeer::VERSION, $key[1], Criteria::EQUAL);
|
||||||
|
$cton0->addAnd($cton1);
|
||||||
|
$this->addOr($cton0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the id column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterById(1234); // WHERE id = 1234
|
||||||
|
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
||||||
|
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @see filterByMessage()
|
||||||
|
*
|
||||||
|
* @param mixed $id The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterById($id = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($id) && null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(MessageVersionPeer::ID, $id, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the code column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
|
||||||
|
* $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $code The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCode($code = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($code)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $code)) {
|
||||||
|
$code = str_replace('*', '%', $code);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(MessageVersionPeer::CODE, $code, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the secured column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterBySecured(1234); // WHERE secured = 1234
|
||||||
|
* $query->filterBySecured(array(12, 34)); // WHERE secured IN (12, 34)
|
||||||
|
* $query->filterBySecured(array('min' => 12)); // WHERE secured > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $secured The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterBySecured($secured = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($secured)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($secured['min'])) {
|
||||||
|
$this->addUsingAlias(MessageVersionPeer::SECURED, $secured['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($secured['max'])) {
|
||||||
|
$this->addUsingAlias(MessageVersionPeer::SECURED, $secured['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(MessageVersionPeer::SECURED, $secured, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the ref column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByRef('fooValue'); // WHERE ref = 'fooValue'
|
||||||
|
* $query->filterByRef('%fooValue%'); // WHERE ref LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $ref The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByRef($ref = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($ref)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $ref)) {
|
||||||
|
$ref = str_replace('*', '%', $ref);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(MessageVersionPeer::REF, $ref, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||||
|
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||||
|
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $createdAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($createdAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($createdAt['min'])) {
|
||||||
|
$this->addUsingAlias(MessageVersionPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($createdAt['max'])) {
|
||||||
|
$this->addUsingAlias(MessageVersionPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(MessageVersionPeer::CREATED_AT, $createdAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the updated_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||||
|
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||||
|
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $updatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($updatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($updatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(MessageVersionPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($updatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(MessageVersionPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(MessageVersionPeer::UPDATED_AT, $updatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersion(1234); // WHERE version = 1234
|
||||||
|
* $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
|
||||||
|
* $query->filterByVersion(array('min' => 12)); // WHERE version > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $version The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersion($version = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($version) && null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(MessageVersionPeer::VERSION, $version, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $versionCreatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($versionCreatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($versionCreatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(MessageVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($versionCreatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(MessageVersionPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(MessageVersionPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_by column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
||||||
|
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $versionCreatedBy The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($versionCreatedBy)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
|
||||||
|
$versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(MessageVersionPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related Message object
|
||||||
|
*
|
||||||
|
* @param Message|PropelObjectCollection $message The related object(s) to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
* @throws PropelException - if the provided filter is invalid.
|
||||||
|
*/
|
||||||
|
public function filterByMessage($message, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($message instanceof Message) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(MessageVersionPeer::ID, $message->getId(), $comparison);
|
||||||
|
} elseif ($message instanceof PropelObjectCollection) {
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(MessageVersionPeer::ID, $message->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByMessage() only accepts arguments of type Message or PropelCollection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the Message relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinMessage($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('Message');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if ($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'Message');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the Message relation Message object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return \Thelia\Model\MessageQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useMessageQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinMessage($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'Message', '\Thelia\Model\MessageQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exclude object from result
|
||||||
|
*
|
||||||
|
* @param MessageVersion $messageVersion Object to remove from the list of results
|
||||||
|
*
|
||||||
|
* @return MessageVersionQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function prune($messageVersion = null)
|
||||||
|
{
|
||||||
|
if ($messageVersion) {
|
||||||
|
$this->addCond('pruneCond0', $this->getAliasedColName(MessageVersionPeer::ID), $messageVersion->getId(), Criteria::NOT_EQUAL);
|
||||||
|
$this->addCond('pruneCond1', $this->getAliasedColName(MessageVersionPeer::VERSION), $messageVersion->getVersion(), Criteria::NOT_EQUAL);
|
||||||
|
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -32,6 +32,9 @@ use Thelia\Model\ProductI18n;
|
|||||||
use Thelia\Model\ProductI18nQuery;
|
use Thelia\Model\ProductI18nQuery;
|
||||||
use Thelia\Model\ProductPeer;
|
use Thelia\Model\ProductPeer;
|
||||||
use Thelia\Model\ProductQuery;
|
use Thelia\Model\ProductQuery;
|
||||||
|
use Thelia\Model\ProductVersion;
|
||||||
|
use Thelia\Model\ProductVersionPeer;
|
||||||
|
use Thelia\Model\ProductVersionQuery;
|
||||||
use Thelia\Model\Rewriting;
|
use Thelia\Model\Rewriting;
|
||||||
use Thelia\Model\RewritingQuery;
|
use Thelia\Model\RewritingQuery;
|
||||||
use Thelia\Model\Stock;
|
use Thelia\Model\Stock;
|
||||||
@@ -155,6 +158,25 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $updated_at;
|
protected $updated_at;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version field.
|
||||||
|
* Note: this column has a database default value of: 0
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version_created_at field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $version_created_at;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the version_created_by field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $version_created_by;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var TaxRule
|
* @var TaxRule
|
||||||
*/
|
*/
|
||||||
@@ -220,6 +242,12 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
protected $collProductI18ns;
|
protected $collProductI18ns;
|
||||||
protected $collProductI18nsPartial;
|
protected $collProductI18nsPartial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var PropelObjectCollection|ProductVersion[] Collection to store aggregation of ProductVersion objects.
|
||||||
|
*/
|
||||||
|
protected $collProductVersions;
|
||||||
|
protected $collProductVersionsPartial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to prevent endless save loop, if this object is referenced
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
* by another object which falls in this transaction.
|
* by another object which falls in this transaction.
|
||||||
@@ -248,6 +276,14 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $currentTranslations;
|
protected $currentTranslations;
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $enforceVersion = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of objects scheduled for deletion.
|
* An array of objects scheduled for deletion.
|
||||||
* @var PropelObjectCollection
|
* @var PropelObjectCollection
|
||||||
@@ -308,6 +344,12 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
protected $productI18nsScheduledForDeletion = null;
|
protected $productI18nsScheduledForDeletion = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of objects scheduled for deletion.
|
||||||
|
* @var PropelObjectCollection
|
||||||
|
*/
|
||||||
|
protected $productVersionsScheduledForDeletion = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies default values to this object.
|
* Applies default values to this object.
|
||||||
* This method should be called from the object's constructor (or
|
* This method should be called from the object's constructor (or
|
||||||
@@ -320,6 +362,7 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
$this->promo = 0;
|
$this->promo = 0;
|
||||||
$this->stock = 0;
|
$this->stock = 0;
|
||||||
$this->visible = 0;
|
$this->visible = 0;
|
||||||
|
$this->version = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -526,6 +569,63 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [version] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getVersion()
|
||||||
|
{
|
||||||
|
return $this->version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [optionally formatted] temporal [version_created_at] column value.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||||
|
* If format is null, then the raw DateTime object will be returned.
|
||||||
|
* @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
|
||||||
|
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||||
|
*/
|
||||||
|
public function getVersionCreatedAt($format = 'Y-m-d H:i:s')
|
||||||
|
{
|
||||||
|
if ($this->version_created_at === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version_created_at === '0000-00-00 00:00:00') {
|
||||||
|
// while technically this is not a default value of null,
|
||||||
|
// this seems to be closest in meaning.
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$dt = new DateTime($this->version_created_at);
|
||||||
|
} catch (Exception $x) {
|
||||||
|
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->version_created_at, true), $x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($format === null) {
|
||||||
|
// Because propel.useDateTimeClass is true, we return a DateTime object.
|
||||||
|
return $dt;
|
||||||
|
} elseif (strpos($format, '%') !== false) {
|
||||||
|
return strftime($format, $dt->format('U'));
|
||||||
|
} else {
|
||||||
|
return $dt->format($format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [version_created_by] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVersionCreatedBy()
|
||||||
|
{
|
||||||
|
return $this->version_created_by;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [id] column.
|
* Set the value of [id] column.
|
||||||
*
|
*
|
||||||
@@ -828,6 +928,71 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
return $this;
|
return $this;
|
||||||
} // setUpdatedAt()
|
} // setUpdatedAt()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [version] column.
|
||||||
|
*
|
||||||
|
* @param int $v new value
|
||||||
|
* @return Product The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersion($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version !== $v) {
|
||||||
|
$this->version = $v;
|
||||||
|
$this->modifiedColumns[] = ProductPeer::VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersion()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of [version_created_at] column to a normalized version of the date/time value specified.
|
||||||
|
*
|
||||||
|
* @param mixed $v string, integer (timestamp), or DateTime value.
|
||||||
|
* Empty strings are treated as null.
|
||||||
|
* @return Product The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersionCreatedAt($v)
|
||||||
|
{
|
||||||
|
$dt = PropelDateTime::newInstance($v, null, 'DateTime');
|
||||||
|
if ($this->version_created_at !== null || $dt !== null) {
|
||||||
|
$currentDateAsString = ($this->version_created_at !== null && $tmpDt = new DateTime($this->version_created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
|
||||||
|
$newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
|
||||||
|
if ($currentDateAsString !== $newDateAsString) {
|
||||||
|
$this->version_created_at = $newDateAsString;
|
||||||
|
$this->modifiedColumns[] = ProductPeer::VERSION_CREATED_AT;
|
||||||
|
}
|
||||||
|
} // if either are not null
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersionCreatedAt()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [version_created_by] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return Product The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setVersionCreatedBy($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->version_created_by !== $v) {
|
||||||
|
$this->version_created_by = $v;
|
||||||
|
$this->modifiedColumns[] = ProductPeer::VERSION_CREATED_BY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setVersionCreatedBy()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the columns in this object are only set to default values.
|
* Indicates whether the columns in this object are only set to default values.
|
||||||
*
|
*
|
||||||
@@ -854,6 +1019,10 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->version !== 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// otherwise, everything was equal, so return true
|
// otherwise, everything was equal, so return true
|
||||||
return true;
|
return true;
|
||||||
} // hasOnlyDefaultValues()
|
} // hasOnlyDefaultValues()
|
||||||
@@ -890,6 +1059,9 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
$this->position = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
|
$this->position = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
|
||||||
$this->created_at = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
|
$this->created_at = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
|
||||||
$this->updated_at = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
|
$this->updated_at = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
|
||||||
|
$this->version = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null;
|
||||||
|
$this->version_created_at = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null;
|
||||||
|
$this->version_created_by = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null;
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
@@ -898,7 +1070,7 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
$this->ensureConsistency();
|
$this->ensureConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $startcol + 14; // 14 = ProductPeer::NUM_HYDRATE_COLUMNS.
|
return $startcol + 17; // 17 = ProductPeer::NUM_HYDRATE_COLUMNS.
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating Product object", $e);
|
throw new PropelException("Error populating Product object", $e);
|
||||||
@@ -984,6 +1156,8 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
|
|
||||||
$this->collProductI18ns = null;
|
$this->collProductI18ns = null;
|
||||||
|
|
||||||
|
$this->collProductVersions = null;
|
||||||
|
|
||||||
} // if (deep)
|
} // if (deep)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1054,6 +1228,14 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
$isInsert = $this->isNew();
|
$isInsert = $this->isNew();
|
||||||
try {
|
try {
|
||||||
$ret = $this->preSave($con);
|
$ret = $this->preSave($con);
|
||||||
|
// versionable behavior
|
||||||
|
if ($this->isVersioningNecessary()) {
|
||||||
|
$this->setVersion($this->isNew() ? 1 : $this->getLastVersionNumber($con) + 1);
|
||||||
|
if (!$this->isColumnModified(ProductPeer::VERSION_CREATED_AT)) {
|
||||||
|
$this->setVersionCreatedAt(time());
|
||||||
|
}
|
||||||
|
$createVersion = true; // for postSave hook
|
||||||
|
}
|
||||||
if ($isInsert) {
|
if ($isInsert) {
|
||||||
$ret = $ret && $this->preInsert($con);
|
$ret = $ret && $this->preInsert($con);
|
||||||
// timestampable behavior
|
// timestampable behavior
|
||||||
@@ -1078,6 +1260,10 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
$this->postUpdate($con);
|
$this->postUpdate($con);
|
||||||
}
|
}
|
||||||
$this->postSave($con);
|
$this->postSave($con);
|
||||||
|
// versionable behavior
|
||||||
|
if (isset($createVersion)) {
|
||||||
|
$this->addVersion($con);
|
||||||
|
}
|
||||||
ProductPeer::addInstanceToPool($this);
|
ProductPeer::addInstanceToPool($this);
|
||||||
} else {
|
} else {
|
||||||
$affectedRows = 0;
|
$affectedRows = 0;
|
||||||
@@ -1305,6 +1491,23 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->productVersionsScheduledForDeletion !== null) {
|
||||||
|
if (!$this->productVersionsScheduledForDeletion->isEmpty()) {
|
||||||
|
ProductVersionQuery::create()
|
||||||
|
->filterByPrimaryKeys($this->productVersionsScheduledForDeletion->getPrimaryKeys(false))
|
||||||
|
->delete($con);
|
||||||
|
$this->productVersionsScheduledForDeletion = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->collProductVersions !== null) {
|
||||||
|
foreach ($this->collProductVersions as $referrerFK) {
|
||||||
|
if (!$referrerFK->isDeleted()) {
|
||||||
|
$affectedRows += $referrerFK->save($con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1373,6 +1576,15 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
if ($this->isColumnModified(ProductPeer::UPDATED_AT)) {
|
if ($this->isColumnModified(ProductPeer::UPDATED_AT)) {
|
||||||
$modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
|
$modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
|
||||||
}
|
}
|
||||||
|
if ($this->isColumnModified(ProductPeer::VERSION)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION`';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(ProductPeer::VERSION_CREATED_AT)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_AT`';
|
||||||
|
}
|
||||||
|
if ($this->isColumnModified(ProductPeer::VERSION_CREATED_BY)) {
|
||||||
|
$modifiedColumns[':p' . $index++] = '`VERSION_CREATED_BY`';
|
||||||
|
}
|
||||||
|
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'INSERT INTO `product` (%s) VALUES (%s)',
|
'INSERT INTO `product` (%s) VALUES (%s)',
|
||||||
@@ -1426,6 +1638,15 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
case '`UPDATED_AT`':
|
case '`UPDATED_AT`':
|
||||||
$stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
|
$stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
|
||||||
break;
|
break;
|
||||||
|
case '`VERSION`':
|
||||||
|
$stmt->bindValue($identifier, $this->version, PDO::PARAM_INT);
|
||||||
|
break;
|
||||||
|
case '`VERSION_CREATED_AT`':
|
||||||
|
$stmt->bindValue($identifier, $this->version_created_at, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
|
case '`VERSION_CREATED_BY`':
|
||||||
|
$stmt->bindValue($identifier, $this->version_created_by, PDO::PARAM_STR);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
@@ -1617,6 +1838,14 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->collProductVersions !== null) {
|
||||||
|
foreach ($this->collProductVersions as $referrerFK) {
|
||||||
|
if (!$referrerFK->validate($columns)) {
|
||||||
|
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
}
|
}
|
||||||
@@ -1694,6 +1923,15 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
case 13:
|
case 13:
|
||||||
return $this->getUpdatedAt();
|
return $this->getUpdatedAt();
|
||||||
break;
|
break;
|
||||||
|
case 14:
|
||||||
|
return $this->getVersion();
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
return $this->getVersionCreatedAt();
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
return $this->getVersionCreatedBy();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
break;
|
break;
|
||||||
@@ -1737,6 +1975,9 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
$keys[11] => $this->getPosition(),
|
$keys[11] => $this->getPosition(),
|
||||||
$keys[12] => $this->getCreatedAt(),
|
$keys[12] => $this->getCreatedAt(),
|
||||||
$keys[13] => $this->getUpdatedAt(),
|
$keys[13] => $this->getUpdatedAt(),
|
||||||
|
$keys[14] => $this->getVersion(),
|
||||||
|
$keys[15] => $this->getVersionCreatedAt(),
|
||||||
|
$keys[16] => $this->getVersionCreatedBy(),
|
||||||
);
|
);
|
||||||
if ($includeForeignObjects) {
|
if ($includeForeignObjects) {
|
||||||
if (null !== $this->aTaxRule) {
|
if (null !== $this->aTaxRule) {
|
||||||
@@ -1772,6 +2013,9 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
if (null !== $this->collProductI18ns) {
|
if (null !== $this->collProductI18ns) {
|
||||||
$result['ProductI18ns'] = $this->collProductI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
$result['ProductI18ns'] = $this->collProductI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
}
|
}
|
||||||
|
if (null !== $this->collProductVersions) {
|
||||||
|
$result['ProductVersions'] = $this->collProductVersions->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -1848,6 +2092,15 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
case 13:
|
case 13:
|
||||||
$this->setUpdatedAt($value);
|
$this->setUpdatedAt($value);
|
||||||
break;
|
break;
|
||||||
|
case 14:
|
||||||
|
$this->setVersion($value);
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
$this->setVersionCreatedAt($value);
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
$this->setVersionCreatedBy($value);
|
||||||
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1886,6 +2139,9 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
if (array_key_exists($keys[11], $arr)) $this->setPosition($arr[$keys[11]]);
|
if (array_key_exists($keys[11], $arr)) $this->setPosition($arr[$keys[11]]);
|
||||||
if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
|
if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
|
||||||
if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]);
|
if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]);
|
||||||
|
if (array_key_exists($keys[14], $arr)) $this->setVersion($arr[$keys[14]]);
|
||||||
|
if (array_key_exists($keys[15], $arr)) $this->setVersionCreatedAt($arr[$keys[15]]);
|
||||||
|
if (array_key_exists($keys[16], $arr)) $this->setVersionCreatedBy($arr[$keys[16]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1911,6 +2167,9 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
if ($this->isColumnModified(ProductPeer::POSITION)) $criteria->add(ProductPeer::POSITION, $this->position);
|
if ($this->isColumnModified(ProductPeer::POSITION)) $criteria->add(ProductPeer::POSITION, $this->position);
|
||||||
if ($this->isColumnModified(ProductPeer::CREATED_AT)) $criteria->add(ProductPeer::CREATED_AT, $this->created_at);
|
if ($this->isColumnModified(ProductPeer::CREATED_AT)) $criteria->add(ProductPeer::CREATED_AT, $this->created_at);
|
||||||
if ($this->isColumnModified(ProductPeer::UPDATED_AT)) $criteria->add(ProductPeer::UPDATED_AT, $this->updated_at);
|
if ($this->isColumnModified(ProductPeer::UPDATED_AT)) $criteria->add(ProductPeer::UPDATED_AT, $this->updated_at);
|
||||||
|
if ($this->isColumnModified(ProductPeer::VERSION)) $criteria->add(ProductPeer::VERSION, $this->version);
|
||||||
|
if ($this->isColumnModified(ProductPeer::VERSION_CREATED_AT)) $criteria->add(ProductPeer::VERSION_CREATED_AT, $this->version_created_at);
|
||||||
|
if ($this->isColumnModified(ProductPeer::VERSION_CREATED_BY)) $criteria->add(ProductPeer::VERSION_CREATED_BY, $this->version_created_by);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
@@ -1987,6 +2246,9 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
$copyObj->setPosition($this->getPosition());
|
$copyObj->setPosition($this->getPosition());
|
||||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||||
|
$copyObj->setVersion($this->getVersion());
|
||||||
|
$copyObj->setVersionCreatedAt($this->getVersionCreatedAt());
|
||||||
|
$copyObj->setVersionCreatedBy($this->getVersionCreatedBy());
|
||||||
|
|
||||||
if ($deepCopy && !$this->startCopy) {
|
if ($deepCopy && !$this->startCopy) {
|
||||||
// important: temporarily setNew(false) because this affects the behavior of
|
// important: temporarily setNew(false) because this affects the behavior of
|
||||||
@@ -2055,6 +2317,12 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->getProductVersions() as $relObj) {
|
||||||
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
|
$copyObj->addProductVersion($relObj->copy($deepCopy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//unflag object copy
|
//unflag object copy
|
||||||
$this->startCopy = false;
|
$this->startCopy = false;
|
||||||
} // if ($deepCopy)
|
} // if ($deepCopy)
|
||||||
@@ -2197,6 +2465,9 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
if ('ProductI18n' == $relationName) {
|
if ('ProductI18n' == $relationName) {
|
||||||
$this->initProductI18ns();
|
$this->initProductI18ns();
|
||||||
}
|
}
|
||||||
|
if ('ProductVersion' == $relationName) {
|
||||||
|
$this->initProductVersions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4648,6 +4919,213 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears out the collProductVersions 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 addProductVersions()
|
||||||
|
*/
|
||||||
|
public function clearProductVersions()
|
||||||
|
{
|
||||||
|
$this->collProductVersions = null; // important to set this to null since that means it is uninitialized
|
||||||
|
$this->collProductVersionsPartial = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reset is the collProductVersions collection loaded partially
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function resetPartialProductVersions($v = true)
|
||||||
|
{
|
||||||
|
$this->collProductVersionsPartial = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the collProductVersions collection.
|
||||||
|
*
|
||||||
|
* By default this just sets the collProductVersions collection to an empty array (like clearcollProductVersions());
|
||||||
|
* 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 initProductVersions($overrideExisting = true)
|
||||||
|
{
|
||||||
|
if (null !== $this->collProductVersions && !$overrideExisting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->collProductVersions = new PropelObjectCollection();
|
||||||
|
$this->collProductVersions->setModel('ProductVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an array of ProductVersion objects which contain a foreign key that references this object.
|
||||||
|
*
|
||||||
|
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||||
|
* Otherwise the results are fetched from the database the first time, then cached.
|
||||||
|
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||||
|
* If this Product is new, it will return
|
||||||
|
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param PropelPDO $con optional connection object
|
||||||
|
* @return PropelObjectCollection|ProductVersion[] List of ProductVersion objects
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function getProductVersions($criteria = null, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collProductVersionsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collProductVersions || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collProductVersions) {
|
||||||
|
// return empty collection
|
||||||
|
$this->initProductVersions();
|
||||||
|
} else {
|
||||||
|
$collProductVersions = ProductVersionQuery::create(null, $criteria)
|
||||||
|
->filterByProduct($this)
|
||||||
|
->find($con);
|
||||||
|
if (null !== $criteria) {
|
||||||
|
if (false !== $this->collProductVersionsPartial && count($collProductVersions)) {
|
||||||
|
$this->initProductVersions(false);
|
||||||
|
|
||||||
|
foreach($collProductVersions as $obj) {
|
||||||
|
if (false == $this->collProductVersions->contains($obj)) {
|
||||||
|
$this->collProductVersions->append($obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collProductVersionsPartial = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $collProductVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($partial && $this->collProductVersions) {
|
||||||
|
foreach($this->collProductVersions as $obj) {
|
||||||
|
if($obj->isNew()) {
|
||||||
|
$collProductVersions[] = $obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collProductVersions = $collProductVersions;
|
||||||
|
$this->collProductVersionsPartial = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->collProductVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a collection of ProductVersion 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 $productVersions A Propel collection.
|
||||||
|
* @param PropelPDO $con Optional connection object
|
||||||
|
*/
|
||||||
|
public function setProductVersions(PropelCollection $productVersions, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$this->productVersionsScheduledForDeletion = $this->getProductVersions(new Criteria(), $con)->diff($productVersions);
|
||||||
|
|
||||||
|
foreach ($this->productVersionsScheduledForDeletion as $productVersionRemoved) {
|
||||||
|
$productVersionRemoved->setProduct(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collProductVersions = null;
|
||||||
|
foreach ($productVersions as $productVersion) {
|
||||||
|
$this->addProductVersion($productVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->collProductVersions = $productVersions;
|
||||||
|
$this->collProductVersionsPartial = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of related ProductVersion objects.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @return int Count of related ProductVersion objects.
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function countProductVersions(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$partial = $this->collProductVersionsPartial && !$this->isNew();
|
||||||
|
if (null === $this->collProductVersions || null !== $criteria || $partial) {
|
||||||
|
if ($this->isNew() && null === $this->collProductVersions) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
if($partial && !$criteria) {
|
||||||
|
return count($this->getProductVersions());
|
||||||
|
}
|
||||||
|
$query = ProductVersionQuery::create(null, $criteria);
|
||||||
|
if ($distinct) {
|
||||||
|
$query->distinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query
|
||||||
|
->filterByProduct($this)
|
||||||
|
->count($con);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return count($this->collProductVersions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called to associate a ProductVersion object to this object
|
||||||
|
* through the ProductVersion foreign key attribute.
|
||||||
|
*
|
||||||
|
* @param ProductVersion $l ProductVersion
|
||||||
|
* @return Product The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function addProductVersion(ProductVersion $l)
|
||||||
|
{
|
||||||
|
if ($this->collProductVersions === null) {
|
||||||
|
$this->initProductVersions();
|
||||||
|
$this->collProductVersionsPartial = true;
|
||||||
|
}
|
||||||
|
if (!$this->collProductVersions->contains($l)) { // only add it if the **same** object is not already associated
|
||||||
|
$this->doAddProductVersion($l);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ProductVersion $productVersion The productVersion object to add.
|
||||||
|
*/
|
||||||
|
protected function doAddProductVersion($productVersion)
|
||||||
|
{
|
||||||
|
$this->collProductVersions[]= $productVersion;
|
||||||
|
$productVersion->setProduct($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ProductVersion $productVersion The productVersion object to remove.
|
||||||
|
*/
|
||||||
|
public function removeProductVersion($productVersion)
|
||||||
|
{
|
||||||
|
if ($this->getProductVersions()->contains($productVersion)) {
|
||||||
|
$this->collProductVersions->remove($this->collProductVersions->search($productVersion));
|
||||||
|
if (null === $this->productVersionsScheduledForDeletion) {
|
||||||
|
$this->productVersionsScheduledForDeletion = clone $this->collProductVersions;
|
||||||
|
$this->productVersionsScheduledForDeletion->clear();
|
||||||
|
}
|
||||||
|
$this->productVersionsScheduledForDeletion[]= $productVersion;
|
||||||
|
$productVersion->setProduct(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the current object and sets all attributes to their default values
|
* Clears the current object and sets all attributes to their default values
|
||||||
*/
|
*/
|
||||||
@@ -4667,6 +5145,9 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
$this->position = null;
|
$this->position = null;
|
||||||
$this->created_at = null;
|
$this->created_at = null;
|
||||||
$this->updated_at = null;
|
$this->updated_at = null;
|
||||||
|
$this->version = null;
|
||||||
|
$this->version_created_at = null;
|
||||||
|
$this->version_created_by = null;
|
||||||
$this->alreadyInSave = false;
|
$this->alreadyInSave = false;
|
||||||
$this->alreadyInValidation = false;
|
$this->alreadyInValidation = false;
|
||||||
$this->clearAllReferences();
|
$this->clearAllReferences();
|
||||||
@@ -4738,6 +5219,11 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
$o->clearAllReferences($deep);
|
$o->clearAllReferences($deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->collProductVersions) {
|
||||||
|
foreach ($this->collProductVersions as $o) {
|
||||||
|
$o->clearAllReferences($deep);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // if ($deep)
|
} // if ($deep)
|
||||||
|
|
||||||
// i18n behavior
|
// i18n behavior
|
||||||
@@ -4784,6 +5270,10 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
$this->collProductI18ns->clearIterator();
|
$this->collProductI18ns->clearIterator();
|
||||||
}
|
}
|
||||||
$this->collProductI18ns = null;
|
$this->collProductI18ns = null;
|
||||||
|
if ($this->collProductVersions instanceof PropelCollection) {
|
||||||
|
$this->collProductVersions->clearIterator();
|
||||||
|
}
|
||||||
|
$this->collProductVersions = null;
|
||||||
$this->aTaxRule = null;
|
$this->aTaxRule = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5016,4 +5506,311 @@ abstract class BaseProduct extends BaseObject implements Persistent
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enforce a new Version of this object upon next save.
|
||||||
|
*
|
||||||
|
* @return Product
|
||||||
|
*/
|
||||||
|
public function enforceVersioning()
|
||||||
|
{
|
||||||
|
$this->enforceVersion = true;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current state must be recorded as a version
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con An optional PropelPDO connection to use.
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isVersioningNecessary($con = null)
|
||||||
|
{
|
||||||
|
if ($this->alreadyInSave) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->enforceVersion) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ProductPeer::isVersioningEnabled() && ($this->isNew() || $this->isModified() || $this->isDeleted())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a version of the current object and saves it.
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return ProductVersion A version object
|
||||||
|
*/
|
||||||
|
public function addVersion($con = null)
|
||||||
|
{
|
||||||
|
$this->enforceVersion = false;
|
||||||
|
|
||||||
|
$version = new ProductVersion();
|
||||||
|
$version->setId($this->getId());
|
||||||
|
$version->setTaxRuleId($this->getTaxRuleId());
|
||||||
|
$version->setRef($this->getRef());
|
||||||
|
$version->setPrice($this->getPrice());
|
||||||
|
$version->setPrice2($this->getPrice2());
|
||||||
|
$version->setEcotax($this->getEcotax());
|
||||||
|
$version->setNewness($this->getNewness());
|
||||||
|
$version->setPromo($this->getPromo());
|
||||||
|
$version->setStock($this->getStock());
|
||||||
|
$version->setVisible($this->getVisible());
|
||||||
|
$version->setWeight($this->getWeight());
|
||||||
|
$version->setPosition($this->getPosition());
|
||||||
|
$version->setCreatedAt($this->getCreatedAt());
|
||||||
|
$version->setUpdatedAt($this->getUpdatedAt());
|
||||||
|
$version->setVersion($this->getVersion());
|
||||||
|
$version->setVersionCreatedAt($this->getVersionCreatedAt());
|
||||||
|
$version->setVersionCreatedBy($this->getVersionCreatedBy());
|
||||||
|
$version->setProduct($this);
|
||||||
|
$version->save($con);
|
||||||
|
|
||||||
|
return $version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the properties of the curent object to the value they had at a specific version
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber The version number to read
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return Product The current object (for fluent API support)
|
||||||
|
* @throws PropelException - if no object with the given version can be found.
|
||||||
|
*/
|
||||||
|
public function toVersion($versionNumber, $con = null)
|
||||||
|
{
|
||||||
|
$version = $this->getOneVersion($versionNumber, $con);
|
||||||
|
if (!$version) {
|
||||||
|
throw new PropelException(sprintf('No Product object found with version %d', $version));
|
||||||
|
}
|
||||||
|
$this->populateFromVersion($version, $con);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the properties of the curent object to the value they had at a specific version
|
||||||
|
*
|
||||||
|
* @param ProductVersion $version The version object to use
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $loadedObjects objects thats been loaded in a chain of populateFromVersion calls on referrer or fk objects.
|
||||||
|
*
|
||||||
|
* @return Product The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function populateFromVersion($version, $con = null, &$loadedObjects = array())
|
||||||
|
{
|
||||||
|
|
||||||
|
$loadedObjects['Product'][$version->getId()][$version->getVersion()] = $this;
|
||||||
|
$this->setId($version->getId());
|
||||||
|
$this->setTaxRuleId($version->getTaxRuleId());
|
||||||
|
$this->setRef($version->getRef());
|
||||||
|
$this->setPrice($version->getPrice());
|
||||||
|
$this->setPrice2($version->getPrice2());
|
||||||
|
$this->setEcotax($version->getEcotax());
|
||||||
|
$this->setNewness($version->getNewness());
|
||||||
|
$this->setPromo($version->getPromo());
|
||||||
|
$this->setStock($version->getStock());
|
||||||
|
$this->setVisible($version->getVisible());
|
||||||
|
$this->setWeight($version->getWeight());
|
||||||
|
$this->setPosition($version->getPosition());
|
||||||
|
$this->setCreatedAt($version->getCreatedAt());
|
||||||
|
$this->setUpdatedAt($version->getUpdatedAt());
|
||||||
|
$this->setVersion($version->getVersion());
|
||||||
|
$this->setVersionCreatedAt($version->getVersionCreatedAt());
|
||||||
|
$this->setVersionCreatedBy($version->getVersionCreatedBy());
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the latest persisted version number for the current object
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getLastVersionNumber($con = null)
|
||||||
|
{
|
||||||
|
$v = ProductVersionQuery::create()
|
||||||
|
->filterByProduct($this)
|
||||||
|
->orderByVersion('desc')
|
||||||
|
->findOne($con);
|
||||||
|
if (!$v) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $v->getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the current object is the latest one
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isLastVersion($con = null)
|
||||||
|
{
|
||||||
|
return $this->getLastVersionNumber($con) == $this->getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a version object for this entity and a version number
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber The version number to read
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return ProductVersion A version object
|
||||||
|
*/
|
||||||
|
public function getOneVersion($versionNumber, $con = null)
|
||||||
|
{
|
||||||
|
return ProductVersionQuery::create()
|
||||||
|
->filterByProduct($this)
|
||||||
|
->filterByVersion($versionNumber)
|
||||||
|
->findOne($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all the versions of this object, in incremental order
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
*
|
||||||
|
* @return PropelObjectCollection A list of ProductVersion objects
|
||||||
|
*/
|
||||||
|
public function getAllVersions($con = null)
|
||||||
|
{
|
||||||
|
$criteria = new Criteria();
|
||||||
|
$criteria->addAscendingOrderByColumn(ProductVersionPeer::VERSION);
|
||||||
|
|
||||||
|
return $this->getProductVersions($criteria, $con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the current object with another of its version.
|
||||||
|
* <code>
|
||||||
|
* print_r($book->compareVersion(1));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param integer $versionNumber
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns)
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
public function compareVersion($versionNumber, $keys = 'columns', $con = null, $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersion = $this->toArray();
|
||||||
|
$toVersion = $this->getOneVersion($versionNumber, $con)->toArray();
|
||||||
|
|
||||||
|
return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares two versions of the current object.
|
||||||
|
* <code>
|
||||||
|
* print_r($book->compareVersions(1, 2));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param integer $fromVersionNumber
|
||||||
|
* @param integer $toVersionNumber
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns)
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
public function compareVersions($fromVersionNumber, $toVersionNumber, $keys = 'columns', $con = null, $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersion = $this->getOneVersion($fromVersionNumber, $con)->toArray();
|
||||||
|
$toVersion = $this->getOneVersion($toVersionNumber, $con)->toArray();
|
||||||
|
|
||||||
|
return $this->computeDiff($fromVersion, $toVersion, $keys, $ignoredColumns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes the diff between two versions.
|
||||||
|
* <code>
|
||||||
|
* print_r($this->computeDiff(1, 2));
|
||||||
|
* => array(
|
||||||
|
* '1' => array('Title' => 'Book title at version 1'),
|
||||||
|
* '2' => array('Title' => 'Book title at version 2')
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param array $fromVersion An array representing the original version.
|
||||||
|
* @param array $toVersion An array representing the destination version.
|
||||||
|
* @param string $keys Main key used for the result diff (versions|columns).
|
||||||
|
* @param array $ignoredColumns The columns to exclude from the diff.
|
||||||
|
*
|
||||||
|
* @return array A list of differences
|
||||||
|
*/
|
||||||
|
protected function computeDiff($fromVersion, $toVersion, $keys = 'columns', $ignoredColumns = array())
|
||||||
|
{
|
||||||
|
$fromVersionNumber = $fromVersion['Version'];
|
||||||
|
$toVersionNumber = $toVersion['Version'];
|
||||||
|
$ignoredColumns = array_merge(array(
|
||||||
|
'Version',
|
||||||
|
'VersionCreatedAt',
|
||||||
|
'VersionCreatedBy',
|
||||||
|
), $ignoredColumns);
|
||||||
|
$diff = array();
|
||||||
|
foreach ($fromVersion as $key => $value) {
|
||||||
|
if (in_array($key, $ignoredColumns)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($toVersion[$key] != $value) {
|
||||||
|
switch ($keys) {
|
||||||
|
case 'versions':
|
||||||
|
$diff[$fromVersionNumber][$key] = $value;
|
||||||
|
$diff[$toVersionNumber][$key] = $toVersion[$key];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$diff[$key] = array(
|
||||||
|
$fromVersionNumber => $value,
|
||||||
|
$toVersionNumber => $toVersion[$key],
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $diff;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* retrieve the last $number versions.
|
||||||
|
*
|
||||||
|
* @param integer $number the number of record to return.
|
||||||
|
* @param ProductVersionQuery|Criteria $criteria Additional criteria to filter.
|
||||||
|
* @param PropelPDO $con An optional connection to use.
|
||||||
|
*
|
||||||
|
* @return PropelCollection|ProductVersion[] List of ProductVersion objects
|
||||||
|
*/
|
||||||
|
public function getLastVersions($number = 10, $criteria = null, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
$criteria = ProductVersionQuery::create(null, $criteria);
|
||||||
|
$criteria->addDescendingOrderByColumn(ProductVersionPeer::VERSION);
|
||||||
|
$criteria->limit($number);
|
||||||
|
|
||||||
|
return $this->getProductVersions($criteria, $con);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ use Thelia\Model\Product;
|
|||||||
use Thelia\Model\ProductCategoryPeer;
|
use Thelia\Model\ProductCategoryPeer;
|
||||||
use Thelia\Model\ProductI18nPeer;
|
use Thelia\Model\ProductI18nPeer;
|
||||||
use Thelia\Model\ProductPeer;
|
use Thelia\Model\ProductPeer;
|
||||||
|
use Thelia\Model\ProductVersionPeer;
|
||||||
use Thelia\Model\RewritingPeer;
|
use Thelia\Model\RewritingPeer;
|
||||||
use Thelia\Model\StockPeer;
|
use Thelia\Model\StockPeer;
|
||||||
use Thelia\Model\TaxRulePeer;
|
use Thelia\Model\TaxRulePeer;
|
||||||
@@ -46,13 +47,13 @@ abstract class BaseProductPeer
|
|||||||
const TM_CLASS = 'ProductTableMap';
|
const TM_CLASS = 'ProductTableMap';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 14;
|
const NUM_COLUMNS = 17;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
|
||||||
const NUM_HYDRATE_COLUMNS = 14;
|
const NUM_HYDRATE_COLUMNS = 17;
|
||||||
|
|
||||||
/** the column name for the ID field */
|
/** the column name for the ID field */
|
||||||
const ID = 'product.ID';
|
const ID = 'product.ID';
|
||||||
@@ -96,6 +97,15 @@ abstract class BaseProductPeer
|
|||||||
/** the column name for the UPDATED_AT field */
|
/** the column name for the UPDATED_AT field */
|
||||||
const UPDATED_AT = 'product.UPDATED_AT';
|
const UPDATED_AT = 'product.UPDATED_AT';
|
||||||
|
|
||||||
|
/** the column name for the VERSION field */
|
||||||
|
const VERSION = 'product.VERSION';
|
||||||
|
|
||||||
|
/** the column name for the VERSION_CREATED_AT field */
|
||||||
|
const VERSION_CREATED_AT = 'product.VERSION_CREATED_AT';
|
||||||
|
|
||||||
|
/** the column name for the VERSION_CREATED_BY field */
|
||||||
|
const VERSION_CREATED_BY = 'product.VERSION_CREATED_BY';
|
||||||
|
|
||||||
/** The default string format for model objects of the related table **/
|
/** The default string format for model objects of the related table **/
|
||||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
const DEFAULT_STRING_FORMAT = 'YAML';
|
||||||
|
|
||||||
@@ -115,6 +125,13 @@ abstract class BaseProductPeer
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
const DEFAULT_LOCALE = 'en_EN';
|
const DEFAULT_LOCALE = 'en_EN';
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the versioning is enabled
|
||||||
|
*/
|
||||||
|
static $isVersioningEnabled = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* holds an array of fieldnames
|
* holds an array of fieldnames
|
||||||
*
|
*
|
||||||
@@ -122,12 +139,12 @@ abstract class BaseProductPeer
|
|||||||
* e.g. ProductPeer::$fieldNames[ProductPeer::TYPE_PHPNAME][0] = 'Id'
|
* e.g. ProductPeer::$fieldNames[ProductPeer::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
protected static $fieldNames = array (
|
protected static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('Id', 'TaxRuleId', 'Ref', 'Price', 'Price2', 'Ecotax', 'Newness', 'Promo', 'Stock', 'Visible', 'Weight', 'Position', 'CreatedAt', 'UpdatedAt', ),
|
BasePeer::TYPE_PHPNAME => array ('Id', 'TaxRuleId', 'Ref', 'Price', 'Price2', 'Ecotax', 'Newness', 'Promo', 'Stock', 'Visible', 'Weight', 'Position', 'CreatedAt', 'UpdatedAt', 'Version', 'VersionCreatedAt', 'VersionCreatedBy', ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'taxRuleId', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'stock', 'visible', 'weight', 'position', 'createdAt', 'updatedAt', ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'taxRuleId', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'stock', 'visible', 'weight', 'position', 'createdAt', 'updatedAt', 'version', 'versionCreatedAt', 'versionCreatedBy', ),
|
||||||
BasePeer::TYPE_COLNAME => array (ProductPeer::ID, ProductPeer::TAX_RULE_ID, ProductPeer::REF, ProductPeer::PRICE, ProductPeer::PRICE2, ProductPeer::ECOTAX, ProductPeer::NEWNESS, ProductPeer::PROMO, ProductPeer::STOCK, ProductPeer::VISIBLE, ProductPeer::WEIGHT, ProductPeer::POSITION, ProductPeer::CREATED_AT, ProductPeer::UPDATED_AT, ),
|
BasePeer::TYPE_COLNAME => array (ProductPeer::ID, ProductPeer::TAX_RULE_ID, ProductPeer::REF, ProductPeer::PRICE, ProductPeer::PRICE2, ProductPeer::ECOTAX, ProductPeer::NEWNESS, ProductPeer::PROMO, ProductPeer::STOCK, ProductPeer::VISIBLE, ProductPeer::WEIGHT, ProductPeer::POSITION, ProductPeer::CREATED_AT, ProductPeer::UPDATED_AT, ProductPeer::VERSION, ProductPeer::VERSION_CREATED_AT, ProductPeer::VERSION_CREATED_BY, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAX_RULE_ID', 'REF', 'PRICE', 'PRICE2', 'ECOTAX', 'NEWNESS', 'PROMO', 'STOCK', 'VISIBLE', 'WEIGHT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'TAX_RULE_ID', 'REF', 'PRICE', 'PRICE2', 'ECOTAX', 'NEWNESS', 'PROMO', 'STOCK', 'VISIBLE', 'WEIGHT', 'POSITION', 'CREATED_AT', 'UPDATED_AT', 'VERSION', 'VERSION_CREATED_AT', 'VERSION_CREATED_BY', ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id', 'tax_rule_id', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'stock', 'visible', 'weight', 'position', 'created_at', 'updated_at', ),
|
BasePeer::TYPE_FIELDNAME => array ('id', 'tax_rule_id', 'ref', 'price', 'price2', 'ecotax', 'newness', 'promo', 'stock', 'visible', 'weight', 'position', 'created_at', 'updated_at', 'version', 'version_created_at', 'version_created_by', ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -137,12 +154,12 @@ abstract class BaseProductPeer
|
|||||||
* e.g. ProductPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
* e.g. ProductPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
protected static $fieldKeys = array (
|
protected static $fieldKeys = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Price' => 3, 'Price2' => 4, 'Ecotax' => 5, 'Newness' => 6, 'Promo' => 7, 'Stock' => 8, 'Visible' => 9, 'Weight' => 10, 'Position' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, ),
|
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'TaxRuleId' => 1, 'Ref' => 2, 'Price' => 3, 'Price2' => 4, 'Ecotax' => 5, 'Newness' => 6, 'Promo' => 7, 'Stock' => 8, 'Visible' => 9, 'Weight' => 10, 'Position' => 11, 'CreatedAt' => 12, 'UpdatedAt' => 13, 'Version' => 14, 'VersionCreatedAt' => 15, 'VersionCreatedBy' => 16, ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'stock' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'createdAt' => 12, 'updatedAt' => 13, ),
|
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'taxRuleId' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'stock' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'createdAt' => 12, 'updatedAt' => 13, 'version' => 14, 'versionCreatedAt' => 15, 'versionCreatedBy' => 16, ),
|
||||||
BasePeer::TYPE_COLNAME => array (ProductPeer::ID => 0, ProductPeer::TAX_RULE_ID => 1, ProductPeer::REF => 2, ProductPeer::PRICE => 3, ProductPeer::PRICE2 => 4, ProductPeer::ECOTAX => 5, ProductPeer::NEWNESS => 6, ProductPeer::PROMO => 7, ProductPeer::STOCK => 8, ProductPeer::VISIBLE => 9, ProductPeer::WEIGHT => 10, ProductPeer::POSITION => 11, ProductPeer::CREATED_AT => 12, ProductPeer::UPDATED_AT => 13, ),
|
BasePeer::TYPE_COLNAME => array (ProductPeer::ID => 0, ProductPeer::TAX_RULE_ID => 1, ProductPeer::REF => 2, ProductPeer::PRICE => 3, ProductPeer::PRICE2 => 4, ProductPeer::ECOTAX => 5, ProductPeer::NEWNESS => 6, ProductPeer::PROMO => 7, ProductPeer::STOCK => 8, ProductPeer::VISIBLE => 9, ProductPeer::WEIGHT => 10, ProductPeer::POSITION => 11, ProductPeer::CREATED_AT => 12, ProductPeer::UPDATED_AT => 13, ProductPeer::VERSION => 14, ProductPeer::VERSION_CREATED_AT => 15, ProductPeer::VERSION_CREATED_BY => 16, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'PRICE' => 3, 'PRICE2' => 4, 'ECOTAX' => 5, 'NEWNESS' => 6, 'PROMO' => 7, 'STOCK' => 8, 'VISIBLE' => 9, 'WEIGHT' => 10, 'POSITION' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, ),
|
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'TAX_RULE_ID' => 1, 'REF' => 2, 'PRICE' => 3, 'PRICE2' => 4, 'ECOTAX' => 5, 'NEWNESS' => 6, 'PROMO' => 7, 'STOCK' => 8, 'VISIBLE' => 9, 'WEIGHT' => 10, 'POSITION' => 11, 'CREATED_AT' => 12, 'UPDATED_AT' => 13, 'VERSION' => 14, 'VERSION_CREATED_AT' => 15, 'VERSION_CREATED_BY' => 16, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'stock' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'created_at' => 12, 'updated_at' => 13, ),
|
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'tax_rule_id' => 1, 'ref' => 2, 'price' => 3, 'price2' => 4, 'ecotax' => 5, 'newness' => 6, 'promo' => 7, 'stock' => 8, 'visible' => 9, 'weight' => 10, 'position' => 11, 'created_at' => 12, 'updated_at' => 13, 'version' => 14, 'version_created_at' => 15, 'version_created_by' => 16, ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -230,6 +247,9 @@ abstract class BaseProductPeer
|
|||||||
$criteria->addSelectColumn(ProductPeer::POSITION);
|
$criteria->addSelectColumn(ProductPeer::POSITION);
|
||||||
$criteria->addSelectColumn(ProductPeer::CREATED_AT);
|
$criteria->addSelectColumn(ProductPeer::CREATED_AT);
|
||||||
$criteria->addSelectColumn(ProductPeer::UPDATED_AT);
|
$criteria->addSelectColumn(ProductPeer::UPDATED_AT);
|
||||||
|
$criteria->addSelectColumn(ProductPeer::VERSION);
|
||||||
|
$criteria->addSelectColumn(ProductPeer::VERSION_CREATED_AT);
|
||||||
|
$criteria->addSelectColumn(ProductPeer::VERSION_CREATED_BY);
|
||||||
} else {
|
} else {
|
||||||
$criteria->addSelectColumn($alias . '.ID');
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
$criteria->addSelectColumn($alias . '.TAX_RULE_ID');
|
$criteria->addSelectColumn($alias . '.TAX_RULE_ID');
|
||||||
@@ -245,6 +265,9 @@ abstract class BaseProductPeer
|
|||||||
$criteria->addSelectColumn($alias . '.POSITION');
|
$criteria->addSelectColumn($alias . '.POSITION');
|
||||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION_CREATED_AT');
|
||||||
|
$criteria->addSelectColumn($alias . '.VERSION_CREATED_BY');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,6 +497,9 @@ abstract class BaseProductPeer
|
|||||||
// Invalidate objects in ProductI18nPeer instance pool,
|
// Invalidate objects in ProductI18nPeer instance pool,
|
||||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
ProductI18nPeer::clearInstancePool();
|
ProductI18nPeer::clearInstancePool();
|
||||||
|
// Invalidate objects in ProductVersionPeer instance pool,
|
||||||
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
|
ProductVersionPeer::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1105,6 +1131,34 @@ abstract class BaseProductPeer
|
|||||||
return $objs;
|
return $objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// versionable behavior
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether versioning is enabled
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function isVersioningEnabled()
|
||||||
|
{
|
||||||
|
return self::$isVersioningEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables versioning
|
||||||
|
*/
|
||||||
|
public static function enableVersioning()
|
||||||
|
{
|
||||||
|
self::$isVersioningEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables versioning
|
||||||
|
*/
|
||||||
|
public static function disableVersioning()
|
||||||
|
{
|
||||||
|
self::$isVersioningEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
} // BaseProductPeer
|
} // BaseProductPeer
|
||||||
|
|
||||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ use Thelia\Model\ProductCategory;
|
|||||||
use Thelia\Model\ProductI18n;
|
use Thelia\Model\ProductI18n;
|
||||||
use Thelia\Model\ProductPeer;
|
use Thelia\Model\ProductPeer;
|
||||||
use Thelia\Model\ProductQuery;
|
use Thelia\Model\ProductQuery;
|
||||||
|
use Thelia\Model\ProductVersion;
|
||||||
use Thelia\Model\Rewriting;
|
use Thelia\Model\Rewriting;
|
||||||
use Thelia\Model\Stock;
|
use Thelia\Model\Stock;
|
||||||
use Thelia\Model\TaxRule;
|
use Thelia\Model\TaxRule;
|
||||||
@@ -45,6 +46,9 @@ use Thelia\Model\TaxRule;
|
|||||||
* @method ProductQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
* @method ProductQuery orderByPosition($order = Criteria::ASC) Order by the position column
|
||||||
* @method ProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
* @method ProductQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||||
* @method ProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
* @method ProductQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||||
|
* @method ProductQuery orderByVersion($order = Criteria::ASC) Order by the version column
|
||||||
|
* @method ProductQuery orderByVersionCreatedAt($order = Criteria::ASC) Order by the version_created_at column
|
||||||
|
* @method ProductQuery orderByVersionCreatedBy($order = Criteria::ASC) Order by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method ProductQuery groupById() Group by the id column
|
* @method ProductQuery groupById() Group by the id column
|
||||||
* @method ProductQuery groupByTaxRuleId() Group by the tax_rule_id column
|
* @method ProductQuery groupByTaxRuleId() Group by the tax_rule_id column
|
||||||
@@ -60,6 +64,9 @@ use Thelia\Model\TaxRule;
|
|||||||
* @method ProductQuery groupByPosition() Group by the position column
|
* @method ProductQuery groupByPosition() Group by the position column
|
||||||
* @method ProductQuery groupByCreatedAt() Group by the created_at column
|
* @method ProductQuery groupByCreatedAt() Group by the created_at column
|
||||||
* @method ProductQuery groupByUpdatedAt() Group by the updated_at column
|
* @method ProductQuery groupByUpdatedAt() Group by the updated_at column
|
||||||
|
* @method ProductQuery groupByVersion() Group by the version column
|
||||||
|
* @method ProductQuery groupByVersionCreatedAt() Group by the version_created_at column
|
||||||
|
* @method ProductQuery groupByVersionCreatedBy() Group by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method ProductQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
* @method ProductQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
* @method ProductQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
* @method ProductQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
@@ -109,6 +116,10 @@ use Thelia\Model\TaxRule;
|
|||||||
* @method ProductQuery rightJoinProductI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductI18n relation
|
* @method ProductQuery rightJoinProductI18n($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductI18n relation
|
||||||
* @method ProductQuery innerJoinProductI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductI18n relation
|
* @method ProductQuery innerJoinProductI18n($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductI18n relation
|
||||||
*
|
*
|
||||||
|
* @method ProductQuery leftJoinProductVersion($relationAlias = null) Adds a LEFT JOIN clause to the query using the ProductVersion relation
|
||||||
|
* @method ProductQuery rightJoinProductVersion($relationAlias = null) Adds a RIGHT JOIN clause to the query using the ProductVersion relation
|
||||||
|
* @method ProductQuery innerJoinProductVersion($relationAlias = null) Adds a INNER JOIN clause to the query using the ProductVersion relation
|
||||||
|
*
|
||||||
* @method Product findOne(PropelPDO $con = null) Return the first Product matching the query
|
* @method Product findOne(PropelPDO $con = null) Return the first Product matching the query
|
||||||
* @method Product findOneOrCreate(PropelPDO $con = null) Return the first Product matching the query, or a new Product object populated from the query conditions when no match is found
|
* @method Product findOneOrCreate(PropelPDO $con = null) Return the first Product matching the query, or a new Product object populated from the query conditions when no match is found
|
||||||
*
|
*
|
||||||
@@ -126,6 +137,9 @@ use Thelia\Model\TaxRule;
|
|||||||
* @method Product findOneByPosition(int $position) Return the first Product filtered by the position column
|
* @method Product findOneByPosition(int $position) Return the first Product filtered by the position column
|
||||||
* @method Product findOneByCreatedAt(string $created_at) Return the first Product filtered by the created_at column
|
* @method Product findOneByCreatedAt(string $created_at) Return the first Product filtered by the created_at column
|
||||||
* @method Product findOneByUpdatedAt(string $updated_at) Return the first Product filtered by the updated_at column
|
* @method Product findOneByUpdatedAt(string $updated_at) Return the first Product filtered by the updated_at column
|
||||||
|
* @method Product findOneByVersion(int $version) Return the first Product filtered by the version column
|
||||||
|
* @method Product findOneByVersionCreatedAt(string $version_created_at) Return the first Product filtered by the version_created_at column
|
||||||
|
* @method Product findOneByVersionCreatedBy(string $version_created_by) Return the first Product filtered by the version_created_by column
|
||||||
*
|
*
|
||||||
* @method array findById(int $id) Return Product objects filtered by the id column
|
* @method array findById(int $id) Return Product objects filtered by the id column
|
||||||
* @method array findByTaxRuleId(int $tax_rule_id) Return Product objects filtered by the tax_rule_id column
|
* @method array findByTaxRuleId(int $tax_rule_id) Return Product objects filtered by the tax_rule_id column
|
||||||
@@ -141,6 +155,9 @@ use Thelia\Model\TaxRule;
|
|||||||
* @method array findByPosition(int $position) Return Product objects filtered by the position column
|
* @method array findByPosition(int $position) Return Product objects filtered by the position column
|
||||||
* @method array findByCreatedAt(string $created_at) Return Product objects filtered by the created_at column
|
* @method array findByCreatedAt(string $created_at) Return Product objects filtered by the created_at column
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return Product objects filtered by the updated_at column
|
* @method array findByUpdatedAt(string $updated_at) Return Product objects filtered by the updated_at column
|
||||||
|
* @method array findByVersion(int $version) Return Product objects filtered by the version column
|
||||||
|
* @method array findByVersionCreatedAt(string $version_created_at) Return Product objects filtered by the version_created_at column
|
||||||
|
* @method array findByVersionCreatedBy(string $version_created_by) Return Product objects filtered by the version_created_by column
|
||||||
*
|
*
|
||||||
* @package propel.generator.Thelia.Model.om
|
* @package propel.generator.Thelia.Model.om
|
||||||
*/
|
*/
|
||||||
@@ -230,7 +247,7 @@ abstract class BaseProductQuery extends ModelCriteria
|
|||||||
*/
|
*/
|
||||||
protected function findPkSimple($key, $con)
|
protected function findPkSimple($key, $con)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `PRICE`, `PRICE2`, `ECOTAX`, `NEWNESS`, `PROMO`, `STOCK`, `VISIBLE`, `WEIGHT`, `POSITION`, `CREATED_AT`, `UPDATED_AT` FROM `product` WHERE `ID` = :p0';
|
$sql = 'SELECT `ID`, `TAX_RULE_ID`, `REF`, `PRICE`, `PRICE2`, `ECOTAX`, `NEWNESS`, `PROMO`, `STOCK`, `VISIBLE`, `WEIGHT`, `POSITION`, `CREATED_AT`, `UPDATED_AT`, `VERSION`, `VERSION_CREATED_AT`, `VERSION_CREATED_BY` FROM `product` WHERE `ID` = :p0';
|
||||||
try {
|
try {
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||||
@@ -873,6 +890,119 @@ abstract class BaseProductQuery extends ModelCriteria
|
|||||||
return $this->addUsingAlias(ProductPeer::UPDATED_AT, $updatedAt, $comparison);
|
return $this->addUsingAlias(ProductPeer::UPDATED_AT, $updatedAt, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersion(1234); // WHERE version = 1234
|
||||||
|
* $query->filterByVersion(array(12, 34)); // WHERE version IN (12, 34)
|
||||||
|
* $query->filterByVersion(array('min' => 12)); // WHERE version > 12
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $version The value to use as filter.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ProductQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersion($version = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($version)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($version['min'])) {
|
||||||
|
$this->addUsingAlias(ProductPeer::VERSION, $version['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($version['max'])) {
|
||||||
|
$this->addUsingAlias(ProductPeer::VERSION, $version['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ProductPeer::VERSION, $version, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_at column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedAt('2011-03-14'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt('now'); // WHERE version_created_at = '2011-03-14'
|
||||||
|
* $query->filterByVersionCreatedAt(array('max' => 'yesterday')); // WHERE version_created_at > '2011-03-13'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param mixed $versionCreatedAt The value to use as filter.
|
||||||
|
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||||
|
* Empty strings are treated as NULL.
|
||||||
|
* Use scalar values for equality.
|
||||||
|
* Use array values for in_array() equivalent.
|
||||||
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ProductQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedAt($versionCreatedAt = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($versionCreatedAt)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($versionCreatedAt['min'])) {
|
||||||
|
$this->addUsingAlias(ProductPeer::VERSION_CREATED_AT, $versionCreatedAt['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($versionCreatedAt['max'])) {
|
||||||
|
$this->addUsingAlias(ProductPeer::VERSION_CREATED_AT, $versionCreatedAt['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ProductPeer::VERSION_CREATED_AT, $versionCreatedAt, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the version_created_by column
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
* <code>
|
||||||
|
* $query->filterByVersionCreatedBy('fooValue'); // WHERE version_created_by = 'fooValue'
|
||||||
|
* $query->filterByVersionCreatedBy('%fooValue%'); // WHERE version_created_by LIKE '%fooValue%'
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* @param string $versionCreatedBy The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ProductQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByVersionCreatedBy($versionCreatedBy = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($versionCreatedBy)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $versionCreatedBy)) {
|
||||||
|
$versionCreatedBy = str_replace('*', '%', $versionCreatedBy);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->addUsingAlias(ProductPeer::VERSION_CREATED_BY, $versionCreatedBy, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related TaxRule object
|
* Filter the query by a related TaxRule object
|
||||||
*
|
*
|
||||||
@@ -1689,6 +1819,80 @@ abstract class BaseProductQuery extends ModelCriteria
|
|||||||
->useQuery($relationAlias ? $relationAlias : 'ProductI18n', '\Thelia\Model\ProductI18nQuery');
|
->useQuery($relationAlias ? $relationAlias : 'ProductI18n', '\Thelia\Model\ProductI18nQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related ProductVersion object
|
||||||
|
*
|
||||||
|
* @param ProductVersion|PropelObjectCollection $productVersion the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return ProductQuery The current query, for fluid interface
|
||||||
|
* @throws PropelException - if the provided filter is invalid.
|
||||||
|
*/
|
||||||
|
public function filterByProductVersion($productVersion, $comparison = null)
|
||||||
|
{
|
||||||
|
if ($productVersion instanceof ProductVersion) {
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(ProductPeer::ID, $productVersion->getId(), $comparison);
|
||||||
|
} elseif ($productVersion instanceof PropelObjectCollection) {
|
||||||
|
return $this
|
||||||
|
->useProductVersionQuery()
|
||||||
|
->filterByPrimaryKeys($productVersion->getPrimaryKeys())
|
||||||
|
->endUse();
|
||||||
|
} else {
|
||||||
|
throw new PropelException('filterByProductVersion() only accepts arguments of type ProductVersion or PropelCollection');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the ProductVersion relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return ProductQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinProductVersion($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('ProductVersion');
|
||||||
|
|
||||||
|
// 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, 'ProductVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the ProductVersion relation ProductVersion 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\ProductVersionQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useProductVersionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinProductVersion($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'ProductVersion', '\Thelia\Model\ProductVersionQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
|
|||||||
1891
core/lib/Thelia/Model/om/BaseProductVersion.php
Normal file
1891
core/lib/Thelia/Model/om/BaseProductVersion.php
Normal file
File diff suppressed because it is too large
Load Diff
1064
core/lib/Thelia/Model/om/BaseProductVersionPeer.php
Normal file
1064
core/lib/Thelia/Model/om/BaseProductVersionPeer.php
Normal file
File diff suppressed because it is too large
Load Diff
1045
core/lib/Thelia/Model/om/BaseProductVersionQuery.php
Normal file
1045
core/lib/Thelia/Model/om/BaseProductVersionQuery.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,10 @@
|
|||||||
<behavior name="i18n">
|
<behavior name="i18n">
|
||||||
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
||||||
</behavior>
|
</behavior>
|
||||||
|
<behavior name="versionable">
|
||||||
|
<parameter name="log_created_at" value="true" />
|
||||||
|
<parameter name="log_created_by" value="true" />
|
||||||
|
</behavior>
|
||||||
</table>
|
</table>
|
||||||
<table name="product">
|
<table name="product">
|
||||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
@@ -45,6 +49,10 @@
|
|||||||
<behavior name="i18n">
|
<behavior name="i18n">
|
||||||
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
||||||
</behavior>
|
</behavior>
|
||||||
|
<behavior name="versionable">
|
||||||
|
<parameter name="log_created_at" value="true" />
|
||||||
|
<parameter name="log_created_by" value="true" />
|
||||||
|
</behavior>
|
||||||
</table>
|
</table>
|
||||||
<table name="product_category">
|
<table name="product_category">
|
||||||
<column name="product_id" primaryKey="true" required="true" type="INTEGER" />
|
<column name="product_id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
@@ -414,6 +422,10 @@
|
|||||||
<behavior name="i18n">
|
<behavior name="i18n">
|
||||||
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
||||||
</behavior>
|
</behavior>
|
||||||
|
<behavior name="versionable">
|
||||||
|
<parameter name="log_created_at" value="true" />
|
||||||
|
<parameter name="log_created_by" value="true" />
|
||||||
|
</behavior>
|
||||||
</table>
|
</table>
|
||||||
<table name="content">
|
<table name="content">
|
||||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
@@ -427,6 +439,10 @@
|
|||||||
<behavior name="i18n">
|
<behavior name="i18n">
|
||||||
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
<parameter name="i18n_columns" value="title, description, chapo, postscriptum" />
|
||||||
</behavior>
|
</behavior>
|
||||||
|
<behavior name="versionable">
|
||||||
|
<parameter name="log_created_at" value="true" />
|
||||||
|
<parameter name="log_created_by" value="true" />
|
||||||
|
</behavior>
|
||||||
</table>
|
</table>
|
||||||
<table name="content_assoc">
|
<table name="content_assoc">
|
||||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
@@ -817,6 +833,10 @@
|
|||||||
<behavior name="i18n">
|
<behavior name="i18n">
|
||||||
<parameter name="i18n_columns" value="title, description, description_html" />
|
<parameter name="i18n_columns" value="title, description, description_html" />
|
||||||
</behavior>
|
</behavior>
|
||||||
|
<behavior name="versionable">
|
||||||
|
<parameter name="log_created_at" value="true" />
|
||||||
|
<parameter name="log_created_by" value="true" />
|
||||||
|
</behavior>
|
||||||
</table>
|
</table>
|
||||||
<table name="rewriting">
|
<table name="rewriting">
|
||||||
<column name="id" primaryKey="true" required="true" type="INTEGER" />
|
<column name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
|
|||||||
Reference in New Issue
Block a user