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