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