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