       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\AttributeAvPeer;
      13: use Thelia\Model\AttributeCombination;
      14: use Thelia\Model\AttributeCombinationPeer;
      15: use Thelia\Model\AttributePeer;
      16: use Thelia\Model\CombinationPeer;
      17: use Thelia\Model\map\AttributeCombinationTableMap;
      18:
      19: /**
      20:  * Base static class for performing query and update operations on the 'attribute_combination' table.
      21:  *
      22:  *
      23:  *
      24:  * @package propel.generator.Thelia.Model.om
      25:  */
      26: abstract class BaseAttributeCombinationPeer
      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_combination';
      34:
      35:     /** the related Propel class for this table */
      36:     const OM_CLASS = 'Thelia\\Model\\AttributeCombination';
      37:
      38:     /** the related TableMap class for this table */
      39:     const TM_CLASS = 'AttributeCombinationTableMap';
      40:
      41:     /** The total number of columns. */
      42:     const NUM_COLUMNS = 6;
      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 = 6;
      49:
      50:     /** the column name for the id field */
      51:     const ID = 'attribute_combination.id';
      52:
      53:     /** the column name for the attribute_id field */
      54:     const ATTRIBUTE_ID = 'attribute_combination.attribute_id';
      55:
      56:     /** the column name for the combination_id field */
      57:     const COMBINATION_ID = 'attribute_combination.combination_id';
      58:
      59:     /** the column name for the attribute_av_id field */
      60:     const ATTRIBUTE_AV_ID = 'attribute_combination.attribute_av_id';
      61:
      62:     /** the column name for the created_at field */
      63:     const CREATED_AT = 'attribute_combination.created_at';
      64:
      65:     /** the column name for the updated_at field */
      66:     const UPDATED_AT = 'attribute_combination.updated_at';
      67:
      68:     /** The default string format for model objects of the related table **/
      69:     const DEFAULT_STRING_FORMAT = 'YAML';
      70:
      71:     /**
      72:      * An identiy map to hold any loaded instances of AttributeCombination objects.
      73:      * This must be public so that other peer classes can access this when hydrating from JOIN
      74:      * queries.
      75:      * @var        array AttributeCombination[]
      76:      */
      77:     public static $instances = array();
      78:
      79:
      80:     /**
      81:      * holds an array of fieldnames
      82:      *
      83:      * first dimension keys are the type constants
      84:      * e.g. AttributeCombinationPeer::$fieldNames[AttributeCombinationPeer::TYPE_PHPNAME][0] = 'Id'
      85:      */
      86:     protected static $fieldNames = array (
      87:         BasePeer::TYPE_PHPNAME => array ('Id', 'AttributeId', 'CombinationId', 'AttributeAvId', 'CreatedAt', 'UpdatedAt', ),
      88:         BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'attributeId', 'combinationId', 'attributeAvId', 'createdAt', 'updatedAt', ),
      89:         BasePeer::TYPE_COLNAME => array (AttributeCombinationPeer::ID, AttributeCombinationPeer::ATTRIBUTE_ID, AttributeCombinationPeer::COMBINATION_ID, AttributeCombinationPeer::ATTRIBUTE_AV_ID, AttributeCombinationPeer::CREATED_AT, AttributeCombinationPeer::UPDATED_AT, ),
      90:         BasePeer::TYPE_RAW_COLNAME => array ('ID', 'ATTRIBUTE_ID', 'COMBINATION_ID', 'ATTRIBUTE_AV_ID', 'CREATED_AT', 'UPDATED_AT', ),
      91:         BasePeer::TYPE_FIELDNAME => array ('id', 'attribute_id', 'combination_id', 'attribute_av_id', 'created_at', 'updated_at', ),
      92:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
      93:     );
      94:
      95:     /**
      96:      * holds an array of keys for quick access to the fieldnames array
      97:      *
      98:      * first dimension keys are the type constants
      99:      * e.g. AttributeCombinationPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
     100:      */
     101:     protected static $fieldKeys = array (
     102:         BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'AttributeId' => 1, 'CombinationId' => 2, 'AttributeAvId' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
     103:         BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'attributeId' => 1, 'combinationId' => 2, 'attributeAvId' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
     104:         BasePeer::TYPE_COLNAME => array (AttributeCombinationPeer::ID => 0, AttributeCombinationPeer::ATTRIBUTE_ID => 1, AttributeCombinationPeer::COMBINATION_ID => 2, AttributeCombinationPeer::ATTRIBUTE_AV_ID => 3, AttributeCombinationPeer::CREATED_AT => 4, AttributeCombinationPeer::UPDATED_AT => 5, ),
     105:         BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'ATTRIBUTE_ID' => 1, 'COMBINATION_ID' => 2, 'ATTRIBUTE_AV_ID' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
     106:         BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'attribute_id' => 1, 'combination_id' => 2, 'attribute_av_id' => 3, 'created_at' => 4, 'updated_at' => 5, ),
     107:         BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
     108:     );
     109:
     110:     /**
     111:      * Translates a fieldname to another type
     112:      *
     113:      * @param      string $name field name
     114:      * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
     115:      *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
     116:      * @param      string $toType   One of the class type constants
     117:      * @return string          translated name of the field.
     118:      * @throws PropelException - if the specified name could not be found in the fieldname mappings.
     119:      */
     120:     public static function translateFieldName($name, $fromType, $toType)
     121:     {
     122:         $toNames = AttributeCombinationPeer::getFieldNames($toType);
     123:         $key = isset(AttributeCombinationPeer::$fieldKeys[$fromType][$name]) ? AttributeCombinationPeer::$fieldKeys[$fromType][$name] : null;
     124:         if ($key === null) {
     125:             throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(AttributeCombinationPeer::$fieldKeys[$fromType], true));
     126:         }
     127:
     128:         return $toNames[$key];
     129:     }
     130:
     131:     /**
     132:      * Returns an array of field names.
     133:      *
     134:      * @param      string $type The type of fieldnames to return:
     135:      *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
     136:      *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
     137:      * @return array           A list of field names
     138:      * @throws PropelException - if the type is not valid.
     139:      */
     140:     public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
     141:     {
     142:         if (!array_key_exists($type, AttributeCombinationPeer::$fieldNames)) {
     143:             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.');
     144:         }
     145:
     146:         return AttributeCombinationPeer::$fieldNames[$type];
     147:     }
     148:
     149:     /**
     150:      * Convenience method which changes table.column to alias.column.
     151:      *
     152:      * Using this method you can maintain SQL abstraction while using column aliases.
     153:      * <code>
     154:      *      $c->addAlias("alias1", TablePeer::TABLE_NAME);
     155:      *      $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
     156:      * </code>
     157:      * @param      string $alias The alias for the current table.
     158:      * @param      string $column The column name for current table. (i.e. AttributeCombinationPeer::COLUMN_NAME).
     159:      * @return string
     160:      */
     161:     public static function alias($alias, $column)
     162:     {
     163:         return str_replace(AttributeCombinationPeer::TABLE_NAME.'.', $alias.'.', $column);
     164:     }
     165:
     166:     /**
     167:      * Add all the columns needed to create a new object.
     168:      *
     169:      * Note: any columns that were marked with lazyLoad="true" in the
     170:      * XML schema will not be added to the select list and only loaded
     171:      * on demand.
     172:      *
     173:      * @param      Criteria $criteria object containing the columns to add.
     174:      * @param      string   $alias    optional table alias
     175:      * @throws PropelException Any exceptions caught during processing will be
     176:      *       rethrown wrapped into a PropelException.
     177:      */
     178:     public static function addSelectColumns(Criteria $criteria, $alias = null)
     179:     {
     180:         if (null === $alias) {
     181:             $criteria->addSelectColumn(AttributeCombinationPeer::ID);
     182:             $criteria->addSelectColumn(AttributeCombinationPeer::ATTRIBUTE_ID);
     183:             $criteria->addSelectColumn(AttributeCombinationPeer::COMBINATION_ID);
     184:             $criteria->addSelectColumn(AttributeCombinationPeer::ATTRIBUTE_AV_ID);
     185:             $criteria->addSelectColumn(AttributeCombinationPeer::CREATED_AT);
     186:             $criteria->addSelectColumn(AttributeCombinationPeer::UPDATED_AT);
     187:         } else {
     188:             $criteria->addSelectColumn($alias . '.id');
     189:             $criteria->addSelectColumn($alias . '.attribute_id');
     190:             $criteria->addSelectColumn($alias . '.combination_id');
     191:             $criteria->addSelectColumn($alias . '.attribute_av_id');
     192:             $criteria->addSelectColumn($alias . '.created_at');
     193:             $criteria->addSelectColumn($alias . '.updated_at');
     194:         }
     195:     }
     196:
     197:     /**
     198:      * Returns the number of rows matching criteria.
     199:      *
     200:      * @param      Criteria $criteria
     201:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     202:      * @param      PropelPDO $con
     203:      * @return int Number of matching rows.
     204:      */
     205:     public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
     206:     {
     207:         // we may modify criteria, so copy it first
     208:         $criteria = clone $criteria;
     209:
     210:         // We need to set the primary table name, since in the case that there are no WHERE columns
     211:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     212:         // tables go into the FROM clause.
     213:         $criteria->setPrimaryTableName(AttributeCombinationPeer::TABLE_NAME);
     214:
     215:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     216:             $criteria->setDistinct();
     217:         }
     218:
     219:         if (!$criteria->hasSelectClause()) {
     220:             AttributeCombinationPeer::addSelectColumns($criteria);
     221:         }
     222:
     223:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     224:         $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME); // Set the correct dbName
     225:
     226:         if ($con === null) {
     227:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     228:         }
     229:         // BasePeer returns a PDOStatement
     230:         $stmt = BasePeer::doCount($criteria, $con);
     231:
     232:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     233:             $count = (int) $row[0];
     234:         } else {
     235:             $count = 0; // no rows returned; we infer that means 0 matches.
     236:         }
     237:         $stmt->closeCursor();
     238:
     239:         return $count;
     240:     }
     241:     /**
     242:      * Selects one object from the DB.
     243:      *
     244:      * @param      Criteria $criteria object used to create the SELECT statement.
     245:      * @param      PropelPDO $con
     246:      * @return                 AttributeCombination
     247:      * @throws PropelException Any exceptions caught during processing will be
     248:      *       rethrown wrapped into a PropelException.
     249:      */
     250:     public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
     251:     {
     252:         $critcopy = clone $criteria;
     253:         $critcopy->setLimit(1);
     254:         $objects = AttributeCombinationPeer::doSelect($critcopy, $con);
     255:         if ($objects) {
     256:             return $objects[0];
     257:         }
     258:
     259:         return null;
     260:     }
     261:     /**
     262:      * Selects several row from the DB.
     263:      *
     264:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
     265:      * @param      PropelPDO $con
     266:      * @return array           Array of selected Objects
     267:      * @throws PropelException Any exceptions caught during processing will be
     268:      *       rethrown wrapped into a PropelException.
     269:      */
     270:     public static function doSelect(Criteria $criteria, PropelPDO $con = null)
     271:     {
     272:         return AttributeCombinationPeer::populateObjects(AttributeCombinationPeer::doSelectStmt($criteria, $con));
     273:     }
     274:     /**
     275:      * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
     276:      *
     277:      * Use this method directly if you want to work with an executed statement directly (for example
     278:      * to perform your own object hydration).
     279:      *
     280:      * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
     281:      * @param      PropelPDO $con The connection to use
     282:      * @throws PropelException Any exceptions caught during processing will be
     283:      *       rethrown wrapped into a PropelException.
     284:      * @return PDOStatement The executed PDOStatement object.
     285:      * @see        BasePeer::doSelect()
     286:      */
     287:     public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
     288:     {
     289:         if ($con === null) {
     290:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     291:         }
     292:
     293:         if (!$criteria->hasSelectClause()) {
     294:             $criteria = clone $criteria;
     295:             AttributeCombinationPeer::addSelectColumns($criteria);
     296:         }
     297:
     298:         // Set the correct dbName
     299:         $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
     300:
     301:         // BasePeer returns a PDOStatement
     302:         return BasePeer::doSelect($criteria, $con);
     303:     }
     304:     /**
     305:      * Adds an object to the instance pool.
     306:      *
     307:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
     308:      * from the database.  In some cases -- especially when you override doSelect*()
     309:      * methods in your stub classes -- you may need to explicitly add objects
     310:      * to the cache in order to ensure that the same objects are always returned by doSelect*()
     311:      * and retrieveByPK*() calls.
     312:      *
     313:      * @param      AttributeCombination $obj A AttributeCombination object.
     314:      * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
     315:      */
     316:     public static function addInstanceToPool($obj, $key = null)
     317:     {
     318:         if (Propel::isInstancePoolingEnabled()) {
     319:             if ($key === null) {
     320:                 $key = serialize(array((string) $obj->getId(), (string) $obj->getAttributeId(), (string) $obj->getCombinationId(), (string) $obj->getAttributeAvId()));
     321:             } // if key === null
     322:             AttributeCombinationPeer::$instances[$key] = $obj;
     323:         }
     324:     }
     325:
     326:     /**
     327:      * Removes an object from the instance pool.
     328:      *
     329:      * Propel keeps cached copies of objects in an instance pool when they are retrieved
     330:      * from the database.  In some cases -- especially when you override doDelete
     331:      * methods in your stub classes -- you may need to explicitly remove objects
     332:      * from the cache in order to prevent returning objects that no longer exist.
     333:      *
     334:      * @param      mixed $value A AttributeCombination object or a primary key value.
     335:      *
     336:      * @return void
     337:      * @throws PropelException - if the value is invalid.
     338:      */
     339:     public static function removeInstanceFromPool($value)
     340:     {
     341:         if (Propel::isInstancePoolingEnabled() && $value !== null) {
     342:             if (is_object($value) && $value instanceof AttributeCombination) {
     343:                 $key = serialize(array((string) $value->getId(), (string) $value->getAttributeId(), (string) $value->getCombinationId(), (string) $value->getAttributeAvId()));
     344:             } elseif (is_array($value) && count($value) === 4) {
     345:                 // assume we've been passed a primary key
     346:                 $key = serialize(array((string) $value[0], (string) $value[1], (string) $value[2], (string) $value[3]));
     347:             } else {
     348:                 $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or AttributeCombination object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
     349:                 throw $e;
     350:             }
     351:
     352:             unset(AttributeCombinationPeer::$instances[$key]);
     353:         }
     354:     } // removeInstanceFromPool()
     355:
     356:     /**
     357:      * 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.
     358:      *
     359:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     360:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
     361:      *
     362:      * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
     363:      * @return   AttributeCombination Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
     364:      * @see        getPrimaryKeyHash()
     365:      */
     366:     public static function getInstanceFromPool($key)
     367:     {
     368:         if (Propel::isInstancePoolingEnabled()) {
     369:             if (isset(AttributeCombinationPeer::$instances[$key])) {
     370:                 return AttributeCombinationPeer::$instances[$key];
     371:             }
     372:         }
     373:
     374:         return null; // just to be explicit
     375:     }
     376:
     377:     /**
     378:      * Clear the instance pool.
     379:      *
     380:      * @return void
     381:      */
     382:     public static function clearInstancePool($and_clear_all_references = false)
     383:     {
     384:       if ($and_clear_all_references)
     385:       {
     386:         foreach (AttributeCombinationPeer::$instances as $instance)
     387:         {
     388:           $instance->clearAllReferences(true);
     389:         }
     390:       }
     391:         AttributeCombinationPeer::$instances = array();
     392:     }
     393:
     394:     /**
     395:      * Method to invalidate the instance pool of all tables related to attribute_combination
     396:      * by a foreign key with ON DELETE CASCADE
     397:      */
     398:     public static function clearRelatedInstancePool()
     399:     {
     400:     }
     401:
     402:     /**
     403:      * 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.
     404:      *
     405:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     406:      * a multi-column primary key, a serialize()d version of the primary key will be returned.
     407:      *
     408:      * @param      array $row PropelPDO resultset row.
     409:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     410:      * @return string A string version of PK or null if the components of primary key in result array are all null.
     411:      */
     412:     public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
     413:     {
     414:         // If the PK cannot be derived from the row, return null.
     415:         if ($row[$startcol] === null && $row[$startcol + 1] === null && $row[$startcol + 2] === null && $row[$startcol + 3] === null) {
     416:             return null;
     417:         }
     418:
     419:         return serialize(array((string) $row[$startcol], (string) $row[$startcol + 1], (string) $row[$startcol + 2], (string) $row[$startcol + 3]));
     420:     }
     421:
     422:     /**
     423:      * Retrieves the primary key from the DB resultset row
     424:      * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     425:      * a multi-column primary key, an array of the primary key columns will be returned.
     426:      *
     427:      * @param      array $row PropelPDO resultset row.
     428:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     429:      * @return mixed The primary key of the row
     430:      */
     431:     public static function getPrimaryKeyFromRow($row, $startcol = 0)
     432:     {
     433:
     434:         return array((int) $row[$startcol], (int) $row[$startcol + 1], (int) $row[$startcol + 2], (int) $row[$startcol + 3]);
     435:     }
     436:
     437:     /**
     438:      * The returned array will contain objects of the default type or
     439:      * objects that inherit from the default.
     440:      *
     441:      * @throws PropelException Any exceptions caught during processing will be
     442:      *       rethrown wrapped into a PropelException.
     443:      */
     444:     public static function populateObjects(PDOStatement $stmt)
     445:     {
     446:         $results = array();
     447:
     448:         // set the class once to avoid overhead in the loop
     449:         $cls = AttributeCombinationPeer::getOMClass();
     450:         // populate the object(s)
     451:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     452:             $key = AttributeCombinationPeer::getPrimaryKeyHashFromRow($row, 0);
     453:             if (null !== ($obj = AttributeCombinationPeer::getInstanceFromPool($key))) {
     454:                 // We no longer rehydrate the object, since this can cause data loss.
     455:                 // See http://www.propelorm.org/ticket/509
     456:                 // $obj->hydrate($row, 0, true); // rehydrate
     457:                 $results[] = $obj;
     458:             } else {
     459:                 $obj = new $cls();
     460:                 $obj->hydrate($row);
     461:                 $results[] = $obj;
     462:                 AttributeCombinationPeer::addInstanceToPool($obj, $key);
     463:             } // if key exists
     464:         }
     465:         $stmt->closeCursor();
     466:
     467:         return $results;
     468:     }
     469:     /**
     470:      * Populates an object of the default type or an object that inherit from the default.
     471:      *
     472:      * @param      array $row PropelPDO resultset row.
     473:      * @param      int $startcol The 0-based offset for reading from the resultset row.
     474:      * @throws PropelException Any exceptions caught during processing will be
     475:      *       rethrown wrapped into a PropelException.
     476:      * @return array (AttributeCombination object, last column rank)
     477:      */
     478:     public static function populateObject($row, $startcol = 0)
     479:     {
     480:         $key = AttributeCombinationPeer::getPrimaryKeyHashFromRow($row, $startcol);
     481:         if (null !== ($obj = AttributeCombinationPeer::getInstanceFromPool($key))) {
     482:             // We no longer rehydrate the object, since this can cause data loss.
     483:             // See http://www.propelorm.org/ticket/509
     484:             // $obj->hydrate($row, $startcol, true); // rehydrate
     485:             $col = $startcol + AttributeCombinationPeer::NUM_HYDRATE_COLUMNS;
     486:         } else {
     487:             $cls = AttributeCombinationPeer::OM_CLASS;
     488:             $obj = new $cls();
     489:             $col = $obj->hydrate($row, $startcol);
     490:             AttributeCombinationPeer::addInstanceToPool($obj, $key);
     491:         }
     492:
     493:         return array($obj, $col);
     494:     }
     495:
     496:
     497:     /**
     498:      * Returns the number of rows matching criteria, joining the related Attribute table
     499:      *
     500:      * @param      Criteria $criteria
     501:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     502:      * @param      PropelPDO $con
     503:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     504:      * @return int Number of matching rows.
     505:      */
     506:     public static function doCountJoinAttribute(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     507:     {
     508:         // we're going to modify criteria, so copy it first
     509:         $criteria = clone $criteria;
     510:
     511:         // We need to set the primary table name, since in the case that there are no WHERE columns
     512:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     513:         // tables go into the FROM clause.
     514:         $criteria->setPrimaryTableName(AttributeCombinationPeer::TABLE_NAME);
     515:
     516:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     517:             $criteria->setDistinct();
     518:         }
     519:
     520:         if (!$criteria->hasSelectClause()) {
     521:             AttributeCombinationPeer::addSelectColumns($criteria);
     522:         }
     523:
     524:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     525:
     526:         // Set the correct dbName
     527:         $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
     528:
     529:         if ($con === null) {
     530:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     531:         }
     532:
     533:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
     534:
     535:         $stmt = BasePeer::doCount($criteria, $con);
     536:
     537:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     538:             $count = (int) $row[0];
     539:         } else {
     540:             $count = 0; // no rows returned; we infer that means 0 matches.
     541:         }
     542:         $stmt->closeCursor();
     543:
     544:         return $count;
     545:     }
     546:
     547:
     548:     /**
     549:      * Returns the number of rows matching criteria, joining the related AttributeAv table
     550:      *
     551:      * @param      Criteria $criteria
     552:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     553:      * @param      PropelPDO $con
     554:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     555:      * @return int Number of matching rows.
     556:      */
     557:     public static function doCountJoinAttributeAv(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     558:     {
     559:         // we're going to modify criteria, so copy it first
     560:         $criteria = clone $criteria;
     561:
     562:         // We need to set the primary table name, since in the case that there are no WHERE columns
     563:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     564:         // tables go into the FROM clause.
     565:         $criteria->setPrimaryTableName(AttributeCombinationPeer::TABLE_NAME);
     566:
     567:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     568:             $criteria->setDistinct();
     569:         }
     570:
     571:         if (!$criteria->hasSelectClause()) {
     572:             AttributeCombinationPeer::addSelectColumns($criteria);
     573:         }
     574:
     575:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     576:
     577:         // Set the correct dbName
     578:         $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
     579:
     580:         if ($con === null) {
     581:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     582:         }
     583:
     584:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior);
     585:
     586:         $stmt = BasePeer::doCount($criteria, $con);
     587:
     588:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     589:             $count = (int) $row[0];
     590:         } else {
     591:             $count = 0; // no rows returned; we infer that means 0 matches.
     592:         }
     593:         $stmt->closeCursor();
     594:
     595:         return $count;
     596:     }
     597:
     598:
     599:     /**
     600:      * Returns the number of rows matching criteria, joining the related Combination table
     601:      *
     602:      * @param      Criteria $criteria
     603:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     604:      * @param      PropelPDO $con
     605:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     606:      * @return int Number of matching rows.
     607:      */
     608:     public static function doCountJoinCombination(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     609:     {
     610:         // we're going to modify criteria, so copy it first
     611:         $criteria = clone $criteria;
     612:
     613:         // We need to set the primary table name, since in the case that there are no WHERE columns
     614:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     615:         // tables go into the FROM clause.
     616:         $criteria->setPrimaryTableName(AttributeCombinationPeer::TABLE_NAME);
     617:
     618:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     619:             $criteria->setDistinct();
     620:         }
     621:
     622:         if (!$criteria->hasSelectClause()) {
     623:             AttributeCombinationPeer::addSelectColumns($criteria);
     624:         }
     625:
     626:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     627:
     628:         // Set the correct dbName
     629:         $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
     630:
     631:         if ($con === null) {
     632:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     633:         }
     634:
     635:         $criteria->addJoin(AttributeCombinationPeer::COMBINATION_ID, CombinationPeer::ID, $join_behavior);
     636:
     637:         $stmt = BasePeer::doCount($criteria, $con);
     638:
     639:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     640:             $count = (int) $row[0];
     641:         } else {
     642:             $count = 0; // no rows returned; we infer that means 0 matches.
     643:         }
     644:         $stmt->closeCursor();
     645:
     646:         return $count;
     647:     }
     648:
     649:
     650:     /**
     651:      * Selects a collection of AttributeCombination objects pre-filled with their Attribute objects.
     652:      * @param      Criteria  $criteria
     653:      * @param      PropelPDO $con
     654:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     655:      * @return array           Array of AttributeCombination objects.
     656:      * @throws PropelException Any exceptions caught during processing will be
     657:      *       rethrown wrapped into a PropelException.
     658:      */
     659:     public static function doSelectJoinAttribute(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     660:     {
     661:         $criteria = clone $criteria;
     662:
     663:         // Set the correct dbName if it has not been overridden
     664:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     665:             $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
     666:         }
     667:
     668:         AttributeCombinationPeer::addSelectColumns($criteria);
     669:         $startcol = AttributeCombinationPeer::NUM_HYDRATE_COLUMNS;
     670:         AttributePeer::addSelectColumns($criteria);
     671:
     672:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
     673:
     674:         $stmt = BasePeer::doSelect($criteria, $con);
     675:         $results = array();
     676:
     677:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     678:             $key1 = AttributeCombinationPeer::getPrimaryKeyHashFromRow($row, 0);
     679:             if (null !== ($obj1 = AttributeCombinationPeer::getInstanceFromPool($key1))) {
     680:                 // We no longer rehydrate the object, since this can cause data loss.
     681:                 // See http://www.propelorm.org/ticket/509
     682:                 // $obj1->hydrate($row, 0, true); // rehydrate
     683:             } else {
     684:
     685:                 $cls = AttributeCombinationPeer::getOMClass();
     686:
     687:                 $obj1 = new $cls();
     688:                 $obj1->hydrate($row);
     689:                 AttributeCombinationPeer::addInstanceToPool($obj1, $key1);
     690:             } // if $obj1 already loaded
     691:
     692:             $key2 = AttributePeer::getPrimaryKeyHashFromRow($row, $startcol);
     693:             if ($key2 !== null) {
     694:                 $obj2 = AttributePeer::getInstanceFromPool($key2);
     695:                 if (!$obj2) {
     696:
     697:                     $cls = AttributePeer::getOMClass();
     698:
     699:                     $obj2 = new $cls();
     700:                     $obj2->hydrate($row, $startcol);
     701:                     AttributePeer::addInstanceToPool($obj2, $key2);
     702:                 } // if obj2 already loaded
     703:
     704:                 // Add the $obj1 (AttributeCombination) to $obj2 (Attribute)
     705:                 $obj2->addAttributeCombination($obj1);
     706:
     707:             } // if joined row was not null
     708:
     709:             $results[] = $obj1;
     710:         }
     711:         $stmt->closeCursor();
     712:
     713:         return $results;
     714:     }
     715:
     716:
     717:     /**
     718:      * Selects a collection of AttributeCombination objects pre-filled with their AttributeAv objects.
     719:      * @param      Criteria  $criteria
     720:      * @param      PropelPDO $con
     721:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     722:      * @return array           Array of AttributeCombination objects.
     723:      * @throws PropelException Any exceptions caught during processing will be
     724:      *       rethrown wrapped into a PropelException.
     725:      */
     726:     public static function doSelectJoinAttributeAv(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     727:     {
     728:         $criteria = clone $criteria;
     729:
     730:         // Set the correct dbName if it has not been overridden
     731:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     732:             $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
     733:         }
     734:
     735:         AttributeCombinationPeer::addSelectColumns($criteria);
     736:         $startcol = AttributeCombinationPeer::NUM_HYDRATE_COLUMNS;
     737:         AttributeAvPeer::addSelectColumns($criteria);
     738:
     739:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior);
     740:
     741:         $stmt = BasePeer::doSelect($criteria, $con);
     742:         $results = array();
     743:
     744:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     745:             $key1 = AttributeCombinationPeer::getPrimaryKeyHashFromRow($row, 0);
     746:             if (null !== ($obj1 = AttributeCombinationPeer::getInstanceFromPool($key1))) {
     747:                 // We no longer rehydrate the object, since this can cause data loss.
     748:                 // See http://www.propelorm.org/ticket/509
     749:                 // $obj1->hydrate($row, 0, true); // rehydrate
     750:             } else {
     751:
     752:                 $cls = AttributeCombinationPeer::getOMClass();
     753:
     754:                 $obj1 = new $cls();
     755:                 $obj1->hydrate($row);
     756:                 AttributeCombinationPeer::addInstanceToPool($obj1, $key1);
     757:             } // if $obj1 already loaded
     758:
     759:             $key2 = AttributeAvPeer::getPrimaryKeyHashFromRow($row, $startcol);
     760:             if ($key2 !== null) {
     761:                 $obj2 = AttributeAvPeer::getInstanceFromPool($key2);
     762:                 if (!$obj2) {
     763:
     764:                     $cls = AttributeAvPeer::getOMClass();
     765:
     766:                     $obj2 = new $cls();
     767:                     $obj2->hydrate($row, $startcol);
     768:                     AttributeAvPeer::addInstanceToPool($obj2, $key2);
     769:                 } // if obj2 already loaded
     770:
     771:                 // Add the $obj1 (AttributeCombination) to $obj2 (AttributeAv)
     772:                 $obj2->addAttributeCombination($obj1);
     773:
     774:             } // if joined row was not null
     775:
     776:             $results[] = $obj1;
     777:         }
     778:         $stmt->closeCursor();
     779:
     780:         return $results;
     781:     }
     782:
     783:
     784:     /**
     785:      * Selects a collection of AttributeCombination objects pre-filled with their Combination objects.
     786:      * @param      Criteria  $criteria
     787:      * @param      PropelPDO $con
     788:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     789:      * @return array           Array of AttributeCombination objects.
     790:      * @throws PropelException Any exceptions caught during processing will be
     791:      *       rethrown wrapped into a PropelException.
     792:      */
     793:     public static function doSelectJoinCombination(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     794:     {
     795:         $criteria = clone $criteria;
     796:
     797:         // Set the correct dbName if it has not been overridden
     798:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     799:             $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
     800:         }
     801:
     802:         AttributeCombinationPeer::addSelectColumns($criteria);
     803:         $startcol = AttributeCombinationPeer::NUM_HYDRATE_COLUMNS;
     804:         CombinationPeer::addSelectColumns($criteria);
     805:
     806:         $criteria->addJoin(AttributeCombinationPeer::COMBINATION_ID, CombinationPeer::ID, $join_behavior);
     807:
     808:         $stmt = BasePeer::doSelect($criteria, $con);
     809:         $results = array();
     810:
     811:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     812:             $key1 = AttributeCombinationPeer::getPrimaryKeyHashFromRow($row, 0);
     813:             if (null !== ($obj1 = AttributeCombinationPeer::getInstanceFromPool($key1))) {
     814:                 // We no longer rehydrate the object, since this can cause data loss.
     815:                 // See http://www.propelorm.org/ticket/509
     816:                 // $obj1->hydrate($row, 0, true); // rehydrate
     817:             } else {
     818:
     819:                 $cls = AttributeCombinationPeer::getOMClass();
     820:
     821:                 $obj1 = new $cls();
     822:                 $obj1->hydrate($row);
     823:                 AttributeCombinationPeer::addInstanceToPool($obj1, $key1);
     824:             } // if $obj1 already loaded
     825:
     826:             $key2 = CombinationPeer::getPrimaryKeyHashFromRow($row, $startcol);
     827:             if ($key2 !== null) {
     828:                 $obj2 = CombinationPeer::getInstanceFromPool($key2);
     829:                 if (!$obj2) {
     830:
     831:                     $cls = CombinationPeer::getOMClass();
     832:
     833:                     $obj2 = new $cls();
     834:                     $obj2->hydrate($row, $startcol);
     835:                     CombinationPeer::addInstanceToPool($obj2, $key2);
     836:                 } // if obj2 already loaded
     837:
     838:                 // Add the $obj1 (AttributeCombination) to $obj2 (Combination)
     839:                 $obj2->addAttributeCombination($obj1);
     840:
     841:             } // if joined row was not null
     842:
     843:             $results[] = $obj1;
     844:         }
     845:         $stmt->closeCursor();
     846:
     847:         return $results;
     848:     }
     849:
     850:
     851:     /**
     852:      * Returns the number of rows matching criteria, joining all related tables
     853:      *
     854:      * @param      Criteria $criteria
     855:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     856:      * @param      PropelPDO $con
     857:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     858:      * @return int Number of matching rows.
     859:      */
     860:     public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
     861:     {
     862:         // we're going to modify criteria, so copy it first
     863:         $criteria = clone $criteria;
     864:
     865:         // We need to set the primary table name, since in the case that there are no WHERE columns
     866:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
     867:         // tables go into the FROM clause.
     868:         $criteria->setPrimaryTableName(AttributeCombinationPeer::TABLE_NAME);
     869:
     870:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
     871:             $criteria->setDistinct();
     872:         }
     873:
     874:         if (!$criteria->hasSelectClause()) {
     875:             AttributeCombinationPeer::addSelectColumns($criteria);
     876:         }
     877:
     878:         $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
     879:
     880:         // Set the correct dbName
     881:         $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
     882:
     883:         if ($con === null) {
     884:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     885:         }
     886:
     887:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
     888:
     889:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior);
     890:
     891:         $criteria->addJoin(AttributeCombinationPeer::COMBINATION_ID, CombinationPeer::ID, $join_behavior);
     892:
     893:         $stmt = BasePeer::doCount($criteria, $con);
     894:
     895:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     896:             $count = (int) $row[0];
     897:         } else {
     898:             $count = 0; // no rows returned; we infer that means 0 matches.
     899:         }
     900:         $stmt->closeCursor();
     901:
     902:         return $count;
     903:     }
     904:
     905:     /**
     906:      * Selects a collection of AttributeCombination objects pre-filled with all related objects.
     907:      *
     908:      * @param      Criteria  $criteria
     909:      * @param      PropelPDO $con
     910:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     911:      * @return array           Array of AttributeCombination objects.
     912:      * @throws PropelException Any exceptions caught during processing will be
     913:      *       rethrown wrapped into a PropelException.
     914:      */
     915:     public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
     916:     {
     917:         $criteria = clone $criteria;
     918:
     919:         // Set the correct dbName if it has not been overridden
     920:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
     921:             $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
     922:         }
     923:
     924:         AttributeCombinationPeer::addSelectColumns($criteria);
     925:         $startcol2 = AttributeCombinationPeer::NUM_HYDRATE_COLUMNS;
     926:
     927:         AttributePeer::addSelectColumns($criteria);
     928:         $startcol3 = $startcol2 + AttributePeer::NUM_HYDRATE_COLUMNS;
     929:
     930:         AttributeAvPeer::addSelectColumns($criteria);
     931:         $startcol4 = $startcol3 + AttributeAvPeer::NUM_HYDRATE_COLUMNS;
     932:
     933:         CombinationPeer::addSelectColumns($criteria);
     934:         $startcol5 = $startcol4 + CombinationPeer::NUM_HYDRATE_COLUMNS;
     935:
     936:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
     937:
     938:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior);
     939:
     940:         $criteria->addJoin(AttributeCombinationPeer::COMBINATION_ID, CombinationPeer::ID, $join_behavior);
     941:
     942:         $stmt = BasePeer::doSelect($criteria, $con);
     943:         $results = array();
     944:
     945:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
     946:             $key1 = AttributeCombinationPeer::getPrimaryKeyHashFromRow($row, 0);
     947:             if (null !== ($obj1 = AttributeCombinationPeer::getInstanceFromPool($key1))) {
     948:                 // We no longer rehydrate the object, since this can cause data loss.
     949:                 // See http://www.propelorm.org/ticket/509
     950:                 // $obj1->hydrate($row, 0, true); // rehydrate
     951:             } else {
     952:                 $cls = AttributeCombinationPeer::getOMClass();
     953:
     954:                 $obj1 = new $cls();
     955:                 $obj1->hydrate($row);
     956:                 AttributeCombinationPeer::addInstanceToPool($obj1, $key1);
     957:             } // if obj1 already loaded
     958:
     959:             // Add objects for joined Attribute rows
     960:
     961:             $key2 = AttributePeer::getPrimaryKeyHashFromRow($row, $startcol2);
     962:             if ($key2 !== null) {
     963:                 $obj2 = AttributePeer::getInstanceFromPool($key2);
     964:                 if (!$obj2) {
     965:
     966:                     $cls = AttributePeer::getOMClass();
     967:
     968:                     $obj2 = new $cls();
     969:                     $obj2->hydrate($row, $startcol2);
     970:                     AttributePeer::addInstanceToPool($obj2, $key2);
     971:                 } // if obj2 loaded
     972:
     973:                 // Add the $obj1 (AttributeCombination) to the collection in $obj2 (Attribute)
     974:                 $obj2->addAttributeCombination($obj1);
     975:             } // if joined row not null
     976:
     977:             // Add objects for joined AttributeAv rows
     978:
     979:             $key3 = AttributeAvPeer::getPrimaryKeyHashFromRow($row, $startcol3);
     980:             if ($key3 !== null) {
     981:                 $obj3 = AttributeAvPeer::getInstanceFromPool($key3);
     982:                 if (!$obj3) {
     983:
     984:                     $cls = AttributeAvPeer::getOMClass();
     985:
     986:                     $obj3 = new $cls();
     987:                     $obj3->hydrate($row, $startcol3);
     988:                     AttributeAvPeer::addInstanceToPool($obj3, $key3);
     989:                 } // if obj3 loaded
     990:
     991:                 // Add the $obj1 (AttributeCombination) to the collection in $obj3 (AttributeAv)
     992:                 $obj3->addAttributeCombination($obj1);
     993:             } // if joined row not null
     994:
     995:             // Add objects for joined Combination rows
     996:
     997:             $key4 = CombinationPeer::getPrimaryKeyHashFromRow($row, $startcol4);
     998:             if ($key4 !== null) {
     999:                 $obj4 = CombinationPeer::getInstanceFromPool($key4);
    1000:                 if (!$obj4) {
    1001:
    1002:                     $cls = CombinationPeer::getOMClass();
    1003:
    1004:                     $obj4 = new $cls();
    1005:                     $obj4->hydrate($row, $startcol4);
    1006:                     CombinationPeer::addInstanceToPool($obj4, $key4);
    1007:                 } // if obj4 loaded
    1008:
    1009:                 // Add the $obj1 (AttributeCombination) to the collection in $obj4 (Combination)
    1010:                 $obj4->addAttributeCombination($obj1);
    1011:             } // if joined row not null
    1012:
    1013:             $results[] = $obj1;
    1014:         }
    1015:         $stmt->closeCursor();
    1016:
    1017:         return $results;
    1018:     }
    1019:
    1020:
    1021:     /**
    1022:      * Returns the number of rows matching criteria, joining the related Attribute table
    1023:      *
    1024:      * @param      Criteria $criteria
    1025:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1026:      * @param      PropelPDO $con
    1027:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1028:      * @return int Number of matching rows.
    1029:      */
    1030:     public static function doCountJoinAllExceptAttribute(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1031:     {
    1032:         // we're going to modify criteria, so copy it first
    1033:         $criteria = clone $criteria;
    1034:
    1035:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1036:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1037:         // tables go into the FROM clause.
    1038:         $criteria->setPrimaryTableName(AttributeCombinationPeer::TABLE_NAME);
    1039:
    1040:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1041:             $criteria->setDistinct();
    1042:         }
    1043:
    1044:         if (!$criteria->hasSelectClause()) {
    1045:             AttributeCombinationPeer::addSelectColumns($criteria);
    1046:         }
    1047:
    1048:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1049:
    1050:         // Set the correct dbName
    1051:         $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
    1052:
    1053:         if ($con === null) {
    1054:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1055:         }
    1056:
    1057:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior);
    1058:
    1059:         $criteria->addJoin(AttributeCombinationPeer::COMBINATION_ID, CombinationPeer::ID, $join_behavior);
    1060:
    1061:         $stmt = BasePeer::doCount($criteria, $con);
    1062:
    1063:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1064:             $count = (int) $row[0];
    1065:         } else {
    1066:             $count = 0; // no rows returned; we infer that means 0 matches.
    1067:         }
    1068:         $stmt->closeCursor();
    1069:
    1070:         return $count;
    1071:     }
    1072:
    1073:
    1074:     /**
    1075:      * Returns the number of rows matching criteria, joining the related AttributeAv table
    1076:      *
    1077:      * @param      Criteria $criteria
    1078:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1079:      * @param      PropelPDO $con
    1080:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1081:      * @return int Number of matching rows.
    1082:      */
    1083:     public static function doCountJoinAllExceptAttributeAv(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1084:     {
    1085:         // we're going to modify criteria, so copy it first
    1086:         $criteria = clone $criteria;
    1087:
    1088:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1089:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1090:         // tables go into the FROM clause.
    1091:         $criteria->setPrimaryTableName(AttributeCombinationPeer::TABLE_NAME);
    1092:
    1093:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1094:             $criteria->setDistinct();
    1095:         }
    1096:
    1097:         if (!$criteria->hasSelectClause()) {
    1098:             AttributeCombinationPeer::addSelectColumns($criteria);
    1099:         }
    1100:
    1101:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1102:
    1103:         // Set the correct dbName
    1104:         $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
    1105:
    1106:         if ($con === null) {
    1107:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1108:         }
    1109:
    1110:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
    1111:
    1112:         $criteria->addJoin(AttributeCombinationPeer::COMBINATION_ID, CombinationPeer::ID, $join_behavior);
    1113:
    1114:         $stmt = BasePeer::doCount($criteria, $con);
    1115:
    1116:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1117:             $count = (int) $row[0];
    1118:         } else {
    1119:             $count = 0; // no rows returned; we infer that means 0 matches.
    1120:         }
    1121:         $stmt->closeCursor();
    1122:
    1123:         return $count;
    1124:     }
    1125:
    1126:
    1127:     /**
    1128:      * Returns the number of rows matching criteria, joining the related Combination table
    1129:      *
    1130:      * @param      Criteria $criteria
    1131:      * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
    1132:      * @param      PropelPDO $con
    1133:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1134:      * @return int Number of matching rows.
    1135:      */
    1136:     public static function doCountJoinAllExceptCombination(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1137:     {
    1138:         // we're going to modify criteria, so copy it first
    1139:         $criteria = clone $criteria;
    1140:
    1141:         // We need to set the primary table name, since in the case that there are no WHERE columns
    1142:         // it will be impossible for the BasePeer::createSelectSql() method to determine which
    1143:         // tables go into the FROM clause.
    1144:         $criteria->setPrimaryTableName(AttributeCombinationPeer::TABLE_NAME);
    1145:
    1146:         if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
    1147:             $criteria->setDistinct();
    1148:         }
    1149:
    1150:         if (!$criteria->hasSelectClause()) {
    1151:             AttributeCombinationPeer::addSelectColumns($criteria);
    1152:         }
    1153:
    1154:         $criteria->clearOrderByColumns(); // ORDER BY should not affect count
    1155:
    1156:         // Set the correct dbName
    1157:         $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
    1158:
    1159:         if ($con === null) {
    1160:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1161:         }
    1162:
    1163:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
    1164:
    1165:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior);
    1166:
    1167:         $stmt = BasePeer::doCount($criteria, $con);
    1168:
    1169:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1170:             $count = (int) $row[0];
    1171:         } else {
    1172:             $count = 0; // no rows returned; we infer that means 0 matches.
    1173:         }
    1174:         $stmt->closeCursor();
    1175:
    1176:         return $count;
    1177:     }
    1178:
    1179:
    1180:     /**
    1181:      * Selects a collection of AttributeCombination objects pre-filled with all related objects except Attribute.
    1182:      *
    1183:      * @param      Criteria  $criteria
    1184:      * @param      PropelPDO $con
    1185:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1186:      * @return array           Array of AttributeCombination objects.
    1187:      * @throws PropelException Any exceptions caught during processing will be
    1188:      *       rethrown wrapped into a PropelException.
    1189:      */
    1190:     public static function doSelectJoinAllExceptAttribute(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1191:     {
    1192:         $criteria = clone $criteria;
    1193:
    1194:         // Set the correct dbName if it has not been overridden
    1195:         // $criteria->getDbName() will return the same object if not set to another value
    1196:         // so == check is okay and faster
    1197:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1198:             $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
    1199:         }
    1200:
    1201:         AttributeCombinationPeer::addSelectColumns($criteria);
    1202:         $startcol2 = AttributeCombinationPeer::NUM_HYDRATE_COLUMNS;
    1203:
    1204:         AttributeAvPeer::addSelectColumns($criteria);
    1205:         $startcol3 = $startcol2 + AttributeAvPeer::NUM_HYDRATE_COLUMNS;
    1206:
    1207:         CombinationPeer::addSelectColumns($criteria);
    1208:         $startcol4 = $startcol3 + CombinationPeer::NUM_HYDRATE_COLUMNS;
    1209:
    1210:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior);
    1211:
    1212:         $criteria->addJoin(AttributeCombinationPeer::COMBINATION_ID, CombinationPeer::ID, $join_behavior);
    1213:
    1214:
    1215:         $stmt = BasePeer::doSelect($criteria, $con);
    1216:         $results = array();
    1217:
    1218:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1219:             $key1 = AttributeCombinationPeer::getPrimaryKeyHashFromRow($row, 0);
    1220:             if (null !== ($obj1 = AttributeCombinationPeer::getInstanceFromPool($key1))) {
    1221:                 // We no longer rehydrate the object, since this can cause data loss.
    1222:                 // See http://www.propelorm.org/ticket/509
    1223:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1224:             } else {
    1225:                 $cls = AttributeCombinationPeer::getOMClass();
    1226:
    1227:                 $obj1 = new $cls();
    1228:                 $obj1->hydrate($row);
    1229:                 AttributeCombinationPeer::addInstanceToPool($obj1, $key1);
    1230:             } // if obj1 already loaded
    1231:
    1232:                 // Add objects for joined AttributeAv rows
    1233:
    1234:                 $key2 = AttributeAvPeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1235:                 if ($key2 !== null) {
    1236:                     $obj2 = AttributeAvPeer::getInstanceFromPool($key2);
    1237:                     if (!$obj2) {
    1238:
    1239:                         $cls = AttributeAvPeer::getOMClass();
    1240:
    1241:                     $obj2 = new $cls();
    1242:                     $obj2->hydrate($row, $startcol2);
    1243:                     AttributeAvPeer::addInstanceToPool($obj2, $key2);
    1244:                 } // if $obj2 already loaded
    1245:
    1246:                 // Add the $obj1 (AttributeCombination) to the collection in $obj2 (AttributeAv)
    1247:                 $obj2->addAttributeCombination($obj1);
    1248:
    1249:             } // if joined row is not null
    1250:
    1251:                 // Add objects for joined Combination rows
    1252:
    1253:                 $key3 = CombinationPeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1254:                 if ($key3 !== null) {
    1255:                     $obj3 = CombinationPeer::getInstanceFromPool($key3);
    1256:                     if (!$obj3) {
    1257:
    1258:                         $cls = CombinationPeer::getOMClass();
    1259:
    1260:                     $obj3 = new $cls();
    1261:                     $obj3->hydrate($row, $startcol3);
    1262:                     CombinationPeer::addInstanceToPool($obj3, $key3);
    1263:                 } // if $obj3 already loaded
    1264:
    1265:                 // Add the $obj1 (AttributeCombination) to the collection in $obj3 (Combination)
    1266:                 $obj3->addAttributeCombination($obj1);
    1267:
    1268:             } // if joined row is not null
    1269:
    1270:             $results[] = $obj1;
    1271:         }
    1272:         $stmt->closeCursor();
    1273:
    1274:         return $results;
    1275:     }
    1276:
    1277:
    1278:     /**
    1279:      * Selects a collection of AttributeCombination objects pre-filled with all related objects except AttributeAv.
    1280:      *
    1281:      * @param      Criteria  $criteria
    1282:      * @param      PropelPDO $con
    1283:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1284:      * @return array           Array of AttributeCombination objects.
    1285:      * @throws PropelException Any exceptions caught during processing will be
    1286:      *       rethrown wrapped into a PropelException.
    1287:      */
    1288:     public static function doSelectJoinAllExceptAttributeAv(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1289:     {
    1290:         $criteria = clone $criteria;
    1291:
    1292:         // Set the correct dbName if it has not been overridden
    1293:         // $criteria->getDbName() will return the same object if not set to another value
    1294:         // so == check is okay and faster
    1295:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1296:             $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
    1297:         }
    1298:
    1299:         AttributeCombinationPeer::addSelectColumns($criteria);
    1300:         $startcol2 = AttributeCombinationPeer::NUM_HYDRATE_COLUMNS;
    1301:
    1302:         AttributePeer::addSelectColumns($criteria);
    1303:         $startcol3 = $startcol2 + AttributePeer::NUM_HYDRATE_COLUMNS;
    1304:
    1305:         CombinationPeer::addSelectColumns($criteria);
    1306:         $startcol4 = $startcol3 + CombinationPeer::NUM_HYDRATE_COLUMNS;
    1307:
    1308:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
    1309:
    1310:         $criteria->addJoin(AttributeCombinationPeer::COMBINATION_ID, CombinationPeer::ID, $join_behavior);
    1311:
    1312:
    1313:         $stmt = BasePeer::doSelect($criteria, $con);
    1314:         $results = array();
    1315:
    1316:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1317:             $key1 = AttributeCombinationPeer::getPrimaryKeyHashFromRow($row, 0);
    1318:             if (null !== ($obj1 = AttributeCombinationPeer::getInstanceFromPool($key1))) {
    1319:                 // We no longer rehydrate the object, since this can cause data loss.
    1320:                 // See http://www.propelorm.org/ticket/509
    1321:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1322:             } else {
    1323:                 $cls = AttributeCombinationPeer::getOMClass();
    1324:
    1325:                 $obj1 = new $cls();
    1326:                 $obj1->hydrate($row);
    1327:                 AttributeCombinationPeer::addInstanceToPool($obj1, $key1);
    1328:             } // if obj1 already loaded
    1329:
    1330:                 // Add objects for joined Attribute rows
    1331:
    1332:                 $key2 = AttributePeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1333:                 if ($key2 !== null) {
    1334:                     $obj2 = AttributePeer::getInstanceFromPool($key2);
    1335:                     if (!$obj2) {
    1336:
    1337:                         $cls = AttributePeer::getOMClass();
    1338:
    1339:                     $obj2 = new $cls();
    1340:                     $obj2->hydrate($row, $startcol2);
    1341:                     AttributePeer::addInstanceToPool($obj2, $key2);
    1342:                 } // if $obj2 already loaded
    1343:
    1344:                 // Add the $obj1 (AttributeCombination) to the collection in $obj2 (Attribute)
    1345:                 $obj2->addAttributeCombination($obj1);
    1346:
    1347:             } // if joined row is not null
    1348:
    1349:                 // Add objects for joined Combination rows
    1350:
    1351:                 $key3 = CombinationPeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1352:                 if ($key3 !== null) {
    1353:                     $obj3 = CombinationPeer::getInstanceFromPool($key3);
    1354:                     if (!$obj3) {
    1355:
    1356:                         $cls = CombinationPeer::getOMClass();
    1357:
    1358:                     $obj3 = new $cls();
    1359:                     $obj3->hydrate($row, $startcol3);
    1360:                     CombinationPeer::addInstanceToPool($obj3, $key3);
    1361:                 } // if $obj3 already loaded
    1362:
    1363:                 // Add the $obj1 (AttributeCombination) to the collection in $obj3 (Combination)
    1364:                 $obj3->addAttributeCombination($obj1);
    1365:
    1366:             } // if joined row is not null
    1367:
    1368:             $results[] = $obj1;
    1369:         }
    1370:         $stmt->closeCursor();
    1371:
    1372:         return $results;
    1373:     }
    1374:
    1375:
    1376:     /**
    1377:      * Selects a collection of AttributeCombination objects pre-filled with all related objects except Combination.
    1378:      *
    1379:      * @param      Criteria  $criteria
    1380:      * @param      PropelPDO $con
    1381:      * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
    1382:      * @return array           Array of AttributeCombination objects.
    1383:      * @throws PropelException Any exceptions caught during processing will be
    1384:      *       rethrown wrapped into a PropelException.
    1385:      */
    1386:     public static function doSelectJoinAllExceptCombination(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1387:     {
    1388:         $criteria = clone $criteria;
    1389:
    1390:         // Set the correct dbName if it has not been overridden
    1391:         // $criteria->getDbName() will return the same object if not set to another value
    1392:         // so == check is okay and faster
    1393:         if ($criteria->getDbName() == Propel::getDefaultDB()) {
    1394:             $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
    1395:         }
    1396:
    1397:         AttributeCombinationPeer::addSelectColumns($criteria);
    1398:         $startcol2 = AttributeCombinationPeer::NUM_HYDRATE_COLUMNS;
    1399:
    1400:         AttributePeer::addSelectColumns($criteria);
    1401:         $startcol3 = $startcol2 + AttributePeer::NUM_HYDRATE_COLUMNS;
    1402:
    1403:         AttributeAvPeer::addSelectColumns($criteria);
    1404:         $startcol4 = $startcol3 + AttributeAvPeer::NUM_HYDRATE_COLUMNS;
    1405:
    1406:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_ID, AttributePeer::ID, $join_behavior);
    1407:
    1408:         $criteria->addJoin(AttributeCombinationPeer::ATTRIBUTE_AV_ID, AttributeAvPeer::ID, $join_behavior);
    1409:
    1410:
    1411:         $stmt = BasePeer::doSelect($criteria, $con);
    1412:         $results = array();
    1413:
    1414:         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    1415:             $key1 = AttributeCombinationPeer::getPrimaryKeyHashFromRow($row, 0);
    1416:             if (null !== ($obj1 = AttributeCombinationPeer::getInstanceFromPool($key1))) {
    1417:                 // We no longer rehydrate the object, since this can cause data loss.
    1418:                 // See http://www.propelorm.org/ticket/509
    1419:                 // $obj1->hydrate($row, 0, true); // rehydrate
    1420:             } else {
    1421:                 $cls = AttributeCombinationPeer::getOMClass();
    1422:
    1423:                 $obj1 = new $cls();
    1424:                 $obj1->hydrate($row);
    1425:                 AttributeCombinationPeer::addInstanceToPool($obj1, $key1);
    1426:             } // if obj1 already loaded
    1427:
    1428:                 // Add objects for joined Attribute rows
    1429:
    1430:                 $key2 = AttributePeer::getPrimaryKeyHashFromRow($row, $startcol2);
    1431:                 if ($key2 !== null) {
    1432:                     $obj2 = AttributePeer::getInstanceFromPool($key2);
    1433:                     if (!$obj2) {
    1434:
    1435:                         $cls = AttributePeer::getOMClass();
    1436:
    1437:                     $obj2 = new $cls();
    1438:                     $obj2->hydrate($row, $startcol2);
    1439:                     AttributePeer::addInstanceToPool($obj2, $key2);
    1440:                 } // if $obj2 already loaded
    1441:
    1442:                 // Add the $obj1 (AttributeCombination) to the collection in $obj2 (Attribute)
    1443:                 $obj2->addAttributeCombination($obj1);
    1444:
    1445:             } // if joined row is not null
    1446:
    1447:                 // Add objects for joined AttributeAv rows
    1448:
    1449:                 $key3 = AttributeAvPeer::getPrimaryKeyHashFromRow($row, $startcol3);
    1450:                 if ($key3 !== null) {
    1451:                     $obj3 = AttributeAvPeer::getInstanceFromPool($key3);
    1452:                     if (!$obj3) {
    1453:
    1454:                         $cls = AttributeAvPeer::getOMClass();
    1455:
    1456:                     $obj3 = new $cls();
    1457:                     $obj3->hydrate($row, $startcol3);
    1458:                     AttributeAvPeer::addInstanceToPool($obj3, $key3);
    1459:                 } // if $obj3 already loaded
    1460:
    1461:                 // Add the $obj1 (AttributeCombination) to the collection in $obj3 (AttributeAv)
    1462:                 $obj3->addAttributeCombination($obj1);
    1463:
    1464:             } // if joined row is not null
    1465:
    1466:             $results[] = $obj1;
    1467:         }
    1468:         $stmt->closeCursor();
    1469:
    1470:         return $results;
    1471:     }
    1472:
    1473:     /**
    1474:      * Returns the TableMap related to this peer.
    1475:      * This method is not needed for general use but a specific application could have a need.
    1476:      * @return TableMap
    1477:      * @throws PropelException Any exceptions caught during processing will be
    1478:      *       rethrown wrapped into a PropelException.
    1479:      */
    1480:     public static function getTableMap()
    1481:     {
    1482:         return Propel::getDatabaseMap(AttributeCombinationPeer::DATABASE_NAME)->getTable(AttributeCombinationPeer::TABLE_NAME);
    1483:     }
    1484:
    1485:     /**
    1486:      * Add a TableMap instance to the database for this peer class.
    1487:      */
    1488:     public static function buildTableMap()
    1489:     {
    1490:       $dbMap = Propel::getDatabaseMap(BaseAttributeCombinationPeer::DATABASE_NAME);
    1491:       if (!$dbMap->hasTable(BaseAttributeCombinationPeer::TABLE_NAME)) {
    1492:         $dbMap->addTableObject(new AttributeCombinationTableMap());
    1493:       }
    1494:     }
    1495:
    1496:     /**
    1497:      * The class that the Peer will make instances of.
    1498:      *
    1499:      *
    1500:      * @return string ClassName
    1501:      */
    1502:     public static function getOMClass($row = 0, $colnum = 0)
    1503:     {
    1504:         return AttributeCombinationPeer::OM_CLASS;
    1505:     }
    1506:
    1507:     /**
    1508:      * Performs an INSERT on the database, given a AttributeCombination or Criteria object.
    1509:      *
    1510:      * @param      mixed $values Criteria or AttributeCombination object containing data that is used to create the INSERT statement.
    1511:      * @param      PropelPDO $con the PropelPDO connection to use
    1512:      * @return mixed           The new primary key.
    1513:      * @throws PropelException Any exceptions caught during processing will be
    1514:      *       rethrown wrapped into a PropelException.
    1515:      */
    1516:     public static function doInsert($values, PropelPDO $con = null)
    1517:     {
    1518:         if ($con === null) {
    1519:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1520:         }
    1521:
    1522:         if ($values instanceof Criteria) {
    1523:             $criteria = clone $values; // rename for clarity
    1524:         } else {
    1525:             $criteria = $values->buildCriteria(); // build Criteria from AttributeCombination object
    1526:         }
    1527:
    1528:         if ($criteria->containsKey(AttributeCombinationPeer::ID) && $criteria->keyContainsValue(AttributeCombinationPeer::ID) ) {
    1529:             throw new PropelException('Cannot insert a value for auto-increment primary key ('.AttributeCombinationPeer::ID.')');
    1530:         }
    1531:
    1532:
    1533:         // Set the correct dbName
    1534:         $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
    1535:
    1536:         try {
    1537:             // use transaction because $criteria could contain info
    1538:             // for more than one table (I guess, conceivably)
    1539:             $con->beginTransaction();
    1540:             $pk = BasePeer::doInsert($criteria, $con);
    1541:             $con->commit();
    1542:         } catch (PropelException $e) {
    1543:             $con->rollBack();
    1544:             throw $e;
    1545:         }
    1546:
    1547:         return $pk;
    1548:     }
    1549:
    1550:     /**
    1551:      * Performs an UPDATE on the database, given a AttributeCombination or Criteria object.
    1552:      *
    1553:      * @param      mixed $values Criteria or AttributeCombination object containing data that is used to create the UPDATE statement.
    1554:      * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
    1555:      * @return int             The number of affected rows (if supported by underlying database driver).
    1556:      * @throws PropelException Any exceptions caught during processing will be
    1557:      *       rethrown wrapped into a PropelException.
    1558:      */
    1559:     public static function doUpdate($values, PropelPDO $con = null)
    1560:     {
    1561:         if ($con === null) {
    1562:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1563:         }
    1564:
    1565:         $selectCriteria = new Criteria(AttributeCombinationPeer::DATABASE_NAME);
    1566:
    1567:         if ($values instanceof Criteria) {
    1568:             $criteria = clone $values; // rename for clarity
    1569:
    1570:             $comparison = $criteria->getComparison(AttributeCombinationPeer::ID);
    1571:             $value = $criteria->remove(AttributeCombinationPeer::ID);
    1572:             if ($value) {
    1573:                 $selectCriteria->add(AttributeCombinationPeer::ID, $value, $comparison);
    1574:             } else {
    1575:                 $selectCriteria->setPrimaryTableName(AttributeCombinationPeer::TABLE_NAME);
    1576:             }
    1577:
    1578:             $comparison = $criteria->getComparison(AttributeCombinationPeer::ATTRIBUTE_ID);
    1579:             $value = $criteria->remove(AttributeCombinationPeer::ATTRIBUTE_ID);
    1580:             if ($value) {
    1581:                 $selectCriteria->add(AttributeCombinationPeer::ATTRIBUTE_ID, $value, $comparison);
    1582:             } else {
    1583:                 $selectCriteria->setPrimaryTableName(AttributeCombinationPeer::TABLE_NAME);
    1584:             }
    1585:
    1586:             $comparison = $criteria->getComparison(AttributeCombinationPeer::COMBINATION_ID);
    1587:             $value = $criteria->remove(AttributeCombinationPeer::COMBINATION_ID);
    1588:             if ($value) {
    1589:                 $selectCriteria->add(AttributeCombinationPeer::COMBINATION_ID, $value, $comparison);
    1590:             } else {
    1591:                 $selectCriteria->setPrimaryTableName(AttributeCombinationPeer::TABLE_NAME);
    1592:             }
    1593:
    1594:             $comparison = $criteria->getComparison(AttributeCombinationPeer::ATTRIBUTE_AV_ID);
    1595:             $value = $criteria->remove(AttributeCombinationPeer::ATTRIBUTE_AV_ID);
    1596:             if ($value) {
    1597:                 $selectCriteria->add(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $value, $comparison);
    1598:             } else {
    1599:                 $selectCriteria->setPrimaryTableName(AttributeCombinationPeer::TABLE_NAME);
    1600:             }
    1601:
    1602:         } else { // $values is AttributeCombination object
    1603:             $criteria = $values->buildCriteria(); // gets full criteria
    1604:             $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
    1605:         }
    1606:
    1607:         // set the correct dbName
    1608:         $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
    1609:
    1610:         return BasePeer::doUpdate($selectCriteria, $criteria, $con);
    1611:     }
    1612:
    1613:     /**
    1614:      * Deletes all rows from the attribute_combination table.
    1615:      *
    1616:      * @param      PropelPDO $con the connection to use
    1617:      * @return int             The number of affected rows (if supported by underlying database driver).
    1618:      * @throws PropelException
    1619:      */
    1620:     public static function doDeleteAll(PropelPDO $con = null)
    1621:     {
    1622:         if ($con === null) {
    1623:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1624:         }
    1625:         $affectedRows = 0; // initialize var to track total num of affected rows
    1626:         try {
    1627:             // use transaction because $criteria could contain info
    1628:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
    1629:             $con->beginTransaction();
    1630:             $affectedRows += BasePeer::doDeleteAll(AttributeCombinationPeer::TABLE_NAME, $con, AttributeCombinationPeer::DATABASE_NAME);
    1631:             // Because this db requires some delete cascade/set null emulation, we have to
    1632:             // clear the cached instance *after* the emulation has happened (since
    1633:             // instances get re-added by the select statement contained therein).
    1634:             AttributeCombinationPeer::clearInstancePool();
    1635:             AttributeCombinationPeer::clearRelatedInstancePool();
    1636:             $con->commit();
    1637:
    1638:             return $affectedRows;
    1639:         } catch (PropelException $e) {
    1640:             $con->rollBack();
    1641:             throw $e;
    1642:         }
    1643:     }
    1644:
    1645:     /**
    1646:      * Performs a DELETE on the database, given a AttributeCombination or Criteria object OR a primary key value.
    1647:      *
    1648:      * @param      mixed $values Criteria or AttributeCombination object or primary key or array of primary keys
    1649:      *              which is used to create the DELETE statement
    1650:      * @param      PropelPDO $con the connection to use
    1651:      * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
    1652:      *              if supported by native driver or if emulated using Propel.
    1653:      * @throws PropelException Any exceptions caught during processing will be
    1654:      *       rethrown wrapped into a PropelException.
    1655:      */
    1656:      public static function doDelete($values, PropelPDO $con = null)
    1657:      {
    1658:         if ($con === null) {
    1659:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
    1660:         }
    1661:
    1662:         if ($values instanceof Criteria) {
    1663:             // invalidate the cache for all objects of this type, since we have no
    1664:             // way of knowing (without running a query) what objects should be invalidated
    1665:             // from the cache based on this Criteria.
    1666:             AttributeCombinationPeer::clearInstancePool();
    1667:             // rename for clarity
    1668:             $criteria = clone $values;
    1669:         } elseif ($values instanceof AttributeCombination) { // it's a model object
    1670:             // invalidate the cache for this single object
    1671:             AttributeCombinationPeer::removeInstanceFromPool($values);
    1672:             // create criteria based on pk values
    1673:             $criteria = $values->buildPkeyCriteria();
    1674:         } else { // it's a primary key, or an array of pks
    1675:             $criteria = new Criteria(AttributeCombinationPeer::DATABASE_NAME);
    1676:             // primary key is composite; we therefore, expect
    1677:             // the primary key passed to be an array of pkey values
    1678:             if (count($values) == count($values, COUNT_RECURSIVE)) {
    1679:                 // array is not multi-dimensional
    1680:                 $values = array($values);
    1681:             }
    1682:             foreach ($values as $value) {
    1683:                 $criterion = $criteria->getNewCriterion(AttributeCombinationPeer::ID, $value[0]);
    1684:                 $criterion->addAnd($criteria->getNewCriterion(AttributeCombinationPeer::ATTRIBUTE_ID, $value[1]));
    1685:                 $criterion->addAnd($criteria->getNewCriterion(AttributeCombinationPeer::COMBINATION_ID, $value[2]));
    1686:                 $criterion->addAnd($criteria->getNewCriterion(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $value[3]));
    1687:                 $criteria->addOr($criterion);
    1688:                 // we can invalidate the cache for this single PK
    1689:                 AttributeCombinationPeer::removeInstanceFromPool($value);
    1690:             }
    1691:         }
    1692:
    1693:         // Set the correct dbName
    1694:         $criteria->setDbName(AttributeCombinationPeer::DATABASE_NAME);
    1695:
    1696:         $affectedRows = 0; // initialize var to track total num of affected rows
    1697:
    1698:         try {
    1699:             // use transaction because $criteria could contain info
    1700:             // for more than one table or we could emulating ON DELETE CASCADE, etc.
    1701:             $con->beginTransaction();
    1702:
    1703:             $affectedRows += BasePeer::doDelete($criteria, $con);
    1704:             AttributeCombinationPeer::clearRelatedInstancePool();
    1705:             $con->commit();
    1706:
    1707:             return $affectedRows;
    1708:         } catch (PropelException $e) {
    1709:             $con->rollBack();
    1710:             throw $e;
    1711:         }
    1712:     }
    1713:
    1714:     /**
    1715:      * Validates all modified columns of given AttributeCombination object.
    1716:      * If parameter $columns is either a single column name or an array of column names
    1717:      * than only those columns are validated.
    1718:      *
    1719:      * NOTICE: This does not apply to primary or foreign keys for now.
    1720:      *
    1721:      * @param      AttributeCombination $obj The object to validate.
    1722:      * @param      mixed $cols Column name or array of column names.
    1723:      *
    1724:      * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
    1725:      */
    1726:     public static function doValidate($obj, $cols = null)
    1727:     {
    1728:         $columns = array();
    1729:
    1730:         if ($cols) {
    1731:             $dbMap = Propel::getDatabaseMap(AttributeCombinationPeer::DATABASE_NAME);
    1732:             $tableMap = $dbMap->getTable(AttributeCombinationPeer::TABLE_NAME);
    1733:
    1734:             if (! is_array($cols)) {
    1735:                 $cols = array($cols);
    1736:             }
    1737:
    1738:             foreach ($cols as $colName) {
    1739:                 if ($tableMap->hasColumn($colName)) {
    1740:                     $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
    1741:                     $columns[$colName] = $obj->$get();
    1742:                 }
    1743:             }
    1744:         } else {
    1745:
    1746:         }
    1747:
    1748:         return BasePeer::doValidate(AttributeCombinationPeer::DATABASE_NAME, AttributeCombinationPeer::TABLE_NAME, $columns);
    1749:     }
    1750:
    1751:     /**
    1752:      * Retrieve object using using composite pkey values.
    1753:      * @param   int $id
    1754:      * @param   int $attribute_id
    1755:      * @param   int $combination_id
    1756:      * @param   int $attribute_av_id
    1757:      * @param      PropelPDO $con
    1758:      * @return   AttributeCombination
    1759:      */
    1760:     public static function retrieveByPK($id, $attribute_id, $combination_id, $attribute_av_id, PropelPDO $con = null) {
    1761:         $_instancePoolKey = serialize(array((string) $id, (string) $attribute_id, (string) $combination_id, (string) $attribute_av_id));
    1762:          if (null !== ($obj = AttributeCombinationPeer::getInstanceFromPool($_instancePoolKey))) {
    1763:              return $obj;
    1764:         }
    1765:
    1766:         if ($con === null) {
    1767:             $con = Propel::getConnection(AttributeCombinationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    1768:         }
    1769:         $criteria = new Criteria(AttributeCombinationPeer::DATABASE_NAME);
    1770:         $criteria->add(AttributeCombinationPeer::ID, $id);
    1771:         $criteria->add(AttributeCombinationPeer::ATTRIBUTE_ID, $attribute_id);
    1772:         $criteria->add(AttributeCombinationPeer::COMBINATION_ID, $combination_id);
    1773:         $criteria->add(AttributeCombinationPeer::ATTRIBUTE_AV_ID, $attribute_av_id);
    1774:         $v = AttributeCombinationPeer::doSelect($criteria, $con);
    1775:
    1776:         return !empty($v) ? $v[0] : null;
    1777:     }
    1778: } // BaseAttributeCombinationPeer
    1779:
    1780: // This is the static code needed to register the TableMap for this table with the main Propel class.
    1781: //
    1782: BaseAttributeCombinationPeer::buildTableMap();
    1783:
    1784: