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