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