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