Overview

Namespaces

  • PHP
  • Thelia
    • Action
    • Controller
    • Core
      • Bundle
      • Event
      • EventListener
      • Template
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools

Classes

  • BaseAccessory
  • BaseAccessoryPeer
  • BaseAccessoryQuery
  • BaseAddress
  • BaseAddressPeer
  • BaseAddressQuery
  • BaseAdmin
  • BaseAdminGroup
  • BaseAdminGroupPeer
  • BaseAdminGroupQuery
  • BaseAdminLog
  • BaseAdminLogPeer
  • BaseAdminLogQuery
  • BaseAdminPeer
  • BaseAdminQuery
  • BaseArea
  • BaseAreaPeer
  • BaseAreaQuery
  • BaseAttribute
  • BaseAttributeAv
  • BaseAttributeAvDesc
  • BaseAttributeAvDescPeer
  • BaseAttributeAvDescQuery
  • BaseAttributeAvI18n
  • BaseAttributeAvI18nPeer
  • BaseAttributeAvI18nQuery
  • BaseAttributeAvPeer
  • BaseAttributeAvQuery
  • BaseAttributeCategory
  • BaseAttributeCategoryPeer
  • BaseAttributeCategoryQuery
  • BaseAttributeCombination
  • BaseAttributeCombinationPeer
  • BaseAttributeCombinationQuery
  • BaseAttributeDesc
  • BaseAttributeDescPeer
  • BaseAttributeDescQuery
  • BaseAttributeI18n
  • BaseAttributeI18nPeer
  • BaseAttributeI18nQuery
  • BaseAttributePeer
  • BaseAttributeQuery
  • BaseCategory
  • BaseCategoryDesc
  • BaseCategoryDescPeer
  • BaseCategoryDescQuery
  • BaseCategoryI18n
  • BaseCategoryI18nPeer
  • BaseCategoryI18nQuery
  • BaseCategoryPeer
  • BaseCategoryQuery
  • BaseCategoryVersion
  • BaseCategoryVersionPeer
  • BaseCategoryVersionQuery
  • BaseCombination
  • BaseCombinationPeer
  • BaseCombinationQuery
  • BaseConfig
  • BaseConfigDesc
  • BaseConfigDescPeer
  • BaseConfigDescQuery
  • BaseConfigI18n
  • BaseConfigI18nPeer
  • BaseConfigI18nQuery
  • BaseConfigPeer
  • BaseConfigQuery
  • BaseContent
  • BaseContentAssoc
  • BaseContentAssocPeer
  • BaseContentAssocQuery
  • BaseContentDesc
  • BaseContentDescPeer
  • BaseContentDescQuery
  • BaseContentFolder
  • BaseContentFolderPeer
  • BaseContentFolderQuery
  • BaseContentI18n
  • BaseContentI18nPeer
  • BaseContentI18nQuery
  • BaseContentPeer
  • BaseContentQuery
  • BaseContentVersion
  • BaseContentVersionPeer
  • BaseContentVersionQuery
  • BaseCountry
  • BaseCountryDesc
  • BaseCountryDescPeer
  • BaseCountryDescQuery
  • BaseCountryI18n
  • BaseCountryI18nPeer
  • BaseCountryI18nQuery
  • BaseCountryPeer
  • BaseCountryQuery
  • BaseCoupon
  • BaseCouponOrder
  • BaseCouponOrderPeer
  • BaseCouponOrderQuery
  • BaseCouponPeer
  • BaseCouponQuery
  • BaseCouponRule
  • BaseCouponRulePeer
  • BaseCouponRuleQuery
  • BaseCurrency
  • BaseCurrencyPeer
  • BaseCurrencyQuery
  • BaseCustomer
  • BaseCustomerPeer
  • BaseCustomerQuery
  • BaseCustomerTitle
  • BaseCustomerTitleDesc
  • BaseCustomerTitleDescPeer
  • BaseCustomerTitleDescQuery
  • BaseCustomerTitleI18n
  • BaseCustomerTitleI18nPeer
  • BaseCustomerTitleI18nQuery
  • BaseCustomerTitlePeer
  • BaseCustomerTitleQuery
  • BaseDelivzone
  • BaseDelivzonePeer
  • BaseDelivzoneQuery
  • BaseDocument
  • BaseDocumentDesc
  • BaseDocumentDescPeer
  • BaseDocumentDescQuery
  • BaseDocumentI18n
  • BaseDocumentI18nPeer
  • BaseDocumentI18nQuery
  • BaseDocumentPeer
  • BaseDocumentQuery
  • BaseFeature
  • BaseFeatureAv
  • BaseFeatureAvDesc
  • BaseFeatureAvDescPeer
  • BaseFeatureAvDescQuery
  • BaseFeatureAvI18n
  • BaseFeatureAvI18nPeer
  • BaseFeatureAvI18nQuery
  • BaseFeatureAvPeer
  • BaseFeatureAvQuery
  • BaseFeatureCategory
  • BaseFeatureCategoryPeer
  • BaseFeatureCategoryQuery
  • BaseFeatureDesc
  • BaseFeatureDescPeer
  • BaseFeatureDescQuery
  • BaseFeatureI18n
  • BaseFeatureI18nPeer
  • BaseFeatureI18nQuery
  • BaseFeaturePeer
  • BaseFeatureProd
  • BaseFeatureProdPeer
  • BaseFeatureProdQuery
  • BaseFeatureQuery
  • BaseFolder
  • BaseFolderDesc
  • BaseFolderDescPeer
  • BaseFolderDescQuery
  • BaseFolderI18n
  • BaseFolderI18nPeer
  • BaseFolderI18nQuery
  • BaseFolderPeer
  • BaseFolderQuery
  • BaseFolderVersion
  • BaseFolderVersionPeer
  • BaseFolderVersionQuery
  • BaseGroup
  • BaseGroupDesc
  • BaseGroupDescPeer
  • BaseGroupDescQuery
  • BaseGroupI18n
  • BaseGroupI18nPeer
  • BaseGroupI18nQuery
  • BaseGroupModule
  • BaseGroupModulePeer
  • BaseGroupModuleQuery
  • BaseGroupPeer
  • BaseGroupQuery
  • BaseGroupResource
  • BaseGroupResourcePeer
  • BaseGroupResourceQuery
  • BaseImage
  • BaseImageDesc
  • BaseImageDescPeer
  • BaseImageDescQuery
  • BaseImageI18n
  • BaseImageI18nPeer
  • BaseImageI18nQuery
  • BaseImagePeer
  • BaseImageQuery
  • BaseLang
  • BaseLangPeer
  • BaseLangQuery
  • BaseMessage
  • BaseMessageDesc
  • BaseMessageDescPeer
  • BaseMessageDescQuery
  • BaseMessageI18n
  • BaseMessageI18nPeer
  • BaseMessageI18nQuery
  • BaseMessagePeer
  • BaseMessageQuery
  • BaseMessageVersion
  • BaseMessageVersionPeer
  • BaseMessageVersionQuery
  • BaseModuleDesc
  • BaseModuleDescPeer
  • BaseModuleDescQuery
  • BaseModuleI18n
  • BaseModuleI18nPeer
  • BaseModuleI18nQuery
  • BaseModulePeer
  • BaseOrder
  • BaseOrderAddress
  • BaseOrderAddressPeer
  • BaseOrderAddressQuery
  • BaseOrderFeature
  • BaseOrderFeaturePeer
  • BaseOrderFeatureQuery
  • BaseOrderPeer
  • BaseOrderProduct
  • BaseOrderProductPeer
  • BaseOrderProductQuery
  • BaseOrderQuery
  • BaseOrderStatus
  • BaseOrderStatusDesc
  • BaseOrderStatusDescPeer
  • BaseOrderStatusDescQuery
  • BaseOrderStatusI18n
  • BaseOrderStatusI18nPeer
  • BaseOrderStatusI18nQuery
  • BaseOrderStatusPeer
  • BaseOrderStatusQuery
  • BaseProduct
  • BaseProductCategory
  • BaseProductCategoryPeer
  • BaseProductCategoryQuery
  • BaseProductDesc
  • BaseProductDescPeer
  • BaseProductDescQuery
  • BaseProductI18n
  • BaseProductI18nPeer
  • BaseProductI18nQuery
  • BaseProductPeer
  • BaseProductQuery
  • BaseProductVersion
  • BaseProductVersionPeer
  • BaseProductVersionQuery
  • BaseResource
  • BaseResourceDesc
  • BaseResourceDescPeer
  • BaseResourceDescQuery
  • BaseResourceI18n
  • BaseResourceI18nPeer
  • BaseResourceI18nQuery
  • BaseResourcePeer
  • BaseResourceQuery
  • BaseRewriting
  • BaseRewritingPeer
  • BaseRewritingQuery
  • BaseStock
  • BaseStockPeer
  • BaseStockQuery
  • BaseTax
  • BaseTaxDesc
  • BaseTaxDescPeer
  • BaseTaxDescQuery
  • BaseTaxI18n
  • BaseTaxI18nPeer
  • BaseTaxI18nQuery
  • BaseTaxPeer
  • BaseTaxQuery
  • BaseTaxRule
  • BaseTaxRuleCountry
  • BaseTaxRuleCountryPeer
  • BaseTaxRuleCountryQuery
  • BaseTaxRuleDesc
  • BaseTaxRuleDescPeer
  • BaseTaxRuleDescQuery
  • BaseTaxRuleI18n
  • BaseTaxRuleI18nPeer
  • BaseTaxRuleI18nQuery
  • BaseTaxRulePeer
  • BaseTaxRuleQuery
  • Overview
  • Namespace
  • Class
  • Tree
   1: <?php
   2: 
   3: namespace Thelia\Model\om;
   4: 
   5: use \BasePeer;
   6: use \Criteria;
   7: use \PDO;
   8: use \PDOStatement;
   9: use \Propel;
  10: use \PropelException;
  11: use \PropelPDO;
  12: use Thelia\Model\FeatureAv;
  13: use Thelia\Model\FeatureAvI18nPeer;
  14: use Thelia\Model\FeatureAvPeer;
  15: use Thelia\Model\FeaturePeer;
  16: use Thelia\Model\FeatureProdPeer;
  17: use Thelia\Model\map\FeatureAvTableMap;
  18: 
  19: /**
  20:  * Base static class for performing query and update operations on the 'feature_av' table.
  21:  *
  22:  *
  23:  *
  24:  * @package propel.generator.Thelia.Model.om
  25:  */
  26: abstract class BaseFeatureAvPeer
  27: {
  28: 
  29:     /** the default database name for this class */
  30:     const DATABASE_NAME = 'thelia';
  31: 
  32:     /** the table name for this class */
  33:     const TABLE_NAME = 'feature_av';
  34: 
  35:     /** the related Propel class for this table */
  36:     const OM_CLASS = 'Thelia\\Model\\FeatureAv';
  37: 
  38:     /** the related TableMap class for this table */
  39:     const TM_CLASS = 'FeatureAvTableMap';
  40: 
  41:     /** The total number of columns. */
  42:     const NUM_COLUMNS = 4;
  43: 
  44:     /** The number of lazy-loaded columns. */
  45:     const NUM_LAZY_LOAD_COLUMNS = 0;
  46: 
  47:     /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
  48:     const NUM_HYDRATE_COLUMNS = 4;
  49: 
  50:     /** the column name for the ID field */
  51:     const ID = 'feature_av.ID';
  52: 
  53:     /** the column name for the FEATURE_ID field */
  54:     const FEATURE_ID = 'feature_av.FEATURE_ID';
  55: 
  56:     /** the column name for the CREATED_AT field */
  57:     const CREATED_AT = 'feature_av.CREATED_AT';
  58: 
  59:     /** the column name for the UPDATED_AT field */
  60:     const UPDATED_AT = 'feature_av.UPDATED_AT';
  61: 
  62:     /** The default string format for model objects of the related table **/
  63:     const DEFAULT_STRING_FORMAT = 'YAML';
  64: 
  65:     /**
  66:      * An identiy map to hold any loaded instances of FeatureAv objects.
  67:      * This must be public so that other peer classes can access this when hydrating from JOIN
  68:      * queries.
  69:      * @var        array FeatureAv[]
  70:      */
  71:     public static $instances = array();
  72: 
  73: 
  74:     // i18n behavior
  75: 
  76:     /**
  77:      * The default locale to use for translations
  78:      * @var        string
  79:      */
  80:     const DEFAULT_LOCALE = 'en_EN';
  81:     /**
  82:      * holds an array of fieldnames
  83:      *
  84:      * first dimension keys are the type constants
  85:      * e.g. FeatureAvPeer::$fieldNames[FeatureAvPeer::TYPE_PHPNAME][0] = 'Id'
  86:      */
  87:     protected static $fieldNames = array (
  88:         BasePeer::TYPE_PHPNAME => array ('Id', 'FeatureId', 'CreatedAt', 'UpdatedAt', ),
  89:         BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'featureId', 'createdAt', 'updatedAt', ),
  90:         BasePeer::TYPE_COLNAME => array (FeatureAvPeer::ID, FeatureAvPeer::FEATURE_ID, FeatureAvPeer::CREATED_AT, FeatureAvPeer::UPDATED_AT, ),
  91:         BasePeer::TYPE_RAW_COLNAME => array ('ID', 'FEATURE_ID', 'CREATED_AT', 'UPDATED_AT', ),
  92:         BasePeer::TYPE_FIELDNAME => array ('id', 'feature_id', 'created_at', 'updated_at', ),
  93:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
  94:     );
  95: 
  96:     /**
  97:      * holds an array of keys for quick access to the fieldnames array
  98:      *
  99:      * first dimension keys are the type constants
 100:      * e.g. FeatureAvPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
 101:      */
 102:     protected static $fieldKeys = array (
 103:         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FeatureId' => 1, 'CreatedAt' => 2, 'UpdatedAt' => 3, ),
 104:         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'featureId' => 1, 'createdAt' => 2, 'updatedAt' => 3, ),
 105:         BasePeer::TYPE_COLNAME => array (FeatureAvPeer::ID => 0, FeatureAvPeer::FEATURE_ID => 1, FeatureAvPeer::CREATED_AT => 2, FeatureAvPeer::UPDATED_AT => 3, ),
 106:         BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'FEATURE_ID' => 1, 'CREATED_AT' => 2, 'UPDATED_AT' => 3, ),
 107:         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'feature_id' => 1, 'created_at' => 2, 'updated_at' => 3, ),
 108:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
 109:     );
 110: 
 111:     /**
 112:      * Translates a fieldname to another type
 113:      *
 114:      * @param      string $name field name
 115:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 116:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
 117:      * @param      string $toType   One of the class type constants
 118:      * @return string          translated name of the field.
 119:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
 120:      */
 121:     public static function translateFieldName($name, $fromType, $toType)
 122:     {
 123:         $toNames = FeatureAvPeer::getFieldNames($toType);
 124:         $key = isset(FeatureAvPeer::$fieldKeys[$fromType][$name]) ? FeatureAvPeer::$fieldKeys[$fromType][$name] : null;
 125:         if ($key === null) {
 126:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(FeatureAvPeer::$fieldKeys[$fromType], true));
 127:         }
 128: 
 129:         return $toNames[$key];
 130:     }
 131: 
 132:     /**
 133:      * Returns an array of field names.
 134:      *
 135:      * @param      string $type The type of fieldnames to return:
 136:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
 137:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
 138:      * @return array           A list of field names
 139:      * @throws PropelException - if the type is not valid.
 140:      */
 141:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
 142:     {
 143:         if (!array_key_exists($type, FeatureAvPeer::$fieldNames)) {
 144:             throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
 145:         }
 146: 
 147:         return FeatureAvPeer::$fieldNames[$type];
 148:     }
 149: 
 150:     /**
 151:      * Convenience method which changes table.column to alias.column.
 152:      *
 153:      * Using this method you can maintain SQL abstraction while using column aliases.
 154:      * <code>
 155:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
 156:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
 157:      * </code>
 158:      * @param      string $alias The alias for the current table.
 159:      * @param      string $column The column name for current table. (i.e. FeatureAvPeer::COLUMN_NAME).
 160:      * @return string
 161:      */
 162:     public static function alias($alias, $column)
 163:     {
 164:         return str_replace(FeatureAvPeer::TABLE_NAME.'.', $alias.'.', $column);
 165:     }
 166: 
 167:     /**
 168:      * Add all the columns needed to create a new object.
 169:      *
 170:      * Note: any columns that were marked with lazyLoad="true" in the
 171:      * XML schema will not be added to the select list and only loaded
 172:      * on demand.
 173:      *
 174:      * @param      Criteria $criteria object containing the columns to add.
 175:      * @param      string   $alias    optional table alias
 176:      * @throws PropelException Any exceptions caught during processing will be
 177:      *       rethrown wrapped into a PropelException.
 178:      */
 179:     public static function addSelectColumns(Criteria $criteria, $alias = null)
 180:     {
 181:         if (null === $alias) {
 182:             $criteria->addSelectColumn(FeatureAvPeer::ID);
 183:             $criteria->addSelectColumn(FeatureAvPeer::FEATURE_ID);
 184:             $criteria->addSelectColumn(FeatureAvPeer::CREATED_AT);
 185:             $criteria->addSelectColumn(FeatureAvPeer::UPDATED_AT);
 186:         } else {
 187:             $criteria->addSelectColumn($alias . '.ID');
 188:             $criteria->addSelectColumn($alias . '.FEATURE_ID');
 189:             $criteria->addSelectColumn($alias . '.CREATED_AT');
 190:             $criteria->addSelectColumn($alias . '.UPDATED_AT');
 191:         }
 192:     }
 193: 
 194:     /**
 195:      * Returns the number of rows matching criteria.
 196:      *
 197:      * @param      Criteria $criteria
 198:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 199:      * @param      PropelPDO $con
 200:      * @return int Number of matching rows.
 201:      */
 202:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
 203:     {
 204:         // we may modify criteria, so copy it first
 205:         $criteria = clone $criteria;
 206: 
 207:         // We need to set the primary table name, since in the case that there are no WHERE columns
 208:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 209:         // tables go into the FROM clause.
 210:         $criteria->setPrimaryTableName(FeatureAvPeer::TABLE_NAME);
 211: 
 212:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 213:             $criteria->setDistinct();
 214:         }
 215: 
 216:         if (!$criteria->hasSelectClause()) {
 217:             FeatureAvPeer::addSelectColumns($criteria);
 218:         }
 219: 
 220:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 221:         $criteria->setDbName(FeatureAvPeer::DATABASE_NAME); // Set the correct dbName
 222: 
 223:         if ($con === null) {
 224:             $con = Propel::getConnection(FeatureAvPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 225:         }
 226:         // BasePeer returns a PDOStatement
 227:         $stmt = BasePeer::doCount($criteria, $con);
 228: 
 229:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 230:             $count = (int) $row[0];
 231:         } else {
 232:             $count = 0; // no rows returned; we infer that means 0 matches.
 233:         }
 234:         $stmt->closeCursor();
 235: 
 236:         return $count;
 237:     }
 238:     /**
 239:      * Selects one object from the DB.
 240:      *
 241:      * @param      Criteria $criteria object used to create the SELECT statement.
 242:      * @param      PropelPDO $con
 243:      * @return                 FeatureAv
 244:      * @throws PropelException Any exceptions caught during processing will be
 245:      *       rethrown wrapped into a PropelException.
 246:      */
 247:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
 248:     {
 249:         $critcopy = clone $criteria;
 250:         $critcopy->setLimit(1);
 251:         $objects = FeatureAvPeer::doSelect($critcopy, $con);
 252:         if ($objects) {
 253:             return $objects[0];
 254:         }
 255: 
 256:         return null;
 257:     }
 258:     /**
 259:      * Selects several row from the DB.
 260:      *
 261:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
 262:      * @param      PropelPDO $con
 263:      * @return array           Array of selected Objects
 264:      * @throws PropelException Any exceptions caught during processing will be
 265:      *       rethrown wrapped into a PropelException.
 266:      */
 267:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
 268:     {
 269:         return FeatureAvPeer::populateObjects(FeatureAvPeer::doSelectStmt($criteria, $con));
 270:     }
 271:     /**
 272:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
 273:      *
 274:      * Use this method directly if you want to work with an executed statement durirectly (for example
 275:      * to perform your own object hydration).
 276:      *
 277:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
 278:      * @param      PropelPDO $con The connection to use
 279:      * @throws PropelException Any exceptions caught during processing will be
 280:      *       rethrown wrapped into a PropelException.
 281:      * @return PDOStatement The executed PDOStatement object.
 282:      * @see        BasePeer::doSelect()
 283:      */
 284:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
 285:     {
 286:         if ($con === null) {
 287:             $con = Propel::getConnection(FeatureAvPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 288:         }
 289: 
 290:         if (!$criteria->hasSelectClause()) {
 291:             $criteria = clone $criteria;
 292:             FeatureAvPeer::addSelectColumns($criteria);
 293:         }
 294: 
 295:         // Set the correct dbName
 296:         $criteria->setDbName(FeatureAvPeer::DATABASE_NAME);
 297: 
 298:         // BasePeer returns a PDOStatement
 299:         return BasePeer::doSelect($criteria, $con);
 300:     }
 301:     /**
 302:      * Adds an object to the instance pool.
 303:      *
 304:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
 305:      * from the database.  In some cases -- especially when you override doSelect*()
 306:      * methods in your stub classes -- you may need to explicitly add objects
 307:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
 308:      * and retrieveByPK*() calls.
 309:      *
 310:      * @param      FeatureAv $obj A FeatureAv object.
 311:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
 312:      */
 313:     public static function addInstanceToPool($obj, $key = null)
 314:     {
 315:         if (Propel::isInstancePoolingEnabled()) {
 316:             if ($key === null) {
 317:                 $key = (string) $obj->getId();
 318:             } // if key === null
 319:             FeatureAvPeer::$instances[$key] = $obj;
 320:         }
 321:     }
 322: 
 323:     /**
 324:      * Removes an object from the instance pool.
 325:      *
 326:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
 327:      * from the database.  In some cases -- especially when you override doDelete
 328:      * methods in your stub classes -- you may need to explicitly remove objects
 329:      * from the cache in order to prevent returning objects that no longer exist.
 330:      *
 331:      * @param      mixed $value A FeatureAv object or a primary key value.
 332:      *
 333:      * @return void
 334:      * @throws PropelException - if the value is invalid.
 335:      */
 336:     public static function removeInstanceFromPool($value)
 337:     {
 338:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
 339:             if (is_object($value) && $value instanceof FeatureAv) {
 340:                 $key = (string) $value->getId();
 341:             } elseif (is_scalar($value)) {
 342:                 // assume we've been passed a primary key
 343:                 $key = (string) $value;
 344:             } else {
 345:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or FeatureAv object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
 346:                 throw $e;
 347:             }
 348: 
 349:             unset(FeatureAvPeer::$instances[$key]);
 350:         }
 351:     } // removeInstanceFromPool()
 352: 
 353:     /**
 354:      * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
 355:      *
 356:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 357:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 358:      *
 359:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
 360:      * @return   FeatureAv Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
 361:      * @see        getPrimaryKeyHash()
 362:      */
 363:     public static function getInstanceFromPool($key)
 364:     {
 365:         if (Propel::isInstancePoolingEnabled()) {
 366:             if (isset(FeatureAvPeer::$instances[$key])) {
 367:                 return FeatureAvPeer::$instances[$key];
 368:             }
 369:         }
 370: 
 371:         return null; // just to be explicit
 372:     }
 373: 
 374:     /**
 375:      * Clear the instance pool.
 376:      *
 377:      * @return void
 378:      */
 379:     public static function clearInstancePool()
 380:     {
 381:         FeatureAvPeer::$instances = array();
 382:     }
 383: 
 384:     /**
 385:      * Method to invalidate the instance pool of all tables related to feature_av
 386:      * by a foreign key with ON DELETE CASCADE
 387:      */
 388:     public static function clearRelatedInstancePool()
 389:     {
 390:         // Invalidate objects in FeatureProdPeer instance pool,
 391:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
 392:         FeatureProdPeer::clearInstancePool();
 393:         // Invalidate objects in FeatureAvI18nPeer instance pool,
 394:         // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
 395:         FeatureAvI18nPeer::clearInstancePool();
 396:     }
 397: 
 398:     /**
 399:      * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
 400:      *
 401:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 402:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
 403:      *
 404:      * @param      array $row PropelPDO resultset row.
 405:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 406:      * @return string A string version of PK or null if the components of primary key in result array are all null.
 407:      */
 408:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
 409:     {
 410:         // If the PK cannot be derived from the row, return null.
 411:         if ($row[$startcol] === null) {
 412:             return null;
 413:         }
 414: 
 415:         return (string) $row[$startcol];
 416:     }
 417: 
 418:     /**
 419:      * Retrieves the primary key from the DB resultset row
 420:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
 421:      * a multi-column primary key, an array of the primary key columns will be returned.
 422:      *
 423:      * @param      array $row PropelPDO resultset row.
 424:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 425:      * @return mixed The primary key of the row
 426:      */
 427:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
 428:     {
 429: 
 430:         return (int) $row[$startcol];
 431:     }
 432: 
 433:     /**
 434:      * The returned array will contain objects of the default type or
 435:      * objects that inherit from the default.
 436:      *
 437:      * @throws PropelException Any exceptions caught during processing will be
 438:      *       rethrown wrapped into a PropelException.
 439:      */
 440:     public static function populateObjects(PDOStatement $stmt)
 441:     {
 442:         $results = array();
 443: 
 444:         // set the class once to avoid overhead in the loop
 445:         $cls = FeatureAvPeer::getOMClass();
 446:         // populate the object(s)
 447:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 448:             $key = FeatureAvPeer::getPrimaryKeyHashFromRow($row, 0);
 449:             if (null !== ($obj = FeatureAvPeer::getInstanceFromPool($key))) {
 450:                 // We no longer rehydrate the object, since this can cause data loss.
 451:                 // See http://www.propelorm.org/ticket/509
 452:                 // $obj->hydrate($row, 0, true); // rehydrate
 453:                 $results[] = $obj;
 454:             } else {
 455:                 $obj = new $cls();
 456:                 $obj->hydrate($row);
 457:                 $results[] = $obj;
 458:                 FeatureAvPeer::addInstanceToPool($obj, $key);
 459:             } // if key exists
 460:         }
 461:         $stmt->closeCursor();
 462: 
 463:         return $results;
 464:     }
 465:     /**
 466:      * Populates an object of the default type or an object that inherit from the default.
 467:      *
 468:      * @param      array $row PropelPDO resultset row.
 469:      * @param      int $startcol The 0-based offset for reading from the resultset row.
 470:      * @throws PropelException Any exceptions caught during processing will be
 471:      *       rethrown wrapped into a PropelException.
 472:      * @return array (FeatureAv object, last column rank)
 473:      */
 474:     public static function populateObject($row, $startcol = 0)
 475:     {
 476:         $key = FeatureAvPeer::getPrimaryKeyHashFromRow($row, $startcol);
 477:         if (null !== ($obj = FeatureAvPeer::getInstanceFromPool($key))) {
 478:             // We no longer rehydrate the object, since this can cause data loss.
 479:             // See http://www.propelorm.org/ticket/509
 480:             // $obj->hydrate($row, $startcol, true); // rehydrate
 481:             $col = $startcol + FeatureAvPeer::NUM_HYDRATE_COLUMNS;
 482:         } else {
 483:             $cls = FeatureAvPeer::OM_CLASS;
 484:             $obj = new $cls();
 485:             $col = $obj->hydrate($row, $startcol);
 486:             FeatureAvPeer::addInstanceToPool($obj, $key);
 487:         }
 488: 
 489:         return array($obj, $col);
 490:     }
 491: 
 492: 
 493:     /**
 494:      * Returns the number of rows matching criteria, joining the related Feature table
 495:      *
 496:      * @param      Criteria $criteria
 497:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 498:      * @param      PropelPDO $con
 499:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 500:      * @return int Number of matching rows.
 501:      */
 502:     public static function doCountJoinFeature(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 503:     {
 504:         // we're going to modify criteria, so copy it first
 505:         $criteria = clone $criteria;
 506: 
 507:         // We need to set the primary table name, since in the case that there are no WHERE columns
 508:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 509:         // tables go into the FROM clause.
 510:         $criteria->setPrimaryTableName(FeatureAvPeer::TABLE_NAME);
 511: 
 512:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 513:             $criteria->setDistinct();
 514:         }
 515: 
 516:         if (!$criteria->hasSelectClause()) {
 517:             FeatureAvPeer::addSelectColumns($criteria);
 518:         }
 519: 
 520:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 521: 
 522:         // Set the correct dbName
 523:         $criteria->setDbName(FeatureAvPeer::DATABASE_NAME);
 524: 
 525:         if ($con === null) {
 526:             $con = Propel::getConnection(FeatureAvPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 527:         }
 528: 
 529:         $criteria->addJoin(FeatureAvPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
 530: 
 531:         $stmt = BasePeer::doCount($criteria, $con);
 532: 
 533:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 534:             $count = (int) $row[0];
 535:         } else {
 536:             $count = 0; // no rows returned; we infer that means 0 matches.
 537:         }
 538:         $stmt->closeCursor();
 539: 
 540:         return $count;
 541:     }
 542: 
 543: 
 544:     /**
 545:      * Selects a collection of FeatureAv objects pre-filled with their Feature objects.
 546:      * @param      Criteria  $criteria
 547:      * @param      PropelPDO $con
 548:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 549:      * @return array           Array of FeatureAv objects.
 550:      * @throws PropelException Any exceptions caught during processing will be
 551:      *       rethrown wrapped into a PropelException.
 552:      */
 553:     public static function doSelectJoinFeature(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 554:     {
 555:         $criteria = clone $criteria;
 556: 
 557:         // Set the correct dbName if it has not been overridden
 558:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 559:             $criteria->setDbName(FeatureAvPeer::DATABASE_NAME);
 560:         }
 561: 
 562:         FeatureAvPeer::addSelectColumns($criteria);
 563:         $startcol = FeatureAvPeer::NUM_HYDRATE_COLUMNS;
 564:         FeaturePeer::addSelectColumns($criteria);
 565: 
 566:         $criteria->addJoin(FeatureAvPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
 567: 
 568:         $stmt = BasePeer::doSelect($criteria, $con);
 569:         $results = array();
 570: 
 571:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 572:             $key1 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, 0);
 573:             if (null !== ($obj1 = FeatureAvPeer::getInstanceFromPool($key1))) {
 574:                 // We no longer rehydrate the object, since this can cause data loss.
 575:                 // See http://www.propelorm.org/ticket/509
 576:                 // $obj1->hydrate($row, 0, true); // rehydrate
 577:             } else {
 578: 
 579:                 $cls = FeatureAvPeer::getOMClass();
 580: 
 581:                 $obj1 = new $cls();
 582:                 $obj1->hydrate($row);
 583:                 FeatureAvPeer::addInstanceToPool($obj1, $key1);
 584:             } // if $obj1 already loaded
 585: 
 586:             $key2 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol);
 587:             if ($key2 !== null) {
 588:                 $obj2 = FeaturePeer::getInstanceFromPool($key2);
 589:                 if (!$obj2) {
 590: 
 591:                     $cls = FeaturePeer::getOMClass();
 592: 
 593:                     $obj2 = new $cls();
 594:                     $obj2->hydrate($row, $startcol);
 595:                     FeaturePeer::addInstanceToPool($obj2, $key2);
 596:                 } // if obj2 already loaded
 597: 
 598:                 // Add the $obj1 (FeatureAv) to $obj2 (Feature)
 599:                 $obj2->addFeatureAv($obj1);
 600: 
 601:             } // if joined row was not null
 602: 
 603:             $results[] = $obj1;
 604:         }
 605:         $stmt->closeCursor();
 606: 
 607:         return $results;
 608:     }
 609: 
 610: 
 611:     /**
 612:      * Returns the number of rows matching criteria, joining all related tables
 613:      *
 614:      * @param      Criteria $criteria
 615:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
 616:      * @param      PropelPDO $con
 617:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 618:      * @return int Number of matching rows.
 619:      */
 620:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
 621:     {
 622:         // we're going to modify criteria, so copy it first
 623:         $criteria = clone $criteria;
 624: 
 625:         // We need to set the primary table name, since in the case that there are no WHERE columns
 626:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
 627:         // tables go into the FROM clause.
 628:         $criteria->setPrimaryTableName(FeatureAvPeer::TABLE_NAME);
 629: 
 630:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
 631:             $criteria->setDistinct();
 632:         }
 633: 
 634:         if (!$criteria->hasSelectClause()) {
 635:             FeatureAvPeer::addSelectColumns($criteria);
 636:         }
 637: 
 638:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
 639: 
 640:         // Set the correct dbName
 641:         $criteria->setDbName(FeatureAvPeer::DATABASE_NAME);
 642: 
 643:         if ($con === null) {
 644:             $con = Propel::getConnection(FeatureAvPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 645:         }
 646: 
 647:         $criteria->addJoin(FeatureAvPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
 648: 
 649:         $stmt = BasePeer::doCount($criteria, $con);
 650: 
 651:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 652:             $count = (int) $row[0];
 653:         } else {
 654:             $count = 0; // no rows returned; we infer that means 0 matches.
 655:         }
 656:         $stmt->closeCursor();
 657: 
 658:         return $count;
 659:     }
 660: 
 661:     /**
 662:      * Selects a collection of FeatureAv objects pre-filled with all related objects.
 663:      *
 664:      * @param      Criteria  $criteria
 665:      * @param      PropelPDO $con
 666:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
 667:      * @return array           Array of FeatureAv objects.
 668:      * @throws PropelException Any exceptions caught during processing will be
 669:      *       rethrown wrapped into a PropelException.
 670:      */
 671:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 672:     {
 673:         $criteria = clone $criteria;
 674: 
 675:         // Set the correct dbName if it has not been overridden
 676:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
 677:             $criteria->setDbName(FeatureAvPeer::DATABASE_NAME);
 678:         }
 679: 
 680:         FeatureAvPeer::addSelectColumns($criteria);
 681:         $startcol2 = FeatureAvPeer::NUM_HYDRATE_COLUMNS;
 682: 
 683:         FeaturePeer::addSelectColumns($criteria);
 684:         $startcol3 = $startcol2 + FeaturePeer::NUM_HYDRATE_COLUMNS;
 685: 
 686:         $criteria->addJoin(FeatureAvPeer::FEATURE_ID, FeaturePeer::ID, $join_behavior);
 687: 
 688:         $stmt = BasePeer::doSelect($criteria, $con);
 689:         $results = array();
 690: 
 691:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
 692:             $key1 = FeatureAvPeer::getPrimaryKeyHashFromRow($row, 0);
 693:             if (null !== ($obj1 = FeatureAvPeer::getInstanceFromPool($key1))) {
 694:                 // We no longer rehydrate the object, since this can cause data loss.
 695:                 // See http://www.propelorm.org/ticket/509
 696:                 // $obj1->hydrate($row, 0, true); // rehydrate
 697:             } else {
 698:                 $cls = FeatureAvPeer::getOMClass();
 699: 
 700:                 $obj1 = new $cls();
 701:                 $obj1->hydrate($row);
 702:                 FeatureAvPeer::addInstanceToPool($obj1, $key1);
 703:             } // if obj1 already loaded
 704: 
 705:             // Add objects for joined Feature rows
 706: 
 707:             $key2 = FeaturePeer::getPrimaryKeyHashFromRow($row, $startcol2);
 708:             if ($key2 !== null) {
 709:                 $obj2 = FeaturePeer::getInstanceFromPool($key2);
 710:                 if (!$obj2) {
 711: 
 712:                     $cls = FeaturePeer::getOMClass();
 713: 
 714:                     $obj2 = new $cls();
 715:                     $obj2->hydrate($row, $startcol2);
 716:                     FeaturePeer::addInstanceToPool($obj2, $key2);
 717:                 } // if obj2 loaded
 718: 
 719:                 // Add the $obj1 (FeatureAv) to the collection in $obj2 (Feature)
 720:                 $obj2->addFeatureAv($obj1);
 721:             } // if joined row not null
 722: 
 723:             $results[] = $obj1;
 724:         }
 725:         $stmt->closeCursor();
 726: 
 727:         return $results;
 728:     }
 729: 
 730:     /**
 731:      * Returns the TableMap related to this peer.
 732:      * This method is not needed for general use but a specific application could have a need.
 733:      * @return TableMap
 734:      * @throws PropelException Any exceptions caught during processing will be
 735:      *       rethrown wrapped into a PropelException.
 736:      */
 737:     public static function getTableMap()
 738:     {
 739:         return Propel::getDatabaseMap(FeatureAvPeer::DATABASE_NAME)->getTable(FeatureAvPeer::TABLE_NAME);
 740:     }
 741: 
 742:     /**
 743:      * Add a TableMap instance to the database for this peer class.
 744:      */
 745:     public static function buildTableMap()
 746:     {
 747:       $dbMap = Propel::getDatabaseMap(BaseFeatureAvPeer::DATABASE_NAME);
 748:       if (!$dbMap->hasTable(BaseFeatureAvPeer::TABLE_NAME)) {
 749:         $dbMap->addTableObject(new FeatureAvTableMap());
 750:       }
 751:     }
 752: 
 753:     /**
 754:      * The class that the Peer will make instances of.
 755:      *
 756:      *
 757:      * @return string ClassName
 758:      */
 759:     public static function getOMClass()
 760:     {
 761:         return FeatureAvPeer::OM_CLASS;
 762:     }
 763: 
 764:     /**
 765:      * Performs an INSERT on the database, given a FeatureAv or Criteria object.
 766:      *
 767:      * @param      mixed $values Criteria or FeatureAv object containing data that is used to create the INSERT statement.
 768:      * @param      PropelPDO $con the PropelPDO connection to use
 769:      * @return mixed           The new primary key.
 770:      * @throws PropelException Any exceptions caught during processing will be
 771:      *       rethrown wrapped into a PropelException.
 772:      */
 773:     public static function doInsert($values, PropelPDO $con = null)
 774:     {
 775:         if ($con === null) {
 776:             $con = Propel::getConnection(FeatureAvPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 777:         }
 778: 
 779:         if ($values instanceof Criteria) {
 780:             $criteria = clone $values; // rename for clarity
 781:         } else {
 782:             $criteria = $values->buildCriteria(); // build Criteria from FeatureAv object
 783:         }
 784: 
 785:         if ($criteria->containsKey(FeatureAvPeer::ID) && $criteria->keyContainsValue(FeatureAvPeer::ID) ) {
 786:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.FeatureAvPeer::ID.')');
 787:         }
 788: 
 789: 
 790:         // Set the correct dbName
 791:         $criteria->setDbName(FeatureAvPeer::DATABASE_NAME);
 792: 
 793:         try {
 794:             // use transaction because $criteria could contain info
 795:             // for more than one table (I guess, conceivably)
 796:             $con->beginTransaction();
 797:             $pk = BasePeer::doInsert($criteria, $con);
 798:             $con->commit();
 799:         } catch (PropelException $e) {
 800:             $con->rollBack();
 801:             throw $e;
 802:         }
 803: 
 804:         return $pk;
 805:     }
 806: 
 807:     /**
 808:      * Performs an UPDATE on the database, given a FeatureAv or Criteria object.
 809:      *
 810:      * @param      mixed $values Criteria or FeatureAv object containing data that is used to create the UPDATE statement.
 811:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
 812:      * @return int             The number of affected rows (if supported by underlying database driver).
 813:      * @throws PropelException Any exceptions caught during processing will be
 814:      *       rethrown wrapped into a PropelException.
 815:      */
 816:     public static function doUpdate($values, PropelPDO $con = null)
 817:     {
 818:         if ($con === null) {
 819:             $con = Propel::getConnection(FeatureAvPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 820:         }
 821: 
 822:         $selectCriteria = new Criteria(FeatureAvPeer::DATABASE_NAME);
 823: 
 824:         if ($values instanceof Criteria) {
 825:             $criteria = clone $values; // rename for clarity
 826: 
 827:             $comparison = $criteria->getComparison(FeatureAvPeer::ID);
 828:             $value = $criteria->remove(FeatureAvPeer::ID);
 829:             if ($value) {
 830:                 $selectCriteria->add(FeatureAvPeer::ID, $value, $comparison);
 831:             } else {
 832:                 $selectCriteria->setPrimaryTableName(FeatureAvPeer::TABLE_NAME);
 833:             }
 834: 
 835:         } else { // $values is FeatureAv object
 836:             $criteria = $values->buildCriteria(); // gets full criteria
 837:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
 838:         }
 839: 
 840:         // set the correct dbName
 841:         $criteria->setDbName(FeatureAvPeer::DATABASE_NAME);
 842: 
 843:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
 844:     }
 845: 
 846:     /**
 847:      * Deletes all rows from the feature_av table.
 848:      *
 849:      * @param      PropelPDO $con the connection to use
 850:      * @return int             The number of affected rows (if supported by underlying database driver).
 851:      * @throws PropelException
 852:      */
 853:     public static function doDeleteAll(PropelPDO $con = null)
 854:     {
 855:         if ($con === null) {
 856:             $con = Propel::getConnection(FeatureAvPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 857:         }
 858:         $affectedRows = 0; // initialize var to track total num of affected rows
 859:         try {
 860:             // use transaction because $criteria could contain info
 861:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
 862:             $con->beginTransaction();
 863:             $affectedRows += BasePeer::doDeleteAll(FeatureAvPeer::TABLE_NAME, $con, FeatureAvPeer::DATABASE_NAME);
 864:             // Because this db requires some delete cascade/set null emulation, we have to
 865:             // clear the cached instance *after* the emulation has happened (since
 866:             // instances get re-added by the select statement contained therein).
 867:             FeatureAvPeer::clearInstancePool();
 868:             FeatureAvPeer::clearRelatedInstancePool();
 869:             $con->commit();
 870: 
 871:             return $affectedRows;
 872:         } catch (PropelException $e) {
 873:             $con->rollBack();
 874:             throw $e;
 875:         }
 876:     }
 877: 
 878:     /**
 879:      * Performs a DELETE on the database, given a FeatureAv or Criteria object OR a primary key value.
 880:      *
 881:      * @param      mixed $values Criteria or FeatureAv object or primary key or array of primary keys
 882:      *              which is used to create the DELETE statement
 883:      * @param      PropelPDO $con the connection to use
 884:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
 885:      *              if supported by native driver or if emulated using Propel.
 886:      * @throws PropelException Any exceptions caught during processing will be
 887:      *       rethrown wrapped into a PropelException.
 888:      */
 889:      public static function doDelete($values, PropelPDO $con = null)
 890:      {
 891:         if ($con === null) {
 892:             $con = Propel::getConnection(FeatureAvPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
 893:         }
 894: 
 895:         if ($values instanceof Criteria) {
 896:             // invalidate the cache for all objects of this type, since we have no
 897:             // way of knowing (without running a query) what objects should be invalidated
 898:             // from the cache based on this Criteria.
 899:             FeatureAvPeer::clearInstancePool();
 900:             // rename for clarity
 901:             $criteria = clone $values;
 902:         } elseif ($values instanceof FeatureAv) { // it's a model object
 903:             // invalidate the cache for this single object
 904:             FeatureAvPeer::removeInstanceFromPool($values);
 905:             // create criteria based on pk values
 906:             $criteria = $values->buildPkeyCriteria();
 907:         } else { // it's a primary key, or an array of pks
 908:             $criteria = new Criteria(FeatureAvPeer::DATABASE_NAME);
 909:             $criteria->add(FeatureAvPeer::ID, (array) $values, Criteria::IN);
 910:             // invalidate the cache for this object(s)
 911:             foreach ((array) $values as $singleval) {
 912:                 FeatureAvPeer::removeInstanceFromPool($singleval);
 913:             }
 914:         }
 915: 
 916:         // Set the correct dbName
 917:         $criteria->setDbName(FeatureAvPeer::DATABASE_NAME);
 918: 
 919:         $affectedRows = 0; // initialize var to track total num of affected rows
 920: 
 921:         try {
 922:             // use transaction because $criteria could contain info
 923:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
 924:             $con->beginTransaction();
 925: 
 926:             $affectedRows += BasePeer::doDelete($criteria, $con);
 927:             FeatureAvPeer::clearRelatedInstancePool();
 928:             $con->commit();
 929: 
 930:             return $affectedRows;
 931:         } catch (PropelException $e) {
 932:             $con->rollBack();
 933:             throw $e;
 934:         }
 935:     }
 936: 
 937:     /**
 938:      * Validates all modified columns of given FeatureAv object.
 939:      * If parameter $columns is either a single column name or an array of column names
 940:      * than only those columns are validated.
 941:      *
 942:      * NOTICE: This does not apply to primary or foreign keys for now.
 943:      *
 944:      * @param      FeatureAv $obj The object to validate.
 945:      * @param      mixed $cols Column name or array of column names.
 946:      *
 947:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
 948:      */
 949:     public static function doValidate($obj, $cols = null)
 950:     {
 951:         $columns = array();
 952: 
 953:         if ($cols) {
 954:             $dbMap = Propel::getDatabaseMap(FeatureAvPeer::DATABASE_NAME);
 955:             $tableMap = $dbMap->getTable(FeatureAvPeer::TABLE_NAME);
 956: 
 957:             if (! is_array($cols)) {
 958:                 $cols = array($cols);
 959:             }
 960: 
 961:             foreach ($cols as $colName) {
 962:                 if ($tableMap->hasColumn($colName)) {
 963:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
 964:                     $columns[$colName] = $obj->$get();
 965:                 }
 966:             }
 967:         } else {
 968: 
 969:         }
 970: 
 971:         return BasePeer::doValidate(FeatureAvPeer::DATABASE_NAME, FeatureAvPeer::TABLE_NAME, $columns);
 972:     }
 973: 
 974:     /**
 975:      * Retrieve a single object by pkey.
 976:      *
 977:      * @param      int $pk the primary key.
 978:      * @param      PropelPDO $con the connection to use
 979:      * @return FeatureAv
 980:      */
 981:     public static function retrieveByPK($pk, PropelPDO $con = null)
 982:     {
 983: 
 984:         if (null !== ($obj = FeatureAvPeer::getInstanceFromPool((string) $pk))) {
 985:             return $obj;
 986:         }
 987: 
 988:         if ($con === null) {
 989:             $con = Propel::getConnection(FeatureAvPeer::DATABASE_NAME, Propel::CONNECTION_READ);
 990:         }
 991: 
 992:         $criteria = new Criteria(FeatureAvPeer::DATABASE_NAME);
 993:         $criteria->add(FeatureAvPeer::ID, $pk);
 994: 
 995:         $v = FeatureAvPeer::doSelect($criteria, $con);
 996: 
 997:         return !empty($v) > 0 ? $v[0] : null;
 998:     }
 999: 
1000:     /**
1001:      * Retrieve multiple objects by pkey.
1002:      *
1003:      * @param      array $pks List of primary keys
1004:      * @param      PropelPDO $con the connection to use
1005:      * @return FeatureAv[]
1006:      * @throws PropelException Any exceptions caught during processing will be
1007:      *       rethrown wrapped into a PropelException.
1008:      */
1009:     public static function retrieveByPKs($pks, PropelPDO $con = null)
1010:     {
1011:         if ($con === null) {
1012:             $con = Propel::getConnection(FeatureAvPeer::DATABASE_NAME, Propel::CONNECTION_READ);
1013:         }
1014: 
1015:         $objs = null;
1016:         if (empty($pks)) {
1017:             $objs = array();
1018:         } else {
1019:             $criteria = new Criteria(FeatureAvPeer::DATABASE_NAME);
1020:             $criteria->add(FeatureAvPeer::ID, $pks, Criteria::IN);
1021:             $objs = FeatureAvPeer::doSelect($criteria, $con);
1022:         }
1023: 
1024:         return $objs;
1025:     }
1026: 
1027: } // BaseFeatureAvPeer
1028: 
1029: // This is the static code needed to register the TableMap for this table with the main Propel class.
1030: //
1031: BaseFeatureAvPeer::buildTableMap();
1032: 
1033: 
thelia API documentation generated by ApiGen 2.8.0