Overview

Namespaces

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

Classes

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