1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Core\Models\Task\Base; |
4
|
|
|
|
5
|
|
|
use \Exception; |
6
|
|
|
use \PDO; |
7
|
|
|
use Core\Models\Task\Task as ChildTask; |
8
|
|
|
use Core\Models\Task\TaskQuery as ChildTaskQuery; |
9
|
|
|
use Core\Models\Task\Map\TaskTableMap; |
10
|
|
|
use Propel\Runtime\Propel; |
11
|
|
|
use Propel\Runtime\ActiveQuery\Criteria; |
12
|
|
|
use Propel\Runtime\ActiveQuery\ModelCriteria; |
13
|
|
|
use Propel\Runtime\Collection\ObjectCollection; |
14
|
|
|
use Propel\Runtime\Connection\ConnectionInterface; |
15
|
|
|
use Propel\Runtime\Exception\PropelException; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Base class that represents a query for the 'tasks' table. |
19
|
|
|
* |
20
|
|
|
* |
21
|
|
|
* |
22
|
|
|
* @method ChildTaskQuery orderById($order = Criteria::ASC) Order by the id column |
23
|
|
|
* @method ChildTaskQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column |
24
|
|
|
* @method ChildTaskQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column |
25
|
|
|
* |
26
|
|
|
* @method ChildTaskQuery groupById() Group by the id column |
27
|
|
|
* @method ChildTaskQuery groupByCreatedAt() Group by the created_at column |
28
|
|
|
* @method ChildTaskQuery groupByUpdatedAt() Group by the updated_at column |
29
|
|
|
* |
30
|
|
|
* @method ChildTaskQuery leftJoin($relation) Adds a LEFT JOIN clause to the query |
31
|
|
|
* @method ChildTaskQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query |
32
|
|
|
* @method ChildTaskQuery innerJoin($relation) Adds a INNER JOIN clause to the query |
33
|
|
|
* |
34
|
|
|
* @method ChildTask findOne(ConnectionInterface $con = null) Return the first ChildTask matching the query |
35
|
|
|
* @method ChildTask findOneOrCreate(ConnectionInterface $con = null) Return the first ChildTask matching the query, or a new ChildTask object populated from the query conditions when no match is found |
36
|
|
|
* |
37
|
|
|
* @method ChildTask findOneById(int $id) Return the first ChildTask filtered by the id column |
38
|
|
|
* @method ChildTask findOneByCreatedAt(string $created_at) Return the first ChildTask filtered by the created_at column |
39
|
|
|
* @method ChildTask findOneByUpdatedAt(string $updated_at) Return the first ChildTask filtered by the updated_at column * |
40
|
|
|
|
41
|
|
|
* @method ChildTask requirePk($key, ConnectionInterface $con = null) Return the ChildTask by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
42
|
|
|
* @method ChildTask requireOne(ConnectionInterface $con = null) Return the first ChildTask matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
43
|
|
|
* |
44
|
|
|
* @method ChildTask requireOneById(int $id) Return the first ChildTask filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
45
|
|
|
* @method ChildTask requireOneByCreatedAt(string $created_at) Return the first ChildTask filtered by the created_at column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
46
|
|
|
* @method ChildTask requireOneByUpdatedAt(string $updated_at) Return the first ChildTask filtered by the updated_at column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
47
|
|
|
* |
48
|
|
|
* @method ChildTask[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildTask objects based on current ModelCriteria |
49
|
|
|
* @method ChildTask[]|ObjectCollection findById(int $id) Return ChildTask objects filtered by the id column |
50
|
|
|
* @method ChildTask[]|ObjectCollection findByCreatedAt(string $created_at) Return ChildTask objects filtered by the created_at column |
51
|
|
|
* @method ChildTask[]|ObjectCollection findByUpdatedAt(string $updated_at) Return ChildTask objects filtered by the updated_at column |
52
|
|
|
* @method ChildTask[]|\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 |
53
|
|
|
* |
54
|
|
|
*/ |
55
|
|
|
abstract class TaskQuery extends ModelCriteria |
56
|
|
|
{ |
57
|
|
|
protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException'; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Initializes internal state of \Core\Models\Task\Base\TaskQuery object. |
61
|
|
|
* |
62
|
|
|
* @param string $dbName The database name |
63
|
|
|
* @param string $modelName The phpName of a model, e.g. 'Book' |
64
|
|
|
* @param string $modelAlias The alias for the model in this query, e.g. 'b' |
65
|
|
|
*/ |
66
|
|
|
public function __construct($dbName = 'default', $modelName = '\\Core\\Models\\Task\\Task', $modelAlias = null) |
67
|
|
|
{ |
68
|
|
|
parent::__construct($dbName, $modelName, $modelAlias); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Returns a new ChildTaskQuery object. |
73
|
|
|
* |
74
|
|
|
* @param string $modelAlias The alias of a model in the query |
75
|
|
|
* @param Criteria $criteria Optional Criteria to build the query from |
76
|
|
|
* |
77
|
|
|
* @return ChildTaskQuery |
78
|
|
|
*/ |
79
|
|
View Code Duplication |
public static function create($modelAlias = null, Criteria $criteria = null) |
|
|
|
|
80
|
|
|
{ |
81
|
|
|
if ($criteria instanceof ChildTaskQuery) { |
82
|
|
|
return $criteria; |
83
|
|
|
} |
84
|
|
|
$query = new ChildTaskQuery(); |
85
|
|
|
if (null !== $modelAlias) { |
86
|
|
|
$query->setModelAlias($modelAlias); |
87
|
|
|
} |
88
|
|
|
if ($criteria instanceof Criteria) { |
89
|
|
|
$query->mergeWith($criteria); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
return $query; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Find object by primary key. |
97
|
|
|
* Propel uses the instance pool to skip the database if the object exists. |
98
|
|
|
* Go fast if the query is untouched. |
99
|
|
|
* |
100
|
|
|
* <code> |
101
|
|
|
* $obj = $c->findPk(12, $con); |
102
|
|
|
* </code> |
103
|
|
|
* |
104
|
|
|
* @param mixed $key Primary key to use for the query |
105
|
|
|
* @param ConnectionInterface $con an optional connection object |
106
|
|
|
* |
107
|
|
|
* @return ChildTask|array|mixed the result, formatted by the current formatter |
108
|
|
|
*/ |
109
|
|
View Code Duplication |
public function findPk($key, ConnectionInterface $con = null) |
|
|
|
|
110
|
|
|
{ |
111
|
|
|
if ($key === null) { |
112
|
|
|
return null; |
113
|
|
|
} |
114
|
|
|
if ((null !== ($obj = TaskTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { |
115
|
|
|
// the object is already in the instance pool |
116
|
|
|
return $obj; |
117
|
|
|
} |
118
|
|
|
if ($con === null) { |
119
|
|
|
$con = Propel::getServiceContainer()->getReadConnection(TaskTableMap::DATABASE_NAME); |
120
|
|
|
} |
121
|
|
|
$this->basePreSelect($con); |
122
|
|
|
if ($this->formatter || $this->modelAlias || $this->with || $this->select |
|
|
|
|
123
|
|
|
|| $this->selectColumns || $this->asColumns || $this->selectModifiers |
|
|
|
|
124
|
|
|
|| $this->map || $this->having || $this->joins) { |
|
|
|
|
125
|
|
|
return $this->findPkComplex($key, $con); |
126
|
|
|
} else { |
127
|
|
|
return $this->findPkSimple($key, $con); |
128
|
|
|
} |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Find object by primary key using raw SQL to go fast. |
133
|
|
|
* Bypass doSelect() and the object formatter by using generated code. |
134
|
|
|
* |
135
|
|
|
* @param mixed $key Primary key to use for the query |
136
|
|
|
* @param ConnectionInterface $con A connection object |
137
|
|
|
* |
138
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
139
|
|
|
* |
140
|
|
|
* @return ChildTask A model object, or null if the key is not found |
141
|
|
|
*/ |
142
|
|
View Code Duplication |
protected function findPkSimple($key, ConnectionInterface $con) |
|
|
|
|
143
|
|
|
{ |
144
|
|
|
$sql = 'SELECT id, created_at, updated_at FROM tasks WHERE id = :p0'; |
145
|
|
|
try { |
146
|
|
|
$stmt = $con->prepare($sql); |
147
|
|
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); |
148
|
|
|
$stmt->execute(); |
149
|
|
|
} catch (Exception $e) { |
150
|
|
|
Propel::log($e->getMessage(), Propel::LOG_ERR); |
151
|
|
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); |
152
|
|
|
} |
153
|
|
|
$obj = null; |
154
|
|
|
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { |
155
|
|
|
/** @var ChildTask $obj */ |
156
|
|
|
$obj = new ChildTask(); |
157
|
|
|
$obj->hydrate($row); |
158
|
|
|
TaskTableMap::addInstanceToPool($obj, (string) $key); |
159
|
|
|
} |
160
|
|
|
$stmt->closeCursor(); |
161
|
|
|
|
162
|
|
|
return $obj; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* Find object by primary key. |
167
|
|
|
* |
168
|
|
|
* @param mixed $key Primary key to use for the query |
169
|
|
|
* @param ConnectionInterface $con A connection object |
170
|
|
|
* |
171
|
|
|
* @return ChildTask|array|mixed the result, formatted by the current formatter |
172
|
|
|
*/ |
173
|
|
View Code Duplication |
protected function findPkComplex($key, ConnectionInterface $con) |
|
|
|
|
174
|
|
|
{ |
175
|
|
|
// As the query uses a PK condition, no limit(1) is necessary. |
176
|
|
|
$criteria = $this->isKeepQuery() ? clone $this : $this; |
177
|
|
|
$dataFetcher = $criteria |
178
|
|
|
->filterByPrimaryKey($key) |
179
|
|
|
->doSelect($con); |
180
|
|
|
|
181
|
|
|
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Find objects by primary key |
186
|
|
|
* <code> |
187
|
|
|
* $objs = $c->findPks(array(12, 56, 832), $con); |
188
|
|
|
* </code> |
189
|
|
|
* @param array $keys Primary keys to use for the query |
190
|
|
|
* @param ConnectionInterface $con an optional connection object |
191
|
|
|
* |
192
|
|
|
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter |
193
|
|
|
*/ |
194
|
|
View Code Duplication |
public function findPks($keys, ConnectionInterface $con = null) |
|
|
|
|
195
|
|
|
{ |
196
|
|
|
if (null === $con) { |
197
|
|
|
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); |
198
|
|
|
} |
199
|
|
|
$this->basePreSelect($con); |
200
|
|
|
$criteria = $this->isKeepQuery() ? clone $this : $this; |
201
|
|
|
$dataFetcher = $criteria |
202
|
|
|
->filterByPrimaryKeys($keys) |
203
|
|
|
->doSelect($con); |
204
|
|
|
|
205
|
|
|
return $criteria->getFormatter()->init($criteria)->format($dataFetcher); |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* Filter the query by primary key |
210
|
|
|
* |
211
|
|
|
* @param mixed $key Primary key to use for the query |
212
|
|
|
* |
213
|
|
|
* @return $this|ChildTaskQuery The current query, for fluid interface |
214
|
|
|
*/ |
215
|
|
|
public function filterByPrimaryKey($key) |
216
|
|
|
{ |
217
|
|
|
|
218
|
|
|
return $this->addUsingAlias(TaskTableMap::COL_ID, $key, Criteria::EQUAL); |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* Filter the query by a list of primary keys |
223
|
|
|
* |
224
|
|
|
* @param array $keys The list of primary key to use for the query |
225
|
|
|
* |
226
|
|
|
* @return $this|ChildTaskQuery The current query, for fluid interface |
227
|
|
|
*/ |
228
|
|
|
public function filterByPrimaryKeys($keys) |
229
|
|
|
{ |
230
|
|
|
|
231
|
|
|
return $this->addUsingAlias(TaskTableMap::COL_ID, $keys, Criteria::IN); |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* Filter the query on the id column |
236
|
|
|
* |
237
|
|
|
* Example usage: |
238
|
|
|
* <code> |
239
|
|
|
* $query->filterById(1234); // WHERE id = 1234 |
240
|
|
|
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34) |
241
|
|
|
* $query->filterById(array('min' => 12)); // WHERE id > 12 |
242
|
|
|
* </code> |
243
|
|
|
* |
244
|
|
|
* @param mixed $id The value to use as filter. |
245
|
|
|
* Use scalar values for equality. |
246
|
|
|
* Use array values for in_array() equivalent. |
247
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
248
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
249
|
|
|
* |
250
|
|
|
* @return $this|ChildTaskQuery The current query, for fluid interface |
251
|
|
|
*/ |
252
|
|
View Code Duplication |
public function filterById($id = null, $comparison = null) |
|
|
|
|
253
|
|
|
{ |
254
|
|
|
if (is_array($id)) { |
255
|
|
|
$useMinMax = false; |
256
|
|
|
if (isset($id['min'])) { |
257
|
|
|
$this->addUsingAlias(TaskTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL); |
258
|
|
|
$useMinMax = true; |
259
|
|
|
} |
260
|
|
|
if (isset($id['max'])) { |
261
|
|
|
$this->addUsingAlias(TaskTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL); |
262
|
|
|
$useMinMax = true; |
263
|
|
|
} |
264
|
|
|
if ($useMinMax) { |
265
|
|
|
return $this; |
266
|
|
|
} |
267
|
|
|
if (null === $comparison) { |
268
|
|
|
$comparison = Criteria::IN; |
269
|
|
|
} |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
return $this->addUsingAlias(TaskTableMap::COL_ID, $id, $comparison); |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Filter the query on the created_at column |
277
|
|
|
* |
278
|
|
|
* Example usage: |
279
|
|
|
* <code> |
280
|
|
|
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14' |
281
|
|
|
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14' |
282
|
|
|
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13' |
283
|
|
|
* </code> |
284
|
|
|
* |
285
|
|
|
* @param mixed $createdAt The value to use as filter. |
286
|
|
|
* Values can be integers (unix timestamps), DateTime objects, or strings. |
287
|
|
|
* Empty strings are treated as NULL. |
288
|
|
|
* Use scalar values for equality. |
289
|
|
|
* Use array values for in_array() equivalent. |
290
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
291
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
292
|
|
|
* |
293
|
|
|
* @return $this|ChildTaskQuery The current query, for fluid interface |
294
|
|
|
*/ |
295
|
|
View Code Duplication |
public function filterByCreatedAt($createdAt = null, $comparison = null) |
|
|
|
|
296
|
|
|
{ |
297
|
|
|
if (is_array($createdAt)) { |
298
|
|
|
$useMinMax = false; |
299
|
|
|
if (isset($createdAt['min'])) { |
300
|
|
|
$this->addUsingAlias(TaskTableMap::COL_CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL); |
301
|
|
|
$useMinMax = true; |
302
|
|
|
} |
303
|
|
|
if (isset($createdAt['max'])) { |
304
|
|
|
$this->addUsingAlias(TaskTableMap::COL_CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL); |
305
|
|
|
$useMinMax = true; |
306
|
|
|
} |
307
|
|
|
if ($useMinMax) { |
308
|
|
|
return $this; |
309
|
|
|
} |
310
|
|
|
if (null === $comparison) { |
311
|
|
|
$comparison = Criteria::IN; |
312
|
|
|
} |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
return $this->addUsingAlias(TaskTableMap::COL_CREATED_AT, $createdAt, $comparison); |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* Filter the query on the updated_at column |
320
|
|
|
* |
321
|
|
|
* Example usage: |
322
|
|
|
* <code> |
323
|
|
|
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14' |
324
|
|
|
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14' |
325
|
|
|
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13' |
326
|
|
|
* </code> |
327
|
|
|
* |
328
|
|
|
* @param mixed $updatedAt The value to use as filter. |
329
|
|
|
* Values can be integers (unix timestamps), DateTime objects, or strings. |
330
|
|
|
* Empty strings are treated as NULL. |
331
|
|
|
* Use scalar values for equality. |
332
|
|
|
* Use array values for in_array() equivalent. |
333
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
334
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
335
|
|
|
* |
336
|
|
|
* @return $this|ChildTaskQuery The current query, for fluid interface |
337
|
|
|
*/ |
338
|
|
View Code Duplication |
public function filterByUpdatedAt($updatedAt = null, $comparison = null) |
|
|
|
|
339
|
|
|
{ |
340
|
|
|
if (is_array($updatedAt)) { |
341
|
|
|
$useMinMax = false; |
342
|
|
|
if (isset($updatedAt['min'])) { |
343
|
|
|
$this->addUsingAlias(TaskTableMap::COL_UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL); |
344
|
|
|
$useMinMax = true; |
345
|
|
|
} |
346
|
|
|
if (isset($updatedAt['max'])) { |
347
|
|
|
$this->addUsingAlias(TaskTableMap::COL_UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL); |
348
|
|
|
$useMinMax = true; |
349
|
|
|
} |
350
|
|
|
if ($useMinMax) { |
351
|
|
|
return $this; |
352
|
|
|
} |
353
|
|
|
if (null === $comparison) { |
354
|
|
|
$comparison = Criteria::IN; |
355
|
|
|
} |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
return $this->addUsingAlias(TaskTableMap::COL_UPDATED_AT, $updatedAt, $comparison); |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
/** |
362
|
|
|
* Exclude object from result |
363
|
|
|
* |
364
|
|
|
* @param ChildTask $task Object to remove from the list of results |
365
|
|
|
* |
366
|
|
|
* @return $this|ChildTaskQuery The current query, for fluid interface |
367
|
|
|
*/ |
368
|
|
|
public function prune($task = null) |
369
|
|
|
{ |
370
|
|
|
if ($task) { |
371
|
|
|
$this->addUsingAlias(TaskTableMap::COL_ID, $task->getId(), Criteria::NOT_EQUAL); |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
return $this; |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
/** |
378
|
|
|
* Deletes all rows from the tasks table. |
379
|
|
|
* |
380
|
|
|
* @param ConnectionInterface $con the connection to use |
381
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). |
382
|
|
|
*/ |
383
|
|
View Code Duplication |
public function doDeleteAll(ConnectionInterface $con = null) |
|
|
|
|
384
|
|
|
{ |
385
|
|
|
if (null === $con) { |
386
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(TaskTableMap::DATABASE_NAME); |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
// use transaction because $criteria could contain info |
390
|
|
|
// for more than one table or we could emulating ON DELETE CASCADE, etc. |
391
|
|
|
return $con->transaction(function () use ($con) { |
392
|
|
|
$affectedRows = 0; // initialize var to track total num of affected rows |
393
|
|
|
$affectedRows += parent::doDeleteAll($con); |
394
|
|
|
// Because this db requires some delete cascade/set null emulation, we have to |
395
|
|
|
// clear the cached instance *after* the emulation has happened (since |
396
|
|
|
// instances get re-added by the select statement contained therein). |
397
|
|
|
TaskTableMap::clearInstancePool(); |
398
|
|
|
TaskTableMap::clearRelatedInstancePool(); |
399
|
|
|
|
400
|
|
|
return $affectedRows; |
401
|
|
|
}); |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
/** |
405
|
|
|
* Performs a DELETE on the database based on the current ModelCriteria |
406
|
|
|
* |
407
|
|
|
* @param ConnectionInterface $con the connection to use |
408
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
409
|
|
|
* if supported by native driver or if emulated using Propel. |
410
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
411
|
|
|
* rethrown wrapped into a PropelException. |
412
|
|
|
*/ |
413
|
|
View Code Duplication |
public function delete(ConnectionInterface $con = null) |
|
|
|
|
414
|
|
|
{ |
415
|
|
|
if (null === $con) { |
416
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(TaskTableMap::DATABASE_NAME); |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
$criteria = $this; |
420
|
|
|
|
421
|
|
|
// Set the correct dbName |
422
|
|
|
$criteria->setDbName(TaskTableMap::DATABASE_NAME); |
423
|
|
|
|
424
|
|
|
// use transaction because $criteria could contain info |
425
|
|
|
// for more than one table or we could emulating ON DELETE CASCADE, etc. |
426
|
|
|
return $con->transaction(function () use ($con, $criteria) { |
427
|
|
|
$affectedRows = 0; // initialize var to track total num of affected rows |
428
|
|
|
|
429
|
|
|
TaskTableMap::removeInstanceFromPool($criteria); |
430
|
|
|
|
431
|
|
|
$affectedRows += ModelCriteria::delete($con); |
432
|
|
|
TaskTableMap::clearRelatedInstancePool(); |
433
|
|
|
|
434
|
|
|
return $affectedRows; |
435
|
|
|
}); |
436
|
|
|
} |
437
|
|
|
|
438
|
|
|
} // TaskQuery |
439
|
|
|
|
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.