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