      1: <?php
      2:
      3: namespace Thelia\Model\om;
      4:
      5: use \Criteria;
      6: use \Exception;
      7: use \ModelCriteria;
      8: use \ModelJoin;
      9: use \PDO;
     10: use \Propel;
     11: use \PropelCollection;
     12: use \PropelException;
     13: use \PropelObjectCollection;
     14: use \PropelPDO;
     15: use Thelia\Model\Admin;
     16: use Thelia\Model\AdminGroup;
     17: use Thelia\Model\AdminGroupPeer;
     18: use Thelia\Model\AdminGroupQuery;
     19: use Thelia\Model\Group;
     20:
     21: /**
     22:  * Base class that represents a query for the 'admin_group' table.
     23:  *
     24:  *
     25:  *
     26:  * @method AdminGroupQuery orderById($order = Criteria::ASC) Order by the id column
     27:  * @method AdminGroupQuery orderByGroupId($order = Criteria::ASC) Order by the group_id column
     28:  * @method AdminGroupQuery orderByAdminId($order = Criteria::ASC) Order by the admin_id column
     29:  * @method AdminGroupQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
     30:  * @method AdminGroupQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
     31:  *
     32:  * @method AdminGroupQuery groupById() Group by the id column
     33:  * @method AdminGroupQuery groupByGroupId() Group by the group_id column
     34:  * @method AdminGroupQuery groupByAdminId() Group by the admin_id column
     35:  * @method AdminGroupQuery groupByCreatedAt() Group by the created_at column
     36:  * @method AdminGroupQuery groupByUpdatedAt() Group by the updated_at column
     37:  *
     38:  * @method AdminGroupQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
     39:  * @method AdminGroupQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
     40:  * @method AdminGroupQuery innerJoin($relation) Adds a INNER JOIN clause to the query
     41:  *
     42:  * @method AdminGroupQuery leftJoinGroup($relationAlias = null) Adds a LEFT JOIN clause to the query using the Group relation
     43:  * @method AdminGroupQuery rightJoinGroup($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Group relation
     44:  * @method AdminGroupQuery innerJoinGroup($relationAlias = null) Adds a INNER JOIN clause to the query using the Group relation
     45:  *
     46:  * @method AdminGroupQuery leftJoinAdmin($relationAlias = null) Adds a LEFT JOIN clause to the query using the Admin relation
     47:  * @method AdminGroupQuery rightJoinAdmin($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Admin relation
     48:  * @method AdminGroupQuery innerJoinAdmin($relationAlias = null) Adds a INNER JOIN clause to the query using the Admin relation
     49:  *
     50:  * @method AdminGroup findOne(PropelPDO $con = null) Return the first AdminGroup matching the query
     51:  * @method AdminGroup findOneOrCreate(PropelPDO $con = null) Return the first AdminGroup matching the query, or a new AdminGroup object populated from the query conditions when no match is found
     52:  *
     53:  * @method AdminGroup findOneByGroupId(int $group_id) Return the first AdminGroup filtered by the group_id column
     54:  * @method AdminGroup findOneByAdminId(int $admin_id) Return the first AdminGroup filtered by the admin_id column
     55:  * @method AdminGroup findOneByCreatedAt(string $created_at) Return the first AdminGroup filtered by the created_at column
     56:  * @method AdminGroup findOneByUpdatedAt(string $updated_at) Return the first AdminGroup filtered by the updated_at column
     57:  *
     58:  * @method array findById(int $id) Return AdminGroup objects filtered by the id column
     59:  * @method array findByGroupId(int $group_id) Return AdminGroup objects filtered by the group_id column
     60:  * @method array findByAdminId(int $admin_id) Return AdminGroup objects filtered by the admin_id column
     61:  * @method array findByCreatedAt(string $created_at) Return AdminGroup objects filtered by the created_at column
     62:  * @method array findByUpdatedAt(string $updated_at) Return AdminGroup objects filtered by the updated_at column
     63:  *
     64:  * @package    propel.generator.Thelia.Model.om
     65:  */
     66: abstract class BaseAdminGroupQuery extends ModelCriteria
     67: {
     68:     /**
     69:      * Initializes internal state of BaseAdminGroupQuery object.
     70:      *
     71:      * @param     string $dbName The dabase name
     72:      * @param     string $modelName The phpName of a model, e.g. 'Book'
     73:      * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     74:      */
     75:     public function __construct($dbName = 'thelia', $modelName = 'Thelia\\Model\\AdminGroup', $modelAlias = null)
     76:     {
     77:         parent::__construct($dbName, $modelName, $modelAlias);
     78:     }
     79:
     80:     /**
     81:      * Returns a new AdminGroupQuery object.
     82:      *
     83:      * @param     string $modelAlias The alias of a model in the query
     84:      * @param   AdminGroupQuery|Criteria $criteria Optional Criteria to build the query from
     85:      *
     86:      * @return AdminGroupQuery
     87:      */
     88:     public static function create($modelAlias = null, $criteria = null)
     89:     {
     90:         if ($criteria instanceof AdminGroupQuery) {
     91:             return $criteria;
     92:         }
     93:         $query = new AdminGroupQuery();
     94:         if (null !== $modelAlias) {
     95:             $query->setModelAlias($modelAlias);
     96:         }
     97:         if ($criteria instanceof Criteria) {
     98:             $query->mergeWith($criteria);
     99:         }
    100:
    101:         return $query;
    102:     }
    103:
    104:     /**
    105:      * Find object by primary key.
    106:      * Propel uses the instance pool to skip the database if the object exists.
    107:      * Go fast if the query is untouched.
    108:      *
    109:      * <code>
    110:      * $obj  = $c->findPk(12, $con);
    111:      * </code>
    112:      *
    113:      * @param mixed $key Primary key to use for the query
    114:      * @param     PropelPDO $con an optional connection object
    115:      *
    116:      * @return   AdminGroup|AdminGroup[]|mixed the result, formatted by the current formatter
    117:      */
    118:     public function findPk($key, $con = null)
    119:     {
    120:         if ($key === null) {
    121:             return null;
    122:         }
    123:         if ((null !== ($obj = AdminGroupPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
    124:             // the object is alredy in the instance pool
    125:             return $obj;
    126:         }
    127:         if ($con === null) {
    128:             $con = Propel::getConnection(AdminGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ);
    129:         }
    130:         $this->basePreSelect($con);
    131:         if ($this->formatter || $this->modelAlias || $this->with || $this->select
    132:          || $this->selectColumns || $this->asColumns || $this->selectModifiers
    133:          || $this->map || $this->having || $this->joins) {
    134:             return $this->findPkComplex($key, $con);
    135:         } else {
    136:             return $this->findPkSimple($key, $con);
    137:         }
    138:     }
    139:
    140:     /**
    141:      * Alias of findPk to use instance pooling
    142:      *
    143:      * @param     mixed $key Primary key to use for the query
    144:      * @param     PropelPDO $con A connection object
    145:      *
    146:      * @return                 AdminGroup A model object, or null if the key is not found
    147:      * @throws PropelException
    148:      */
    149:      public function findOneById($key, $con = null)
    150:      {
    151:         return $this->findPk($key, $con);
    152:      }
    153:
    154:     /**
    155:      * Find object by primary key using raw SQL to go fast.
    156:      * Bypass doSelect() and the object formatter by using generated code.
    157:      *
    158:      * @param     mixed $key Primary key to use for the query
    159:      * @param     PropelPDO $con A connection object
    160:      *
    161:      * @return                 AdminGroup A model object, or null if the key is not found
    162:      * @throws PropelException
    163:      */
    164:     protected function findPkSimple($key, $con)
    165:     {
    166:         $sql = 'SELECT `id`, `group_id`, `admin_id`, `created_at`, `updated_at` FROM `admin_group` WHERE `id` = :p0';
    167:         try {
    168:             $stmt = $con->prepare($sql);
    169:             $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
    170:             $stmt->execute();
    171:         } catch (Exception $e) {
    172:             Propel::log($e->getMessage(), Propel::LOG_ERR);
    173:             throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
    174:         }
    175:         $obj = null;
    176:         if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
    177:             $obj = new AdminGroup();
    178:             $obj->hydrate($row);
    179:             AdminGroupPeer::addInstanceToPool($obj, (string) $key);
    180:         }
    181:         $stmt->closeCursor();
    182:
    183:         return $obj;
    184:     }
    185:
    186:     /**
    187:      * Find object by primary key.
    188:      *
    189:      * @param     mixed $key Primary key to use for the query
    190:      * @param     PropelPDO $con A connection object
    191:      *
    192:      * @return AdminGroup|AdminGroup[]|mixed the result, formatted by the current formatter
    193:      */
    194:     protected function findPkComplex($key, $con)
    195:     {
    196:         // As the query uses a PK condition, no limit(1) is necessary.
    197:         $criteria = $this->isKeepQuery() ? clone $this : $this;
    198:         $stmt = $criteria
    199:             ->filterByPrimaryKey($key)
    200:             ->doSelect($con);
    201:
    202:         return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    203:     }
    204:
    205:     /**
    206:      * Find objects by primary key
    207:      * <code>
    208:      * $objs = $c->findPks(array(12, 56, 832), $con);
    209:      * </code>
    210:      * @param     array $keys Primary keys to use for the query
    211:      * @param     PropelPDO $con an optional connection object
    212:      *
    213:      * @return PropelObjectCollection|AdminGroup[]|mixed the list of results, formatted by the current formatter
    214:      */
    215:     public function findPks($keys, $con = null)
    216:     {
    217:         if ($con === null) {
    218:             $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
    219:         }
    220:         $this->basePreSelect($con);
    221:         $criteria = $this->isKeepQuery() ? clone $this : $this;
    222:         $stmt = $criteria
    223:             ->filterByPrimaryKeys($keys)
    224:             ->doSelect($con);
    225:
    226:         return $criteria->getFormatter()->init($criteria)->format($stmt);
    227:     }
    228:
    229:     /**
    230:      * Filter the query by primary key
    231:      *
    232:      * @param     mixed $key Primary key to use for the query
    233:      *
    234:      * @return AdminGroupQuery The current query, for fluid interface
    235:      */
    236:     public function filterByPrimaryKey($key)
    237:     {
    238:
    239:         return $this->addUsingAlias(AdminGroupPeer::ID, $key, Criteria::EQUAL);
    240:     }
    241:
    242:     /**
    243:      * Filter the query by a list of primary keys
    244:      *
    245:      * @param     array $keys The list of primary key to use for the query
    246:      *
    247:      * @return AdminGroupQuery The current query, for fluid interface
    248:      */
    249:     public function filterByPrimaryKeys($keys)
    250:     {
    251:
    252:         return $this->addUsingAlias(AdminGroupPeer::ID, $keys, Criteria::IN);
    253:     }
    254:
    255:     /**
    256:      * Filter the query on the id column
    257:      *
    258:      * Example usage:
    259:      * <code>
    260:      * $query->filterById(1234); // WHERE id = 1234
    261:      * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
    262:      * $query->filterById(array('min' => 12)); // WHERE id >= 12
    263:      * $query->filterById(array('max' => 12)); // WHERE id <= 12
    264:      * </code>
    265:      *
    266:      * @param     mixed $id The value to use as filter.
    267:      *              Use scalar values for equality.
    268:      *              Use array values for in_array() equivalent.
    269:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    270:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    271:      *
    272:      * @return AdminGroupQuery The current query, for fluid interface
    273:      */
    274:     public function filterById($id = null, $comparison = null)
    275:     {
    276:         if (is_array($id)) {
    277:             $useMinMax = false;
    278:             if (isset($id['min'])) {
    279:                 $this->addUsingAlias(AdminGroupPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
    280:                 $useMinMax = true;
    281:             }
    282:             if (isset($id['max'])) {
    283:                 $this->addUsingAlias(AdminGroupPeer::ID, $id['max'], Criteria::LESS_EQUAL);
    284:                 $useMinMax = true;
    285:             }
    286:             if ($useMinMax) {
    287:                 return $this;
    288:             }
    289:             if (null === $comparison) {
    290:                 $comparison = Criteria::IN;
    291:             }
    292:         }
    293:
    294:         return $this->addUsingAlias(AdminGroupPeer::ID, $id, $comparison);
    295:     }
    296:
    297:     /**
    298:      * Filter the query on the group_id column
    299:      *
    300:      * Example usage:
    301:      * <code>
    302:      * $query->filterByGroupId(1234); // WHERE group_id = 1234
    303:      * $query->filterByGroupId(array(12, 34)); // WHERE group_id IN (12, 34)
    304:      * $query->filterByGroupId(array('min' => 12)); // WHERE group_id >= 12
    305:      * $query->filterByGroupId(array('max' => 12)); // WHERE group_id <= 12
    306:      * </code>
    307:      *
    308:      * @see       filterByGroup()
    309:      *
    310:      * @param     mixed $groupId The value to use as filter.
    311:      *              Use scalar values for equality.
    312:      *              Use array values for in_array() equivalent.
    313:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    314:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    315:      *
    316:      * @return AdminGroupQuery The current query, for fluid interface
    317:      */
    318:     public function filterByGroupId($groupId = null, $comparison = null)
    319:     {
    320:         if (is_array($groupId)) {
    321:             $useMinMax = false;
    322:             if (isset($groupId['min'])) {
    323:                 $this->addUsingAlias(AdminGroupPeer::GROUP_ID, $groupId['min'], Criteria::GREATER_EQUAL);
    324:                 $useMinMax = true;
    325:             }
    326:             if (isset($groupId['max'])) {
    327:                 $this->addUsingAlias(AdminGroupPeer::GROUP_ID, $groupId['max'], Criteria::LESS_EQUAL);
    328:                 $useMinMax = true;
    329:             }
    330:             if ($useMinMax) {
    331:                 return $this;
    332:             }
    333:             if (null === $comparison) {
    334:                 $comparison = Criteria::IN;
    335:             }
    336:         }
    337:
    338:         return $this->addUsingAlias(AdminGroupPeer::GROUP_ID, $groupId, $comparison);
    339:     }
    340:
    341:     /**
    342:      * Filter the query on the admin_id column
    343:      *
    344:      * Example usage:
    345:      * <code>
    346:      * $query->filterByAdminId(1234); // WHERE admin_id = 1234
    347:      * $query->filterByAdminId(array(12, 34)); // WHERE admin_id IN (12, 34)
    348:      * $query->filterByAdminId(array('min' => 12)); // WHERE admin_id >= 12
    349:      * $query->filterByAdminId(array('max' => 12)); // WHERE admin_id <= 12
    350:      * </code>
    351:      *
    352:      * @see       filterByAdmin()
    353:      *
    354:      * @param     mixed $adminId The value to use as filter.
    355:      *              Use scalar values for equality.
    356:      *              Use array values for in_array() equivalent.
    357:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    358:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    359:      *
    360:      * @return AdminGroupQuery The current query, for fluid interface
    361:      */
    362:     public function filterByAdminId($adminId = null, $comparison = null)
    363:     {
    364:         if (is_array($adminId)) {
    365:             $useMinMax = false;
    366:             if (isset($adminId['min'])) {
    367:                 $this->addUsingAlias(AdminGroupPeer::ADMIN_ID, $adminId['min'], Criteria::GREATER_EQUAL);
    368:                 $useMinMax = true;
    369:             }
    370:             if (isset($adminId['max'])) {
    371:                 $this->addUsingAlias(AdminGroupPeer::ADMIN_ID, $adminId['max'], Criteria::LESS_EQUAL);
    372:                 $useMinMax = true;
    373:             }
    374:             if ($useMinMax) {
    375:                 return $this;
    376:             }
    377:             if (null === $comparison) {
    378:                 $comparison = Criteria::IN;
    379:             }
    380:         }
    381:
    382:         return $this->addUsingAlias(AdminGroupPeer::ADMIN_ID, $adminId, $comparison);
    383:     }
    384:
    385:     /**
    386:      * Filter the query on the created_at column
    387:      *
    388:      * Example usage:
    389:      * <code>
    390:      * $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
    391:      * $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
    392:      * $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
    393:      * </code>
    394:      *
    395:      * @param     mixed $createdAt The value to use as filter.
    396:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    397:      *              Empty strings are treated as NULL.
    398:      *              Use scalar values for equality.
    399:      *              Use array values for in_array() equivalent.
    400:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    401:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    402:      *
    403:      * @return AdminGroupQuery The current query, for fluid interface
    404:      */
    405:     public function filterByCreatedAt($createdAt = null, $comparison = null)
    406:     {
    407:         if (is_array($createdAt)) {
    408:             $useMinMax = false;
    409:             if (isset($createdAt['min'])) {
    410:                 $this->addUsingAlias(AdminGroupPeer::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
    411:                 $useMinMax = true;
    412:             }
    413:             if (isset($createdAt['max'])) {
    414:                 $this->addUsingAlias(AdminGroupPeer::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
    415:                 $useMinMax = true;
    416:             }
    417:             if ($useMinMax) {
    418:                 return $this;
    419:             }
    420:             if (null === $comparison) {
    421:                 $comparison = Criteria::IN;
    422:             }
    423:         }
    424:
    425:         return $this->addUsingAlias(AdminGroupPeer::CREATED_AT, $createdAt, $comparison);
    426:     }
    427:
    428:     /**
    429:      * Filter the query on the updated_at column
    430:      *
    431:      * Example usage:
    432:      * <code>
    433:      * $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
    434:      * $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
    435:      * $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
    436:      * </code>
    437:      *
    438:      * @param     mixed $updatedAt The value to use as filter.
    439:      *              Values can be integers (unix timestamps), DateTime objects, or strings.
    440:      *              Empty strings are treated as NULL.
    441:      *              Use scalar values for equality.
    442:      *              Use array values for in_array() equivalent.
    443:      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
    444:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    445:      *
    446:      * @return AdminGroupQuery The current query, for fluid interface
    447:      */
    448:     public function filterByUpdatedAt($updatedAt = null, $comparison = null)
    449:     {
    450:         if (is_array($updatedAt)) {
    451:             $useMinMax = false;
    452:             if (isset($updatedAt['min'])) {
    453:                 $this->addUsingAlias(AdminGroupPeer::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
    454:                 $useMinMax = true;
    455:             }
    456:             if (isset($updatedAt['max'])) {
    457:                 $this->addUsingAlias(AdminGroupPeer::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
    458:                 $useMinMax = true;
    459:             }
    460:             if ($useMinMax) {
    461:                 return $this;
    462:             }
    463:             if (null === $comparison) {
    464:                 $comparison = Criteria::IN;
    465:             }
    466:         }
    467:
    468:         return $this->addUsingAlias(AdminGroupPeer::UPDATED_AT, $updatedAt, $comparison);
    469:     }
    470:
    471:     /**
    472:      * Filter the query by a related Group object
    473:      *
    474:      * @param   Group|PropelObjectCollection $group The related object(s) to use as filter
    475:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    476:      *
    477:      * @return                 AdminGroupQuery The current query, for fluid interface
    478:      * @throws PropelException - if the provided filter is invalid.
    479:      */
    480:     public function filterByGroup($group, $comparison = null)
    481:     {
    482:         if ($group instanceof Group) {
    483:             return $this
    484:                 ->addUsingAlias(AdminGroupPeer::GROUP_ID, $group->getId(), $comparison);
    485:         } elseif ($group instanceof PropelObjectCollection) {
    486:             if (null === $comparison) {
    487:                 $comparison = Criteria::IN;
    488:             }
    489:
    490:             return $this
    491:                 ->addUsingAlias(AdminGroupPeer::GROUP_ID, $group->toKeyValue('PrimaryKey', 'Id'), $comparison);
    492:         } else {
    493:             throw new PropelException('filterByGroup() only accepts arguments of type Group or PropelCollection');
    494:         }
    495:     }
    496:
    497:     /**
    498:      * Adds a JOIN clause to the query using the Group relation
    499:      *
    500:      * @param     string $relationAlias optional alias for the relation
    501:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    502:      *
    503:      * @return AdminGroupQuery The current query, for fluid interface
    504:      */
    505:     public function joinGroup($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    506:     {
    507:         $tableMap = $this->getTableMap();
    508:         $relationMap = $tableMap->getRelation('Group');
    509:
    510:         // create a ModelJoin object for this join
    511:         $join = new ModelJoin();
    512:         $join->setJoinType($joinType);
    513:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    514:         if ($previousJoin = $this->getPreviousJoin()) {
    515:             $join->setPreviousJoin($previousJoin);
    516:         }
    517:
    518:         // add the ModelJoin to the current object
    519:         if ($relationAlias) {
    520:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    521:             $this->addJoinObject($join, $relationAlias);
    522:         } else {
    523:             $this->addJoinObject($join, 'Group');
    524:         }
    525:
    526:         return $this;
    527:     }
    528:
    529:     /**
    530:      * Use the Group relation Group object
    531:      *
    532:      * @see       useQuery()
    533:      *
    534:      * @param     string $relationAlias optional alias for the relation,
    535:      *                                   to be used as main alias in the secondary query
    536:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    537:      *
    538:      * @return   \Thelia\Model\GroupQuery A secondary query class using the current class as primary query
    539:      */
    540:     public function useGroupQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    541:     {
    542:         return $this
    543:             ->joinGroup($relationAlias, $joinType)
    544:             ->useQuery($relationAlias ? $relationAlias : 'Group', '\Thelia\Model\GroupQuery');
    545:     }
    546:
    547:     /**
    548:      * Filter the query by a related Admin object
    549:      *
    550:      * @param   Admin|PropelObjectCollection $admin The related object(s) to use as filter
    551:      * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
    552:      *
    553:      * @return                 AdminGroupQuery The current query, for fluid interface
    554:      * @throws PropelException - if the provided filter is invalid.
    555:      */
    556:     public function filterByAdmin($admin, $comparison = null)
    557:     {
    558:         if ($admin instanceof Admin) {
    559:             return $this
    560:                 ->addUsingAlias(AdminGroupPeer::ADMIN_ID, $admin->getId(), $comparison);
    561:         } elseif ($admin instanceof PropelObjectCollection) {
    562:             if (null === $comparison) {
    563:                 $comparison = Criteria::IN;
    564:             }
    565:
    566:             return $this
    567:                 ->addUsingAlias(AdminGroupPeer::ADMIN_ID, $admin->toKeyValue('PrimaryKey', 'Id'), $comparison);
    568:         } else {
    569:             throw new PropelException('filterByAdmin() only accepts arguments of type Admin or PropelCollection');
    570:         }
    571:     }
    572:
    573:     /**
    574:      * Adds a JOIN clause to the query using the Admin relation
    575:      *
    576:      * @param     string $relationAlias optional alias for the relation
    577:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    578:      *
    579:      * @return AdminGroupQuery The current query, for fluid interface
    580:      */
    581:     public function joinAdmin($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    582:     {
    583:         $tableMap = $this->getTableMap();
    584:         $relationMap = $tableMap->getRelation('Admin');
    585:
    586:         // create a ModelJoin object for this join
    587:         $join = new ModelJoin();
    588:         $join->setJoinType($joinType);
    589:         $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
    590:         if ($previousJoin = $this->getPreviousJoin()) {
    591:             $join->setPreviousJoin($previousJoin);
    592:         }
    593:
    594:         // add the ModelJoin to the current object
    595:         if ($relationAlias) {
    596:             $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
    597:             $this->addJoinObject($join, $relationAlias);
    598:         } else {
    599:             $this->addJoinObject($join, 'Admin');
    600:         }
    601:
    602:         return $this;
    603:     }
    604:
    605:     /**
    606:      * Use the Admin relation Admin object
    607:      *
    608:      * @see       useQuery()
    609:      *
    610:      * @param     string $relationAlias optional alias for the relation,
    611:      *                                   to be used as main alias in the secondary query
    612:      * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
    613:      *
    614:      * @return   \Thelia\Model\AdminQuery A secondary query class using the current class as primary query
    615:      */
    616:     public function useAdminQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
    617:     {
    618:         return $this
    619:             ->joinAdmin($relationAlias, $joinType)
    620:             ->useQuery($relationAlias ? $relationAlias : 'Admin', '\Thelia\Model\AdminQuery');
    621:     }
    622:
    623:     /**
    624:      * Exclude object from result
    625:      *
    626:      * @param   AdminGroup $adminGroup Object to remove from the list of results
    627:      *
    628:      * @return AdminGroupQuery The current query, for fluid interface
    629:      */
    630:     public function prune($adminGroup = null)
    631:     {
    632:         if ($adminGroup) {
    633:             $this->addUsingAlias(AdminGroupPeer::ID, $adminGroup->getId(), Criteria::NOT_EQUAL);
    634:         }
    635:
    636:         return $this;
    637:     }
    638:
    639:     // timestampable behavior
    640:
    641:     /**
    642:      * Filter by the latest updated
    643:      *
    644:      * @param      int $nbDays Maximum age of the latest update in days
    645:      *
    646:      * @return     AdminGroupQuery The current query, for fluid interface
    647:      */
    648:     public function recentlyUpdated($nbDays = 7)
    649:     {
    650:         return $this->addUsingAlias(AdminGroupPeer::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    651:     }
    652:
    653:     /**
    654:      * Order by update date desc
    655:      *
    656:      * @return     AdminGroupQuery The current query, for fluid interface
    657:      */
    658:     public function lastUpdatedFirst()
    659:     {
    660:         return $this->addDescendingOrderByColumn(AdminGroupPeer::UPDATED_AT);
    661:     }
    662:
    663:     /**
    664:      * Order by update date asc
    665:      *
    666:      * @return     AdminGroupQuery The current query, for fluid interface
    667:      */
    668:     public function firstUpdatedFirst()
    669:     {
    670:         return $this->addAscendingOrderByColumn(AdminGroupPeer::UPDATED_AT);
    671:     }
    672:
    673:     /**
    674:      * Filter by the latest created
    675:      *
    676:      * @param      int $nbDays Maximum age of in days
    677:      *
    678:      * @return     AdminGroupQuery The current query, for fluid interface
    679:      */
    680:     public function recentlyCreated($nbDays = 7)
    681:     {
    682:         return $this->addUsingAlias(AdminGroupPeer::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
    683:     }
    684:
    685:     /**
    686:      * Order by create date desc
    687:      *
    688:      * @return     AdminGroupQuery The current query, for fluid interface
    689:      */
    690:     public function lastCreatedFirst()
    691:     {
    692:         return $this->addDescendingOrderByColumn(AdminGroupPeer::CREATED_AT);
    693:     }
    694:
    695:     /**
    696:      * Order by create date asc
    697:      *
    698:      * @return     AdminGroupQuery The current query, for fluid interface
    699:      */
    700:     public function firstCreatedFirst()
    701:     {
    702:         return $this->addAscendingOrderByColumn(AdminGroupPeer::CREATED_AT);
    703:     }
    704: }
    705: