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
|
|
|
public function findPk($key, ConnectionInterface $con = null) |
127
|
|
|
{ |
128
|
|
|
if ($key === null) { |
129
|
|
|
return null; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
if ($con === null) { |
133
|
|
|
$con = Propel::getServiceContainer()->getReadConnection(BannersI18nTableMap::DATABASE_NAME); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
$this->basePreSelect($con); |
137
|
|
|
|
138
|
|
|
if ( |
|
|
|
|
139
|
|
|
$this->formatter || $this->modelAlias || $this->with || $this->select |
|
|
|
|
140
|
|
|
|| $this->selectColumns || $this->asColumns || $this->selectModifiers |
141
|
|
|
|| $this->map || $this->having || $this->joins |
142
|
|
|
) { |
143
|
|
|
return $this->findPkComplex($key, $con); |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
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])]))))) { |
147
|
|
|
// the object is already in the instance pool |
148
|
|
|
return $obj; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
return $this->findPkSimple($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 ConnectionInterface $con A connection object |
160
|
|
|
* |
161
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
|
|
|
|
162
|
|
|
* |
163
|
|
|
* @return ChildBannersI18n A model object, or null if the key is not found |
|
|
|
|
164
|
|
|
*/ |
165
|
|
|
protected function findPkSimple($key, ConnectionInterface $con) |
166
|
|
|
{ |
167
|
|
|
$sql = 'SELECT id, locale, name FROM banners_i18n WHERE id = :p0 AND locale = :p1'; |
168
|
|
|
try { |
169
|
|
|
$stmt = $con->prepare($sql); |
170
|
|
|
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT); |
171
|
|
|
$stmt->bindValue(':p1', $key[1], PDO::PARAM_STR); |
172
|
|
|
$stmt->execute(); |
173
|
|
|
} catch (Exception $e) { |
174
|
|
|
Propel::log($e->getMessage(), Propel::LOG_ERR); |
175
|
|
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); |
176
|
|
|
} |
177
|
|
|
$obj = null; |
178
|
|
|
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { |
179
|
|
|
/** @var ChildBannersI18n $obj */ |
180
|
|
|
$obj = new ChildBannersI18n(); |
181
|
|
|
$obj->hydrate($row); |
182
|
|
|
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])])); |
183
|
|
|
} |
184
|
|
|
$stmt->closeCursor(); |
185
|
|
|
|
186
|
|
|
return $obj; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* Find object by primary key. |
191
|
|
|
* |
192
|
|
|
* @param mixed $key Primary key to use for the query |
193
|
|
|
* @param ConnectionInterface $con A connection object |
194
|
|
|
* |
195
|
|
|
* @return ChildBannersI18n|array|mixed the result, formatted by the current formatter |
196
|
|
|
*/ |
197
|
|
View Code Duplication |
protected function findPkComplex($key, ConnectionInterface $con) |
198
|
|
|
{ |
199
|
|
|
// As the query uses a PK condition, no limit(1) is necessary. |
200
|
|
|
$criteria = $this->isKeepQuery() ? clone $this : $this; |
201
|
|
|
$dataFetcher = $criteria |
202
|
|
|
->filterByPrimaryKey($key) |
203
|
|
|
->doSelect($con); |
204
|
|
|
|
205
|
|
|
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* Find objects by primary key |
210
|
|
|
* <code> |
211
|
|
|
* $objs = $c->findPks(array(array(12, 56), array(832, 123), array(123, 456)), $con); |
212
|
|
|
* </code> |
213
|
|
|
* @param array $keys Primary keys to use for the query |
214
|
|
|
* @param ConnectionInterface $con an optional connection object |
215
|
|
|
* |
216
|
|
|
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter |
217
|
|
|
*/ |
218
|
|
View Code Duplication |
public function findPks($keys, ConnectionInterface $con = null) |
219
|
|
|
{ |
220
|
|
|
if (null === $con) { |
221
|
|
|
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); |
222
|
|
|
} |
223
|
|
|
$this->basePreSelect($con); |
224
|
|
|
$criteria = $this->isKeepQuery() ? clone $this : $this; |
225
|
|
|
$dataFetcher = $criteria |
226
|
|
|
->filterByPrimaryKeys($keys) |
227
|
|
|
->doSelect($con); |
228
|
|
|
|
229
|
|
|
return $criteria->getFormatter()->init($criteria)->format($dataFetcher); |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* Filter the query by primary key |
234
|
|
|
* |
235
|
|
|
* @param mixed $key Primary key to use for the query |
236
|
|
|
* |
237
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
238
|
|
|
*/ |
239
|
|
|
public function filterByPrimaryKey($key) |
240
|
|
|
{ |
241
|
|
|
$this->addUsingAlias(BannersI18nTableMap::COL_ID, $key[0], Criteria::EQUAL); |
242
|
|
|
$this->addUsingAlias(BannersI18nTableMap::COL_LOCALE, $key[1], Criteria::EQUAL); |
243
|
|
|
|
244
|
|
|
return $this; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* Filter the query by a list of primary keys |
249
|
|
|
* |
250
|
|
|
* @param array $keys The list of primary key to use for the query |
251
|
|
|
* |
252
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
253
|
|
|
*/ |
254
|
|
|
public function filterByPrimaryKeys($keys) |
255
|
|
|
{ |
256
|
|
|
if (empty($keys)) { |
257
|
|
|
return $this->add(null, '1<>1', Criteria::CUSTOM); |
258
|
|
|
} |
259
|
|
|
foreach ($keys as $key) { |
260
|
|
|
$cton0 = $this->getNewCriterion(BannersI18nTableMap::COL_ID, $key[0], Criteria::EQUAL); |
261
|
|
|
$cton1 = $this->getNewCriterion(BannersI18nTableMap::COL_LOCALE, $key[1], Criteria::EQUAL); |
262
|
|
|
$cton0->addAnd($cton1); |
263
|
|
|
$this->addOr($cton0); |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
return $this; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* Filter the query on the id column |
271
|
|
|
* |
272
|
|
|
* Example usage: |
273
|
|
|
* <code> |
274
|
|
|
* $query->filterById(1234); // WHERE id = 1234 |
275
|
|
|
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34) |
276
|
|
|
* $query->filterById(array('min' => 12)); // WHERE id > 12 |
277
|
|
|
* </code> |
278
|
|
|
* |
279
|
|
|
* @see filterByBanners() |
280
|
|
|
* |
281
|
|
|
* @param mixed $id The value to use as filter. |
|
|
|
|
282
|
|
|
* Use scalar values for equality. |
283
|
|
|
* Use array values for in_array() equivalent. |
284
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
285
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
286
|
|
|
* |
287
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
288
|
|
|
*/ |
289
|
|
View Code Duplication |
public function filterById($id = null, $comparison = null) |
290
|
|
|
{ |
291
|
|
|
if (is_array($id)) { |
292
|
|
|
$useMinMax = false; |
293
|
|
|
if (isset($id['min'])) { |
294
|
|
|
$this->addUsingAlias(BannersI18nTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL); |
295
|
|
|
$useMinMax = true; |
296
|
|
|
} |
297
|
|
|
if (isset($id['max'])) { |
298
|
|
|
$this->addUsingAlias(BannersI18nTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL); |
299
|
|
|
$useMinMax = true; |
300
|
|
|
} |
301
|
|
|
if ($useMinMax) { |
302
|
|
|
return $this; |
303
|
|
|
} |
304
|
|
|
if (null === $comparison) { |
305
|
|
|
$comparison = Criteria::IN; |
306
|
|
|
} |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
return $this->addUsingAlias(BannersI18nTableMap::COL_ID, $id, $comparison); |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
/** |
313
|
|
|
* Filter the query on the locale column |
314
|
|
|
* |
315
|
|
|
* Example usage: |
316
|
|
|
* <code> |
317
|
|
|
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue' |
318
|
|
|
* $query->filterByLocale('%fooValue%', Criteria::LIKE); // WHERE locale LIKE '%fooValue%' |
319
|
|
|
* </code> |
320
|
|
|
* |
321
|
|
|
* @param string $locale The value to use as filter. |
322
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
323
|
|
|
* |
324
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
325
|
|
|
*/ |
326
|
|
View Code Duplication |
public function filterByLocale($locale = null, $comparison = null) |
327
|
|
|
{ |
328
|
|
|
if (null === $comparison) { |
329
|
|
|
if (is_array($locale)) { |
330
|
|
|
$comparison = Criteria::IN; |
331
|
|
|
} |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
return $this->addUsingAlias(BannersI18nTableMap::COL_LOCALE, $locale, $comparison); |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* Filter the query on the name column |
339
|
|
|
* |
340
|
|
|
* Example usage: |
341
|
|
|
* <code> |
342
|
|
|
* $query->filterByName('fooValue'); // WHERE name = 'fooValue' |
343
|
|
|
* $query->filterByName('%fooValue%', Criteria::LIKE); // WHERE name LIKE '%fooValue%' |
344
|
|
|
* </code> |
345
|
|
|
* |
346
|
|
|
* @param string $name The value to use as filter. |
347
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
348
|
|
|
* |
349
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
350
|
|
|
*/ |
351
|
|
View Code Duplication |
public function filterByName($name = null, $comparison = null) |
352
|
|
|
{ |
353
|
|
|
if (null === $comparison) { |
354
|
|
|
if (is_array($name)) { |
355
|
|
|
$comparison = Criteria::IN; |
356
|
|
|
} |
357
|
|
|
} |
358
|
|
|
|
359
|
|
|
return $this->addUsingAlias(BannersI18nTableMap::COL_NAME, $name, $comparison); |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
/** |
363
|
|
|
* Filter the query by a related \xbanners\models\Banners object |
364
|
|
|
* |
365
|
|
|
* @param \xbanners\models\Banners|ObjectCollection $banners The related object(s) to use as filter |
366
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
367
|
|
|
* |
368
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
|
|
|
|
369
|
|
|
* |
370
|
|
|
* @return ChildBannersI18nQuery The current query, for fluid interface |
371
|
|
|
*/ |
372
|
|
|
public function filterByBanners($banners, $comparison = null) |
373
|
|
|
{ |
374
|
|
|
if ($banners instanceof \xbanners\models\Banners) { |
375
|
|
|
return $this |
376
|
|
|
->addUsingAlias(BannersI18nTableMap::COL_ID, $banners->getId(), $comparison); |
377
|
|
|
} elseif ($banners instanceof ObjectCollection) { |
378
|
|
|
if (null === $comparison) { |
379
|
|
|
$comparison = Criteria::IN; |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
return $this |
383
|
|
|
->addUsingAlias(BannersI18nTableMap::COL_ID, $banners->toKeyValue('PrimaryKey', 'Id'), $comparison); |
384
|
|
|
} else { |
385
|
|
|
throw new PropelException('filterByBanners() only accepts arguments of type \xbanners\models\Banners or Collection'); |
386
|
|
|
} |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
/** |
390
|
|
|
* Adds a JOIN clause to the query using the Banners relation |
391
|
|
|
* |
392
|
|
|
* @param string $relationAlias optional alias for the relation |
393
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
394
|
|
|
* |
395
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
396
|
|
|
*/ |
397
|
|
View Code Duplication |
public function joinBanners($relationAlias = null, $joinType = 'LEFT JOIN') |
398
|
|
|
{ |
399
|
|
|
$tableMap = $this->getTableMap(); |
400
|
|
|
$relationMap = $tableMap->getRelation('Banners'); |
401
|
|
|
|
402
|
|
|
// create a ModelJoin object for this join |
403
|
|
|
$join = new ModelJoin(); |
404
|
|
|
$join->setJoinType($joinType); |
405
|
|
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
406
|
|
|
if ($previousJoin = $this->getPreviousJoin()) { |
407
|
|
|
$join->setPreviousJoin($previousJoin); |
|
|
|
|
408
|
|
|
} |
409
|
|
|
|
410
|
|
|
// add the ModelJoin to the current object |
411
|
|
|
if ($relationAlias) { |
412
|
|
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
413
|
|
|
$this->addJoinObject($join, $relationAlias); |
414
|
|
|
} else { |
415
|
|
|
$this->addJoinObject($join, 'Banners'); |
416
|
|
|
} |
417
|
|
|
|
418
|
|
|
return $this; |
419
|
|
|
} |
420
|
|
|
|
421
|
|
|
/** |
422
|
|
|
* Use the Banners relation Banners object |
423
|
|
|
* |
424
|
|
|
* @see useQuery() |
425
|
|
|
* |
426
|
|
|
* @param string $relationAlias optional alias for the relation, |
|
|
|
|
427
|
|
|
* to be used as main alias in the secondary query |
|
|
|
|
428
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
429
|
|
|
* |
430
|
|
|
* @return \xbanners\models\BannersQuery A secondary query class using the current class as primary query |
431
|
|
|
*/ |
432
|
|
|
public function useBannersQuery($relationAlias = null, $joinType = 'LEFT JOIN') |
433
|
|
|
{ |
434
|
|
|
return $this |
435
|
|
|
->joinBanners($relationAlias, $joinType) |
436
|
|
|
->useQuery($relationAlias ? $relationAlias : 'Banners', '\xbanners\models\BannersQuery'); |
437
|
|
|
} |
438
|
|
|
|
439
|
|
|
/** |
440
|
|
|
* Exclude object from result |
441
|
|
|
* |
442
|
|
|
* @param ChildBannersI18n $bannersI18n Object to remove from the list of results |
443
|
|
|
* |
444
|
|
|
* @return $this|ChildBannersI18nQuery The current query, for fluid interface |
|
|
|
|
445
|
|
|
*/ |
446
|
|
|
public function prune($bannersI18n = null) |
447
|
|
|
{ |
448
|
|
|
if ($bannersI18n) { |
449
|
|
|
$this->addCond('pruneCond0', $this->getAliasedColName(BannersI18nTableMap::COL_ID), $bannersI18n->getId(), Criteria::NOT_EQUAL); |
450
|
|
|
$this->addCond('pruneCond1', $this->getAliasedColName(BannersI18nTableMap::COL_LOCALE), $bannersI18n->getLocale(), Criteria::NOT_EQUAL); |
451
|
|
|
$this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
return $this; |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
/** |
458
|
|
|
* Deletes all rows from the banners_i18n table. |
459
|
|
|
* |
460
|
|
|
* @param ConnectionInterface $con the connection to use |
461
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). |
462
|
|
|
*/ |
463
|
|
View Code Duplication |
public function doDeleteAll(ConnectionInterface $con = null) |
464
|
|
|
{ |
465
|
|
|
if (null === $con) { |
466
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(BannersI18nTableMap::DATABASE_NAME); |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
// use transaction because $criteria could contain info |
470
|
|
|
// for more than one table or we could emulating ON DELETE CASCADE, etc. |
471
|
|
|
return $con->transaction(function () use ($con) { |
472
|
|
|
$affectedRows = 0; // initialize var to track total num of affected rows |
473
|
|
|
$affectedRows += parent::doDeleteAll($con); |
474
|
|
|
// Because this db requires some delete cascade/set null emulation, we have to |
475
|
|
|
// clear the cached instance *after* the emulation has happened (since |
476
|
|
|
// instances get re-added by the select statement contained therein). |
477
|
|
|
BannersI18nTableMap::clearInstancePool(); |
478
|
|
|
BannersI18nTableMap::clearRelatedInstancePool(); |
479
|
|
|
|
480
|
|
|
return $affectedRows; |
481
|
|
|
}); |
482
|
|
|
} |
483
|
|
|
|
484
|
|
|
/** |
485
|
|
|
* Performs a DELETE on the database based on the current ModelCriteria |
486
|
|
|
* |
487
|
|
|
* @param ConnectionInterface $con the connection to use |
488
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
489
|
|
|
* if supported by native driver or if emulated using Propel. |
490
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
491
|
|
|
* rethrown wrapped into a PropelException. |
|
|
|
|
492
|
|
|
*/ |
493
|
|
View Code Duplication |
public function delete(ConnectionInterface $con = null) |
494
|
|
|
{ |
495
|
|
|
if (null === $con) { |
496
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(BannersI18nTableMap::DATABASE_NAME); |
497
|
|
|
} |
498
|
|
|
|
499
|
|
|
$criteria = $this; |
500
|
|
|
|
501
|
|
|
// Set the correct dbName |
502
|
|
|
$criteria->setDbName(BannersI18nTableMap::DATABASE_NAME); |
503
|
|
|
|
504
|
|
|
// use transaction because $criteria could contain info |
505
|
|
|
// for more than one table or we could emulating ON DELETE CASCADE, etc. |
506
|
|
|
return $con->transaction(function () use ($con, $criteria) { |
507
|
|
|
$affectedRows = 0; // initialize var to track total num of affected rows |
508
|
|
|
|
509
|
|
|
BannersI18nTableMap::removeInstanceFromPool($criteria); |
510
|
|
|
|
511
|
|
|
$affectedRows += ModelCriteria::delete($con); |
512
|
|
|
BannersI18nTableMap::clearRelatedInstancePool(); |
513
|
|
|
|
514
|
|
|
return $affectedRows; |
515
|
|
|
}); |
516
|
|
|
} |
517
|
|
|
|
518
|
|
|
} // BannersI18nQuery |
|
|
|
|
519
|
|
|
|