first commit
This commit is contained in:
12
plugins/stTrustPlugin/lib/model/Trust.php
Normal file
12
plugins/stTrustPlugin/lib/model/Trust.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Subclass for representing a row from the 'st_trust' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package plugins.stTrustPlugin.lib.model
|
||||
*/
|
||||
class Trust extends BaseTrust
|
||||
{
|
||||
}
|
||||
12
plugins/stTrustPlugin/lib/model/TrustI18n.php
Normal file
12
plugins/stTrustPlugin/lib/model/TrustI18n.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Subclass for representing a row from the 'st_trust_i18n' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package plugins.stTrustPlugin.lib.model
|
||||
*/
|
||||
class TrustI18n extends BaseTrustI18n
|
||||
{
|
||||
}
|
||||
12
plugins/stTrustPlugin/lib/model/TrustI18nPeer.php
Normal file
12
plugins/stTrustPlugin/lib/model/TrustI18nPeer.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Subclass for performing query and update operations on the 'st_trust_i18n' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package plugins.stTrustPlugin.lib.model
|
||||
*/
|
||||
class TrustI18nPeer extends BaseTrustI18nPeer
|
||||
{
|
||||
}
|
||||
12
plugins/stTrustPlugin/lib/model/TrustPeer.php
Normal file
12
plugins/stTrustPlugin/lib/model/TrustPeer.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Subclass for performing query and update operations on the 'st_trust' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package plugins.stTrustPlugin.lib.model
|
||||
*/
|
||||
class TrustPeer extends BaseTrustPeer
|
||||
{
|
||||
}
|
||||
96
plugins/stTrustPlugin/lib/model/map/TrustI18nMapBuilder.php
Normal file
96
plugins/stTrustPlugin/lib/model/map/TrustI18nMapBuilder.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* This class adds structure of 'st_trust_i18n' table to 'propel' DatabaseMap object.
|
||||
*
|
||||
*
|
||||
*
|
||||
* These statically-built map classes are 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 plugins.stTrustPlugin.lib.model.map
|
||||
*/
|
||||
class TrustI18nMapBuilder {
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'plugins.stTrustPlugin.lib.model.map.TrustI18nMapBuilder';
|
||||
|
||||
/**
|
||||
* The database map.
|
||||
*/
|
||||
private $dbMap;
|
||||
|
||||
/**
|
||||
* Tells us if this DatabaseMapBuilder is built so that we
|
||||
* don't have to re-build it every time.
|
||||
*
|
||||
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
|
||||
*/
|
||||
public function isBuilt()
|
||||
{
|
||||
return ($this->dbMap !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the databasemap this map builder built.
|
||||
*
|
||||
* @return the databasemap
|
||||
*/
|
||||
public function getDatabaseMap()
|
||||
{
|
||||
return $this->dbMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* The doBuild() method builds the DatabaseMap
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function doBuild()
|
||||
{
|
||||
$this->dbMap = Propel::getDatabaseMap('propel');
|
||||
|
||||
$tMap = $this->dbMap->addTable('st_trust_i18n');
|
||||
$tMap->setPhpName('TrustI18n');
|
||||
|
||||
$tMap->setUseIdGenerator(false);
|
||||
|
||||
$tMap->addForeignPrimaryKey('ID', 'Id', 'int' , CreoleTypes::INTEGER, 'st_trust', 'ID', true, null);
|
||||
|
||||
$tMap->addPrimaryKey('CULTURE', 'Culture', 'string', CreoleTypes::VARCHAR, true, 7);
|
||||
|
||||
$tMap->addColumn('FIELD_DESCRIPTION', 'FieldDescription', 'string', CreoleTypes::LONGVARCHAR, false, null);
|
||||
|
||||
$tMap->addColumn('FIELD_LABEL_F', 'FieldLabelF', 'string', CreoleTypes::VARCHAR, false, 255);
|
||||
|
||||
$tMap->addColumn('FIELD_SUB_LABEL_F', 'FieldSubLabelF', 'string', CreoleTypes::VARCHAR, false, 255);
|
||||
|
||||
$tMap->addColumn('FIELD_DESCRIPTION_F', 'FieldDescriptionF', 'string', CreoleTypes::LONGVARCHAR, false, null);
|
||||
|
||||
$tMap->addColumn('ICON_F', 'IconF', 'string', CreoleTypes::VARCHAR, false, 255);
|
||||
|
||||
$tMap->addColumn('FIELD_LABEL_S', 'FieldLabelS', 'string', CreoleTypes::VARCHAR, false, 255);
|
||||
|
||||
$tMap->addColumn('FIELD_SUB_LABEL_S', 'FieldSubLabelS', 'string', CreoleTypes::VARCHAR, false, 255);
|
||||
|
||||
$tMap->addColumn('FIELD_DESCRIPTION_S', 'FieldDescriptionS', 'string', CreoleTypes::LONGVARCHAR, false, null);
|
||||
|
||||
$tMap->addColumn('ICON_S', 'IconS', 'string', CreoleTypes::VARCHAR, false, 255);
|
||||
|
||||
$tMap->addColumn('FIELD_LABEL_T', 'FieldLabelT', 'string', CreoleTypes::VARCHAR, false, 255);
|
||||
|
||||
$tMap->addColumn('FIELD_SUB_LABEL_T', 'FieldSubLabelT', 'string', CreoleTypes::VARCHAR, false, 255);
|
||||
|
||||
$tMap->addColumn('FIELD_DESCRIPTION_T', 'FieldDescriptionT', 'string', CreoleTypes::LONGVARCHAR, false, null);
|
||||
|
||||
$tMap->addColumn('ICON_T', 'IconT', 'string', CreoleTypes::VARCHAR, false, 255);
|
||||
|
||||
} // doBuild()
|
||||
|
||||
} // TrustI18nMapBuilder
|
||||
82
plugins/stTrustPlugin/lib/model/map/TrustMapBuilder.php
Normal file
82
plugins/stTrustPlugin/lib/model/map/TrustMapBuilder.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* This class adds structure of 'st_trust' table to 'propel' DatabaseMap object.
|
||||
*
|
||||
*
|
||||
*
|
||||
* These statically-built map classes are 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 plugins.stTrustPlugin.lib.model.map
|
||||
*/
|
||||
class TrustMapBuilder {
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'plugins.stTrustPlugin.lib.model.map.TrustMapBuilder';
|
||||
|
||||
/**
|
||||
* The database map.
|
||||
*/
|
||||
private $dbMap;
|
||||
|
||||
/**
|
||||
* Tells us if this DatabaseMapBuilder is built so that we
|
||||
* don't have to re-build it every time.
|
||||
*
|
||||
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
|
||||
*/
|
||||
public function isBuilt()
|
||||
{
|
||||
return ($this->dbMap !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the databasemap this map builder built.
|
||||
*
|
||||
* @return the databasemap
|
||||
*/
|
||||
public function getDatabaseMap()
|
||||
{
|
||||
return $this->dbMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* The doBuild() method builds the DatabaseMap
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function doBuild()
|
||||
{
|
||||
$this->dbMap = Propel::getDatabaseMap('propel');
|
||||
|
||||
$tMap = $this->dbMap->addTable('st_trust');
|
||||
$tMap->setPhpName('Trust');
|
||||
|
||||
$tMap->setUseIdGenerator(true);
|
||||
|
||||
$tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
|
||||
|
||||
$tMap->addColumn('UPDATED_AT', 'UpdatedAt', 'int', CreoleTypes::TIMESTAMP, false, null);
|
||||
|
||||
$tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
|
||||
|
||||
$tMap->addForeignKey('PRODUCT_ID', 'ProductId', 'int', CreoleTypes::INTEGER, 'st_product', 'ID', true, null);
|
||||
|
||||
$tMap->addColumn('FIELD_ON', 'FieldOn', 'boolean', CreoleTypes::BOOLEAN, false, null);
|
||||
|
||||
$tMap->addColumn('FIELD_F_ON', 'FieldFOn', 'boolean', CreoleTypes::BOOLEAN, false, null);
|
||||
|
||||
$tMap->addColumn('FIELD_S_ON', 'FieldSOn', 'boolean', CreoleTypes::BOOLEAN, false, null);
|
||||
|
||||
$tMap->addColumn('FIELD_T_ON', 'FieldTOn', 'boolean', CreoleTypes::BOOLEAN, false, null);
|
||||
|
||||
} // doBuild()
|
||||
|
||||
} // TrustMapBuilder
|
||||
1430
plugins/stTrustPlugin/lib/model/om/BaseTrust.php
Normal file
1430
plugins/stTrustPlugin/lib/model/om/BaseTrust.php
Normal file
File diff suppressed because it is too large
Load Diff
1388
plugins/stTrustPlugin/lib/model/om/BaseTrustI18n.php
Normal file
1388
plugins/stTrustPlugin/lib/model/om/BaseTrustI18n.php
Normal file
File diff suppressed because it is too large
Load Diff
894
plugins/stTrustPlugin/lib/model/om/BaseTrustI18nPeer.php
Normal file
894
plugins/stTrustPlugin/lib/model/om/BaseTrustI18nPeer.php
Normal file
@@ -0,0 +1,894 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Base static class for performing query and update operations on the 'st_trust_i18n' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package plugins.stTrustPlugin.lib.model.om
|
||||
*/
|
||||
abstract class BaseTrustI18nPeer {
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'propel';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'st_trust_i18n';
|
||||
|
||||
/** A class that can be returned by this peer. */
|
||||
const CLASS_DEFAULT = 'plugins.stTrustPlugin.lib.model.TrustI18n';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 15;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
|
||||
/** the column name for the ID field */
|
||||
const ID = 'st_trust_i18n.ID';
|
||||
|
||||
/** the column name for the CULTURE field */
|
||||
const CULTURE = 'st_trust_i18n.CULTURE';
|
||||
|
||||
/** the column name for the FIELD_DESCRIPTION field */
|
||||
const FIELD_DESCRIPTION = 'st_trust_i18n.FIELD_DESCRIPTION';
|
||||
|
||||
/** the column name for the FIELD_LABEL_F field */
|
||||
const FIELD_LABEL_F = 'st_trust_i18n.FIELD_LABEL_F';
|
||||
|
||||
/** the column name for the FIELD_SUB_LABEL_F field */
|
||||
const FIELD_SUB_LABEL_F = 'st_trust_i18n.FIELD_SUB_LABEL_F';
|
||||
|
||||
/** the column name for the FIELD_DESCRIPTION_F field */
|
||||
const FIELD_DESCRIPTION_F = 'st_trust_i18n.FIELD_DESCRIPTION_F';
|
||||
|
||||
/** the column name for the ICON_F field */
|
||||
const ICON_F = 'st_trust_i18n.ICON_F';
|
||||
|
||||
/** the column name for the FIELD_LABEL_S field */
|
||||
const FIELD_LABEL_S = 'st_trust_i18n.FIELD_LABEL_S';
|
||||
|
||||
/** the column name for the FIELD_SUB_LABEL_S field */
|
||||
const FIELD_SUB_LABEL_S = 'st_trust_i18n.FIELD_SUB_LABEL_S';
|
||||
|
||||
/** the column name for the FIELD_DESCRIPTION_S field */
|
||||
const FIELD_DESCRIPTION_S = 'st_trust_i18n.FIELD_DESCRIPTION_S';
|
||||
|
||||
/** the column name for the ICON_S field */
|
||||
const ICON_S = 'st_trust_i18n.ICON_S';
|
||||
|
||||
/** the column name for the FIELD_LABEL_T field */
|
||||
const FIELD_LABEL_T = 'st_trust_i18n.FIELD_LABEL_T';
|
||||
|
||||
/** the column name for the FIELD_SUB_LABEL_T field */
|
||||
const FIELD_SUB_LABEL_T = 'st_trust_i18n.FIELD_SUB_LABEL_T';
|
||||
|
||||
/** the column name for the FIELD_DESCRIPTION_T field */
|
||||
const FIELD_DESCRIPTION_T = 'st_trust_i18n.FIELD_DESCRIPTION_T';
|
||||
|
||||
/** the column name for the ICON_T field */
|
||||
const ICON_T = 'st_trust_i18n.ICON_T';
|
||||
|
||||
/** The PHP to DB Name Mapping */
|
||||
private static $phpNameMap = null;
|
||||
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('Id', 'Culture', 'FieldDescription', 'FieldLabelF', 'FieldSubLabelF', 'FieldDescriptionF', 'IconF', 'FieldLabelS', 'FieldSubLabelS', 'FieldDescriptionS', 'IconS', 'FieldLabelT', 'FieldSubLabelT', 'FieldDescriptionT', 'IconT', ),
|
||||
BasePeer::TYPE_COLNAME => array (TrustI18nPeer::ID, TrustI18nPeer::CULTURE, TrustI18nPeer::FIELD_DESCRIPTION, TrustI18nPeer::FIELD_LABEL_F, TrustI18nPeer::FIELD_SUB_LABEL_F, TrustI18nPeer::FIELD_DESCRIPTION_F, TrustI18nPeer::ICON_F, TrustI18nPeer::FIELD_LABEL_S, TrustI18nPeer::FIELD_SUB_LABEL_S, TrustI18nPeer::FIELD_DESCRIPTION_S, TrustI18nPeer::ICON_S, TrustI18nPeer::FIELD_LABEL_T, TrustI18nPeer::FIELD_SUB_LABEL_T, TrustI18nPeer::FIELD_DESCRIPTION_T, TrustI18nPeer::ICON_T, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'culture', 'field_description', 'field_label_f', 'field_sub_label_f', 'field_description_f', 'icon_f', 'field_label_s', 'field_sub_label_s', 'field_description_s', 'icon_s', 'field_label_t', 'field_sub_label_t', 'field_description_t', 'icon_t', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Culture' => 1, 'FieldDescription' => 2, 'FieldLabelF' => 3, 'FieldSubLabelF' => 4, 'FieldDescriptionF' => 5, 'IconF' => 6, 'FieldLabelS' => 7, 'FieldSubLabelS' => 8, 'FieldDescriptionS' => 9, 'IconS' => 10, 'FieldLabelT' => 11, 'FieldSubLabelT' => 12, 'FieldDescriptionT' => 13, 'IconT' => 14, ),
|
||||
BasePeer::TYPE_COLNAME => array (TrustI18nPeer::ID => 0, TrustI18nPeer::CULTURE => 1, TrustI18nPeer::FIELD_DESCRIPTION => 2, TrustI18nPeer::FIELD_LABEL_F => 3, TrustI18nPeer::FIELD_SUB_LABEL_F => 4, TrustI18nPeer::FIELD_DESCRIPTION_F => 5, TrustI18nPeer::ICON_F => 6, TrustI18nPeer::FIELD_LABEL_S => 7, TrustI18nPeer::FIELD_SUB_LABEL_S => 8, TrustI18nPeer::FIELD_DESCRIPTION_S => 9, TrustI18nPeer::ICON_S => 10, TrustI18nPeer::FIELD_LABEL_T => 11, TrustI18nPeer::FIELD_SUB_LABEL_T => 12, TrustI18nPeer::FIELD_DESCRIPTION_T => 13, TrustI18nPeer::ICON_T => 14, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'culture' => 1, 'field_description' => 2, 'field_label_f' => 3, 'field_sub_label_f' => 4, 'field_description_f' => 5, 'icon_f' => 6, 'field_label_s' => 7, 'field_sub_label_s' => 8, 'field_description_s' => 9, 'icon_s' => 10, 'field_label_t' => 11, 'field_sub_label_t' => 12, 'field_description_t' => 13, 'icon_t' => 14, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
|
||||
);
|
||||
|
||||
protected static $hydrateMethod = null;
|
||||
|
||||
protected static $postHydrateMethod = null;
|
||||
|
||||
public static function setHydrateMethod($callback)
|
||||
{
|
||||
self::$hydrateMethod = $callback;
|
||||
}
|
||||
|
||||
public static function setPostHydrateMethod($callback)
|
||||
{
|
||||
self::$postHydrateMethod = $callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MapBuilder the map builder for this peer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getMapBuilder()
|
||||
{
|
||||
return BasePeer::getMapBuilder('plugins.stTrustPlugin.lib.model.map.TrustI18nMapBuilder');
|
||||
}
|
||||
/**
|
||||
* Gets a map (hash) of PHP names to DB column names.
|
||||
*
|
||||
* @return array The PHP to DB name map for this peer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
|
||||
*/
|
||||
public static function getPhpNameMap()
|
||||
{
|
||||
if (self::$phpNameMap === null) {
|
||||
$map = TrustI18nPeer::getTableMap();
|
||||
$columns = $map->getColumns();
|
||||
$nameMap = array();
|
||||
foreach ($columns as $column) {
|
||||
$nameMap[$column->getPhpName()] = $column->getColumnName();
|
||||
}
|
||||
self::$phpNameMap = $nameMap;
|
||||
}
|
||||
return self::$phpNameMap;
|
||||
}
|
||||
/**
|
||||
* Translates a fieldname to another type
|
||||
*
|
||||
* @param string $name field name
|
||||
* @param string $fromType One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @param string $toType One of the class type constants
|
||||
* @return string translated name of the field.
|
||||
*/
|
||||
static public function translateFieldName($name, $fromType, $toType)
|
||||
{
|
||||
$toNames = self::getFieldNames($toType);
|
||||
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
|
||||
if ($key === null) {
|
||||
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
|
||||
}
|
||||
return $toNames[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of of field names.
|
||||
*
|
||||
* @param string $type The type of fieldnames to return:
|
||||
* One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return array A list of field names
|
||||
*/
|
||||
|
||||
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
if (!array_key_exists($type, self::$fieldNames)) {
|
||||
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
|
||||
}
|
||||
return self::$fieldNames[$type];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method which changes table.column to alias.column.
|
||||
*
|
||||
* Using this method you can maintain SQL abstraction while using column aliases.
|
||||
* <code>
|
||||
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
|
||||
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
||||
* </code>
|
||||
* @param string $alias The alias for the current table.
|
||||
* @param string $column The column name for current table. (i.e. TrustI18nPeer::COLUMN_NAME).
|
||||
* @return string
|
||||
*/
|
||||
public static function alias($alias, $column)
|
||||
{
|
||||
return str_replace(TrustI18nPeer::TABLE_NAME.'.', $alias.'.', $column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param criteria object containing the columns to add.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria)
|
||||
{
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::ID);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::CULTURE);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::FIELD_DESCRIPTION);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::FIELD_LABEL_F);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::FIELD_SUB_LABEL_F);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::FIELD_DESCRIPTION_F);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::ICON_F);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::FIELD_LABEL_S);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::FIELD_SUB_LABEL_S);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::FIELD_DESCRIPTION_S);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::ICON_S);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::FIELD_LABEL_T);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::FIELD_SUB_LABEL_T);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::FIELD_DESCRIPTION_T);
|
||||
|
||||
$criteria->addSelectColumn(TrustI18nPeer::ICON_T);
|
||||
|
||||
|
||||
if (stEventDispatcher::getInstance()->getListeners('TrustI18nPeer.postAddSelectColumns')) {
|
||||
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'TrustI18nPeer.postAddSelectColumns'));
|
||||
}
|
||||
}
|
||||
|
||||
const COUNT = 'COUNT(st_trust_i18n.ID)';
|
||||
const COUNT_DISTINCT = 'COUNT(DISTINCT st_trust_i18n.ID)';
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
|
||||
* @param Connection $con
|
||||
* @return int Number of matching rows.
|
||||
*/
|
||||
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
|
||||
{
|
||||
// we're going to modify criteria, so copy it first
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// clear out anything that might confuse the ORDER BY clause
|
||||
$criteria->clearSelectColumns()->clearOrderByColumns();
|
||||
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->addSelectColumn(TrustI18nPeer::COUNT_DISTINCT);
|
||||
} else {
|
||||
$criteria->addSelectColumn(TrustI18nPeer::COUNT);
|
||||
}
|
||||
|
||||
// just in case we're grouping: add those columns to the select statement
|
||||
foreach($criteria->getGroupByColumns() as $column)
|
||||
{
|
||||
$criteria->addSelectColumn($column);
|
||||
}
|
||||
|
||||
$rs = TrustI18nPeer::doSelectRS($criteria, $con);
|
||||
if ($rs->next()) {
|
||||
return $rs->getInt(1);
|
||||
} else {
|
||||
// no rows returned; we infer that means 0 matches.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Method to select one object from the DB.
|
||||
*
|
||||
* @param Criteria $criteria object used to create the SELECT statement.
|
||||
* @param Connection $con
|
||||
* @return TrustI18n
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectOne(Criteria $criteria, $con = null)
|
||||
{
|
||||
$critcopy = clone $criteria;
|
||||
$critcopy->setLimit(1);
|
||||
$objects = TrustI18nPeer::doSelect($critcopy, $con);
|
||||
if ($objects) {
|
||||
return $objects[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Method to do selects.
|
||||
*
|
||||
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
|
||||
* @param Connection $con
|
||||
* @return TrustI18n[]
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelect(Criteria $criteria, $con = null)
|
||||
{
|
||||
return TrustI18nPeer::populateObjects(TrustI18nPeer::doSelectRS($criteria, $con));
|
||||
}
|
||||
/**
|
||||
* Prepares the Criteria object and uses the parent doSelect()
|
||||
* method to get a ResultSet.
|
||||
*
|
||||
* Use this method directly if you want to just get the resultset
|
||||
* (instead of an array of objects).
|
||||
*
|
||||
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
|
||||
* @param Connection $con the connection to use
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return ResultSet The resultset object with numerically-indexed fields.
|
||||
* @see BasePeer::doSelect()
|
||||
*/
|
||||
public static function doSelectRS(Criteria $criteria, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if (!$criteria->getSelectColumns()) {
|
||||
$criteria = clone $criteria;
|
||||
TrustI18nPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
if (stEventDispatcher::getInstance()->getListeners('BasePeer.preDoSelectRs')) {
|
||||
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'BasePeer.preDoSelectRs'));
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
// BasePeer returns a Creole ResultSet, set to return
|
||||
// rows indexed numerically.
|
||||
$rs = BasePeer::doSelect($criteria, $con);
|
||||
|
||||
if (stEventDispatcher::getInstance()->getListeners('BasePeer.postDoSelectRs')) {
|
||||
stEventDispatcher::getInstance()->notify(new sfEvent($rs, 'BasePeer.postDoSelectRs'));
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(ResultSet $rs)
|
||||
{
|
||||
|
||||
if (self::$hydrateMethod)
|
||||
{
|
||||
return call_user_func(self::$hydrateMethod, $rs);
|
||||
}
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = TrustI18nPeer::getOMClass();
|
||||
$cls = Propel::import($cls);
|
||||
// populate the object(s)
|
||||
while($rs->next()) {
|
||||
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($rs);
|
||||
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj) : $obj;
|
||||
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related Trust table
|
||||
*
|
||||
* @param Criteria $c
|
||||
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
|
||||
* @param Connection $con
|
||||
* @return int Number of matching rows.
|
||||
*/
|
||||
public static function doCountJoinTrust(Criteria $criteria, $distinct = false, $con = null)
|
||||
{
|
||||
// we're going to modify criteria, so copy it first
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// clear out anything that might confuse the ORDER BY clause
|
||||
$criteria->clearSelectColumns()->clearOrderByColumns();
|
||||
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->addSelectColumn(TrustI18nPeer::COUNT_DISTINCT);
|
||||
} else {
|
||||
$criteria->addSelectColumn(TrustI18nPeer::COUNT);
|
||||
}
|
||||
|
||||
// just in case we're grouping: add those columns to the select statement
|
||||
foreach($criteria->getGroupByColumns() as $column)
|
||||
{
|
||||
$criteria->addSelectColumn($column);
|
||||
}
|
||||
|
||||
$criteria->addJoin(TrustI18nPeer::ID, TrustPeer::ID);
|
||||
|
||||
$rs = TrustI18nPeer::doSelectRS($criteria, $con);
|
||||
if ($rs->next()) {
|
||||
return $rs->getInt(1);
|
||||
} else {
|
||||
// no rows returned; we infer that means 0 matches.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of TrustI18n objects pre-filled with their Trust objects.
|
||||
*
|
||||
* @return TrustI18n[] Array of TrustI18n objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinTrust(Criteria $c, $con = null)
|
||||
{
|
||||
$c = clone $c;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
if ($c->getDbName() == Propel::getDefaultDB()) {
|
||||
$c->setDbName(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
TrustI18nPeer::addSelectColumns($c);
|
||||
|
||||
TrustPeer::addSelectColumns($c);
|
||||
|
||||
$c->addJoin(TrustI18nPeer::ID, TrustPeer::ID);
|
||||
$rs = TrustI18nPeer::doSelectRs($c, $con);
|
||||
|
||||
if (self::$hydrateMethod)
|
||||
{
|
||||
return call_user_func(self::$hydrateMethod, $rs);
|
||||
}
|
||||
|
||||
$results = array();
|
||||
|
||||
while($rs->next()) {
|
||||
|
||||
$obj1 = new TrustI18n();
|
||||
$startcol = $obj1->hydrate($rs);
|
||||
if ($obj1->getId())
|
||||
{
|
||||
|
||||
$obj2 = new Trust();
|
||||
$obj2->hydrate($rs, $startcol);
|
||||
$obj2->addTrustI18n($obj1);
|
||||
}
|
||||
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining all related tables
|
||||
*
|
||||
* @param Criteria $c
|
||||
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
|
||||
* @param Connection $con
|
||||
* @return int Number of matching rows.
|
||||
*/
|
||||
public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// clear out anything that might confuse the ORDER BY clause
|
||||
$criteria->clearSelectColumns()->clearOrderByColumns();
|
||||
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->addSelectColumn(TrustI18nPeer::COUNT_DISTINCT);
|
||||
} else {
|
||||
$criteria->addSelectColumn(TrustI18nPeer::COUNT);
|
||||
}
|
||||
|
||||
// just in case we're grouping: add those columns to the select statement
|
||||
foreach($criteria->getGroupByColumns() as $column)
|
||||
{
|
||||
$criteria->addSelectColumn($column);
|
||||
}
|
||||
|
||||
$criteria->addJoin(TrustI18nPeer::ID, TrustPeer::ID);
|
||||
|
||||
$rs = TrustI18nPeer::doSelectRS($criteria, $con);
|
||||
if ($rs->next()) {
|
||||
return $rs->getInt(1);
|
||||
} else {
|
||||
// no rows returned; we infer that means 0 matches.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of TrustI18n objects pre-filled with all related objects.
|
||||
*
|
||||
* @return TrustI18n[]
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAll(Criteria $c, $con = null)
|
||||
{
|
||||
$c = clone $c;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
if ($c->getDbName() == Propel::getDefaultDB()) {
|
||||
$c->setDbName(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
TrustI18nPeer::addSelectColumns($c);
|
||||
$startcol2 = (TrustI18nPeer::NUM_COLUMNS - TrustI18nPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
|
||||
|
||||
TrustPeer::addSelectColumns($c);
|
||||
$startcol3 = $startcol2 + TrustPeer::NUM_COLUMNS;
|
||||
|
||||
$c->addJoin(TrustI18nPeer::ID, TrustPeer::ID);
|
||||
|
||||
$rs = BasePeer::doSelect($c, $con);
|
||||
|
||||
if (self::$hydrateMethod)
|
||||
{
|
||||
return call_user_func(self::$hydrateMethod, $rs);
|
||||
}
|
||||
$results = array();
|
||||
|
||||
while($rs->next()) {
|
||||
|
||||
$omClass = TrustI18nPeer::getOMClass();
|
||||
|
||||
|
||||
$cls = Propel::import($omClass);
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($rs);
|
||||
|
||||
|
||||
// Add objects for joined Trust rows
|
||||
|
||||
$omClass = TrustPeer::getOMClass();
|
||||
|
||||
|
||||
$cls = Propel::import($omClass);
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($rs, $startcol2);
|
||||
|
||||
$newObject = true;
|
||||
for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
|
||||
$temp_obj1 = $results[$j];
|
||||
$temp_obj2 = $temp_obj1->getTrust(); // CHECKME
|
||||
if (null !== $temp_obj2 && $temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
|
||||
$newObject = false;
|
||||
$temp_obj2->addTrustI18n($obj1); // CHECKME
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($newObject) {
|
||||
$obj2->initTrustI18ns();
|
||||
$obj2->addTrustI18n($obj1);
|
||||
}
|
||||
|
||||
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this peer.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the Peer will make instances of.
|
||||
*
|
||||
* This uses a dot-path notation which is tranalted into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass()
|
||||
{
|
||||
return TrustI18nPeer::CLASS_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform an INSERT on the database, given a TrustI18n or Criteria object.
|
||||
*
|
||||
* @param mixed $values Criteria or TrustI18n object containing data that is used to create the INSERT statement.
|
||||
* @param Connection $con the connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($values, $con = null)
|
||||
{
|
||||
|
||||
foreach (sfMixer::getCallables('BaseTrustI18nPeer:doInsert:pre') as $callable)
|
||||
{
|
||||
$ret = call_user_func($callable, 'BaseTrustI18nPeer', $values, $con);
|
||||
if (false !== $ret)
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
} else {
|
||||
$criteria = $values->buildCriteria(); // build Criteria from TrustI18n object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->begin();
|
||||
$pk = BasePeer::doInsert($criteria, $con);
|
||||
$con->commit();
|
||||
} catch(PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
foreach (sfMixer::getCallables('BaseTrustI18nPeer:doInsert:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, 'BaseTrustI18nPeer', $values, $con, $pk);
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform an UPDATE on the database, given a TrustI18n or Criteria object.
|
||||
*
|
||||
* @param mixed $values Criteria or TrustI18n object containing data that is used to create the UPDATE statement.
|
||||
* @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doUpdate($values, $con = null)
|
||||
{
|
||||
|
||||
foreach (sfMixer::getCallables('BaseTrustI18nPeer:doUpdate:pre') as $callable)
|
||||
{
|
||||
$ret = call_user_func($callable, 'BaseTrustI18nPeer', $values, $con);
|
||||
if (false !== $ret)
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$selectCriteria = new Criteria(self::DATABASE_NAME);
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
|
||||
$comparison = $criteria->getComparison(TrustI18nPeer::ID);
|
||||
$selectCriteria->add(TrustI18nPeer::ID, $criteria->remove(TrustI18nPeer::ID), $comparison);
|
||||
|
||||
$comparison = $criteria->getComparison(TrustI18nPeer::CULTURE);
|
||||
$selectCriteria->add(TrustI18nPeer::CULTURE, $criteria->remove(TrustI18nPeer::CULTURE), $comparison);
|
||||
|
||||
} else { // $values is TrustI18n object
|
||||
$criteria = $values->buildCriteria(); // gets full criteria
|
||||
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
|
||||
}
|
||||
|
||||
// set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
$ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
|
||||
|
||||
|
||||
foreach (sfMixer::getCallables('BaseTrustI18nPeer:doUpdate:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, 'BaseTrustI18nPeer', $values, $con, $ret);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to DELETE all rows from the st_trust_i18n table.
|
||||
*
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll($con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->begin();
|
||||
$affectedRows += BasePeer::doDeleteAll(TrustI18nPeer::TABLE_NAME, $con);
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform a DELETE on the database, given a TrustI18n or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or TrustI18n object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param Connection $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete($values, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(TrustI18nPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
} elseif ($values instanceof TrustI18n) {
|
||||
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else {
|
||||
// it must be the primary key
|
||||
$criteria = new Criteria(self::DATABASE_NAME);
|
||||
// primary key is composite; we therefore, expect
|
||||
// the primary key passed to be an array of pkey
|
||||
// values
|
||||
if(count($values) == count($values, COUNT_RECURSIVE))
|
||||
{
|
||||
// array is not multi-dimensional
|
||||
$values = array($values);
|
||||
}
|
||||
$vals = array();
|
||||
foreach($values as $value)
|
||||
{
|
||||
|
||||
$vals[0][] = $value[0];
|
||||
$vals[1][] = $value[1];
|
||||
}
|
||||
|
||||
$criteria->add(TrustI18nPeer::ID, $vals[0], Criteria::IN);
|
||||
$criteria->add(TrustI18nPeer::CULTURE, $vals[1], Criteria::IN);
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->begin();
|
||||
|
||||
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates all modified columns of given TrustI18n object.
|
||||
* If parameter $columns is either a single column name or an array of column names
|
||||
* than only those columns are validated.
|
||||
*
|
||||
* NOTICE: This does not apply to primary or foreign keys for now.
|
||||
*
|
||||
* @param TrustI18n $obj The object to validate.
|
||||
* @param mixed $cols Column name or array of column names.
|
||||
*
|
||||
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
|
||||
*/
|
||||
public static function doValidate(TrustI18n $obj, $cols = null)
|
||||
{
|
||||
$columns = array();
|
||||
|
||||
if ($cols) {
|
||||
$dbMap = Propel::getDatabaseMap(TrustI18nPeer::DATABASE_NAME);
|
||||
$tableMap = $dbMap->getTable(TrustI18nPeer::TABLE_NAME);
|
||||
|
||||
if (! is_array($cols)) {
|
||||
$cols = array($cols);
|
||||
}
|
||||
|
||||
foreach($cols as $colName) {
|
||||
if ($tableMap->containsColumn($colName)) {
|
||||
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
|
||||
$columns[$colName] = $obj->$get();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
$res = BasePeer::doValidate(TrustI18nPeer::DATABASE_NAME, TrustI18nPeer::TABLE_NAME, $columns);
|
||||
if ($res !== true) {
|
||||
$request = sfContext::getInstance()->getRequest();
|
||||
foreach ($res as $failed) {
|
||||
$col = TrustI18nPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
|
||||
$request->setError($col, $failed->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve object using using composite pkey values.
|
||||
* @param int $id
|
||||
@param string $culture
|
||||
|
||||
* @param Connection $con
|
||||
* @return TrustI18n
|
||||
*/
|
||||
public static function retrieveByPK( $id, $culture, $con = null) {
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(TrustI18nPeer::ID, $id);
|
||||
$criteria->add(TrustI18nPeer::CULTURE, $culture);
|
||||
$v = TrustI18nPeer::doSelect($criteria, $con);
|
||||
|
||||
return !empty($v) ? $v[0] : null;
|
||||
}
|
||||
} // BaseTrustI18nPeer
|
||||
|
||||
// static code to register the map builder for this Peer with the main Propel class
|
||||
if (Propel::isInit()) {
|
||||
// the MapBuilder classes register themselves with Propel during initialization
|
||||
// so we need to load them here.
|
||||
try {
|
||||
BaseTrustI18nPeer::getMapBuilder();
|
||||
} catch (Exception $e) {
|
||||
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
|
||||
}
|
||||
} else {
|
||||
// even if Propel is not yet initialized, the map builder class can be registered
|
||||
// now and then it will be loaded when Propel initializes.
|
||||
Propel::registerMapBuilder('plugins.stTrustPlugin.lib.model.map.TrustI18nMapBuilder');
|
||||
}
|
||||
961
plugins/stTrustPlugin/lib/model/om/BaseTrustPeer.php
Normal file
961
plugins/stTrustPlugin/lib/model/om/BaseTrustPeer.php
Normal file
@@ -0,0 +1,961 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Base static class for performing query and update operations on the 'st_trust' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package plugins.stTrustPlugin.lib.model.om
|
||||
*/
|
||||
abstract class BaseTrustPeer {
|
||||
|
||||
/** the default database name for this class */
|
||||
const DATABASE_NAME = 'propel';
|
||||
|
||||
/** the table name for this class */
|
||||
const TABLE_NAME = 'st_trust';
|
||||
|
||||
/** A class that can be returned by this peer. */
|
||||
const CLASS_DEFAULT = 'plugins.stTrustPlugin.lib.model.Trust';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 8;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
||||
|
||||
/** the column name for the CREATED_AT field */
|
||||
const CREATED_AT = 'st_trust.CREATED_AT';
|
||||
|
||||
/** the column name for the UPDATED_AT field */
|
||||
const UPDATED_AT = 'st_trust.UPDATED_AT';
|
||||
|
||||
/** the column name for the ID field */
|
||||
const ID = 'st_trust.ID';
|
||||
|
||||
/** the column name for the PRODUCT_ID field */
|
||||
const PRODUCT_ID = 'st_trust.PRODUCT_ID';
|
||||
|
||||
/** the column name for the FIELD_ON field */
|
||||
const FIELD_ON = 'st_trust.FIELD_ON';
|
||||
|
||||
/** the column name for the FIELD_F_ON field */
|
||||
const FIELD_F_ON = 'st_trust.FIELD_F_ON';
|
||||
|
||||
/** the column name for the FIELD_S_ON field */
|
||||
const FIELD_S_ON = 'st_trust.FIELD_S_ON';
|
||||
|
||||
/** the column name for the FIELD_T_ON field */
|
||||
const FIELD_T_ON = 'st_trust.FIELD_T_ON';
|
||||
|
||||
/** The PHP to DB Name Mapping */
|
||||
private static $phpNameMap = null;
|
||||
|
||||
|
||||
/**
|
||||
* holds an array of fieldnames
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('CreatedAt', 'UpdatedAt', 'Id', 'ProductId', 'FieldOn', 'FieldFOn', 'FieldSOn', 'FieldTOn', ),
|
||||
BasePeer::TYPE_COLNAME => array (TrustPeer::CREATED_AT, TrustPeer::UPDATED_AT, TrustPeer::ID, TrustPeer::PRODUCT_ID, TrustPeer::FIELD_ON, TrustPeer::FIELD_F_ON, TrustPeer::FIELD_S_ON, TrustPeer::FIELD_T_ON, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('created_at', 'updated_at', 'id', 'product_id', 'field_on', 'field_f_on', 'field_s_on', 'field_t_on', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
|
||||
);
|
||||
|
||||
/**
|
||||
* holds an array of keys for quick access to the fieldnames array
|
||||
*
|
||||
* first dimension keys are the type constants
|
||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('CreatedAt' => 0, 'UpdatedAt' => 1, 'Id' => 2, 'ProductId' => 3, 'FieldOn' => 4, 'FieldFOn' => 5, 'FieldSOn' => 6, 'FieldTOn' => 7, ),
|
||||
BasePeer::TYPE_COLNAME => array (TrustPeer::CREATED_AT => 0, TrustPeer::UPDATED_AT => 1, TrustPeer::ID => 2, TrustPeer::PRODUCT_ID => 3, TrustPeer::FIELD_ON => 4, TrustPeer::FIELD_F_ON => 5, TrustPeer::FIELD_S_ON => 6, TrustPeer::FIELD_T_ON => 7, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('created_at' => 0, 'updated_at' => 1, 'id' => 2, 'product_id' => 3, 'field_on' => 4, 'field_f_on' => 5, 'field_s_on' => 6, 'field_t_on' => 7, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
|
||||
);
|
||||
|
||||
protected static $hydrateMethod = null;
|
||||
|
||||
protected static $postHydrateMethod = null;
|
||||
|
||||
public static function setHydrateMethod($callback)
|
||||
{
|
||||
self::$hydrateMethod = $callback;
|
||||
}
|
||||
|
||||
public static function setPostHydrateMethod($callback)
|
||||
{
|
||||
self::$postHydrateMethod = $callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MapBuilder the map builder for this peer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getMapBuilder()
|
||||
{
|
||||
return BasePeer::getMapBuilder('plugins.stTrustPlugin.lib.model.map.TrustMapBuilder');
|
||||
}
|
||||
/**
|
||||
* Gets a map (hash) of PHP names to DB column names.
|
||||
*
|
||||
* @return array The PHP to DB name map for this peer
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
|
||||
*/
|
||||
public static function getPhpNameMap()
|
||||
{
|
||||
if (self::$phpNameMap === null) {
|
||||
$map = TrustPeer::getTableMap();
|
||||
$columns = $map->getColumns();
|
||||
$nameMap = array();
|
||||
foreach ($columns as $column) {
|
||||
$nameMap[$column->getPhpName()] = $column->getColumnName();
|
||||
}
|
||||
self::$phpNameMap = $nameMap;
|
||||
}
|
||||
return self::$phpNameMap;
|
||||
}
|
||||
/**
|
||||
* Translates a fieldname to another type
|
||||
*
|
||||
* @param string $name field name
|
||||
* @param string $fromType One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @param string $toType One of the class type constants
|
||||
* @return string translated name of the field.
|
||||
*/
|
||||
static public function translateFieldName($name, $fromType, $toType)
|
||||
{
|
||||
$toNames = self::getFieldNames($toType);
|
||||
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
|
||||
if ($key === null) {
|
||||
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
|
||||
}
|
||||
return $toNames[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of of field names.
|
||||
*
|
||||
* @param string $type The type of fieldnames to return:
|
||||
* One of the class type constants TYPE_PHPNAME,
|
||||
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
|
||||
* @return array A list of field names
|
||||
*/
|
||||
|
||||
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
|
||||
{
|
||||
if (!array_key_exists($type, self::$fieldNames)) {
|
||||
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
|
||||
}
|
||||
return self::$fieldNames[$type];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method which changes table.column to alias.column.
|
||||
*
|
||||
* Using this method you can maintain SQL abstraction while using column aliases.
|
||||
* <code>
|
||||
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
|
||||
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
||||
* </code>
|
||||
* @param string $alias The alias for the current table.
|
||||
* @param string $column The column name for current table. (i.e. TrustPeer::COLUMN_NAME).
|
||||
* @return string
|
||||
*/
|
||||
public static function alias($alias, $column)
|
||||
{
|
||||
return str_replace(TrustPeer::TABLE_NAME.'.', $alias.'.', $column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all the columns needed to create a new object.
|
||||
*
|
||||
* Note: any columns that were marked with lazyLoad="true" in the
|
||||
* XML schema will not be added to the select list and only loaded
|
||||
* on demand.
|
||||
*
|
||||
* @param criteria object containing the columns to add.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function addSelectColumns(Criteria $criteria)
|
||||
{
|
||||
|
||||
$criteria->addSelectColumn(TrustPeer::CREATED_AT);
|
||||
|
||||
$criteria->addSelectColumn(TrustPeer::UPDATED_AT);
|
||||
|
||||
$criteria->addSelectColumn(TrustPeer::ID);
|
||||
|
||||
$criteria->addSelectColumn(TrustPeer::PRODUCT_ID);
|
||||
|
||||
$criteria->addSelectColumn(TrustPeer::FIELD_ON);
|
||||
|
||||
$criteria->addSelectColumn(TrustPeer::FIELD_F_ON);
|
||||
|
||||
$criteria->addSelectColumn(TrustPeer::FIELD_S_ON);
|
||||
|
||||
$criteria->addSelectColumn(TrustPeer::FIELD_T_ON);
|
||||
|
||||
|
||||
if (stEventDispatcher::getInstance()->getListeners('TrustPeer.postAddSelectColumns')) {
|
||||
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'TrustPeer.postAddSelectColumns'));
|
||||
}
|
||||
}
|
||||
|
||||
const COUNT = 'COUNT(st_trust.ID)';
|
||||
const COUNT_DISTINCT = 'COUNT(DISTINCT st_trust.ID)';
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
|
||||
* @param Connection $con
|
||||
* @return int Number of matching rows.
|
||||
*/
|
||||
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
|
||||
{
|
||||
// we're going to modify criteria, so copy it first
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// clear out anything that might confuse the ORDER BY clause
|
||||
$criteria->clearSelectColumns()->clearOrderByColumns();
|
||||
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->addSelectColumn(TrustPeer::COUNT_DISTINCT);
|
||||
} else {
|
||||
$criteria->addSelectColumn(TrustPeer::COUNT);
|
||||
}
|
||||
|
||||
// just in case we're grouping: add those columns to the select statement
|
||||
foreach($criteria->getGroupByColumns() as $column)
|
||||
{
|
||||
$criteria->addSelectColumn($column);
|
||||
}
|
||||
|
||||
$rs = TrustPeer::doSelectRS($criteria, $con);
|
||||
if ($rs->next()) {
|
||||
return $rs->getInt(1);
|
||||
} else {
|
||||
// no rows returned; we infer that means 0 matches.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Method to select one object from the DB.
|
||||
*
|
||||
* @param Criteria $criteria object used to create the SELECT statement.
|
||||
* @param Connection $con
|
||||
* @return Trust
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectOne(Criteria $criteria, $con = null)
|
||||
{
|
||||
$critcopy = clone $criteria;
|
||||
$critcopy->setLimit(1);
|
||||
$objects = TrustPeer::doSelect($critcopy, $con);
|
||||
if ($objects) {
|
||||
return $objects[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Method to do selects.
|
||||
*
|
||||
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
|
||||
* @param Connection $con
|
||||
* @return Trust[]
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelect(Criteria $criteria, $con = null)
|
||||
{
|
||||
return TrustPeer::populateObjects(TrustPeer::doSelectRS($criteria, $con));
|
||||
}
|
||||
/**
|
||||
* Prepares the Criteria object and uses the parent doSelect()
|
||||
* method to get a ResultSet.
|
||||
*
|
||||
* Use this method directly if you want to just get the resultset
|
||||
* (instead of an array of objects).
|
||||
*
|
||||
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
|
||||
* @param Connection $con the connection to use
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return ResultSet The resultset object with numerically-indexed fields.
|
||||
* @see BasePeer::doSelect()
|
||||
*/
|
||||
public static function doSelectRS(Criteria $criteria, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if (!$criteria->getSelectColumns()) {
|
||||
$criteria = clone $criteria;
|
||||
TrustPeer::addSelectColumns($criteria);
|
||||
}
|
||||
|
||||
if (stEventDispatcher::getInstance()->getListeners('BasePeer.preDoSelectRs')) {
|
||||
stEventDispatcher::getInstance()->notify(new sfEvent($criteria, 'BasePeer.preDoSelectRs'));
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
// BasePeer returns a Creole ResultSet, set to return
|
||||
// rows indexed numerically.
|
||||
$rs = BasePeer::doSelect($criteria, $con);
|
||||
|
||||
if (stEventDispatcher::getInstance()->getListeners('BasePeer.postDoSelectRs')) {
|
||||
stEventDispatcher::getInstance()->notify(new sfEvent($rs, 'BasePeer.postDoSelectRs'));
|
||||
}
|
||||
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* The returned array will contain objects of the default type or
|
||||
* objects that inherit from the default.
|
||||
*
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function populateObjects(ResultSet $rs)
|
||||
{
|
||||
|
||||
if (self::$hydrateMethod)
|
||||
{
|
||||
return call_user_func(self::$hydrateMethod, $rs);
|
||||
}
|
||||
$results = array();
|
||||
|
||||
// set the class once to avoid overhead in the loop
|
||||
$cls = TrustPeer::getOMClass();
|
||||
$cls = Propel::import($cls);
|
||||
// populate the object(s)
|
||||
while($rs->next()) {
|
||||
|
||||
$obj = new $cls();
|
||||
$obj->hydrate($rs);
|
||||
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj) : $obj;
|
||||
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining the related Product table
|
||||
*
|
||||
* @param Criteria $c
|
||||
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
|
||||
* @param Connection $con
|
||||
* @return int Number of matching rows.
|
||||
*/
|
||||
public static function doCountJoinProduct(Criteria $criteria, $distinct = false, $con = null)
|
||||
{
|
||||
// we're going to modify criteria, so copy it first
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// clear out anything that might confuse the ORDER BY clause
|
||||
$criteria->clearSelectColumns()->clearOrderByColumns();
|
||||
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->addSelectColumn(TrustPeer::COUNT_DISTINCT);
|
||||
} else {
|
||||
$criteria->addSelectColumn(TrustPeer::COUNT);
|
||||
}
|
||||
|
||||
// just in case we're grouping: add those columns to the select statement
|
||||
foreach($criteria->getGroupByColumns() as $column)
|
||||
{
|
||||
$criteria->addSelectColumn($column);
|
||||
}
|
||||
|
||||
$criteria->addJoin(TrustPeer::PRODUCT_ID, ProductPeer::ID);
|
||||
|
||||
$rs = TrustPeer::doSelectRS($criteria, $con);
|
||||
if ($rs->next()) {
|
||||
return $rs->getInt(1);
|
||||
} else {
|
||||
// no rows returned; we infer that means 0 matches.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of Trust objects pre-filled with their Product objects.
|
||||
*
|
||||
* @return Trust[] Array of Trust objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinProduct(Criteria $c, $con = null)
|
||||
{
|
||||
$c = clone $c;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
if ($c->getDbName() == Propel::getDefaultDB()) {
|
||||
$c->setDbName(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
TrustPeer::addSelectColumns($c);
|
||||
|
||||
ProductPeer::addSelectColumns($c);
|
||||
|
||||
$c->addJoin(TrustPeer::PRODUCT_ID, ProductPeer::ID);
|
||||
$rs = TrustPeer::doSelectRs($c, $con);
|
||||
|
||||
if (self::$hydrateMethod)
|
||||
{
|
||||
return call_user_func(self::$hydrateMethod, $rs);
|
||||
}
|
||||
|
||||
$results = array();
|
||||
|
||||
while($rs->next()) {
|
||||
|
||||
$obj1 = new Trust();
|
||||
$startcol = $obj1->hydrate($rs);
|
||||
if ($obj1->getProductId())
|
||||
{
|
||||
|
||||
$obj2 = new Product();
|
||||
$obj2->hydrate($rs, $startcol);
|
||||
$obj2->addTrust($obj1);
|
||||
}
|
||||
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows matching criteria, joining all related tables
|
||||
*
|
||||
* @param Criteria $c
|
||||
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
|
||||
* @param Connection $con
|
||||
* @return int Number of matching rows.
|
||||
*/
|
||||
public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
|
||||
{
|
||||
$criteria = clone $criteria;
|
||||
|
||||
// clear out anything that might confuse the ORDER BY clause
|
||||
$criteria->clearSelectColumns()->clearOrderByColumns();
|
||||
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||
$criteria->addSelectColumn(TrustPeer::COUNT_DISTINCT);
|
||||
} else {
|
||||
$criteria->addSelectColumn(TrustPeer::COUNT);
|
||||
}
|
||||
|
||||
// just in case we're grouping: add those columns to the select statement
|
||||
foreach($criteria->getGroupByColumns() as $column)
|
||||
{
|
||||
$criteria->addSelectColumn($column);
|
||||
}
|
||||
|
||||
$criteria->addJoin(TrustPeer::PRODUCT_ID, ProductPeer::ID);
|
||||
|
||||
$rs = TrustPeer::doSelectRS($criteria, $con);
|
||||
if ($rs->next()) {
|
||||
return $rs->getInt(1);
|
||||
} else {
|
||||
// no rows returned; we infer that means 0 matches.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of Trust objects pre-filled with all related objects.
|
||||
*
|
||||
* @return Trust[]
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectJoinAll(Criteria $c, $con = null)
|
||||
{
|
||||
$c = clone $c;
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
if ($c->getDbName() == Propel::getDefaultDB()) {
|
||||
$c->setDbName(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
TrustPeer::addSelectColumns($c);
|
||||
$startcol2 = (TrustPeer::NUM_COLUMNS - TrustPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
|
||||
|
||||
ProductPeer::addSelectColumns($c);
|
||||
$startcol3 = $startcol2 + ProductPeer::NUM_COLUMNS;
|
||||
|
||||
$c->addJoin(TrustPeer::PRODUCT_ID, ProductPeer::ID);
|
||||
|
||||
$rs = BasePeer::doSelect($c, $con);
|
||||
|
||||
if (self::$hydrateMethod)
|
||||
{
|
||||
return call_user_func(self::$hydrateMethod, $rs);
|
||||
}
|
||||
$results = array();
|
||||
|
||||
while($rs->next()) {
|
||||
|
||||
$omClass = TrustPeer::getOMClass();
|
||||
|
||||
|
||||
$cls = Propel::import($omClass);
|
||||
$obj1 = new $cls();
|
||||
$obj1->hydrate($rs);
|
||||
|
||||
|
||||
// Add objects for joined Product rows
|
||||
|
||||
$omClass = ProductPeer::getOMClass();
|
||||
|
||||
|
||||
$cls = Propel::import($omClass);
|
||||
$obj2 = new $cls();
|
||||
$obj2->hydrate($rs, $startcol2);
|
||||
|
||||
$newObject = true;
|
||||
for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
|
||||
$temp_obj1 = $results[$j];
|
||||
$temp_obj2 = $temp_obj1->getProduct(); // CHECKME
|
||||
if (null !== $temp_obj2 && $temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
|
||||
$newObject = false;
|
||||
$temp_obj2->addTrust($obj1); // CHECKME
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($newObject) {
|
||||
$obj2->initTrusts();
|
||||
$obj2->addTrust($obj1);
|
||||
}
|
||||
|
||||
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects a collection of Trust objects pre-filled with their i18n objects.
|
||||
*
|
||||
* @return array Array of Trust objects.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doSelectWithI18n(Criteria $c, $culture = null, $con = null)
|
||||
{
|
||||
$c = clone $c;
|
||||
|
||||
if ($culture === null)
|
||||
{
|
||||
$culture = sfContext::getInstance()->getUser()->getCulture();
|
||||
}
|
||||
|
||||
// Set the correct dbName if it has not been overridden
|
||||
if ($c->getDbName() == Propel::getDefaultDB())
|
||||
{
|
||||
$c->setDbName(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if (!$c->getSelectColumns())
|
||||
{
|
||||
TrustPeer::addSelectColumns($c);
|
||||
TrustI18nPeer::addSelectColumns($c);
|
||||
}
|
||||
|
||||
$c->addJoin(TrustPeer::ID, sprintf('%s AND %s = \'%s\'', TrustI18nPeer::ID, TrustI18nPeer::CULTURE, $culture), Criteria::LEFT_JOIN);
|
||||
|
||||
$rs = TrustPeer::doSelectRs($c, $con);
|
||||
|
||||
if (self::$hydrateMethod)
|
||||
{
|
||||
return call_user_func(self::$hydrateMethod, $rs);
|
||||
}
|
||||
|
||||
$results = array();
|
||||
|
||||
while($rs->next()) {
|
||||
|
||||
$obj1 = new Trust();
|
||||
$startcol = $obj1->hydrate($rs);
|
||||
$obj1->setCulture($culture);
|
||||
|
||||
$obj2 = new TrustI18n();
|
||||
$obj2->hydrate($rs, $startcol);
|
||||
|
||||
$obj1->setTrustI18nForCulture($obj2, $culture);
|
||||
$obj2->setTrust($obj1);
|
||||
|
||||
$results[] = self::$postHydrateMethod ? call_user_func(self::$postHydrateMethod, $obj1) : $obj1;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TableMap related to this peer.
|
||||
* This method is not needed for general use but a specific application could have a need.
|
||||
* @return TableMap
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function getTableMap()
|
||||
{
|
||||
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* The class that the Peer will make instances of.
|
||||
*
|
||||
* This uses a dot-path notation which is tranalted into a path
|
||||
* relative to a location on the PHP include_path.
|
||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
||||
*
|
||||
* @return string path.to.ClassName
|
||||
*/
|
||||
public static function getOMClass()
|
||||
{
|
||||
return TrustPeer::CLASS_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform an INSERT on the database, given a Trust or Criteria object.
|
||||
*
|
||||
* @param mixed $values Criteria or Trust object containing data that is used to create the INSERT statement.
|
||||
* @param Connection $con the connection to use
|
||||
* @return mixed The new primary key.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doInsert($values, $con = null)
|
||||
{
|
||||
|
||||
foreach (sfMixer::getCallables('BaseTrustPeer:doInsert:pre') as $callable)
|
||||
{
|
||||
$ret = call_user_func($callable, 'BaseTrustPeer', $values, $con);
|
||||
if (false !== $ret)
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
} else {
|
||||
$criteria = $values->buildCriteria(); // build Criteria from Trust object
|
||||
}
|
||||
|
||||
$criteria->remove(TrustPeer::ID); // remove pkey col since this table uses auto-increment
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table (I guess, conceivably)
|
||||
$con->begin();
|
||||
$pk = BasePeer::doInsert($criteria, $con);
|
||||
$con->commit();
|
||||
} catch(PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
foreach (sfMixer::getCallables('BaseTrustPeer:doInsert:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, 'BaseTrustPeer', $values, $con, $pk);
|
||||
}
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform an UPDATE on the database, given a Trust or Criteria object.
|
||||
*
|
||||
* @param mixed $values Criteria or Trust object containing data that is used to create the UPDATE statement.
|
||||
* @param Connection $con The connection to use (specify Connection object to exert more control over transactions).
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doUpdate($values, $con = null)
|
||||
{
|
||||
|
||||
foreach (sfMixer::getCallables('BaseTrustPeer:doUpdate:pre') as $callable)
|
||||
{
|
||||
$ret = call_user_func($callable, 'BaseTrustPeer', $values, $con);
|
||||
if (false !== $ret)
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$selectCriteria = new Criteria(self::DATABASE_NAME);
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
|
||||
$comparison = $criteria->getComparison(TrustPeer::ID);
|
||||
$selectCriteria->add(TrustPeer::ID, $criteria->remove(TrustPeer::ID), $comparison);
|
||||
|
||||
} else { // $values is Trust object
|
||||
$criteria = $values->buildCriteria(); // gets full criteria
|
||||
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
|
||||
}
|
||||
|
||||
// set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
$ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
|
||||
|
||||
|
||||
foreach (sfMixer::getCallables('BaseTrustPeer:doUpdate:post') as $callable)
|
||||
{
|
||||
call_user_func($callable, 'BaseTrustPeer', $values, $con, $ret);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to DELETE all rows from the st_trust table.
|
||||
*
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
public static function doDeleteAll($con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->begin();
|
||||
$affectedRows += TrustPeer::doOnDeleteCascade(new Criteria(), $con);
|
||||
$affectedRows += BasePeer::doDeleteAll(TrustPeer::TABLE_NAME, $con);
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method perform a DELETE on the database, given a Trust or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or Trust object or primary key or array of primary keys
|
||||
* which is used to create the DELETE statement
|
||||
* @param Connection $con the connection to use
|
||||
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
|
||||
* if supported by native driver or if emulated using Propel.
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
*/
|
||||
public static function doDelete($values, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(TrustPeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
$criteria = clone $values; // rename for clarity
|
||||
} elseif ($values instanceof Trust) {
|
||||
|
||||
$criteria = $values->buildPkeyCriteria();
|
||||
} else {
|
||||
// it must be the primary key
|
||||
$criteria = new Criteria(self::DATABASE_NAME);
|
||||
$criteria->add(TrustPeer::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(self::DATABASE_NAME);
|
||||
|
||||
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||
|
||||
try {
|
||||
// use transaction because $criteria could contain info
|
||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||
$con->begin();
|
||||
$affectedRows += TrustPeer::doOnDeleteCascade($criteria, $con);
|
||||
$affectedRows += BasePeer::doDelete($criteria, $con);
|
||||
$con->commit();
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
|
||||
* feature (like MySQL or SQLite).
|
||||
*
|
||||
* This method is not very speedy because it must perform a query first to get
|
||||
* the implicated records and then perform the deletes by calling those Peer classes.
|
||||
*
|
||||
* This method should be used within a transaction if possible.
|
||||
*
|
||||
* @param Criteria $criteria
|
||||
* @param Connection $con
|
||||
* @return int The number of affected rows (if supported by underlying database driver).
|
||||
*/
|
||||
protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
|
||||
{
|
||||
// initialize var to track total num of affected rows
|
||||
$affectedRows = 0;
|
||||
|
||||
// first find the objects that are implicated by the $criteria
|
||||
$objects = TrustPeer::doSelect($criteria, $con);
|
||||
foreach($objects as $obj) {
|
||||
|
||||
|
||||
// delete related TrustI18n objects
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(TrustI18nPeer::ID, $obj->getId());
|
||||
$affectedRows += TrustI18nPeer::doDelete($c, $con);
|
||||
}
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates all modified columns of given Trust object.
|
||||
* If parameter $columns is either a single column name or an array of column names
|
||||
* than only those columns are validated.
|
||||
*
|
||||
* NOTICE: This does not apply to primary or foreign keys for now.
|
||||
*
|
||||
* @param Trust $obj The object to validate.
|
||||
* @param mixed $cols Column name or array of column names.
|
||||
*
|
||||
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
|
||||
*/
|
||||
public static function doValidate(Trust $obj, $cols = null)
|
||||
{
|
||||
$columns = array();
|
||||
|
||||
if ($cols) {
|
||||
$dbMap = Propel::getDatabaseMap(TrustPeer::DATABASE_NAME);
|
||||
$tableMap = $dbMap->getTable(TrustPeer::TABLE_NAME);
|
||||
|
||||
if (! is_array($cols)) {
|
||||
$cols = array($cols);
|
||||
}
|
||||
|
||||
foreach($cols as $colName) {
|
||||
if ($tableMap->containsColumn($colName)) {
|
||||
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
|
||||
$columns[$colName] = $obj->$get();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
$res = BasePeer::doValidate(TrustPeer::DATABASE_NAME, TrustPeer::TABLE_NAME, $columns);
|
||||
if ($res !== true) {
|
||||
$request = sfContext::getInstance()->getRequest();
|
||||
foreach ($res as $failed) {
|
||||
$col = TrustPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
|
||||
$request->setError($col, $failed->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a single object by pkey.
|
||||
*
|
||||
* @param mixed $pk the primary key.
|
||||
* @param Connection $con the connection to use
|
||||
* @return Trust
|
||||
*/
|
||||
public static function retrieveByPK($pk, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = new Criteria(TrustPeer::DATABASE_NAME);
|
||||
|
||||
$criteria->add(TrustPeer::ID, $pk);
|
||||
|
||||
|
||||
$v = TrustPeer::doSelect($criteria, $con);
|
||||
|
||||
return !empty($v) > 0 ? $v[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve multiple objects by pkey.
|
||||
*
|
||||
* @param array $pks List of primary keys
|
||||
* @param Connection $con the connection to use
|
||||
* @throws PropelException Any exceptions caught during processing will be
|
||||
* rethrown wrapped into a PropelException.
|
||||
* @return Trust[]
|
||||
*/
|
||||
public static function retrieveByPKs($pks, $con = null)
|
||||
{
|
||||
if ($con === null) {
|
||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$objs = null;
|
||||
if (empty($pks)) {
|
||||
$objs = array();
|
||||
} else {
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(TrustPeer::ID, $pks, Criteria::IN);
|
||||
$objs = TrustPeer::doSelect($criteria, $con);
|
||||
}
|
||||
return $objs;
|
||||
}
|
||||
|
||||
} // BaseTrustPeer
|
||||
|
||||
// static code to register the map builder for this Peer with the main Propel class
|
||||
if (Propel::isInit()) {
|
||||
// the MapBuilder classes register themselves with Propel during initialization
|
||||
// so we need to load them here.
|
||||
try {
|
||||
BaseTrustPeer::getMapBuilder();
|
||||
} catch (Exception $e) {
|
||||
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
|
||||
}
|
||||
} else {
|
||||
// even if Propel is not yet initialized, the map builder class can be registered
|
||||
// now and then it will be loaded when Propel initializes.
|
||||
Propel::registerMapBuilder('plugins.stTrustPlugin.lib.model.map.TrustMapBuilder');
|
||||
}
|
||||
Reference in New Issue
Block a user