1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Jalle19\StatusManager\Database\Base; |
4
|
|
|
|
5
|
|
|
use \Exception; |
6
|
|
|
use \PDO; |
7
|
|
|
use Jalle19\StatusManager\Database\Subscription as ChildSubscription; |
8
|
|
|
use Jalle19\StatusManager\Database\SubscriptionQuery as ChildSubscriptionQuery; |
9
|
|
|
use Jalle19\StatusManager\Database\Map\SubscriptionTableMap; |
10
|
|
|
use Propel\Runtime\Propel; |
11
|
|
|
use Propel\Runtime\ActiveQuery\Criteria; |
12
|
|
|
use Propel\Runtime\ActiveQuery\ModelCriteria; |
13
|
|
|
use Propel\Runtime\ActiveQuery\ModelJoin; |
14
|
|
|
use Propel\Runtime\Collection\ObjectCollection; |
15
|
|
|
use Propel\Runtime\Connection\ConnectionInterface; |
16
|
|
|
use Propel\Runtime\Exception\PropelException; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Base class that represents a query for the 'subscription' table. |
20
|
|
|
* |
21
|
|
|
* |
22
|
|
|
* |
23
|
|
|
* @method ChildSubscriptionQuery orderById($order = Criteria::ASC) Order by the id column |
24
|
|
|
* @method ChildSubscriptionQuery orderByInstanceName($order = Criteria::ASC) Order by the instance_name column |
25
|
|
|
* @method ChildSubscriptionQuery orderByUserId($order = Criteria::ASC) Order by the user_id column |
26
|
|
|
* @method ChildSubscriptionQuery orderByChannelId($order = Criteria::ASC) Order by the channel_id column |
27
|
|
|
* @method ChildSubscriptionQuery orderBySubscriptionId($order = Criteria::ASC) Order by the subscription_id column |
28
|
|
|
* @method ChildSubscriptionQuery orderByStarted($order = Criteria::ASC) Order by the started column |
29
|
|
|
* @method ChildSubscriptionQuery orderByStopped($order = Criteria::ASC) Order by the stopped column |
30
|
|
|
* @method ChildSubscriptionQuery orderByTitle($order = Criteria::ASC) Order by the title column |
31
|
|
|
* @method ChildSubscriptionQuery orderByService($order = Criteria::ASC) Order by the service column |
32
|
|
|
* |
33
|
|
|
* @method ChildSubscriptionQuery groupById() Group by the id column |
34
|
|
|
* @method ChildSubscriptionQuery groupByInstanceName() Group by the instance_name column |
35
|
|
|
* @method ChildSubscriptionQuery groupByUserId() Group by the user_id column |
36
|
|
|
* @method ChildSubscriptionQuery groupByChannelId() Group by the channel_id column |
37
|
|
|
* @method ChildSubscriptionQuery groupBySubscriptionId() Group by the subscription_id column |
38
|
|
|
* @method ChildSubscriptionQuery groupByStarted() Group by the started column |
39
|
|
|
* @method ChildSubscriptionQuery groupByStopped() Group by the stopped column |
40
|
|
|
* @method ChildSubscriptionQuery groupByTitle() Group by the title column |
41
|
|
|
* @method ChildSubscriptionQuery groupByService() Group by the service column |
42
|
|
|
* |
43
|
|
|
* @method ChildSubscriptionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query |
44
|
|
|
* @method ChildSubscriptionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query |
45
|
|
|
* @method ChildSubscriptionQuery innerJoin($relation) Adds a INNER JOIN clause to the query |
46
|
|
|
* |
47
|
|
|
* @method ChildSubscriptionQuery leftJoinWith($relation) Adds a LEFT JOIN clause and with to the query |
48
|
|
|
* @method ChildSubscriptionQuery rightJoinWith($relation) Adds a RIGHT JOIN clause and with to the query |
49
|
|
|
* @method ChildSubscriptionQuery innerJoinWith($relation) Adds a INNER JOIN clause and with to the query |
50
|
|
|
* |
51
|
|
|
* @method ChildSubscriptionQuery leftJoinInstance($relationAlias = null) Adds a LEFT JOIN clause to the query using the Instance relation |
52
|
|
|
* @method ChildSubscriptionQuery rightJoinInstance($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Instance relation |
53
|
|
|
* @method ChildSubscriptionQuery innerJoinInstance($relationAlias = null) Adds a INNER JOIN clause to the query using the Instance relation |
54
|
|
|
* |
55
|
|
|
* @method ChildSubscriptionQuery joinWithInstance($joinType = Criteria::INNER_JOIN) Adds a join clause and with to the query using the Instance relation |
56
|
|
|
* |
57
|
|
|
* @method ChildSubscriptionQuery leftJoinWithInstance() Adds a LEFT JOIN clause and with to the query using the Instance relation |
58
|
|
|
* @method ChildSubscriptionQuery rightJoinWithInstance() Adds a RIGHT JOIN clause and with to the query using the Instance relation |
59
|
|
|
* @method ChildSubscriptionQuery innerJoinWithInstance() Adds a INNER JOIN clause and with to the query using the Instance relation |
60
|
|
|
* |
61
|
|
|
* @method ChildSubscriptionQuery leftJoinUser($relationAlias = null) Adds a LEFT JOIN clause to the query using the User relation |
62
|
|
|
* @method ChildSubscriptionQuery rightJoinUser($relationAlias = null) Adds a RIGHT JOIN clause to the query using the User relation |
63
|
|
|
* @method ChildSubscriptionQuery innerJoinUser($relationAlias = null) Adds a INNER JOIN clause to the query using the User relation |
64
|
|
|
* |
65
|
|
|
* @method ChildSubscriptionQuery joinWithUser($joinType = Criteria::INNER_JOIN) Adds a join clause and with to the query using the User relation |
66
|
|
|
* |
67
|
|
|
* @method ChildSubscriptionQuery leftJoinWithUser() Adds a LEFT JOIN clause and with to the query using the User relation |
68
|
|
|
* @method ChildSubscriptionQuery rightJoinWithUser() Adds a RIGHT JOIN clause and with to the query using the User relation |
69
|
|
|
* @method ChildSubscriptionQuery innerJoinWithUser() Adds a INNER JOIN clause and with to the query using the User relation |
70
|
|
|
* |
71
|
|
|
* @method ChildSubscriptionQuery leftJoinChannel($relationAlias = null) Adds a LEFT JOIN clause to the query using the Channel relation |
72
|
|
|
* @method ChildSubscriptionQuery rightJoinChannel($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Channel relation |
73
|
|
|
* @method ChildSubscriptionQuery innerJoinChannel($relationAlias = null) Adds a INNER JOIN clause to the query using the Channel relation |
74
|
|
|
* |
75
|
|
|
* @method ChildSubscriptionQuery joinWithChannel($joinType = Criteria::INNER_JOIN) Adds a join clause and with to the query using the Channel relation |
76
|
|
|
* |
77
|
|
|
* @method ChildSubscriptionQuery leftJoinWithChannel() Adds a LEFT JOIN clause and with to the query using the Channel relation |
78
|
|
|
* @method ChildSubscriptionQuery rightJoinWithChannel() Adds a RIGHT JOIN clause and with to the query using the Channel relation |
79
|
|
|
* @method ChildSubscriptionQuery innerJoinWithChannel() Adds a INNER JOIN clause and with to the query using the Channel relation |
80
|
|
|
* |
81
|
|
|
* @method \Jalle19\StatusManager\Database\InstanceQuery|\Jalle19\StatusManager\Database\UserQuery|\Jalle19\StatusManager\Database\ChannelQuery endUse() Finalizes a secondary criteria and merges it with its primary Criteria |
82
|
|
|
* |
83
|
|
|
* @method ChildSubscription findOne(ConnectionInterface $con = null) Return the first ChildSubscription matching the query |
84
|
|
|
* @method ChildSubscription findOneOrCreate(ConnectionInterface $con = null) Return the first ChildSubscription matching the query, or a new ChildSubscription object populated from the query conditions when no match is found |
85
|
|
|
* |
86
|
|
|
* @method ChildSubscription findOneById(int $id) Return the first ChildSubscription filtered by the id column |
87
|
|
|
* @method ChildSubscription findOneByInstanceName(string $instance_name) Return the first ChildSubscription filtered by the instance_name column |
88
|
|
|
* @method ChildSubscription findOneByUserId(int $user_id) Return the first ChildSubscription filtered by the user_id column |
89
|
|
|
* @method ChildSubscription findOneByChannelId(int $channel_id) Return the first ChildSubscription filtered by the channel_id column |
90
|
|
|
* @method ChildSubscription findOneBySubscriptionId(int $subscription_id) Return the first ChildSubscription filtered by the subscription_id column |
91
|
|
|
* @method ChildSubscription findOneByStarted(string $started) Return the first ChildSubscription filtered by the started column |
92
|
|
|
* @method ChildSubscription findOneByStopped(string $stopped) Return the first ChildSubscription filtered by the stopped column |
93
|
|
|
* @method ChildSubscription findOneByTitle(string $title) Return the first ChildSubscription filtered by the title column |
94
|
|
|
* @method ChildSubscription findOneByService(string $service) Return the first ChildSubscription filtered by the service column * |
95
|
|
|
|
96
|
|
|
* @method ChildSubscription requirePk($key, ConnectionInterface $con = null) Return the ChildSubscription by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
97
|
|
|
* @method ChildSubscription requireOne(ConnectionInterface $con = null) Return the first ChildSubscription matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
98
|
|
|
* |
99
|
|
|
* @method ChildSubscription requireOneById(int $id) Return the first ChildSubscription filtered by the id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
100
|
|
|
* @method ChildSubscription requireOneByInstanceName(string $instance_name) Return the first ChildSubscription filtered by the instance_name column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
101
|
|
|
* @method ChildSubscription requireOneByUserId(int $user_id) Return the first ChildSubscription filtered by the user_id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
102
|
|
|
* @method ChildSubscription requireOneByChannelId(int $channel_id) Return the first ChildSubscription filtered by the channel_id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
103
|
|
|
* @method ChildSubscription requireOneBySubscriptionId(int $subscription_id) Return the first ChildSubscription filtered by the subscription_id column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
104
|
|
|
* @method ChildSubscription requireOneByStarted(string $started) Return the first ChildSubscription filtered by the started column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
105
|
|
|
* @method ChildSubscription requireOneByStopped(string $stopped) Return the first ChildSubscription filtered by the stopped column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
106
|
|
|
* @method ChildSubscription requireOneByTitle(string $title) Return the first ChildSubscription filtered by the title column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
107
|
|
|
* @method ChildSubscription requireOneByService(string $service) Return the first ChildSubscription filtered by the service column and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
108
|
|
|
* |
109
|
|
|
* @method ChildSubscription[]|ObjectCollection find(ConnectionInterface $con = null) Return ChildSubscription objects based on current ModelCriteria |
110
|
|
|
* @method ChildSubscription[]|ObjectCollection findById(int $id) Return ChildSubscription objects filtered by the id column |
111
|
|
|
* @method ChildSubscription[]|ObjectCollection findByInstanceName(string $instance_name) Return ChildSubscription objects filtered by the instance_name column |
112
|
|
|
* @method ChildSubscription[]|ObjectCollection findByUserId(int $user_id) Return ChildSubscription objects filtered by the user_id column |
113
|
|
|
* @method ChildSubscription[]|ObjectCollection findByChannelId(int $channel_id) Return ChildSubscription objects filtered by the channel_id column |
114
|
|
|
* @method ChildSubscription[]|ObjectCollection findBySubscriptionId(int $subscription_id) Return ChildSubscription objects filtered by the subscription_id column |
115
|
|
|
* @method ChildSubscription[]|ObjectCollection findByStarted(string $started) Return ChildSubscription objects filtered by the started column |
116
|
|
|
* @method ChildSubscription[]|ObjectCollection findByStopped(string $stopped) Return ChildSubscription objects filtered by the stopped column |
117
|
|
|
* @method ChildSubscription[]|ObjectCollection findByTitle(string $title) Return ChildSubscription objects filtered by the title column |
118
|
|
|
* @method ChildSubscription[]|ObjectCollection findByService(string $service) Return ChildSubscription objects filtered by the service column |
119
|
|
|
* @method ChildSubscription[]|\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 |
120
|
|
|
* |
121
|
|
|
*/ |
122
|
|
|
abstract class SubscriptionQuery extends ModelCriteria |
123
|
|
|
{ |
124
|
|
|
protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException'; |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Initializes internal state of \Jalle19\StatusManager\Database\Base\SubscriptionQuery object. |
128
|
|
|
* |
129
|
|
|
* @param string $dbName The database name |
130
|
|
|
* @param string $modelName The phpName of a model, e.g. 'Book' |
131
|
|
|
* @param string $modelAlias The alias for the model in this query, e.g. 'b' |
132
|
|
|
*/ |
133
|
|
|
public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Subscription', $modelAlias = null) |
134
|
|
|
{ |
135
|
|
|
parent::__construct($dbName, $modelName, $modelAlias); |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* Returns a new ChildSubscriptionQuery object. |
140
|
|
|
* |
141
|
|
|
* @param string $modelAlias The alias of a model in the query |
142
|
|
|
* @param Criteria $criteria Optional Criteria to build the query from |
143
|
|
|
* |
144
|
|
|
* @return ChildSubscriptionQuery |
145
|
|
|
*/ |
146
|
|
View Code Duplication |
public static function create($modelAlias = null, Criteria $criteria = null) |
|
|
|
|
147
|
|
|
{ |
148
|
|
|
if ($criteria instanceof ChildSubscriptionQuery) { |
149
|
|
|
return $criteria; |
150
|
|
|
} |
151
|
|
|
$query = new ChildSubscriptionQuery(); |
152
|
|
|
if (null !== $modelAlias) { |
153
|
|
|
$query->setModelAlias($modelAlias); |
154
|
|
|
} |
155
|
|
|
if ($criteria instanceof Criteria) { |
156
|
|
|
$query->mergeWith($criteria); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
return $query; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* Find object by primary key. |
164
|
|
|
* Propel uses the instance pool to skip the database if the object exists. |
165
|
|
|
* Go fast if the query is untouched. |
166
|
|
|
* |
167
|
|
|
* <code> |
168
|
|
|
* $obj = $c->findPk(12, $con); |
169
|
|
|
* </code> |
170
|
|
|
* |
171
|
|
|
* @param mixed $key Primary key to use for the query |
172
|
|
|
* @param ConnectionInterface $con an optional connection object |
173
|
|
|
* |
174
|
|
|
* @return ChildSubscription|array|mixed the result, formatted by the current formatter |
175
|
|
|
*/ |
176
|
|
View Code Duplication |
public function findPk($key, ConnectionInterface $con = null) |
|
|
|
|
177
|
|
|
{ |
178
|
|
|
if ($key === null) { |
179
|
|
|
return null; |
180
|
|
|
} |
181
|
|
|
if ((null !== ($obj = SubscriptionTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) { |
182
|
|
|
// the object is already in the instance pool |
183
|
|
|
return $obj; |
184
|
|
|
} |
185
|
|
|
if ($con === null) { |
186
|
|
|
$con = Propel::getServiceContainer()->getReadConnection(SubscriptionTableMap::DATABASE_NAME); |
187
|
|
|
} |
188
|
|
|
$this->basePreSelect($con); |
189
|
|
|
if ($this->formatter || $this->modelAlias || $this->with || $this->select |
|
|
|
|
190
|
|
|
|| $this->selectColumns || $this->asColumns || $this->selectModifiers |
|
|
|
|
191
|
|
|
|| $this->map || $this->having || $this->joins) { |
|
|
|
|
192
|
|
|
return $this->findPkComplex($key, $con); |
193
|
|
|
} else { |
194
|
|
|
return $this->findPkSimple($key, $con); |
195
|
|
|
} |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Find object by primary key using raw SQL to go fast. |
200
|
|
|
* Bypass doSelect() and the object formatter by using generated code. |
201
|
|
|
* |
202
|
|
|
* @param mixed $key Primary key to use for the query |
203
|
|
|
* @param ConnectionInterface $con A connection object |
204
|
|
|
* |
205
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
206
|
|
|
* |
207
|
|
|
* @return ChildSubscription A model object, or null if the key is not found |
208
|
|
|
*/ |
209
|
|
View Code Duplication |
protected function findPkSimple($key, ConnectionInterface $con) |
|
|
|
|
210
|
|
|
{ |
211
|
|
|
$sql = 'SELECT id, instance_name, user_id, channel_id, subscription_id, started, stopped, title, service FROM subscription WHERE id = :p0'; |
212
|
|
|
try { |
213
|
|
|
$stmt = $con->prepare($sql); |
214
|
|
|
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); |
215
|
|
|
$stmt->execute(); |
216
|
|
|
} catch (Exception $e) { |
217
|
|
|
Propel::log($e->getMessage(), Propel::LOG_ERR); |
218
|
|
|
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); |
219
|
|
|
} |
220
|
|
|
$obj = null; |
221
|
|
|
if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { |
222
|
|
|
/** @var ChildSubscription $obj */ |
223
|
|
|
$obj = new ChildSubscription(); |
224
|
|
|
$obj->hydrate($row); |
225
|
|
|
SubscriptionTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key); |
226
|
|
|
} |
227
|
|
|
$stmt->closeCursor(); |
228
|
|
|
|
229
|
|
|
return $obj; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* Find object by primary key. |
234
|
|
|
* |
235
|
|
|
* @param mixed $key Primary key to use for the query |
236
|
|
|
* @param ConnectionInterface $con A connection object |
237
|
|
|
* |
238
|
|
|
* @return ChildSubscription|array|mixed the result, formatted by the current formatter |
239
|
|
|
*/ |
240
|
|
View Code Duplication |
protected function findPkComplex($key, ConnectionInterface $con) |
|
|
|
|
241
|
|
|
{ |
242
|
|
|
// As the query uses a PK condition, no limit(1) is necessary. |
243
|
|
|
$criteria = $this->isKeepQuery() ? clone $this : $this; |
244
|
|
|
$dataFetcher = $criteria |
245
|
|
|
->filterByPrimaryKey($key) |
246
|
|
|
->doSelect($con); |
247
|
|
|
|
248
|
|
|
return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* Find objects by primary key |
253
|
|
|
* <code> |
254
|
|
|
* $objs = $c->findPks(array(12, 56, 832), $con); |
255
|
|
|
* </code> |
256
|
|
|
* @param array $keys Primary keys to use for the query |
257
|
|
|
* @param ConnectionInterface $con an optional connection object |
258
|
|
|
* |
259
|
|
|
* @return ObjectCollection|array|mixed the list of results, formatted by the current formatter |
260
|
|
|
*/ |
261
|
|
View Code Duplication |
public function findPks($keys, ConnectionInterface $con = null) |
|
|
|
|
262
|
|
|
{ |
263
|
|
|
if (null === $con) { |
264
|
|
|
$con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); |
265
|
|
|
} |
266
|
|
|
$this->basePreSelect($con); |
267
|
|
|
$criteria = $this->isKeepQuery() ? clone $this : $this; |
268
|
|
|
$dataFetcher = $criteria |
269
|
|
|
->filterByPrimaryKeys($keys) |
270
|
|
|
->doSelect($con); |
271
|
|
|
|
272
|
|
|
return $criteria->getFormatter()->init($criteria)->format($dataFetcher); |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Filter the query by primary key |
277
|
|
|
* |
278
|
|
|
* @param mixed $key Primary key to use for the query |
279
|
|
|
* |
280
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
281
|
|
|
*/ |
282
|
|
|
public function filterByPrimaryKey($key) |
283
|
|
|
{ |
284
|
|
|
|
285
|
|
|
return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $key, Criteria::EQUAL); |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* Filter the query by a list of primary keys |
290
|
|
|
* |
291
|
|
|
* @param array $keys The list of primary key to use for the query |
292
|
|
|
* |
293
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
294
|
|
|
*/ |
295
|
|
|
public function filterByPrimaryKeys($keys) |
296
|
|
|
{ |
297
|
|
|
|
298
|
|
|
return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $keys, Criteria::IN); |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* Filter the query on the id column |
303
|
|
|
* |
304
|
|
|
* Example usage: |
305
|
|
|
* <code> |
306
|
|
|
* $query->filterById(1234); // WHERE id = 1234 |
307
|
|
|
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34) |
308
|
|
|
* $query->filterById(array('min' => 12)); // WHERE id > 12 |
309
|
|
|
* </code> |
310
|
|
|
* |
311
|
|
|
* @param mixed $id The value to use as filter. |
312
|
|
|
* Use scalar values for equality. |
313
|
|
|
* Use array values for in_array() equivalent. |
314
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
315
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
316
|
|
|
* |
317
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
318
|
|
|
*/ |
319
|
|
View Code Duplication |
public function filterById($id = null, $comparison = null) |
|
|
|
|
320
|
|
|
{ |
321
|
|
|
if (is_array($id)) { |
322
|
|
|
$useMinMax = false; |
323
|
|
|
if (isset($id['min'])) { |
324
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL); |
325
|
|
|
$useMinMax = true; |
326
|
|
|
} |
327
|
|
|
if (isset($id['max'])) { |
328
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL); |
329
|
|
|
$useMinMax = true; |
330
|
|
|
} |
331
|
|
|
if ($useMinMax) { |
332
|
|
|
return $this; |
333
|
|
|
} |
334
|
|
|
if (null === $comparison) { |
335
|
|
|
$comparison = Criteria::IN; |
336
|
|
|
} |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $id, $comparison); |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* Filter the query on the instance_name column |
344
|
|
|
* |
345
|
|
|
* Example usage: |
346
|
|
|
* <code> |
347
|
|
|
* $query->filterByInstanceName('fooValue'); // WHERE instance_name = 'fooValue' |
348
|
|
|
* $query->filterByInstanceName('%fooValue%'); // WHERE instance_name LIKE '%fooValue%' |
349
|
|
|
* </code> |
350
|
|
|
* |
351
|
|
|
* @param string $instanceName The value to use as filter. |
352
|
|
|
* Accepts wildcards (* and % trigger a LIKE) |
353
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
354
|
|
|
* |
355
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
356
|
|
|
*/ |
357
|
|
View Code Duplication |
public function filterByInstanceName($instanceName = null, $comparison = null) |
|
|
|
|
358
|
|
|
{ |
359
|
|
|
if (null === $comparison) { |
360
|
|
|
if (is_array($instanceName)) { |
361
|
|
|
$comparison = Criteria::IN; |
362
|
|
|
} elseif (preg_match('/[\%\*]/', $instanceName)) { |
363
|
|
|
$instanceName = str_replace('*', '%', $instanceName); |
364
|
|
|
$comparison = Criteria::LIKE; |
365
|
|
|
} |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
return $this->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instanceName, $comparison); |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* Filter the query on the user_id column |
373
|
|
|
* |
374
|
|
|
* Example usage: |
375
|
|
|
* <code> |
376
|
|
|
* $query->filterByUserId(1234); // WHERE user_id = 1234 |
377
|
|
|
* $query->filterByUserId(array(12, 34)); // WHERE user_id IN (12, 34) |
378
|
|
|
* $query->filterByUserId(array('min' => 12)); // WHERE user_id > 12 |
379
|
|
|
* </code> |
380
|
|
|
* |
381
|
|
|
* @see filterByUser() |
382
|
|
|
* |
383
|
|
|
* @param mixed $userId The value to use as filter. |
384
|
|
|
* Use scalar values for equality. |
385
|
|
|
* Use array values for in_array() equivalent. |
386
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
387
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
388
|
|
|
* |
389
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
390
|
|
|
*/ |
391
|
|
View Code Duplication |
public function filterByUserId($userId = null, $comparison = null) |
|
|
|
|
392
|
|
|
{ |
393
|
|
|
if (is_array($userId)) { |
394
|
|
|
$useMinMax = false; |
395
|
|
|
if (isset($userId['min'])) { |
396
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId['min'], Criteria::GREATER_EQUAL); |
397
|
|
|
$useMinMax = true; |
398
|
|
|
} |
399
|
|
|
if (isset($userId['max'])) { |
400
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId['max'], Criteria::LESS_EQUAL); |
401
|
|
|
$useMinMax = true; |
402
|
|
|
} |
403
|
|
|
if ($useMinMax) { |
404
|
|
|
return $this; |
405
|
|
|
} |
406
|
|
|
if (null === $comparison) { |
407
|
|
|
$comparison = Criteria::IN; |
408
|
|
|
} |
409
|
|
|
} |
410
|
|
|
|
411
|
|
|
return $this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId, $comparison); |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
/** |
415
|
|
|
* Filter the query on the channel_id column |
416
|
|
|
* |
417
|
|
|
* Example usage: |
418
|
|
|
* <code> |
419
|
|
|
* $query->filterByChannelId(1234); // WHERE channel_id = 1234 |
420
|
|
|
* $query->filterByChannelId(array(12, 34)); // WHERE channel_id IN (12, 34) |
421
|
|
|
* $query->filterByChannelId(array('min' => 12)); // WHERE channel_id > 12 |
422
|
|
|
* </code> |
423
|
|
|
* |
424
|
|
|
* @see filterByChannel() |
425
|
|
|
* |
426
|
|
|
* @param mixed $channelId The value to use as filter. |
427
|
|
|
* Use scalar values for equality. |
428
|
|
|
* Use array values for in_array() equivalent. |
429
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
430
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
431
|
|
|
* |
432
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
433
|
|
|
*/ |
434
|
|
View Code Duplication |
public function filterByChannelId($channelId = null, $comparison = null) |
|
|
|
|
435
|
|
|
{ |
436
|
|
|
if (is_array($channelId)) { |
437
|
|
|
$useMinMax = false; |
438
|
|
|
if (isset($channelId['min'])) { |
439
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId['min'], Criteria::GREATER_EQUAL); |
440
|
|
|
$useMinMax = true; |
441
|
|
|
} |
442
|
|
|
if (isset($channelId['max'])) { |
443
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId['max'], Criteria::LESS_EQUAL); |
444
|
|
|
$useMinMax = true; |
445
|
|
|
} |
446
|
|
|
if ($useMinMax) { |
447
|
|
|
return $this; |
448
|
|
|
} |
449
|
|
|
if (null === $comparison) { |
450
|
|
|
$comparison = Criteria::IN; |
451
|
|
|
} |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
return $this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId, $comparison); |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
/** |
458
|
|
|
* Filter the query on the subscription_id column |
459
|
|
|
* |
460
|
|
|
* Example usage: |
461
|
|
|
* <code> |
462
|
|
|
* $query->filterBySubscriptionId(1234); // WHERE subscription_id = 1234 |
463
|
|
|
* $query->filterBySubscriptionId(array(12, 34)); // WHERE subscription_id IN (12, 34) |
464
|
|
|
* $query->filterBySubscriptionId(array('min' => 12)); // WHERE subscription_id > 12 |
465
|
|
|
* </code> |
466
|
|
|
* |
467
|
|
|
* @param mixed $subscriptionId The value to use as filter. |
468
|
|
|
* Use scalar values for equality. |
469
|
|
|
* Use array values for in_array() equivalent. |
470
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
471
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
472
|
|
|
* |
473
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
474
|
|
|
*/ |
475
|
|
View Code Duplication |
public function filterBySubscriptionId($subscriptionId = null, $comparison = null) |
|
|
|
|
476
|
|
|
{ |
477
|
|
|
if (is_array($subscriptionId)) { |
478
|
|
|
$useMinMax = false; |
479
|
|
|
if (isset($subscriptionId['min'])) { |
480
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId['min'], Criteria::GREATER_EQUAL); |
481
|
|
|
$useMinMax = true; |
482
|
|
|
} |
483
|
|
|
if (isset($subscriptionId['max'])) { |
484
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId['max'], Criteria::LESS_EQUAL); |
485
|
|
|
$useMinMax = true; |
486
|
|
|
} |
487
|
|
|
if ($useMinMax) { |
488
|
|
|
return $this; |
489
|
|
|
} |
490
|
|
|
if (null === $comparison) { |
491
|
|
|
$comparison = Criteria::IN; |
492
|
|
|
} |
493
|
|
|
} |
494
|
|
|
|
495
|
|
|
return $this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId, $comparison); |
496
|
|
|
} |
497
|
|
|
|
498
|
|
|
/** |
499
|
|
|
* Filter the query on the started column |
500
|
|
|
* |
501
|
|
|
* Example usage: |
502
|
|
|
* <code> |
503
|
|
|
* $query->filterByStarted('2011-03-14'); // WHERE started = '2011-03-14' |
504
|
|
|
* $query->filterByStarted('now'); // WHERE started = '2011-03-14' |
505
|
|
|
* $query->filterByStarted(array('max' => 'yesterday')); // WHERE started > '2011-03-13' |
506
|
|
|
* </code> |
507
|
|
|
* |
508
|
|
|
* @param mixed $started The value to use as filter. |
509
|
|
|
* Values can be integers (unix timestamps), DateTime objects, or strings. |
510
|
|
|
* Empty strings are treated as NULL. |
511
|
|
|
* Use scalar values for equality. |
512
|
|
|
* Use array values for in_array() equivalent. |
513
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
514
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
515
|
|
|
* |
516
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
517
|
|
|
*/ |
518
|
|
View Code Duplication |
public function filterByStarted($started = null, $comparison = null) |
|
|
|
|
519
|
|
|
{ |
520
|
|
|
if (is_array($started)) { |
521
|
|
|
$useMinMax = false; |
522
|
|
|
if (isset($started['min'])) { |
523
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started['min'], Criteria::GREATER_EQUAL); |
524
|
|
|
$useMinMax = true; |
525
|
|
|
} |
526
|
|
|
if (isset($started['max'])) { |
527
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started['max'], Criteria::LESS_EQUAL); |
528
|
|
|
$useMinMax = true; |
529
|
|
|
} |
530
|
|
|
if ($useMinMax) { |
531
|
|
|
return $this; |
532
|
|
|
} |
533
|
|
|
if (null === $comparison) { |
534
|
|
|
$comparison = Criteria::IN; |
535
|
|
|
} |
536
|
|
|
} |
537
|
|
|
|
538
|
|
|
return $this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started, $comparison); |
539
|
|
|
} |
540
|
|
|
|
541
|
|
|
/** |
542
|
|
|
* Filter the query on the stopped column |
543
|
|
|
* |
544
|
|
|
* Example usage: |
545
|
|
|
* <code> |
546
|
|
|
* $query->filterByStopped('2011-03-14'); // WHERE stopped = '2011-03-14' |
547
|
|
|
* $query->filterByStopped('now'); // WHERE stopped = '2011-03-14' |
548
|
|
|
* $query->filterByStopped(array('max' => 'yesterday')); // WHERE stopped > '2011-03-13' |
549
|
|
|
* </code> |
550
|
|
|
* |
551
|
|
|
* @param mixed $stopped The value to use as filter. |
552
|
|
|
* Values can be integers (unix timestamps), DateTime objects, or strings. |
553
|
|
|
* Empty strings are treated as NULL. |
554
|
|
|
* Use scalar values for equality. |
555
|
|
|
* Use array values for in_array() equivalent. |
556
|
|
|
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
557
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
558
|
|
|
* |
559
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
560
|
|
|
*/ |
561
|
|
View Code Duplication |
public function filterByStopped($stopped = null, $comparison = null) |
|
|
|
|
562
|
|
|
{ |
563
|
|
|
if (is_array($stopped)) { |
564
|
|
|
$useMinMax = false; |
565
|
|
|
if (isset($stopped['min'])) { |
566
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped['min'], Criteria::GREATER_EQUAL); |
567
|
|
|
$useMinMax = true; |
568
|
|
|
} |
569
|
|
|
if (isset($stopped['max'])) { |
570
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped['max'], Criteria::LESS_EQUAL); |
571
|
|
|
$useMinMax = true; |
572
|
|
|
} |
573
|
|
|
if ($useMinMax) { |
574
|
|
|
return $this; |
575
|
|
|
} |
576
|
|
|
if (null === $comparison) { |
577
|
|
|
$comparison = Criteria::IN; |
578
|
|
|
} |
579
|
|
|
} |
580
|
|
|
|
581
|
|
|
return $this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped, $comparison); |
582
|
|
|
} |
583
|
|
|
|
584
|
|
|
/** |
585
|
|
|
* Filter the query on the title column |
586
|
|
|
* |
587
|
|
|
* Example usage: |
588
|
|
|
* <code> |
589
|
|
|
* $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' |
590
|
|
|
* $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' |
591
|
|
|
* </code> |
592
|
|
|
* |
593
|
|
|
* @param string $title The value to use as filter. |
594
|
|
|
* Accepts wildcards (* and % trigger a LIKE) |
595
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
596
|
|
|
* |
597
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
598
|
|
|
*/ |
599
|
|
View Code Duplication |
public function filterByTitle($title = null, $comparison = null) |
|
|
|
|
600
|
|
|
{ |
601
|
|
|
if (null === $comparison) { |
602
|
|
|
if (is_array($title)) { |
603
|
|
|
$comparison = Criteria::IN; |
604
|
|
|
} elseif (preg_match('/[\%\*]/', $title)) { |
605
|
|
|
$title = str_replace('*', '%', $title); |
606
|
|
|
$comparison = Criteria::LIKE; |
607
|
|
|
} |
608
|
|
|
} |
609
|
|
|
|
610
|
|
|
return $this->addUsingAlias(SubscriptionTableMap::COL_TITLE, $title, $comparison); |
611
|
|
|
} |
612
|
|
|
|
613
|
|
|
/** |
614
|
|
|
* Filter the query on the service column |
615
|
|
|
* |
616
|
|
|
* Example usage: |
617
|
|
|
* <code> |
618
|
|
|
* $query->filterByService('fooValue'); // WHERE service = 'fooValue' |
619
|
|
|
* $query->filterByService('%fooValue%'); // WHERE service LIKE '%fooValue%' |
620
|
|
|
* </code> |
621
|
|
|
* |
622
|
|
|
* @param string $service The value to use as filter. |
623
|
|
|
* Accepts wildcards (* and % trigger a LIKE) |
624
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
625
|
|
|
* |
626
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
627
|
|
|
*/ |
628
|
|
View Code Duplication |
public function filterByService($service = null, $comparison = null) |
|
|
|
|
629
|
|
|
{ |
630
|
|
|
if (null === $comparison) { |
631
|
|
|
if (is_array($service)) { |
632
|
|
|
$comparison = Criteria::IN; |
633
|
|
|
} elseif (preg_match('/[\%\*]/', $service)) { |
634
|
|
|
$service = str_replace('*', '%', $service); |
635
|
|
|
$comparison = Criteria::LIKE; |
636
|
|
|
} |
637
|
|
|
} |
638
|
|
|
|
639
|
|
|
return $this->addUsingAlias(SubscriptionTableMap::COL_SERVICE, $service, $comparison); |
640
|
|
|
} |
641
|
|
|
|
642
|
|
|
/** |
643
|
|
|
* Filter the query by a related \Jalle19\StatusManager\Database\Instance object |
644
|
|
|
* |
645
|
|
|
* @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter |
646
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
647
|
|
|
* |
648
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
649
|
|
|
* |
650
|
|
|
* @return ChildSubscriptionQuery The current query, for fluid interface |
651
|
|
|
*/ |
652
|
|
View Code Duplication |
public function filterByInstance($instance, $comparison = null) |
|
|
|
|
653
|
|
|
{ |
654
|
|
|
if ($instance instanceof \Jalle19\StatusManager\Database\Instance) { |
655
|
|
|
return $this |
656
|
|
|
->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instance->getName(), $comparison); |
657
|
|
|
} elseif ($instance instanceof ObjectCollection) { |
658
|
|
|
if (null === $comparison) { |
659
|
|
|
$comparison = Criteria::IN; |
660
|
|
|
} |
661
|
|
|
|
662
|
|
|
return $this |
663
|
|
|
->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instance->toKeyValue('PrimaryKey', 'Name'), $comparison); |
664
|
|
|
} else { |
665
|
|
|
throw new PropelException('filterByInstance() only accepts arguments of type \Jalle19\StatusManager\Database\Instance or Collection'); |
666
|
|
|
} |
667
|
|
|
} |
668
|
|
|
|
669
|
|
|
/** |
670
|
|
|
* Adds a JOIN clause to the query using the Instance relation |
671
|
|
|
* |
672
|
|
|
* @param string $relationAlias optional alias for the relation |
673
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
674
|
|
|
* |
675
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
676
|
|
|
*/ |
677
|
|
View Code Duplication |
public function joinInstance($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
|
|
|
678
|
|
|
{ |
679
|
|
|
$tableMap = $this->getTableMap(); |
680
|
|
|
$relationMap = $tableMap->getRelation('Instance'); |
681
|
|
|
|
682
|
|
|
// create a ModelJoin object for this join |
683
|
|
|
$join = new ModelJoin(); |
684
|
|
|
$join->setJoinType($joinType); |
685
|
|
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
686
|
|
|
if ($previousJoin = $this->getPreviousJoin()) { |
687
|
|
|
$join->setPreviousJoin($previousJoin); |
|
|
|
|
688
|
|
|
} |
689
|
|
|
|
690
|
|
|
// add the ModelJoin to the current object |
691
|
|
|
if ($relationAlias) { |
|
|
|
|
692
|
|
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
693
|
|
|
$this->addJoinObject($join, $relationAlias); |
694
|
|
|
} else { |
695
|
|
|
$this->addJoinObject($join, 'Instance'); |
696
|
|
|
} |
697
|
|
|
|
698
|
|
|
return $this; |
699
|
|
|
} |
700
|
|
|
|
701
|
|
|
/** |
702
|
|
|
* Use the Instance relation Instance object |
703
|
|
|
* |
704
|
|
|
* @see useQuery() |
705
|
|
|
* |
706
|
|
|
* @param string $relationAlias optional alias for the relation, |
707
|
|
|
* to be used as main alias in the secondary query |
708
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
709
|
|
|
* |
710
|
|
|
* @return \Jalle19\StatusManager\Database\InstanceQuery A secondary query class using the current class as primary query |
711
|
|
|
*/ |
712
|
|
|
public function useInstanceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
713
|
|
|
{ |
714
|
|
|
return $this |
715
|
|
|
->joinInstance($relationAlias, $joinType) |
716
|
|
|
->useQuery($relationAlias ? $relationAlias : 'Instance', '\Jalle19\StatusManager\Database\InstanceQuery'); |
717
|
|
|
} |
718
|
|
|
|
719
|
|
|
/** |
720
|
|
|
* Filter the query by a related \Jalle19\StatusManager\Database\User object |
721
|
|
|
* |
722
|
|
|
* @param \Jalle19\StatusManager\Database\User|ObjectCollection $user The related object(s) to use as filter |
723
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
724
|
|
|
* |
725
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
726
|
|
|
* |
727
|
|
|
* @return ChildSubscriptionQuery The current query, for fluid interface |
728
|
|
|
*/ |
729
|
|
View Code Duplication |
public function filterByUser($user, $comparison = null) |
|
|
|
|
730
|
|
|
{ |
731
|
|
|
if ($user instanceof \Jalle19\StatusManager\Database\User) { |
732
|
|
|
return $this |
733
|
|
|
->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $user->getId(), $comparison); |
734
|
|
|
} elseif ($user instanceof ObjectCollection) { |
735
|
|
|
if (null === $comparison) { |
736
|
|
|
$comparison = Criteria::IN; |
737
|
|
|
} |
738
|
|
|
|
739
|
|
|
return $this |
740
|
|
|
->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); |
741
|
|
|
} else { |
742
|
|
|
throw new PropelException('filterByUser() only accepts arguments of type \Jalle19\StatusManager\Database\User or Collection'); |
743
|
|
|
} |
744
|
|
|
} |
745
|
|
|
|
746
|
|
|
/** |
747
|
|
|
* Adds a JOIN clause to the query using the User relation |
748
|
|
|
* |
749
|
|
|
* @param string $relationAlias optional alias for the relation |
750
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
751
|
|
|
* |
752
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
753
|
|
|
*/ |
754
|
|
View Code Duplication |
public function joinUser($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
|
|
|
755
|
|
|
{ |
756
|
|
|
$tableMap = $this->getTableMap(); |
757
|
|
|
$relationMap = $tableMap->getRelation('User'); |
758
|
|
|
|
759
|
|
|
// create a ModelJoin object for this join |
760
|
|
|
$join = new ModelJoin(); |
761
|
|
|
$join->setJoinType($joinType); |
762
|
|
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
763
|
|
|
if ($previousJoin = $this->getPreviousJoin()) { |
764
|
|
|
$join->setPreviousJoin($previousJoin); |
|
|
|
|
765
|
|
|
} |
766
|
|
|
|
767
|
|
|
// add the ModelJoin to the current object |
768
|
|
|
if ($relationAlias) { |
|
|
|
|
769
|
|
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
770
|
|
|
$this->addJoinObject($join, $relationAlias); |
771
|
|
|
} else { |
772
|
|
|
$this->addJoinObject($join, 'User'); |
773
|
|
|
} |
774
|
|
|
|
775
|
|
|
return $this; |
776
|
|
|
} |
777
|
|
|
|
778
|
|
|
/** |
779
|
|
|
* Use the User relation User object |
780
|
|
|
* |
781
|
|
|
* @see useQuery() |
782
|
|
|
* |
783
|
|
|
* @param string $relationAlias optional alias for the relation, |
784
|
|
|
* to be used as main alias in the secondary query |
785
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
786
|
|
|
* |
787
|
|
|
* @return \Jalle19\StatusManager\Database\UserQuery A secondary query class using the current class as primary query |
788
|
|
|
*/ |
789
|
|
|
public function useUserQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
790
|
|
|
{ |
791
|
|
|
return $this |
792
|
|
|
->joinUser($relationAlias, $joinType) |
793
|
|
|
->useQuery($relationAlias ? $relationAlias : 'User', '\Jalle19\StatusManager\Database\UserQuery'); |
794
|
|
|
} |
795
|
|
|
|
796
|
|
|
/** |
797
|
|
|
* Filter the query by a related \Jalle19\StatusManager\Database\Channel object |
798
|
|
|
* |
799
|
|
|
* @param \Jalle19\StatusManager\Database\Channel|ObjectCollection $channel The related object(s) to use as filter |
800
|
|
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
801
|
|
|
* |
802
|
|
|
* @throws \Propel\Runtime\Exception\PropelException |
803
|
|
|
* |
804
|
|
|
* @return ChildSubscriptionQuery The current query, for fluid interface |
805
|
|
|
*/ |
806
|
|
View Code Duplication |
public function filterByChannel($channel, $comparison = null) |
|
|
|
|
807
|
|
|
{ |
808
|
|
|
if ($channel instanceof \Jalle19\StatusManager\Database\Channel) { |
809
|
|
|
return $this |
810
|
|
|
->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channel->getId(), $comparison); |
811
|
|
|
} elseif ($channel instanceof ObjectCollection) { |
812
|
|
|
if (null === $comparison) { |
813
|
|
|
$comparison = Criteria::IN; |
814
|
|
|
} |
815
|
|
|
|
816
|
|
|
return $this |
817
|
|
|
->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channel->toKeyValue('PrimaryKey', 'Id'), $comparison); |
818
|
|
|
} else { |
819
|
|
|
throw new PropelException('filterByChannel() only accepts arguments of type \Jalle19\StatusManager\Database\Channel or Collection'); |
820
|
|
|
} |
821
|
|
|
} |
822
|
|
|
|
823
|
|
|
/** |
824
|
|
|
* Adds a JOIN clause to the query using the Channel relation |
825
|
|
|
* |
826
|
|
|
* @param string $relationAlias optional alias for the relation |
827
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
828
|
|
|
* |
829
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
830
|
|
|
*/ |
831
|
|
View Code Duplication |
public function joinChannel($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
|
|
|
832
|
|
|
{ |
833
|
|
|
$tableMap = $this->getTableMap(); |
834
|
|
|
$relationMap = $tableMap->getRelation('Channel'); |
835
|
|
|
|
836
|
|
|
// create a ModelJoin object for this join |
837
|
|
|
$join = new ModelJoin(); |
838
|
|
|
$join->setJoinType($joinType); |
839
|
|
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
840
|
|
|
if ($previousJoin = $this->getPreviousJoin()) { |
841
|
|
|
$join->setPreviousJoin($previousJoin); |
|
|
|
|
842
|
|
|
} |
843
|
|
|
|
844
|
|
|
// add the ModelJoin to the current object |
845
|
|
|
if ($relationAlias) { |
|
|
|
|
846
|
|
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
847
|
|
|
$this->addJoinObject($join, $relationAlias); |
848
|
|
|
} else { |
849
|
|
|
$this->addJoinObject($join, 'Channel'); |
850
|
|
|
} |
851
|
|
|
|
852
|
|
|
return $this; |
853
|
|
|
} |
854
|
|
|
|
855
|
|
|
/** |
856
|
|
|
* Use the Channel relation Channel object |
857
|
|
|
* |
858
|
|
|
* @see useQuery() |
859
|
|
|
* |
860
|
|
|
* @param string $relationAlias optional alias for the relation, |
861
|
|
|
* to be used as main alias in the secondary query |
862
|
|
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
863
|
|
|
* |
864
|
|
|
* @return \Jalle19\StatusManager\Database\ChannelQuery A secondary query class using the current class as primary query |
865
|
|
|
*/ |
866
|
|
|
public function useChannelQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
867
|
|
|
{ |
868
|
|
|
return $this |
869
|
|
|
->joinChannel($relationAlias, $joinType) |
870
|
|
|
->useQuery($relationAlias ? $relationAlias : 'Channel', '\Jalle19\StatusManager\Database\ChannelQuery'); |
871
|
|
|
} |
872
|
|
|
|
873
|
|
|
/** |
874
|
|
|
* Exclude object from result |
875
|
|
|
* |
876
|
|
|
* @param ChildSubscription $subscription Object to remove from the list of results |
877
|
|
|
* |
878
|
|
|
* @return $this|ChildSubscriptionQuery The current query, for fluid interface |
879
|
|
|
*/ |
880
|
|
|
public function prune($subscription = null) |
881
|
|
|
{ |
882
|
|
|
if ($subscription) { |
883
|
|
|
$this->addUsingAlias(SubscriptionTableMap::COL_ID, $subscription->getId(), Criteria::NOT_EQUAL); |
884
|
|
|
} |
885
|
|
|
|
886
|
|
|
return $this; |
887
|
|
|
} |
888
|
|
|
|
889
|
|
|
/** |
890
|
|
|
* Deletes all rows from the subscription table. |
891
|
|
|
* |
892
|
|
|
* @param ConnectionInterface $con the connection to use |
893
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). |
894
|
|
|
*/ |
895
|
|
View Code Duplication |
public function doDeleteAll(ConnectionInterface $con = null) |
|
|
|
|
896
|
|
|
{ |
897
|
|
|
if (null === $con) { |
898
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME); |
899
|
|
|
} |
900
|
|
|
|
901
|
|
|
// use transaction because $criteria could contain info |
902
|
|
|
// for more than one table or we could emulating ON DELETE CASCADE, etc. |
903
|
|
|
return $con->transaction(function () use ($con) { |
904
|
|
|
$affectedRows = 0; // initialize var to track total num of affected rows |
905
|
|
|
$affectedRows += parent::doDeleteAll($con); |
906
|
|
|
// Because this db requires some delete cascade/set null emulation, we have to |
907
|
|
|
// clear the cached instance *after* the emulation has happened (since |
908
|
|
|
// instances get re-added by the select statement contained therein). |
909
|
|
|
SubscriptionTableMap::clearInstancePool(); |
910
|
|
|
SubscriptionTableMap::clearRelatedInstancePool(); |
911
|
|
|
|
912
|
|
|
return $affectedRows; |
913
|
|
|
}); |
914
|
|
|
} |
915
|
|
|
|
916
|
|
|
/** |
917
|
|
|
* Performs a DELETE on the database based on the current ModelCriteria |
918
|
|
|
* |
919
|
|
|
* @param ConnectionInterface $con the connection to use |
920
|
|
|
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
921
|
|
|
* if supported by native driver or if emulated using Propel. |
922
|
|
|
* @throws PropelException Any exceptions caught during processing will be |
923
|
|
|
* rethrown wrapped into a PropelException. |
924
|
|
|
*/ |
925
|
|
View Code Duplication |
public function delete(ConnectionInterface $con = null) |
|
|
|
|
926
|
|
|
{ |
927
|
|
|
if (null === $con) { |
928
|
|
|
$con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME); |
929
|
|
|
} |
930
|
|
|
|
931
|
|
|
$criteria = $this; |
932
|
|
|
|
933
|
|
|
// Set the correct dbName |
934
|
|
|
$criteria->setDbName(SubscriptionTableMap::DATABASE_NAME); |
935
|
|
|
|
936
|
|
|
// use transaction because $criteria could contain info |
937
|
|
|
// for more than one table or we could emulating ON DELETE CASCADE, etc. |
938
|
|
|
return $con->transaction(function () use ($con, $criteria) { |
939
|
|
|
$affectedRows = 0; // initialize var to track total num of affected rows |
940
|
|
|
|
941
|
|
|
SubscriptionTableMap::removeInstanceFromPool($criteria); |
942
|
|
|
|
943
|
|
|
$affectedRows += ModelCriteria::delete($con); |
944
|
|
|
SubscriptionTableMap::clearRelatedInstancePool(); |
945
|
|
|
|
946
|
|
|
return $affectedRows; |
947
|
|
|
}); |
948
|
|
|
} |
949
|
|
|
|
950
|
|
|
} // SubscriptionQuery |
951
|
|
|
|
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.