Overview

Namespaces

  • Thelia
    • Action
    • Config
    • Controller
    • Core
      • Bundle
      • DependencyInjection
        • Compiler
        • Loader
      • Event
      • EventListener
      • Template
        • BaseParam
    • Exception
    • Log
      • Destination
    • Model
      • map
      • om
    • Routing
      • Matcher
    • Tools
    • Tpex
      • BaseParam
      • Element
        • Loop
        • TestLoop
      • Event
      • Exception
      • Filter
      • Tokenizer

Classes

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