1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace core\models\Base; |
4
|
|
|
|
5
|
|
|
use \Exception; |
6
|
|
|
use \PDO; |
7
|
|
|
use \SCategory; |
8
|
|
|
use \SProducts; |
9
|
|
|
use Map\SCategoryTableMap; |
10
|
|
|
use Map\SProductsTableMap; |
11
|
|
|
use Propel\Runtime\Propel; |
12
|
|
|
use Propel\Runtime\ActiveQuery\Criteria; |
13
|
|
|
use Propel\Runtime\ActiveQuery\ModelCriteria; |
14
|
|
|
use Propel\Runtime\ActiveQuery\ModelJoin; |
15
|
|
|
use Propel\Runtime\Collection\ObjectCollection; |
16
|
|
|
use Propel\Runtime\Connection\ConnectionInterface; |
17
|
|
|
use Propel\Runtime\Exception\PropelException; |
18
|
|
|
use core\models\Route as ChildRoute; |
19
|
|
|
use core\models\RouteQuery as ChildRouteQuery; |
20
|
|
|
use core\models\Map\RouteTableMap; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Base class that represents a query for the 'route' table. |
24
|
|
|
* |
25
|
|
|
* |
26
|
|
|
* |
27
|
|
|
* @method ChildRouteQuery orderById($order = Criteria::ASC) Order by the id column |
28
|
|
|
* @method ChildRouteQuery orderByEntityId($order = Criteria::ASC) Order by the entity_id column |
29
|
|
|
* @method ChildRouteQuery orderByType($order = Criteria::ASC) Order by the type column |
30
|
|
|
* @method ChildRouteQuery orderByParentUrl($order = Criteria::ASC) Order by the parent_url column |
31
|
|
|
* @method ChildRouteQuery orderByUrl($order = Criteria::ASC) Order by the url column |
32
|
|
|
* |
33
|
|
|
* @method ChildRouteQuery groupById() Group by the id column |
34
|
|
|
* @method ChildRouteQuery groupByEntityId() Group by the entity_id column |
35
|
|
|
* @method ChildRouteQuery groupByType() Group by the type column |
36
|
|
|
* @method ChildRouteQuery groupByParentUrl() Group by the parent_url column |
37
|
|
|
* @method ChildRouteQuery groupByUrl() Group by the url column |
38
|
|
|
* |
39
|
|
|
* @method ChildRouteQuery leftJoin($relation) Adds a LEFT JOIN clause to the query |
40
|
|
|
* @method ChildRouteQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query |
41
|
|
|
* @method ChildRouteQuery innerJoin($relation) Adds a INNER JOIN clause to the query |
42
|
|
|
* |
43
|
|
|
* @method ChildRouteQuery leftJoinWith($relation) Adds a LEFT JOIN clause and with to the query |
44
|
|
|
* @method ChildRouteQuery rightJoinWith($relation) Adds a RIGHT JOIN clause and with to the query |
45
|
|
|
* @method ChildRouteQuery innerJoinWith($relation) Adds a INNER JOIN clause and with to the query |
46
|
|
|
* |
47
|
|
|
* @method ChildRouteQuery leftJoinSCategory($relationAlias = null) Adds a LEFT JOIN clause to the query using the SCategory relation |
48
|
|
|
* @method ChildRouteQuery rightJoinSCategory($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SCategory relation |
49
|
|
|
* @method ChildRouteQuery innerJoinSCategory($relationAlias = null) Adds a INNER JOIN clause to the query using the SCategory relation |
50
|
|
|
* |
51
|
|
|
* @method ChildRouteQuery joinWithSCategory($joinType = Criteria::INNER_JOIN) Adds a join clause and with to the query using the SCategory relation |
52
|
|
|
* |
53
|
|
|
* @method ChildRouteQuery leftJoinWithSCategory() Adds a LEFT JOIN clause and with to the query using the SCategory relation |
54
|
|
|
* @method ChildRouteQuery rightJoinWithSCategory() Adds a RIGHT JOIN clause and with to the query using the SCategory relation |
55
|
|
|
* @method ChildRouteQuery innerJoinWithSCategory() Adds a INNER JOIN clause and with to the query using the SCategory relation |
56
|
|
|
* |
57
|
|
|
* @method ChildRouteQuery leftJoinSProducts($relationAlias = null) Adds a LEFT JOIN clause to the query using the SProducts relation |
58
|
|
|
* @method ChildRouteQuery rightJoinSProducts($relationAlias = null) Adds a RIGHT JOIN clause to the query using the SProducts relation |
59
|
|
|
* @method ChildRouteQuery innerJoinSProducts($relationAlias = null) Adds a INNER JOIN clause to the query using the SProducts relation |
60
|
|
|
* |
61
|
|
|
* @method ChildRouteQuery joinWithSProducts($joinType = Criteria::INNER_JOIN) Adds a join clause and with to the query using the SProducts relation |
62
|
|
|
* |
63
|
|
|
* @method ChildRouteQuery leftJoinWithSProducts() Adds a LEFT JOIN clause and with to the query using the SProducts relation |
64
|
|
|
* @method ChildRouteQuery rightJoinWithSProducts() Adds a RIGHT JOIN clause and with to the query using the SProducts relation |
65
|
|
|
* @method ChildRouteQuery innerJoinWithSProducts() Adds a INNER JOIN clause and with to the query using the SProducts relation |
66
|
|
|
* |
67
|
|
|
* @method \SCategoryQuery|\SProductsQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria |
68
|
|
|
* |
69
|
|
|
* @method ChildRoute findOne(ConnectionInterface $con = null) Return the first ChildRoute matching the query |
70
|
|
|
* @method ChildRoute findOneOrCreate(ConnectionInterface $con = null) Return the first ChildRoute matching the query, or a new ChildRoute object populated from the query conditions when no match is found |
71
|
|
|
* |
72
|
|
|
* @method ChildRoute findOneById(int $id) Return the first ChildRoute filtered by the id column |
73
|
|
|
* @method ChildRoute findOneByEntityId(int $entity_id) Return the first ChildRoute filtered by the entity_id column |
74
|
|
|
* @method ChildRoute findOneByType(string $type) Return the first ChildRoute filtered by the type column |
75
|
|
|
* @method ChildRoute findOneByParentUrl(string $parent_url) Return the first ChildRoute filtered by the parent_url column |
76
|
|
|
* @method ChildRoute findOneByUrl(string $url) Return the first ChildRoute filtered by the url column * |
77
|
|
|
|
78
|
|
|
* @method ChildRoute requirePk($key, ConnectionInterface $con = null) Return the ChildRoute by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
79
|
|
|
* @method ChildRoute requireOne(ConnectionInterface $con = null) Return the first ChildRoute matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
80
|
|
|
* |
81
|
|
|
* @method ChildRoute requireOneById(int $id) Return the first ChildRoute filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
82
|
|
|
* @method ChildRoute requireOneByEntityId(int $entity_id) Return the first ChildRoute filtered by the entity_id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
83
|
|
|
* @method ChildRoute requireOneByType(string $type) Return the first ChildRoute filtered by the type column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
84
|
|
|
* @method ChildRoute requireOneByParentUrl(string $parent_url) Return the first ChildRoute filtered by the parent_url column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
85
|
|
|
* @method ChildRoute requireOneByUrl(string $url) Return the first ChildRoute filtered by the url column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
86
|
|
|
* |
87
|
|
|
* @method ChildRoute[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildRoute objects based on current ModelCriteria |
88
|
|
|
* @method ChildRoute[]|ObjectCollection findById(int $id) Return ChildRoute objects filtered by the id column |
89
|
|
|
* @method ChildRoute[]|ObjectCollection findByEntityId(int $entity_id) Return ChildRoute objects filtered by the entity_id column |
90
|
|
|
* @method ChildRoute[]|ObjectCollection findByType(string $type) Return ChildRoute objects filtered by the type column |
91
|
|
|
* @method ChildRoute[]|ObjectCollection findByParentUrl(string $parent_url) Return ChildRoute objects filtered by the parent_url column |
92
|
|
|
* @method ChildRoute[]|ObjectCollection findByUrl(string $url) Return ChildRoute objects filtered by the url column |
93
|
|
|
* @method ChildRoute[]|\Propel\Runtime\Util\PropelModelPager paginate($page = 1, $maxPerPage = 10, ConnectionInterface $con = null) Issue a SELECT query based on the current ModelCriteria and uses a page and a maximum number of results per page to compute an offset and a limit |
94
|
|
|
* |
95
|
|
|
*/ |
|
|
|
|
96
|
|
|
abstract class RouteQuery extends ModelCriteria |
97
|
|
|
{ |
|
|
|
|
98
|
|
|
protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException'; |
|
|
|
|
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Initializes internal state of \core\models\Base\RouteQuery object. |
102
|
|
|
* |
103
|
|
|
* @param string $dbName The database name |
104
|
|
|
* @param string $modelName The phpName of a model, e.g. 'Book' |
105
|
|
|
* @param string $modelAlias The alias for the model in this query, e.g. 'b' |
106
|
|
|
*/ |
107
|
|
|
public function __construct($dbName = 'Shop', $modelName = '\\core\\models\\Route', $modelAlias = null) |
108
|
|
|
{ |
109
|
|
|
parent::__construct($dbName, $modelName, $modelAlias); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Returns a new ChildRouteQuery object. |
114
|
|
|
* |
115
|
|
|
* @param string $modelAlias The alias of a model in the query |
116
|
|
|
* @param Criteria $criteria Optional Criteria to build the query from |
117
|
|
|
* |
118
|
|
|
* @return ChildRouteQuery |
119
|
|
|
*/ |
120
|
|
|
public static function create($modelAlias = null, Criteria $criteria = null) |
121
|
|
|
{ |
122
|
|
|
if ($criteria instanceof ChildRouteQuery) { |
123
|
|
|
return $criteria; |
124
|
|
|
} |
125
|
|
|
$query = new ChildRouteQuery(); |
126
|
|
|
if (null !== $modelAlias) { |
127
|
|
|
$query->setModelAlias($modelAlias); |
128
|
|
|
} |
129
|
|
|
if ($criteria instanceof Criteria) { |
130
|
|
|
$query->mergeWith($criteria); |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
return $query; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Find object by primary key. |
138
|
|
|
* Propel uses the instance pool to skip the database if the object exists. |
139
|
|
|
* Go fast if the query is untouched. |
140
|
|
|
* |
141
|
|
|
* <code> |
|
|
|
|
142
|
|
|
* $obj = $c->findPk(12, $con); |
143
|
|
|
* </code> |
144
|
|
|
* |
145
|
|
|
* @param mixed $key Primary key to use for the query |
146
|
|
|
* @param ConnectionInterface $con an optional connection object |
147
|
|
|
* |
148
|
|
|
* @return ChildRoute|array|mixed the result, formatted by the current formatter |
149
|
|
|
*/ |
150
|
|
View Code Duplication |
public function findPk($key, ConnectionInterface $con = null) |
151
|
|
|
{ |
152
|
|
|
if ($key === null) { |
153
|
|
|
return null; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
if ($con === null) { |
157
|
|
|
$con = Propel::getServiceContainer()->getReadConnection(RouteTableMap::DATABASE_NAME); |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
$this->basePreSelect($con); |
161
|
|
|
|
162
|
|
|
if ( |
|
|
|
|
163
|
|
|
$this->formatter || $this->modelAlias || $this->with || $this->select |
|
|
|
|
164
|
|
|
|| $this->selectColumns || $this->asColumns || $this->selectModifiers |
165
|
|
|
|| $this->map || $this->having || $this->joins |
166
|
|
|
) { |
167
|
|
|
return $this->findPkComplex($key, $con); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
if ((null !== ($obj = RouteTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key)))) { |
171
|
|
|
// the object is already in the instance pool |
172
|
|
|
return $obj; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
return $this->findPkSimple($key, $con); |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* Find object by primary key using raw SQL to go fast. |
180
|
|
|
* Bypass doSelect() and the object formatter by using generated code. |
181
|
|
|
* |
182
|
|
|
* @param mixed $key Primary key to use for the query |
183
|
|
|
* @param ConnectionInterface $con A connection object |
184
|
|
|
* |
185
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
|
|
|
|
186
|
|
|
* |
187
|
|
|
* @return ChildRoute A model object, or null if the key is not found |
|
|
|
|
188
|
|
|
*/ |
189
|
|
|
protected function findPkSimple($key, ConnectionInterface $con) |
190
|
|
|
{ |
191
|
|
|
$sql = 'SELECT id, entity_id, type, parent_url, url FROM route WHERE id = :p0'; |
192
|
|
|
try { |
193
|
|
|
$stmt = $con->prepare($sql); |
194
|
|
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); |
195
|
|
|
$stmt->execute(); |
196
|
|
|
} catch (Exception $e) { |
197
|
|
|
Propel::log($e->getMessage(), Propel::LOG_ERR); |
198
|
|
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); |
199
|
|
|
} |
200
|
|
|
$obj = null; |
201
|
|
|
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { |
202
|
|
|
/** @var ChildRoute $obj */ |
203
|
|
|
$obj = new ChildRoute(); |
204
|
|
|
$obj->hydrate($row); |
205
|
|
|
RouteTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key); |
206
|
|
|
} |
207
|
|
|
$stmt->closeCursor(); |
208
|
|
|
|
209
|
|
|
return $obj; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Find object by primary key. |
214
|
|
|
* |
215
|
|
|
* @param mixed $key Primary key to use for the query |
216
|
|
|
* @param ConnectionInterface $con A connection object |
217
|
|
|
* |
218
|
|
|
* @return ChildRoute|array|mixed the result, formatted by the current formatter |
219
|
|
|
*/ |
220
|
|
View Code Duplication |
protected function findPkComplex($key, ConnectionInterface $con) |
221
|
|
|
{ |
222
|
|
|
// As the query uses a PK condition, no limit(1) is necessary. |
223
|
|
|
$criteria = $this->isKeepQuery() ? clone $this : $this; |
224
|
|
|
$dataFetcher = $criteria |
225
|
|
|
->filterByPrimaryKey($key) |
226
|
|
|
->doSelect($con); |
227
|
|
|
|
228
|
|
|
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* Find objects by primary key |
233
|
|
|
* <code> |
234
|
|
|
* $objs = $c->findPks(array(12, 56, 832), $con); |
235
|
|
|
* </code> |
236
|
|
|
* @param array $keys Primary keys to use for the query |
237
|
|
|
* @param ConnectionInterface $con an optional connection object |
238
|
|
|
* |
239
|
|
|
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter |
240
|
|
|
*/ |
241
|
|
View Code Duplication |
public function findPks($keys, ConnectionInterface $con = null) |
242
|
|
|
{ |
243
|
|
|
if (null === $con) { |
244
|
|
|
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); |
245
|
|
|
} |
246
|
|
|
$this->basePreSelect($con); |
247
|
|
|
$criteria = $this->isKeepQuery() ? clone $this : $this; |
248
|
|
|
$dataFetcher = $criteria |
249
|
|
|
->filterByPrimaryKeys($keys) |
250
|
|
|
->doSelect($con); |
251
|
|
|
|
252
|
|
|
return $criteria->getFormatter()->init($criteria)->format($dataFetcher); |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* Filter the query by primary key |
257
|
|
|
* |
258
|
|
|
* @param mixed $key Primary key to use for the query |
259
|
|
|
* |
260
|
|
|
* @return $this|ChildRouteQuery The current query, for fluid interface |
|
|
|
|
261
|
|
|
*/ |
262
|
|
|
public function filterByPrimaryKey($key) |
263
|
|
|
{ |
264
|
|
|
|
265
|
|
|
return $this->addUsingAlias(RouteTableMap::COL_ID, $key, Criteria::EQUAL); |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* Filter the query by a list of primary keys |
270
|
|
|
* |
271
|
|
|
* @param array $keys The list of primary key to use for the query |
272
|
|
|
* |
273
|
|
|
* @return $this|ChildRouteQuery The current query, for fluid interface |
|
|
|
|
274
|
|
|
*/ |
275
|
|
|
public function filterByPrimaryKeys($keys) |
276
|
|
|
{ |
277
|
|
|
|
278
|
|
|
return $this->addUsingAlias(RouteTableMap::COL_ID, $keys, Criteria::IN); |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
/** |
282
|
|
|
* Filter the query on the id column |
283
|
|
|
* |
284
|
|
|
* Example usage: |
285
|
|
|
* <code> |
286
|
|
|
* $query->filterById(1234); // WHERE id = 1234 |
287
|
|
|
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34) |
288
|
|
|
* $query->filterById(array('min' => 12)); // WHERE id > 12 |
289
|
|
|
* </code> |
290
|
|
|
* |
291
|
|
|
* @param mixed $id The value to use as filter. |
292
|
|
|
* Use scalar values for equality. |
293
|
|
|
* Use array values for in_array() equivalent. |
294
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
295
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
296
|
|
|
* |
297
|
|
|
* @return $this|ChildRouteQuery The current query, for fluid interface |
|
|
|
|
298
|
|
|
*/ |
299
|
|
|
public function filterById($id = null, $comparison = null) |
300
|
|
|
{ |
301
|
|
|
if (is_array($id)) { |
302
|
|
|
$useMinMax = false; |
303
|
|
|
if (isset($id['min'])) { |
304
|
|
|
$this->addUsingAlias(RouteTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL); |
305
|
|
|
$useMinMax = true; |
306
|
|
|
} |
307
|
|
|
if (isset($id['max'])) { |
308
|
|
|
$this->addUsingAlias(RouteTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL); |
309
|
|
|
$useMinMax = true; |
310
|
|
|
} |
311
|
|
|
if ($useMinMax) { |
312
|
|
|
return $this; |
313
|
|
|
} |
314
|
|
|
if (null === $comparison) { |
315
|
|
|
$comparison = Criteria::IN; |
316
|
|
|
} |
317
|
|
|
} |
318
|
|
|
|
319
|
|
|
return $this->addUsingAlias(RouteTableMap::COL_ID, $id, $comparison); |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* Filter the query on the entity_id column |
324
|
|
|
* |
325
|
|
|
* Example usage: |
326
|
|
|
* <code> |
327
|
|
|
* $query->filterByEntityId(1234); // WHERE entity_id = 1234 |
328
|
|
|
* $query->filterByEntityId(array(12, 34)); // WHERE entity_id IN (12, 34) |
329
|
|
|
* $query->filterByEntityId(array('min' => 12)); // WHERE entity_id > 12 |
330
|
|
|
* </code> |
331
|
|
|
* |
332
|
|
|
* @param mixed $entityId The value to use as filter. |
333
|
|
|
* Use scalar values for equality. |
334
|
|
|
* Use array values for in_array() equivalent. |
335
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
336
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
337
|
|
|
* |
338
|
|
|
* @return $this|ChildRouteQuery The current query, for fluid interface |
|
|
|
|
339
|
|
|
*/ |
340
|
|
|
public function filterByEntityId($entityId = null, $comparison = null) |
341
|
|
|
{ |
342
|
|
|
if (is_array($entityId)) { |
343
|
|
|
$useMinMax = false; |
344
|
|
|
if (isset($entityId['min'])) { |
345
|
|
|
$this->addUsingAlias(RouteTableMap::COL_ENTITY_ID, $entityId['min'], Criteria::GREATER_EQUAL); |
346
|
|
|
$useMinMax = true; |
347
|
|
|
} |
348
|
|
|
if (isset($entityId['max'])) { |
349
|
|
|
$this->addUsingAlias(RouteTableMap::COL_ENTITY_ID, $entityId['max'], Criteria::LESS_EQUAL); |
350
|
|
|
$useMinMax = true; |
351
|
|
|
} |
352
|
|
|
if ($useMinMax) { |
353
|
|
|
return $this; |
354
|
|
|
} |
355
|
|
|
if (null === $comparison) { |
356
|
|
|
$comparison = Criteria::IN; |
357
|
|
|
} |
358
|
|
|
} |
359
|
|
|
|
360
|
|
|
return $this->addUsingAlias(RouteTableMap::COL_ENTITY_ID, $entityId, $comparison); |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* Filter the query on the type column |
365
|
|
|
* |
366
|
|
|
* Example usage: |
367
|
|
|
* <code> |
368
|
|
|
* $query->filterByType('fooValue'); // WHERE type = 'fooValue' |
369
|
|
|
* $query->filterByType('%fooValue%', Criteria::LIKE); // WHERE type LIKE '%fooValue%' |
370
|
|
|
* </code> |
371
|
|
|
* |
372
|
|
|
* @param string $type The value to use as filter. |
373
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
374
|
|
|
* |
375
|
|
|
* @return $this|ChildRouteQuery The current query, for fluid interface |
|
|
|
|
376
|
|
|
*/ |
377
|
|
View Code Duplication |
public function filterByType($type = null, $comparison = null) |
378
|
|
|
{ |
379
|
|
|
if (null === $comparison) { |
380
|
|
|
if (is_array($type)) { |
381
|
|
|
$comparison = Criteria::IN; |
382
|
|
|
} |
383
|
|
|
} |
384
|
|
|
|
385
|
|
|
return $this->addUsingAlias(RouteTableMap::COL_TYPE, $type, $comparison); |
386
|
|
|
} |
387
|
|
|
|
388
|
|
|
/** |
389
|
|
|
* Filter the query on the parent_url column |
390
|
|
|
* |
391
|
|
|
* Example usage: |
392
|
|
|
* <code> |
393
|
|
|
* $query->filterByParentUrl('fooValue'); // WHERE parent_url = 'fooValue' |
394
|
|
|
* $query->filterByParentUrl('%fooValue%', Criteria::LIKE); // WHERE parent_url LIKE '%fooValue%' |
395
|
|
|
* </code> |
396
|
|
|
* |
397
|
|
|
* @param string $parentUrl The value to use as filter. |
398
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
399
|
|
|
* |
400
|
|
|
* @return $this|ChildRouteQuery The current query, for fluid interface |
|
|
|
|
401
|
|
|
*/ |
402
|
|
View Code Duplication |
public function filterByParentUrl($parentUrl = null, $comparison = null) |
403
|
|
|
{ |
404
|
|
|
if (null === $comparison) { |
405
|
|
|
if (is_array($parentUrl)) { |
406
|
|
|
$comparison = Criteria::IN; |
407
|
|
|
} |
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
return $this->addUsingAlias(RouteTableMap::COL_PARENT_URL, $parentUrl, $comparison); |
411
|
|
|
} |
412
|
|
|
|
413
|
|
|
/** |
414
|
|
|
* Filter the query on the url column |
415
|
|
|
* |
416
|
|
|
* Example usage: |
417
|
|
|
* <code> |
418
|
|
|
* $query->filterByUrl('fooValue'); // WHERE url = 'fooValue' |
419
|
|
|
* $query->filterByUrl('%fooValue%', Criteria::LIKE); // WHERE url LIKE '%fooValue%' |
420
|
|
|
* </code> |
421
|
|
|
* |
422
|
|
|
* @param string $url The value to use as filter. |
423
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
424
|
|
|
* |
425
|
|
|
* @return $this|ChildRouteQuery The current query, for fluid interface |
|
|
|
|
426
|
|
|
*/ |
427
|
|
View Code Duplication |
public function filterByUrl($url = null, $comparison = null) |
428
|
|
|
{ |
429
|
|
|
if (null === $comparison) { |
430
|
|
|
if (is_array($url)) { |
431
|
|
|
$comparison = Criteria::IN; |
432
|
|
|
} |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
return $this->addUsingAlias(RouteTableMap::COL_URL, $url, $comparison); |
436
|
|
|
} |
437
|
|
|
|
438
|
|
|
/** |
439
|
|
|
* Filter the query by a related \SCategory object |
440
|
|
|
* |
441
|
|
|
* @param \SCategory|ObjectCollection $sCategory the related object to use as filter |
442
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
443
|
|
|
* |
444
|
|
|
* @return ChildRouteQuery The current query, for fluid interface |
445
|
|
|
*/ |
446
|
|
View Code Duplication |
public function filterBySCategory($sCategory, $comparison = null) |
447
|
|
|
{ |
448
|
|
|
if ($sCategory instanceof \SCategory) { |
|
|
|
|
449
|
|
|
return $this |
450
|
|
|
->addUsingAlias(RouteTableMap::COL_ID, $sCategory->getRouteId(), $comparison); |
451
|
|
|
} elseif ($sCategory instanceof ObjectCollection) { |
452
|
|
|
return $this |
453
|
|
|
->useSCategoryQuery() |
454
|
|
|
->filterByPrimaryKeys($sCategory->getPrimaryKeys()) |
455
|
|
|
->endUse(); |
456
|
|
|
} else { |
457
|
|
|
throw new PropelException('filterBySCategory() only accepts arguments of type \SCategory or Collection'); |
458
|
|
|
} |
459
|
|
|
} |
460
|
|
|
|
461
|
|
|
/** |
462
|
|
|
* Adds a JOIN clause to the query using the SCategory relation |
463
|
|
|
* |
464
|
|
|
* @param string $relationAlias optional alias for the relation |
465
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
466
|
|
|
* |
467
|
|
|
* @return $this|ChildRouteQuery The current query, for fluid interface |
|
|
|
|
468
|
|
|
*/ |
469
|
|
View Code Duplication |
public function joinSCategory($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
470
|
|
|
{ |
471
|
|
|
$tableMap = $this->getTableMap(); |
472
|
|
|
$relationMap = $tableMap->getRelation('SCategory'); |
473
|
|
|
|
474
|
|
|
// create a ModelJoin object for this join |
475
|
|
|
$join = new ModelJoin(); |
476
|
|
|
$join->setJoinType($joinType); |
477
|
|
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
478
|
|
|
if ($previousJoin = $this->getPreviousJoin()) { |
479
|
|
|
$join->setPreviousJoin($previousJoin); |
|
|
|
|
480
|
|
|
} |
481
|
|
|
|
482
|
|
|
// add the ModelJoin to the current object |
483
|
|
|
if ($relationAlias) { |
484
|
|
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
485
|
|
|
$this->addJoinObject($join, $relationAlias); |
486
|
|
|
} else { |
487
|
|
|
$this->addJoinObject($join, 'SCategory'); |
488
|
|
|
} |
489
|
|
|
|
490
|
|
|
return $this; |
491
|
|
|
} |
492
|
|
|
|
493
|
|
|
/** |
494
|
|
|
* Use the SCategory relation SCategory object |
495
|
|
|
* |
496
|
|
|
* @see useQuery() |
497
|
|
|
* |
498
|
|
|
* @param string $relationAlias optional alias for the relation, |
|
|
|
|
499
|
|
|
* to be used as main alias in the secondary query |
|
|
|
|
500
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
501
|
|
|
* |
502
|
|
|
* @return \SCategoryQuery A secondary query class using the current class as primary query |
|
|
|
|
503
|
|
|
*/ |
504
|
|
|
public function useSCategoryQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
505
|
|
|
{ |
506
|
|
|
return $this |
507
|
|
|
->joinSCategory($relationAlias, $joinType) |
508
|
|
|
->useQuery($relationAlias ? $relationAlias : 'SCategory', '\SCategoryQuery'); |
509
|
|
|
} |
510
|
|
|
|
511
|
|
|
/** |
512
|
|
|
* Filter the query by a related \SProducts object |
513
|
|
|
* |
514
|
|
|
* @param \SProducts|ObjectCollection $sProducts the related object to use as filter |
515
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
516
|
|
|
* |
517
|
|
|
* @return ChildRouteQuery The current query, for fluid interface |
518
|
|
|
*/ |
519
|
|
View Code Duplication |
public function filterBySProducts($sProducts, $comparison = null) |
520
|
|
|
{ |
521
|
|
|
if ($sProducts instanceof \SProducts) { |
|
|
|
|
522
|
|
|
return $this |
523
|
|
|
->addUsingAlias(RouteTableMap::COL_ID, $sProducts->getRouteId(), $comparison); |
524
|
|
|
} elseif ($sProducts instanceof ObjectCollection) { |
525
|
|
|
return $this |
526
|
|
|
->useSProductsQuery() |
527
|
|
|
->filterByPrimaryKeys($sProducts->getPrimaryKeys()) |
528
|
|
|
->endUse(); |
529
|
|
|
} else { |
530
|
|
|
throw new PropelException('filterBySProducts() only accepts arguments of type \SProducts or Collection'); |
531
|
|
|
} |
532
|
|
|
} |
533
|
|
|
|
534
|
|
|
/** |
535
|
|
|
* Adds a JOIN clause to the query using the SProducts relation |
536
|
|
|
* |
537
|
|
|
* @param string $relationAlias optional alias for the relation |
538
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
539
|
|
|
* |
540
|
|
|
* @return $this|ChildRouteQuery The current query, for fluid interface |
|
|
|
|
541
|
|
|
*/ |
542
|
|
View Code Duplication |
public function joinSProducts($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
543
|
|
|
{ |
544
|
|
|
$tableMap = $this->getTableMap(); |
545
|
|
|
$relationMap = $tableMap->getRelation('SProducts'); |
546
|
|
|
|
547
|
|
|
// create a ModelJoin object for this join |
548
|
|
|
$join = new ModelJoin(); |
549
|
|
|
$join->setJoinType($joinType); |
550
|
|
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
551
|
|
|
if ($previousJoin = $this->getPreviousJoin()) { |
552
|
|
|
$join->setPreviousJoin($previousJoin); |
|
|
|
|
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
// add the ModelJoin to the current object |
556
|
|
|
if ($relationAlias) { |
557
|
|
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
558
|
|
|
$this->addJoinObject($join, $relationAlias); |
559
|
|
|
} else { |
560
|
|
|
$this->addJoinObject($join, 'SProducts'); |
561
|
|
|
} |
562
|
|
|
|
563
|
|
|
return $this; |
564
|
|
|
} |
565
|
|
|
|
566
|
|
|
/** |
567
|
|
|
* Use the SProducts relation SProducts object |
568
|
|
|
* |
569
|
|
|
* @see useQuery() |
570
|
|
|
* |
571
|
|
|
* @param string $relationAlias optional alias for the relation, |
|
|
|
|
572
|
|
|
* to be used as main alias in the secondary query |
|
|
|
|
573
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
574
|
|
|
* |
575
|
|
|
* @return \SProductsQuery A secondary query class using the current class as primary query |
|
|
|
|
576
|
|
|
*/ |
577
|
|
|
public function useSProductsQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
578
|
|
|
{ |
579
|
|
|
return $this |
580
|
|
|
->joinSProducts($relationAlias, $joinType) |
581
|
|
|
->useQuery($relationAlias ? $relationAlias : 'SProducts', '\SProductsQuery'); |
582
|
|
|
} |
583
|
|
|
|
584
|
|
|
/** |
585
|
|
|
* Exclude object from result |
586
|
|
|
* |
587
|
|
|
* @param ChildRoute $route Object to remove from the list of results |
588
|
|
|
* |
589
|
|
|
* @return $this|ChildRouteQuery The current query, for fluid interface |
|
|
|
|
590
|
|
|
*/ |
591
|
|
|
public function prune($route = null) |
592
|
|
|
{ |
593
|
|
|
if ($route) { |
594
|
|
|
$this->addUsingAlias(RouteTableMap::COL_ID, $route->getId(), Criteria::NOT_EQUAL); |
595
|
|
|
} |
596
|
|
|
|
597
|
|
|
return $this; |
598
|
|
|
} |
599
|
|
|
|
600
|
|
|
/** |
601
|
|
|
* Deletes all rows from the route table. |
602
|
|
|
* |
603
|
|
|
* @param ConnectionInterface $con the connection to use |
604
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). |
605
|
|
|
*/ |
606
|
|
View Code Duplication |
public function doDeleteAll(ConnectionInterface $con = null) |
607
|
|
|
{ |
608
|
|
|
if (null === $con) { |
609
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(RouteTableMap::DATABASE_NAME); |
610
|
|
|
} |
611
|
|
|
|
612
|
|
|
// use transaction because $criteria could contain info |
613
|
|
|
// for more than one table or we could emulating ON DELETE CASCADE, etc. |
614
|
|
|
return $con->transaction(function () use ($con) { |
615
|
|
|
$affectedRows = 0; // initialize var to track total num of affected rows |
616
|
|
|
$affectedRows += $this->doOnDeleteCascade($con); |
617
|
|
|
$affectedRows += parent::doDeleteAll($con); |
618
|
|
|
// Because this db requires some delete cascade/set null emulation, we have to |
619
|
|
|
// clear the cached instance *after* the emulation has happened (since |
620
|
|
|
// instances get re-added by the select statement contained therein). |
621
|
|
|
RouteTableMap::clearInstancePool(); |
622
|
|
|
RouteTableMap::clearRelatedInstancePool(); |
623
|
|
|
|
624
|
|
|
return $affectedRows; |
625
|
|
|
}); |
626
|
|
|
} |
627
|
|
|
|
628
|
|
|
/** |
629
|
|
|
* Performs a DELETE on the database based on the current ModelCriteria |
630
|
|
|
* |
631
|
|
|
* @param ConnectionInterface $con the connection to use |
632
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
633
|
|
|
* if supported by native driver or if emulated using Propel. |
634
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
635
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
636
|
|
|
*/ |
637
|
|
View Code Duplication |
public function delete(ConnectionInterface $con = null) |
638
|
|
|
{ |
639
|
|
|
if (null === $con) { |
640
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(RouteTableMap::DATABASE_NAME); |
641
|
|
|
} |
642
|
|
|
|
643
|
|
|
$criteria = $this; |
644
|
|
|
|
645
|
|
|
// Set the correct dbName |
646
|
|
|
$criteria->setDbName(RouteTableMap::DATABASE_NAME); |
647
|
|
|
|
648
|
|
|
// use transaction because $criteria could contain info |
649
|
|
|
// for more than one table or we could emulating ON DELETE CASCADE, etc. |
650
|
|
|
return $con->transaction(function () use ($con, $criteria) { |
651
|
|
|
$affectedRows = 0; // initialize var to track total num of affected rows |
652
|
|
|
|
653
|
|
|
// cloning the Criteria in case it's modified by doSelect() or doSelectStmt() |
654
|
|
|
$c = clone $criteria; |
655
|
|
|
$affectedRows += $c->doOnDeleteCascade($con); |
656
|
|
|
|
657
|
|
|
RouteTableMap::removeInstanceFromPool($criteria); |
658
|
|
|
|
659
|
|
|
$affectedRows += ModelCriteria::delete($con); |
660
|
|
|
RouteTableMap::clearRelatedInstancePool(); |
661
|
|
|
|
662
|
|
|
return $affectedRows; |
663
|
|
|
}); |
664
|
|
|
} |
665
|
|
|
|
666
|
|
|
/** |
667
|
|
|
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this |
668
|
|
|
* feature (like MySQL or SQLite). |
669
|
|
|
* |
670
|
|
|
* This method is not very speedy because it must perform a query first to get |
671
|
|
|
* the implicated records and then perform the deletes by calling those Query classes. |
672
|
|
|
* |
673
|
|
|
* This method should be used within a transaction if possible. |
674
|
|
|
* |
675
|
|
|
* @param ConnectionInterface $con |
676
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). |
677
|
|
|
*/ |
678
|
|
|
protected function doOnDeleteCascade(ConnectionInterface $con) |
679
|
|
|
{ |
680
|
|
|
// initialize var to track total num of affected rows |
681
|
|
|
$affectedRows = 0; |
682
|
|
|
|
683
|
|
|
// first find the objects that are implicated by the $this |
684
|
|
|
$objects = ChildRouteQuery::create(null, $this)->find($con); |
685
|
|
View Code Duplication |
foreach ($objects as $obj) { |
686
|
|
|
|
|
|
|
|
687
|
|
|
|
688
|
|
|
// delete related SCategory objects |
689
|
|
|
$query = new \SCategoryQuery; |
|
|
|
|
690
|
|
|
|
691
|
|
|
$query->add(SCategoryTableMap::COL_ROUTE_ID, $obj->getId()); |
692
|
|
|
$affectedRows += $query->delete($con); |
693
|
|
|
|
694
|
|
|
// delete related SProducts objects |
695
|
|
|
$query = new \SProductsQuery; |
|
|
|
|
696
|
|
|
|
697
|
|
|
$query->add(SProductsTableMap::COL_ROUTE_ID, $obj->getId()); |
698
|
|
|
$affectedRows += $query->delete($con); |
699
|
|
|
} |
700
|
|
|
|
701
|
|
|
return $affectedRows; |
702
|
|
|
} |
703
|
|
|
|
704
|
|
|
} // RouteQuery |
|
|
|
|
705
|
|
|
|