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