Overview

Namespaces

  • Thelia
    • Action
    • Controller
    • Core
      • Bundle
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Exception
      • Loop
      • Tests

Classes

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