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

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