1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace xbanners\models\Base; |
4
|
|
|
|
5
|
|
|
use \Exception; |
6
|
|
|
use \PDO; |
7
|
|
|
use Propel\Runtime\Propel; |
8
|
|
|
use Propel\Runtime\ActiveQuery\Criteria; |
9
|
|
|
use Propel\Runtime\ActiveQuery\ModelCriteria; |
10
|
|
|
use Propel\Runtime\ActiveQuery\ModelJoin; |
11
|
|
|
use Propel\Runtime\Collection\ObjectCollection; |
12
|
|
|
use Propel\Runtime\Connection\ConnectionInterface; |
13
|
|
|
use Propel\Runtime\Exception\PropelException; |
14
|
|
|
use xbanners\models\BannersI18n as ChildBannersI18n; |
15
|
|
|
use xbanners\models\BannersI18nQuery as ChildBannersI18nQuery; |
16
|
|
|
use xbanners\models\Map\BannersI18nTableMap; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Base class that represents a query for the 'banners_i18n' table. |
20
|
|
|
* |
21
|
|
|
* |
22
|
|
|
* |
23
|
|
|
* @method ChildBannersI18nQuery orderById($order = Criteria::ASC) Order by the id column |
24
|
|
|
* @method ChildBannersI18nQuery orderByLocale($order = Criteria::ASC) Order by the locale column |
25
|
|
|
* @method ChildBannersI18nQuery orderByName($order = Criteria::ASC) Order by the name column |
26
|
|
|
* |
27
|
|
|
* @method ChildBannersI18nQuery groupById() Group by the id column |
28
|
|
|
* @method ChildBannersI18nQuery groupByLocale() Group by the locale column |
29
|
|
|
* @method ChildBannersI18nQuery groupByName() Group by the name column |
30
|
|
|
* |
31
|
|
|
* @method ChildBannersI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query |
32
|
|
|
* @method ChildBannersI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query |
33
|
|
|
* @method ChildBannersI18nQuery innerJoin($relation) Adds a INNER JOIN clause to the query |
34
|
|
|
* |
35
|
|
|
* @method ChildBannersI18nQuery leftJoinWith($relation) Adds a LEFT JOIN clause and with to the query |
36
|
|
|
* @method ChildBannersI18nQuery rightJoinWith($relation) Adds a RIGHT JOIN clause and with to the query |
37
|
|
|
* @method ChildBannersI18nQuery innerJoinWith($relation) Adds a INNER JOIN clause and with to the query |
38
|
|
|
* |
39
|
|
|
* @method ChildBannersI18nQuery leftJoinBanners($relationAlias = null) Adds a LEFT JOIN clause to the query using the Banners relation |
40
|
|
|
* @method ChildBannersI18nQuery rightJoinBanners($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Banners relation |
41
|
|
|
* @method ChildBannersI18nQuery innerJoinBanners($relationAlias = null) Adds a INNER JOIN clause to the query using the Banners relation |
42
|
|
|
* |
43
|
|
|
* @method ChildBannersI18nQuery joinWithBanners($joinType = Criteria::INNER_JOIN) Adds a join clause and with to the query using the Banners relation |
44
|
|
|
* |
45
|
|
|
* @method ChildBannersI18nQuery leftJoinWithBanners() Adds a LEFT JOIN clause and with to the query using the Banners relation |
46
|
|
|
* @method ChildBannersI18nQuery rightJoinWithBanners() Adds a RIGHT JOIN clause and with to the query using the Banners relation |
47
|
|
|
* @method ChildBannersI18nQuery innerJoinWithBanners() Adds a INNER JOIN clause and with to the query using the Banners relation |
48
|
|
|
* |
49
|
|
|
* @method \xbanners\models\BannersQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria |
50
|
|
|
* |
51
|
|
|
* @method ChildBannersI18n findOne(ConnectionInterface $con = null) Return the first ChildBannersI18n matching the query |
52
|
|
|
* @method ChildBannersI18n findOneOrCreate(ConnectionInterface $con = null) Return the first ChildBannersI18n matching the query, or a new ChildBannersI18n object populated from the query conditions when no match is found |
53
|
|
|
* |
54
|
|
|
* @method ChildBannersI18n findOneById(int $id) Return the first ChildBannersI18n filtered by the id column |
55
|
|
|
* @method ChildBannersI18n findOneByLocale(string $locale) Return the first ChildBannersI18n filtered by the locale column |
56
|
|
|
* @method ChildBannersI18n findOneByName(string $name) Return the first ChildBannersI18n filtered by the name column * |
57
|
|
|
|
58
|
|
|
* @method ChildBannersI18n requirePk($key, ConnectionInterface $con = null) Return the ChildBannersI18n by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
59
|
|
|
* @method ChildBannersI18n requireOne(ConnectionInterface $con = null) Return the first ChildBannersI18n matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
60
|
|
|
* |
61
|
|
|
* @method ChildBannersI18n requireOneById(int $id) Return the first ChildBannersI18n filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
62
|
|
|
* @method ChildBannersI18n requireOneByLocale(string $locale) Return the first ChildBannersI18n filtered by the locale column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
63
|
|
|
* @method ChildBannersI18n requireOneByName(string $name) Return the first ChildBannersI18n filtered by the name column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
64
|
|
|
* |
65
|
|
|
* @method ChildBannersI18n[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildBannersI18n objects based on current ModelCriteria |
66
|
|
|
* @method ChildBannersI18n[]|ObjectCollection findById(int $id) Return ChildBannersI18n objects filtered by the id column |
67
|
|
|
* @method ChildBannersI18n[]|ObjectCollection findByLocale(string $locale) Return ChildBannersI18n objects filtered by the locale column |
68
|
|
|
* @method ChildBannersI18n[]|ObjectCollection findByName(string $name) Return ChildBannersI18n objects filtered by the name column |
69
|
|
|
* @method ChildBannersI18n[]|\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 |
70
|
|
|
* |
71
|
|
|
*/ |
|
|
|
|
72
|
|
|
abstract class BannersI18nQuery extends ModelCriteria |
73
|
|
|
{ |
|
|
|
|
74
|
|
|
protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException'; |
|
|
|
|
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Initializes internal state of \xbanners\models\Base\BannersI18nQuery object. |
78
|
|
|
* |
79
|
|
|
* @param string $dbName The database 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 = 'Shop', $modelName = '\\xbanners\\models\\BannersI18n', $modelAlias = null) |
84
|
|
|
{ |
85
|
|
|
parent::__construct($dbName, $modelName, $modelAlias); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Returns a new ChildBannersI18nQuery object. |
90
|
|
|
* |
91
|
|
|
* @param string $modelAlias The alias of a model in the query |
|
|
|
|
92
|
|
|
* @param Criteria $criteria Optional Criteria to build the query from |
|
|
|
|
93
|
|
|
* |
94
|
|
|
* @return ChildBannersI18nQuery |
95
|
|
|
*/ |
96
|
|
View Code Duplication |
public static function create($modelAlias = null, Criteria $criteria = null) |
97
|
|
|
{ |
98
|
|
|
if ($criteria instanceof ChildBannersI18nQuery) { |
99
|
|
|
return $criteria; |
100
|
|
|
} |
101
|
|
|
$query = new ChildBannersI18nQuery(); |
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(array(12, 34), $con); |
119
|
|
|
* </code> |
120
|
|
|
* |
121
|
|
|
* @param array[$id, $locale] $key Primary key to use for the query |
|
|
|
|
122
|
|
|
* @param ConnectionInterface $con an optional connection object |
|
|
|
|
123
|
|
|
* |
124
|
|
|
* @return ChildBannersI18n|array|mixed the result, formatted by the current formatter |
125
|
|
|
*/ |
126
|
|
View Code Duplication |
public function findPk($key, ConnectionInterface $con = null) |
127
|
|
|
{ |
128
|
|
|
if ($key === null) { |
129
|
|
|
return null; |
130
|
|
|
} |
131
|
|
|
if ((null !== ($obj = BannersI18nTableMap::getInstanceFromPool(serialize([(null === $key[0] || is_scalar($key[0]) || is_callable([$key[0], '__toString']) ? (string) $key[0] : $key[0]), (null === $key[1] || is_scalar($key[1]) || is_callable([$key[1], '__toString']) ? (string) $key[1] : $key[1])])))) && !$this->formatter) { |
132
|
|
|
// the object is already in the instance pool |
133
|
|
|
return $obj; |
134
|
|
|
} |
135
|
|
|
if ($con === null) { |
136
|
|
|
$con = Propel::getServiceContainer()->getReadConnection(BannersI18nTableMap::DATABASE_NAME); |
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 ConnectionInterface $con A connection object |
154
|
|
|
* |
155
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
|
|
|
|
156
|
|
|
* |
157
|
|
|
* @return ChildBannersI18n A model object, or null if the key is not found |
|
|
|
|
158
|
|
|
*/ |
159
|
|
View Code Duplication |
protected function findPkSimple($key, ConnectionInterface $con) |
160
|
|
|
{ |
161
|
|
|
$sql = 'SELECT id, locale, name FROM banners_i18n WHERE id = :p0 AND locale = :p1'; |
162
|
|
|
try { |
163
|
|
|
$stmt = $con->prepare($sql); |
164
|
|
|
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); |
165
|
|
|
$stmt->bindValue(':p1', $key[1], PDO::PARAM_STR); |
166
|
|
|
$stmt->execute(); |
167
|
|
|
} catch (Exception $e) { |
168
|
|
|
Propel::log($e->getMessage(), Propel::LOG_ERR); |
169
|
|
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); |
170
|
|
|
} |
171
|
|
|
$obj = null; |
172
|
|
|
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { |
173
|
|
|
/** @var ChildBannersI18n $obj */ |
174
|
|
|
$obj = new ChildBannersI18n(); |
175
|
|
|
$obj->hydrate($row); |
176
|
|
|
BannersI18nTableMap::addInstanceToPool($obj, serialize([(null === $key[0] || is_scalar($key[0]) || is_callable([$key[0], '__toString']) ? (string) $key[0] : $key[0]), (null === $key[1] || is_scalar($key[1]) || is_callable([$key[1], '__toString']) ? (string) $key[1] : $key[1])])); |
177
|
|
|
} |
178
|
|
|
$stmt->closeCursor(); |
179
|
|
|
|
180
|
|
|
return $obj; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* Find object by primary key. |
185
|
|
|
* |
186
|
|
|
* @param mixed $key Primary key to use for the query |
187
|
|
|
* @param ConnectionInterface $con A connection object |
188
|
|
|
* |
189
|
|
|
* @return ChildBannersI18n|array|mixed the result, formatted by the current formatter |
190
|
|
|
*/ |
191
|
|
View Code Duplication |
protected function findPkComplex($key, ConnectionInterface $con) |
192
|
|
|
{ |
193
|
|
|
// As the query uses a PK condition, no limit(1) is necessary. |
194
|
|
|
$criteria = $this->isKeepQuery() ? clone $this : $this; |
195
|
|
|
$dataFetcher = $criteria |
196
|
|
|
->filterByPrimaryKey($key) |
197
|
|
|
->doSelect($con); |
198
|
|
|
|
199
|
|
|
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Find objects by primary key |
204
|
|
|
* <code> |
205
|
|
|
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con); |
206
|
|
|
* </code> |
207
|
|
|
* @param array $keys Primary keys to use for the query |
208
|
|
|
* @param ConnectionInterface $con an optional connection object |
|
|
|
|
209
|
|
|
* |
210
|
|
|
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter |
211
|
|
|
*/ |
212
|
|
View Code Duplication |
public function findPks($keys, ConnectionInterface $con = null) |
213
|
|
|
{ |
214
|
|
|
if (null === $con) { |
215
|
|
|
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); |
216
|
|
|
} |
217
|
|
|
$this->basePreSelect($con); |
218
|
|
|
$criteria = $this->isKeepQuery() ? clone $this : $this; |
219
|
|
|
$dataFetcher = $criteria |
220
|
|
|
->filterByPrimaryKeys($keys) |
221
|
|
|
->doSelect($con); |
222
|
|
|
|
223
|
|
|
return $criteria->getFormatter()->init($criteria)->format($dataFetcher); |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Filter the query by primary key |
228
|
|
|
* |
229
|
|
|
* @param mixed $key Primary key to use for the query |
230
|
|
|
* |
231
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
232
|
|
|
*/ |
233
|
|
|
public function filterByPrimaryKey($key) |
234
|
|
|
{ |
235
|
|
|
$this->addUsingAlias(BannersI18nTableMap::COL_ID, $key[0], Criteria::EQUAL); |
236
|
|
|
$this->addUsingAlias(BannersI18nTableMap::COL_LOCALE, $key[1], Criteria::EQUAL); |
237
|
|
|
|
238
|
|
|
return $this; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* Filter the query by a list of primary keys |
243
|
|
|
* |
244
|
|
|
* @param array $keys The list of primary key to use for the query |
245
|
|
|
* |
246
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
247
|
|
|
*/ |
248
|
|
View Code Duplication |
public function filterByPrimaryKeys($keys) |
249
|
|
|
{ |
250
|
|
|
if (empty($keys)) { |
251
|
|
|
return $this->add(null, '1<>1', Criteria::CUSTOM); |
252
|
|
|
} |
253
|
|
|
foreach ($keys as $key) { |
254
|
|
|
$cton0 = $this->getNewCriterion(BannersI18nTableMap::COL_ID, $key[0], Criteria::EQUAL); |
255
|
|
|
$cton1 = $this->getNewCriterion(BannersI18nTableMap::COL_LOCALE, $key[1], Criteria::EQUAL); |
256
|
|
|
$cton0->addAnd($cton1); |
257
|
|
|
$this->addOr($cton0); |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
return $this; |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* Filter the query on the id column |
265
|
|
|
* |
266
|
|
|
* Example usage: |
267
|
|
|
* <code> |
268
|
|
|
* $query->filterById(1234); // WHERE id = 1234 |
269
|
|
|
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34) |
270
|
|
|
* $query->filterById(array('min' => 12)); // WHERE id > 12 |
271
|
|
|
* </code> |
272
|
|
|
* |
273
|
|
|
* @see filterByBanners() |
274
|
|
|
* |
275
|
|
|
* @param mixed $id The value to use as filter. |
|
|
|
|
276
|
|
|
* Use scalar values for equality. |
277
|
|
|
* Use array values for in_array() equivalent. |
278
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
279
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
|
|
|
280
|
|
|
* |
281
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
282
|
|
|
*/ |
283
|
|
View Code Duplication |
public function filterById($id = null, $comparison = null) |
284
|
|
|
{ |
285
|
|
|
if (is_array($id)) { |
286
|
|
|
$useMinMax = false; |
287
|
|
|
if (isset($id['min'])) { |
288
|
|
|
$this->addUsingAlias(BannersI18nTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL); |
289
|
|
|
$useMinMax = true; |
290
|
|
|
} |
291
|
|
|
if (isset($id['max'])) { |
292
|
|
|
$this->addUsingAlias(BannersI18nTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL); |
293
|
|
|
$useMinMax = true; |
294
|
|
|
} |
295
|
|
|
if ($useMinMax) { |
296
|
|
|
return $this; |
297
|
|
|
} |
298
|
|
|
if (null === $comparison) { |
299
|
|
|
$comparison = Criteria::IN; |
300
|
|
|
} |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
return $this->addUsingAlias(BannersI18nTableMap::COL_ID, $id, $comparison); |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* Filter the query on the locale column |
308
|
|
|
* |
309
|
|
|
* Example usage: |
310
|
|
|
* <code> |
311
|
|
|
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue' |
312
|
|
|
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%' |
313
|
|
|
* </code> |
314
|
|
|
* |
315
|
|
|
* @param string $locale The value to use as filter. |
|
|
|
|
316
|
|
|
* Accepts wildcards (* and % trigger a LIKE) |
|
|
|
|
317
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
|
|
|
318
|
|
|
* |
319
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
320
|
|
|
*/ |
321
|
|
View Code Duplication |
public function filterByLocale($locale = null, $comparison = null) |
322
|
|
|
{ |
323
|
|
|
if (null === $comparison) { |
324
|
|
|
if (is_array($locale)) { |
325
|
|
|
$comparison = Criteria::IN; |
326
|
|
|
} elseif (preg_match('/[\%\*]/', $locale)) { |
327
|
|
|
$locale = str_replace('*', '%', $locale); |
328
|
|
|
$comparison = Criteria::LIKE; |
329
|
|
|
} |
330
|
|
|
} |
331
|
|
|
|
332
|
|
|
return $this->addUsingAlias(BannersI18nTableMap::COL_LOCALE, $locale, $comparison); |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* Filter the query on the name column |
337
|
|
|
* |
338
|
|
|
* Example usage: |
339
|
|
|
* <code> |
340
|
|
|
* $query->filterByName('fooValue'); // WHERE name = 'fooValue' |
341
|
|
|
* $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%' |
342
|
|
|
* </code> |
343
|
|
|
* |
344
|
|
|
* @param string $name The value to use as filter. |
|
|
|
|
345
|
|
|
* Accepts wildcards (* and % trigger a LIKE) |
|
|
|
|
346
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
|
|
|
347
|
|
|
* |
348
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
349
|
|
|
*/ |
350
|
|
View Code Duplication |
public function filterByName($name = null, $comparison = null) |
351
|
|
|
{ |
352
|
|
|
if (null === $comparison) { |
353
|
|
|
if (is_array($name)) { |
354
|
|
|
$comparison = Criteria::IN; |
355
|
|
|
} elseif (preg_match('/[\%\*]/', $name)) { |
356
|
|
|
$name = str_replace('*', '%', $name); |
357
|
|
|
$comparison = Criteria::LIKE; |
358
|
|
|
} |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
return $this->addUsingAlias(BannersI18nTableMap::COL_NAME, $name, $comparison); |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* Filter the query by a related \xbanners\models\Banners object |
366
|
|
|
* |
367
|
|
|
* @param \xbanners\models\Banners|ObjectCollection $banners The related object(s) to use as filter |
368
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
|
|
|
369
|
|
|
* |
370
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
|
|
|
|
371
|
|
|
* |
372
|
|
|
* @return ChildBannersI18nQuery The current query, for fluid interface |
373
|
|
|
*/ |
374
|
|
View Code Duplication |
public function filterByBanners($banners, $comparison = null) |
375
|
|
|
{ |
376
|
|
|
if ($banners instanceof \xbanners\models\Banners) { |
377
|
|
|
return $this |
378
|
|
|
->addUsingAlias(BannersI18nTableMap::COL_ID, $banners->getId(), $comparison); |
379
|
|
|
} elseif ($banners instanceof ObjectCollection) { |
380
|
|
|
if (null === $comparison) { |
381
|
|
|
$comparison = Criteria::IN; |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
return $this |
385
|
|
|
->addUsingAlias(BannersI18nTableMap::COL_ID, $banners->toKeyValue('PrimaryKey', 'Id'), $comparison); |
386
|
|
|
} else { |
387
|
|
|
throw new PropelException('filterByBanners() only accepts arguments of type \xbanners\models\Banners or Collection'); |
388
|
|
|
} |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
/** |
392
|
|
|
* Adds a JOIN clause to the query using the Banners relation |
393
|
|
|
* |
394
|
|
|
* @param string $relationAlias optional alias for the relation |
|
|
|
|
395
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
396
|
|
|
* |
397
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
398
|
|
|
*/ |
399
|
|
View Code Duplication |
public function joinBanners($relationAlias = null, $joinType = 'LEFT JOIN') |
400
|
|
|
{ |
401
|
|
|
$tableMap = $this->getTableMap(); |
402
|
|
|
$relationMap = $tableMap->getRelation('Banners'); |
403
|
|
|
|
404
|
|
|
// create a ModelJoin object for this join |
405
|
|
|
$join = new ModelJoin(); |
406
|
|
|
$join->setJoinType($joinType); |
407
|
|
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
408
|
|
|
if ($previousJoin = $this->getPreviousJoin()) { |
409
|
|
|
$join->setPreviousJoin($previousJoin); |
|
|
|
|
410
|
|
|
} |
411
|
|
|
|
412
|
|
|
// add the ModelJoin to the current object |
413
|
|
|
if ($relationAlias) { |
414
|
|
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
415
|
|
|
$this->addJoinObject($join, $relationAlias); |
416
|
|
|
} else { |
417
|
|
|
$this->addJoinObject($join, 'Banners'); |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
return $this; |
421
|
|
|
} |
422
|
|
|
|
423
|
|
|
/** |
424
|
|
|
* Use the Banners relation Banners object |
425
|
|
|
* |
426
|
|
|
* @see useQuery() |
427
|
|
|
* |
428
|
|
|
* @param string $relationAlias optional alias for the relation, |
|
|
|
|
429
|
|
|
* to be used as main alias in the secondary query |
|
|
|
|
430
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
431
|
|
|
* |
432
|
|
|
* @return \xbanners\models\BannersQuery A secondary query class using the current class as primary query |
433
|
|
|
*/ |
434
|
|
|
public function useBannersQuery($relationAlias = null, $joinType = 'LEFT JOIN') |
435
|
|
|
{ |
436
|
|
|
return $this |
437
|
|
|
->joinBanners($relationAlias, $joinType) |
438
|
|
|
->useQuery($relationAlias ? $relationAlias : 'Banners', '\xbanners\models\BannersQuery'); |
439
|
|
|
} |
440
|
|
|
|
441
|
|
|
/** |
442
|
|
|
* Exclude object from result |
443
|
|
|
* |
444
|
|
|
* @param ChildBannersI18n $bannersI18n Object to remove from the list of results |
|
|
|
|
445
|
|
|
* |
446
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
447
|
|
|
*/ |
448
|
|
View Code Duplication |
public function prune($bannersI18n = null) |
449
|
|
|
{ |
450
|
|
|
if ($bannersI18n) { |
451
|
|
|
$this->addCond('pruneCond0', $this->getAliasedColName(BannersI18nTableMap::COL_ID), $bannersI18n->getId(), Criteria::NOT_EQUAL); |
452
|
|
|
$this->addCond('pruneCond1', $this->getAliasedColName(BannersI18nTableMap::COL_LOCALE), $bannersI18n->getLocale(), Criteria::NOT_EQUAL); |
453
|
|
|
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
return $this; |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
/** |
460
|
|
|
* Deletes all rows from the banners_i18n table. |
461
|
|
|
* |
462
|
|
|
* @param ConnectionInterface $con the connection to use |
|
|
|
|
463
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). |
464
|
|
|
*/ |
465
|
|
|
public function doDeleteAll(ConnectionInterface $con = null) |
466
|
|
|
{ |
467
|
|
|
if (null === $con) { |
468
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(BannersI18nTableMap::DATABASE_NAME); |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
// use transaction because $criteria could contain info |
472
|
|
|
// for more than one table or we could emulating ON DELETE CASCADE, etc. |
473
|
|
|
return $con->transaction(function () use ($con) { |
474
|
|
|
$affectedRows = 0; // initialize var to track total num of affected rows |
475
|
|
|
$affectedRows += parent::doDeleteAll($con); |
476
|
|
|
// Because this db requires some delete cascade/set null emulation, we have to |
477
|
|
|
// clear the cached instance *after* the emulation has happened (since |
478
|
|
|
// instances get re-added by the select statement contained therein). |
479
|
|
|
BannersI18nTableMap::clearInstancePool(); |
480
|
|
|
BannersI18nTableMap::clearRelatedInstancePool(); |
481
|
|
|
|
482
|
|
|
return $affectedRows; |
483
|
|
|
}); |
484
|
|
|
} |
485
|
|
|
|
486
|
|
|
/** |
487
|
|
|
* Performs a DELETE on the database based on the current ModelCriteria |
488
|
|
|
* |
489
|
|
|
* @param ConnectionInterface $con the connection to use |
|
|
|
|
490
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
491
|
|
|
* if supported by native driver or if emulated using Propel. |
492
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
493
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
494
|
|
|
*/ |
495
|
|
View Code Duplication |
public function delete(ConnectionInterface $con = null) |
496
|
|
|
{ |
497
|
|
|
if (null === $con) { |
498
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(BannersI18nTableMap::DATABASE_NAME); |
499
|
|
|
} |
500
|
|
|
|
501
|
|
|
$criteria = $this; |
502
|
|
|
|
503
|
|
|
// Set the correct dbName |
504
|
|
|
$criteria->setDbName(BannersI18nTableMap::DATABASE_NAME); |
505
|
|
|
|
506
|
|
|
// use transaction because $criteria could contain info |
507
|
|
|
// for more than one table or we could emulating ON DELETE CASCADE, etc. |
508
|
|
|
return $con->transaction(function () use ($con, $criteria) { |
509
|
|
|
$affectedRows = 0; // initialize var to track total num of affected rows |
510
|
|
|
|
511
|
|
|
BannersI18nTableMap::removeInstanceFromPool($criteria); |
512
|
|
|
|
513
|
|
|
$affectedRows += ModelCriteria::delete($con); |
514
|
|
|
BannersI18nTableMap::clearRelatedInstancePool(); |
515
|
|
|
|
516
|
|
|
return $affectedRows; |
517
|
|
|
}); |
518
|
|
|
} |
519
|
|
|
|
520
|
|
|
} // BannersI18nQuery |
|
|
|
|
521
|
|
|
|