# File core/lib/Thelia/Model/om/BaseGroupModulePeer.php | thelia

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