Completed
Push — development ( eb9524...db4517 )
by Andrij
28:49 queued 02:09
created

BannersI18nQuery::create()   A

Complexity

Conditions 4
Paths 5

Size

Total Lines 15
Code Lines 9

Duplication

Lines 15
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 15
loc 15
rs 9.2
cc 4
eloc 9
nc 5
nop 2
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
 */
0 ignored issues
show
introduced by
Additional blank lines found at end of doc comment
Loading history...
72
abstract class BannersI18nQuery extends ModelCriteria
73
{
0 ignored issues
show
introduced by
Opening brace of a class must be on the same line as the definition
Loading history...
74
    protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException';
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before member var; 0 found
Loading history...
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'
0 ignored issues
show
Documentation introduced by
Should the type for parameter $modelAlias not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
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
0 ignored issues
show
Documentation introduced by
Should the type for parameter $modelAlias not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
92
     * @param     Criteria $criteria Optional Criteria to build the query from
0 ignored issues
show
Documentation introduced by
Should the type for parameter $criteria not be null|Criteria?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
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>
0 ignored issues
show
introduced by
Doc comment long description must start with a capital letter
Loading history...
118
     * $obj = $c->findPk(array(12, 34), $con);
119
     * </code>
120
     *
121
     * @param array[$id, $locale] $key Primary key to use for the query
0 ignored issues
show
Documentation introduced by
The doc-type array[$id, could not be parsed: Expected "]" at position 2, but found "$id". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
Bug introduced by
There is no parameter named $locale]. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
introduced by
Expected 1 spaces after parameter type; 0 found
Loading history...
introduced by
Doc comment for parameter $id, does not match actual variable name $con
Loading history...
122
     * @param ConnectionInterface $con an optional connection object
0 ignored issues
show
Documentation introduced by
Should the type for parameter $con not be null|ConnectionInterface?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
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
0 ignored issues
show
Coding Style introduced by
Multi-line IF statement not indented correctly; expected 12 spaces but found 9
Loading history...
141
         || $this->map || $this->having || $this->joins) {
0 ignored issues
show
Coding Style introduced by
Multi-line IF statement not indented correctly; expected 12 spaces but found 9
Loading history...
Coding Style introduced by
Closing parenthesis of a multi-line IF statement must be on a new line
Loading history...
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
0 ignored issues
show
introduced by
Comment missing or not on the next line for @throws tag in function comment
Loading history...
156
     *
157
     * @return ChildBannersI18n A model object, or null if the key is not found
0 ignored issues
show
Documentation introduced by
Should the return type not be ChildBannersI18n|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
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
0 ignored issues
show
Documentation introduced by
Should the type for parameter $con not be null|ConnectionInterface?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
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
0 ignored issues
show
introduced by
@return data type must not contain "$"
Loading history...
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
0 ignored issues
show
introduced by
@return data type must not contain "$"
Loading history...
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.
0 ignored issues
show
introduced by
Paramater tags must be defined first in a doc commment
Loading history...
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
0 ignored issues
show
Documentation introduced by
Should the type for parameter $comparison not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
280
     *
281
     * @return $this|ChildBannersI18nQuery The current query, for fluid interface
0 ignored issues
show
introduced by
@return data type must not contain "$"
Loading history...
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.
0 ignored issues
show
Documentation introduced by
Should the type for parameter $locale not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
316
     *              Accepts wildcards (* and % trigger a LIKE)
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
317
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
0 ignored issues
show
Documentation introduced by
Should the type for parameter $comparison not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
318
     *
319
     * @return $this|ChildBannersI18nQuery The current query, for fluid interface
0 ignored issues
show
introduced by
@return data type must not contain "$"
Loading history...
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.
0 ignored issues
show
Documentation introduced by
Should the type for parameter $name not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
345
     *              Accepts wildcards (* and % trigger a LIKE)
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
346
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
0 ignored issues
show
Documentation introduced by
Should the type for parameter $comparison not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
347
     *
348
     * @return $this|ChildBannersI18nQuery The current query, for fluid interface
0 ignored issues
show
introduced by
@return data type must not contain "$"
Loading history...
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
0 ignored issues
show
Documentation introduced by
Should the type for parameter $comparison not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
369
     *
370
     * @throws \Propel\Runtime\Exception\PropelException
0 ignored issues
show
introduced by
Comment missing or not on the next line for @throws tag in function comment
Loading history...
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
0 ignored issues
show
Documentation introduced by
Should the type for parameter $relationAlias not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
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
0 ignored issues
show
introduced by
@return data type must not contain "$"
Loading history...
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);
0 ignored issues
show
Compatibility introduced by
$previousJoin of type object<Propel\Runtime\ActiveQuery\Join> is not a sub-type of object<Propel\Runtime\ActiveQuery\ModelJoin>. It seems like you assume a child class of the class Propel\Runtime\ActiveQuery\Join to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
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,
0 ignored issues
show
Documentation introduced by
Should the type for parameter $relationAlias not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
introduced by
Paramater tags must be defined first in a doc commment
Loading history...
429
     *                                   to be used as main alias in the secondary query
0 ignored issues
show
introduced by
Parameter comment must start with a capital letter
Loading history...
introduced by
Parameter comment must end with a full stop
Loading history...
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
0 ignored issues
show
Documentation introduced by
Should the type for parameter $bannersI18n not be ChildBannersI18n|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
445
     *
446
     * @return $this|ChildBannersI18nQuery The current query, for fluid interface
0 ignored issues
show
introduced by
@return data type must not contain "$"
Loading history...
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
0 ignored issues
show
Documentation introduced by
Should the type for parameter $con not be null|ConnectionInterface?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
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
0 ignored issues
show
Documentation introduced by
Should the type for parameter $con not be null|ConnectionInterface?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
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.
0 ignored issues
show
introduced by
@throws tag comment must start with a capital letter
Loading history...
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
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
521