@@ -142,7 +142,7 @@ |
||
142 | 142 | if ($configuration === false) |
143 | 143 | throw new InvalidConfigurationException('Failed to parse the specified configuration file'); |
144 | 144 | |
145 | - $instances = []; |
|
145 | + $instances = []; |
|
146 | 146 | |
147 | 147 | // Parse sections |
148 | 148 | foreach ($configuration as $section => $values) |
@@ -124,23 +124,26 @@ discard block |
||
124 | 124 | private function parseConfiguration(InputInterface $input) |
125 | 125 | { |
126 | 126 | // Check that the configuration file exists |
127 | - if (!file_exists($input->getArgument('configFile'))) |
|
128 | - throw new InvalidConfigurationException('The specified configuration file does not exist'); |
|
127 | + if (!file_exists($input->getArgument('configFile'))) { |
|
128 | + throw new InvalidConfigurationException('The specified configuration file does not exist'); |
|
129 | + } |
|
129 | 130 | |
130 | 131 | // Check that the database exists and is writable |
131 | 132 | $databasePath = $input->getArgument('databaseFile'); |
132 | 133 | |
133 | - if (!file_exists($databasePath)) |
|
134 | - throw new InvalidConfigurationException('The specified database path does not exist'); |
|
135 | - else if (!is_writable($databasePath)) |
|
136 | - throw new InvalidConfigurationException('The specified database path is not writable'); |
|
134 | + if (!file_exists($databasePath)) { |
|
135 | + throw new InvalidConfigurationException('The specified database path does not exist'); |
|
136 | + } else if (!is_writable($databasePath)) { |
|
137 | + throw new InvalidConfigurationException('The specified database path is not writable'); |
|
138 | + } |
|
137 | 139 | |
138 | 140 | // Parse the configuration file |
139 | 141 | $configuration = parse_ini_file($input->getArgument('configFile'), true); |
140 | 142 | |
141 | 143 | // Check that the file was parsed |
142 | - if ($configuration === false) |
|
143 | - throw new InvalidConfigurationException('Failed to parse the specified configuration file'); |
|
144 | + if ($configuration === false) { |
|
145 | + throw new InvalidConfigurationException('Failed to parse the specified configuration file'); |
|
146 | + } |
|
144 | 147 | |
145 | 148 | $instances = []; |
146 | 149 | |
@@ -157,12 +160,14 @@ discard block |
||
157 | 160 | $instance = new Instance($name, $address, $port); |
158 | 161 | |
159 | 162 | // Optionally set ignored users |
160 | - if (isset($values['ignoredUsers'])) |
|
161 | - $instance->setIgnoredUsers($values['ignoredUsers']); |
|
163 | + if (isset($values['ignoredUsers'])) { |
|
164 | + $instance->setIgnoredUsers($values['ignoredUsers']); |
|
165 | + } |
|
162 | 166 | |
163 | 167 | // Optionally set credentials |
164 | - if (isset($values['username']) && isset($values['password'])) |
|
165 | - $instance->setCredentials($values['username'], $values['password']); |
|
168 | + if (isset($values['username']) && isset($values['password'])) { |
|
169 | + $instance->setCredentials($values['username'], $values['password']); |
|
170 | + } |
|
166 | 171 | |
167 | 172 | $instances[] = $instance; |
168 | 173 | break; |
@@ -170,8 +175,9 @@ discard block |
||
170 | 175 | } |
171 | 176 | |
172 | 177 | // Validate the configuration. We need at least one instance. |
173 | - if (empty($instances)) |
|
174 | - throw new InvalidConfigurationException('No instances defined, you need to specify at least one instance'); |
|
178 | + if (empty($instances)) { |
|
179 | + throw new InvalidConfigurationException('No instances defined, you need to specify at least one instance'); |
|
180 | + } |
|
175 | 181 | |
176 | 182 | // Create the configuration object |
177 | 183 | $config = new Configuration($databasePath, $instances); |
@@ -200,8 +206,9 @@ discard block |
||
200 | 206 | */ |
201 | 207 | private static function getSectionType($section) |
202 | 208 | { |
203 | - if (substr($section, 0, 8) === 'instance') |
|
204 | - return Configuration::SECTION_TYPE_INSTANCE; |
|
209 | + if (substr($section, 0, 8) === 'instance') { |
|
210 | + return Configuration::SECTION_TYPE_INSTANCE; |
|
211 | + } |
|
205 | 212 | |
206 | 213 | throw new InvalidConfigurationException('Unknown section "' . $section . '"'); |
207 | 214 | } |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | |
621 | 621 | // use transaction because $criteria could contain info |
622 | 622 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
623 | - return $con->transaction(function () use ($con) { |
|
623 | + return $con->transaction(function() use ($con) { |
|
624 | 624 | $affectedRows = 0; // initialize var to track total num of affected rows |
625 | 625 | $affectedRows += parent::doDeleteAll($con); |
626 | 626 | // Because this db requires some delete cascade/set null emulation, we have to |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | // use transaction because $criteria could contain info |
657 | 657 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
658 | - return $con->transaction(function () use ($con, $criteria) { |
|
658 | + return $con->transaction(function() use ($con, $criteria) { |
|
659 | 659 | $affectedRows = 0; // initialize var to track total num of affected rows |
660 | 660 | |
661 | 661 | UserTableMap::removeInstanceFromPool($criteria); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * |
425 | 425 | * @see filterByUser() |
426 | 426 | * |
427 | - * @param mixed $userId The value to use as filter. |
|
427 | + * @param integer|null $userId The value to use as filter. |
|
428 | 428 | * Use scalar values for equality. |
429 | 429 | * Use array values for in_array() equivalent. |
430 | 430 | * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * $query->filterBySubscriptionId(array('min' => 12)); // WHERE subscription_id > 12 |
509 | 509 | * </code> |
510 | 510 | * |
511 | - * @param mixed $subscriptionId The value to use as filter. |
|
511 | + * @param integer $subscriptionId The value to use as filter. |
|
512 | 512 | * Use scalar values for equality. |
513 | 513 | * Use array values for in_array() equivalent. |
514 | 514 | * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | * $query->filterByStarted(array('max' => 'yesterday')); // WHERE started > '2011-03-13' |
550 | 550 | * </code> |
551 | 551 | * |
552 | - * @param mixed $started The value to use as filter. |
|
552 | + * @param integer $started The value to use as filter. |
|
553 | 553 | * Values can be integers (unix timestamps), DateTime objects, or strings. |
554 | 554 | * Empty strings are treated as NULL. |
555 | 555 | * Use scalar values for equality. |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | /** |
687 | 687 | * Filter the query by a related \Jalle19\StatusManager\Database\Instance object |
688 | 688 | * |
689 | - * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter |
|
689 | + * @param Instance $instance The related object(s) to use as filter |
|
690 | 690 | * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
691 | 691 | * |
692 | 692 | * @throws \Propel\Runtime\Exception\PropelException |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | /** |
764 | 764 | * Filter the query by a related \Jalle19\StatusManager\Database\Input object |
765 | 765 | * |
766 | - * @param \Jalle19\StatusManager\Database\Input|ObjectCollection $input The related object(s) to use as filter |
|
766 | + * @param Input $input The related object(s) to use as filter |
|
767 | 767 | * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
768 | 768 | * |
769 | 769 | * @throws \Propel\Runtime\Exception\PropelException |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | /** |
841 | 841 | * Filter the query by a related \Jalle19\StatusManager\Database\User object |
842 | 842 | * |
843 | - * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user The related object(s) to use as filter |
|
843 | + * @param User $user The related object(s) to use as filter |
|
844 | 844 | * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
845 | 845 | * |
846 | 846 | * @throws \Propel\Runtime\Exception\PropelException |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | /** |
918 | 918 | * Filter the query by a related \Jalle19\StatusManager\Database\Channel object |
919 | 919 | * |
920 | - * @param \Jalle19\StatusManager\Database\Channel|ObjectCollection $channel The related object(s) to use as filter |
|
920 | + * @param Channel $channel The related object(s) to use as filter |
|
921 | 921 | * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
922 | 922 | * |
923 | 923 | * @throws \Propel\Runtime\Exception\PropelException |
@@ -105,7 +105,6 @@ discard block |
||
105 | 105 | * @method ChildSubscription findOneByStopped(string $stopped) Return the first ChildSubscription filtered by the stopped column |
106 | 106 | * @method ChildSubscription findOneByTitle(string $title) Return the first ChildSubscription filtered by the title column |
107 | 107 | * @method ChildSubscription findOneByService(string $service) Return the first ChildSubscription filtered by the service column * |
108 | - |
|
109 | 108 | * @method ChildSubscription requirePk($key, ConnectionInterface $con = null) Return the ChildSubscription by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
110 | 109 | * @method ChildSubscription requireOne(ConnectionInterface $con = null) Return the first ChildSubscription matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
111 | 110 | * |
@@ -136,936 +135,936 @@ discard block |
||
136 | 135 | */ |
137 | 136 | abstract class SubscriptionQuery extends ModelCriteria |
138 | 137 | { |
139 | - protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException'; |
|
140 | - |
|
141 | - /** |
|
142 | - * Initializes internal state of \Jalle19\StatusManager\Database\Base\SubscriptionQuery object. |
|
143 | - * |
|
144 | - * @param string $dbName The database name |
|
145 | - * @param string $modelName The phpName of a model, e.g. 'Book' |
|
146 | - * @param string $modelAlias The alias for the model in this query, e.g. 'b' |
|
147 | - */ |
|
148 | - public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Subscription', $modelAlias = null) |
|
149 | - { |
|
150 | - parent::__construct($dbName, $modelName, $modelAlias); |
|
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * Returns a new ChildSubscriptionQuery object. |
|
155 | - * |
|
156 | - * @param string $modelAlias The alias of a model in the query |
|
157 | - * @param Criteria $criteria Optional Criteria to build the query from |
|
158 | - * |
|
159 | - * @return ChildSubscriptionQuery |
|
160 | - */ |
|
161 | - public static function create($modelAlias = null, Criteria $criteria = null) |
|
162 | - { |
|
163 | - if ($criteria instanceof ChildSubscriptionQuery) { |
|
164 | - return $criteria; |
|
165 | - } |
|
166 | - $query = new ChildSubscriptionQuery(); |
|
167 | - if (null !== $modelAlias) { |
|
168 | - $query->setModelAlias($modelAlias); |
|
169 | - } |
|
170 | - if ($criteria instanceof Criteria) { |
|
171 | - $query->mergeWith($criteria); |
|
172 | - } |
|
173 | - |
|
174 | - return $query; |
|
175 | - } |
|
176 | - |
|
177 | - /** |
|
178 | - * Find object by primary key. |
|
179 | - * Propel uses the instance pool to skip the database if the object exists. |
|
180 | - * Go fast if the query is untouched. |
|
181 | - * |
|
182 | - * <code> |
|
183 | - * $obj = $c->findPk(12, $con); |
|
184 | - * </code> |
|
185 | - * |
|
186 | - * @param mixed $key Primary key to use for the query |
|
187 | - * @param ConnectionInterface $con an optional connection object |
|
188 | - * |
|
189 | - * @return ChildSubscription|array|mixed the result, formatted by the current formatter |
|
190 | - */ |
|
191 | - public function findPk($key, ConnectionInterface $con = null) |
|
192 | - { |
|
193 | - if ($key === null) { |
|
194 | - return null; |
|
195 | - } |
|
196 | - if ((null !== ($obj = SubscriptionTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) { |
|
197 | - // the object is already in the instance pool |
|
198 | - return $obj; |
|
199 | - } |
|
200 | - if ($con === null) { |
|
201 | - $con = Propel::getServiceContainer()->getReadConnection(SubscriptionTableMap::DATABASE_NAME); |
|
202 | - } |
|
203 | - $this->basePreSelect($con); |
|
204 | - if ($this->formatter || $this->modelAlias || $this->with || $this->select |
|
205 | - || $this->selectColumns || $this->asColumns || $this->selectModifiers |
|
206 | - || $this->map || $this->having || $this->joins) { |
|
207 | - return $this->findPkComplex($key, $con); |
|
208 | - } else { |
|
209 | - return $this->findPkSimple($key, $con); |
|
210 | - } |
|
211 | - } |
|
212 | - |
|
213 | - /** |
|
214 | - * Find object by primary key using raw SQL to go fast. |
|
215 | - * Bypass doSelect() and the object formatter by using generated code. |
|
216 | - * |
|
217 | - * @param mixed $key Primary key to use for the query |
|
218 | - * @param ConnectionInterface $con A connection object |
|
219 | - * |
|
220 | - * @throws \Propel\Runtime\Exception\PropelException |
|
221 | - * |
|
222 | - * @return ChildSubscription A model object, or null if the key is not found |
|
223 | - */ |
|
224 | - protected function findPkSimple($key, ConnectionInterface $con) |
|
225 | - { |
|
226 | - $sql = 'SELECT id, instance_name, input_uuid, user_id, channel_id, subscription_id, started, stopped, title, service FROM subscription WHERE id = :p0'; |
|
227 | - try { |
|
228 | - $stmt = $con->prepare($sql); |
|
229 | - $stmt->bindValue(':p0', $key, PDO::PARAM_INT); |
|
230 | - $stmt->execute(); |
|
231 | - } catch (Exception $e) { |
|
232 | - Propel::log($e->getMessage(), Propel::LOG_ERR); |
|
233 | - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); |
|
234 | - } |
|
235 | - $obj = null; |
|
236 | - if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { |
|
237 | - /** @var ChildSubscription $obj */ |
|
238 | - $obj = new ChildSubscription(); |
|
239 | - $obj->hydrate($row); |
|
240 | - SubscriptionTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key); |
|
241 | - } |
|
242 | - $stmt->closeCursor(); |
|
243 | - |
|
244 | - return $obj; |
|
245 | - } |
|
246 | - |
|
247 | - /** |
|
248 | - * Find object by primary key. |
|
249 | - * |
|
250 | - * @param mixed $key Primary key to use for the query |
|
251 | - * @param ConnectionInterface $con A connection object |
|
252 | - * |
|
253 | - * @return ChildSubscription|array|mixed the result, formatted by the current formatter |
|
254 | - */ |
|
255 | - protected function findPkComplex($key, ConnectionInterface $con) |
|
256 | - { |
|
257 | - // As the query uses a PK condition, no limit(1) is necessary. |
|
258 | - $criteria = $this->isKeepQuery() ? clone $this : $this; |
|
259 | - $dataFetcher = $criteria |
|
260 | - ->filterByPrimaryKey($key) |
|
261 | - ->doSelect($con); |
|
262 | - |
|
263 | - return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); |
|
264 | - } |
|
265 | - |
|
266 | - /** |
|
267 | - * Find objects by primary key |
|
268 | - * <code> |
|
269 | - * $objs = $c->findPks(array(12, 56, 832), $con); |
|
270 | - * </code> |
|
271 | - * @param array $keys Primary keys to use for the query |
|
272 | - * @param ConnectionInterface $con an optional connection object |
|
273 | - * |
|
274 | - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter |
|
275 | - */ |
|
276 | - public function findPks($keys, ConnectionInterface $con = null) |
|
277 | - { |
|
278 | - if (null === $con) { |
|
279 | - $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); |
|
280 | - } |
|
281 | - $this->basePreSelect($con); |
|
282 | - $criteria = $this->isKeepQuery() ? clone $this : $this; |
|
283 | - $dataFetcher = $criteria |
|
284 | - ->filterByPrimaryKeys($keys) |
|
285 | - ->doSelect($con); |
|
286 | - |
|
287 | - return $criteria->getFormatter()->init($criteria)->format($dataFetcher); |
|
288 | - } |
|
289 | - |
|
290 | - /** |
|
291 | - * Filter the query by primary key |
|
292 | - * |
|
293 | - * @param mixed $key Primary key to use for the query |
|
294 | - * |
|
295 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
296 | - */ |
|
297 | - public function filterByPrimaryKey($key) |
|
298 | - { |
|
299 | - |
|
300 | - return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $key, Criteria::EQUAL); |
|
301 | - } |
|
302 | - |
|
303 | - /** |
|
304 | - * Filter the query by a list of primary keys |
|
305 | - * |
|
306 | - * @param array $keys The list of primary key to use for the query |
|
307 | - * |
|
308 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
309 | - */ |
|
310 | - public function filterByPrimaryKeys($keys) |
|
311 | - { |
|
312 | - |
|
313 | - return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $keys, Criteria::IN); |
|
314 | - } |
|
315 | - |
|
316 | - /** |
|
317 | - * Filter the query on the id column |
|
318 | - * |
|
319 | - * Example usage: |
|
320 | - * <code> |
|
321 | - * $query->filterById(1234); // WHERE id = 1234 |
|
322 | - * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) |
|
323 | - * $query->filterById(array('min' => 12)); // WHERE id > 12 |
|
324 | - * </code> |
|
325 | - * |
|
326 | - * @param mixed $id The value to use as filter. |
|
327 | - * Use scalar values for equality. |
|
328 | - * Use array values for in_array() equivalent. |
|
329 | - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
330 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
331 | - * |
|
332 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
333 | - */ |
|
334 | - public function filterById($id = null, $comparison = null) |
|
335 | - { |
|
336 | - if (is_array($id)) { |
|
337 | - $useMinMax = false; |
|
338 | - if (isset($id['min'])) { |
|
339 | - $this->addUsingAlias(SubscriptionTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL); |
|
340 | - $useMinMax = true; |
|
341 | - } |
|
342 | - if (isset($id['max'])) { |
|
343 | - $this->addUsingAlias(SubscriptionTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL); |
|
344 | - $useMinMax = true; |
|
345 | - } |
|
346 | - if ($useMinMax) { |
|
347 | - return $this; |
|
348 | - } |
|
349 | - if (null === $comparison) { |
|
350 | - $comparison = Criteria::IN; |
|
351 | - } |
|
352 | - } |
|
353 | - |
|
354 | - return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $id, $comparison); |
|
355 | - } |
|
356 | - |
|
357 | - /** |
|
358 | - * Filter the query on the instance_name column |
|
359 | - * |
|
360 | - * Example usage: |
|
361 | - * <code> |
|
362 | - * $query->filterByInstanceName('fooValue'); // WHERE instance_name = 'fooValue' |
|
363 | - * $query->filterByInstanceName('%fooValue%'); // WHERE instance_name LIKE '%fooValue%' |
|
364 | - * </code> |
|
365 | - * |
|
366 | - * @param string $instanceName The value to use as filter. |
|
367 | - * Accepts wildcards (* and % trigger a LIKE) |
|
368 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
369 | - * |
|
370 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
371 | - */ |
|
372 | - public function filterByInstanceName($instanceName = null, $comparison = null) |
|
373 | - { |
|
374 | - if (null === $comparison) { |
|
375 | - if (is_array($instanceName)) { |
|
376 | - $comparison = Criteria::IN; |
|
377 | - } elseif (preg_match('/[\%\*]/', $instanceName)) { |
|
378 | - $instanceName = str_replace('*', '%', $instanceName); |
|
379 | - $comparison = Criteria::LIKE; |
|
380 | - } |
|
381 | - } |
|
382 | - |
|
383 | - return $this->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instanceName, $comparison); |
|
384 | - } |
|
385 | - |
|
386 | - /** |
|
387 | - * Filter the query on the input_uuid column |
|
388 | - * |
|
389 | - * Example usage: |
|
390 | - * <code> |
|
391 | - * $query->filterByInputUuid('fooValue'); // WHERE input_uuid = 'fooValue' |
|
392 | - * $query->filterByInputUuid('%fooValue%'); // WHERE input_uuid LIKE '%fooValue%' |
|
393 | - * </code> |
|
394 | - * |
|
395 | - * @param string $inputUuid The value to use as filter. |
|
396 | - * Accepts wildcards (* and % trigger a LIKE) |
|
397 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
398 | - * |
|
399 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
400 | - */ |
|
401 | - public function filterByInputUuid($inputUuid = null, $comparison = null) |
|
402 | - { |
|
403 | - if (null === $comparison) { |
|
404 | - if (is_array($inputUuid)) { |
|
405 | - $comparison = Criteria::IN; |
|
406 | - } elseif (preg_match('/[\%\*]/', $inputUuid)) { |
|
407 | - $inputUuid = str_replace('*', '%', $inputUuid); |
|
408 | - $comparison = Criteria::LIKE; |
|
409 | - } |
|
410 | - } |
|
411 | - |
|
412 | - return $this->addUsingAlias(SubscriptionTableMap::COL_INPUT_UUID, $inputUuid, $comparison); |
|
413 | - } |
|
414 | - |
|
415 | - /** |
|
416 | - * Filter the query on the user_id column |
|
417 | - * |
|
418 | - * Example usage: |
|
419 | - * <code> |
|
420 | - * $query->filterByUserId(1234); // WHERE user_id = 1234 |
|
421 | - * $query->filterByUserId(array(12, 34)); // WHERE user_id IN (12, 34) |
|
422 | - * $query->filterByUserId(array('min' => 12)); // WHERE user_id > 12 |
|
423 | - * </code> |
|
424 | - * |
|
425 | - * @see filterByUser() |
|
426 | - * |
|
427 | - * @param mixed $userId The value to use as filter. |
|
428 | - * Use scalar values for equality. |
|
429 | - * Use array values for in_array() equivalent. |
|
430 | - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
431 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
432 | - * |
|
433 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
434 | - */ |
|
435 | - public function filterByUserId($userId = null, $comparison = null) |
|
436 | - { |
|
437 | - if (is_array($userId)) { |
|
438 | - $useMinMax = false; |
|
439 | - if (isset($userId['min'])) { |
|
440 | - $this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId['min'], Criteria::GREATER_EQUAL); |
|
441 | - $useMinMax = true; |
|
442 | - } |
|
443 | - if (isset($userId['max'])) { |
|
444 | - $this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId['max'], Criteria::LESS_EQUAL); |
|
445 | - $useMinMax = true; |
|
446 | - } |
|
447 | - if ($useMinMax) { |
|
448 | - return $this; |
|
449 | - } |
|
450 | - if (null === $comparison) { |
|
451 | - $comparison = Criteria::IN; |
|
452 | - } |
|
453 | - } |
|
454 | - |
|
455 | - return $this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId, $comparison); |
|
456 | - } |
|
457 | - |
|
458 | - /** |
|
459 | - * Filter the query on the channel_id column |
|
460 | - * |
|
461 | - * Example usage: |
|
462 | - * <code> |
|
463 | - * $query->filterByChannelId(1234); // WHERE channel_id = 1234 |
|
464 | - * $query->filterByChannelId(array(12, 34)); // WHERE channel_id IN (12, 34) |
|
465 | - * $query->filterByChannelId(array('min' => 12)); // WHERE channel_id > 12 |
|
466 | - * </code> |
|
467 | - * |
|
468 | - * @see filterByChannel() |
|
469 | - * |
|
470 | - * @param mixed $channelId The value to use as filter. |
|
471 | - * Use scalar values for equality. |
|
472 | - * Use array values for in_array() equivalent. |
|
473 | - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
474 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
475 | - * |
|
476 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
477 | - */ |
|
478 | - public function filterByChannelId($channelId = null, $comparison = null) |
|
479 | - { |
|
480 | - if (is_array($channelId)) { |
|
481 | - $useMinMax = false; |
|
482 | - if (isset($channelId['min'])) { |
|
483 | - $this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId['min'], Criteria::GREATER_EQUAL); |
|
484 | - $useMinMax = true; |
|
485 | - } |
|
486 | - if (isset($channelId['max'])) { |
|
487 | - $this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId['max'], Criteria::LESS_EQUAL); |
|
488 | - $useMinMax = true; |
|
489 | - } |
|
490 | - if ($useMinMax) { |
|
491 | - return $this; |
|
492 | - } |
|
493 | - if (null === $comparison) { |
|
494 | - $comparison = Criteria::IN; |
|
495 | - } |
|
496 | - } |
|
497 | - |
|
498 | - return $this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId, $comparison); |
|
499 | - } |
|
500 | - |
|
501 | - /** |
|
502 | - * Filter the query on the subscription_id column |
|
503 | - * |
|
504 | - * Example usage: |
|
505 | - * <code> |
|
506 | - * $query->filterBySubscriptionId(1234); // WHERE subscription_id = 1234 |
|
507 | - * $query->filterBySubscriptionId(array(12, 34)); // WHERE subscription_id IN (12, 34) |
|
508 | - * $query->filterBySubscriptionId(array('min' => 12)); // WHERE subscription_id > 12 |
|
509 | - * </code> |
|
510 | - * |
|
511 | - * @param mixed $subscriptionId The value to use as filter. |
|
512 | - * Use scalar values for equality. |
|
513 | - * Use array values for in_array() equivalent. |
|
514 | - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
515 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
516 | - * |
|
517 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
518 | - */ |
|
519 | - public function filterBySubscriptionId($subscriptionId = null, $comparison = null) |
|
520 | - { |
|
521 | - if (is_array($subscriptionId)) { |
|
522 | - $useMinMax = false; |
|
523 | - if (isset($subscriptionId['min'])) { |
|
524 | - $this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId['min'], Criteria::GREATER_EQUAL); |
|
525 | - $useMinMax = true; |
|
526 | - } |
|
527 | - if (isset($subscriptionId['max'])) { |
|
528 | - $this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId['max'], Criteria::LESS_EQUAL); |
|
529 | - $useMinMax = true; |
|
530 | - } |
|
531 | - if ($useMinMax) { |
|
532 | - return $this; |
|
533 | - } |
|
534 | - if (null === $comparison) { |
|
535 | - $comparison = Criteria::IN; |
|
536 | - } |
|
537 | - } |
|
538 | - |
|
539 | - return $this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId, $comparison); |
|
540 | - } |
|
541 | - |
|
542 | - /** |
|
543 | - * Filter the query on the started column |
|
544 | - * |
|
545 | - * Example usage: |
|
546 | - * <code> |
|
547 | - * $query->filterByStarted('2011-03-14'); // WHERE started = '2011-03-14' |
|
548 | - * $query->filterByStarted('now'); // WHERE started = '2011-03-14' |
|
549 | - * $query->filterByStarted(array('max' => 'yesterday')); // WHERE started > '2011-03-13' |
|
550 | - * </code> |
|
551 | - * |
|
552 | - * @param mixed $started The value to use as filter. |
|
553 | - * Values can be integers (unix timestamps), DateTime objects, or strings. |
|
554 | - * Empty strings are treated as NULL. |
|
555 | - * Use scalar values for equality. |
|
556 | - * Use array values for in_array() equivalent. |
|
557 | - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
558 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
559 | - * |
|
560 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
561 | - */ |
|
562 | - public function filterByStarted($started = null, $comparison = null) |
|
563 | - { |
|
564 | - if (is_array($started)) { |
|
565 | - $useMinMax = false; |
|
566 | - if (isset($started['min'])) { |
|
567 | - $this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started['min'], Criteria::GREATER_EQUAL); |
|
568 | - $useMinMax = true; |
|
569 | - } |
|
570 | - if (isset($started['max'])) { |
|
571 | - $this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started['max'], Criteria::LESS_EQUAL); |
|
572 | - $useMinMax = true; |
|
573 | - } |
|
574 | - if ($useMinMax) { |
|
575 | - return $this; |
|
576 | - } |
|
577 | - if (null === $comparison) { |
|
578 | - $comparison = Criteria::IN; |
|
579 | - } |
|
580 | - } |
|
581 | - |
|
582 | - return $this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started, $comparison); |
|
583 | - } |
|
584 | - |
|
585 | - /** |
|
586 | - * Filter the query on the stopped column |
|
587 | - * |
|
588 | - * Example usage: |
|
589 | - * <code> |
|
590 | - * $query->filterByStopped('2011-03-14'); // WHERE stopped = '2011-03-14' |
|
591 | - * $query->filterByStopped('now'); // WHERE stopped = '2011-03-14' |
|
592 | - * $query->filterByStopped(array('max' => 'yesterday')); // WHERE stopped > '2011-03-13' |
|
593 | - * </code> |
|
594 | - * |
|
595 | - * @param mixed $stopped The value to use as filter. |
|
596 | - * Values can be integers (unix timestamps), DateTime objects, or strings. |
|
597 | - * Empty strings are treated as NULL. |
|
598 | - * Use scalar values for equality. |
|
599 | - * Use array values for in_array() equivalent. |
|
600 | - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
601 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
602 | - * |
|
603 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
604 | - */ |
|
605 | - public function filterByStopped($stopped = null, $comparison = null) |
|
606 | - { |
|
607 | - if (is_array($stopped)) { |
|
608 | - $useMinMax = false; |
|
609 | - if (isset($stopped['min'])) { |
|
610 | - $this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped['min'], Criteria::GREATER_EQUAL); |
|
611 | - $useMinMax = true; |
|
612 | - } |
|
613 | - if (isset($stopped['max'])) { |
|
614 | - $this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped['max'], Criteria::LESS_EQUAL); |
|
615 | - $useMinMax = true; |
|
616 | - } |
|
617 | - if ($useMinMax) { |
|
618 | - return $this; |
|
619 | - } |
|
620 | - if (null === $comparison) { |
|
621 | - $comparison = Criteria::IN; |
|
622 | - } |
|
623 | - } |
|
624 | - |
|
625 | - return $this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped, $comparison); |
|
626 | - } |
|
627 | - |
|
628 | - /** |
|
629 | - * Filter the query on the title column |
|
630 | - * |
|
631 | - * Example usage: |
|
632 | - * <code> |
|
633 | - * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' |
|
634 | - * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' |
|
635 | - * </code> |
|
636 | - * |
|
637 | - * @param string $title The value to use as filter. |
|
638 | - * Accepts wildcards (* and % trigger a LIKE) |
|
639 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
640 | - * |
|
641 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
642 | - */ |
|
643 | - public function filterByTitle($title = null, $comparison = null) |
|
644 | - { |
|
645 | - if (null === $comparison) { |
|
646 | - if (is_array($title)) { |
|
647 | - $comparison = Criteria::IN; |
|
648 | - } elseif (preg_match('/[\%\*]/', $title)) { |
|
649 | - $title = str_replace('*', '%', $title); |
|
650 | - $comparison = Criteria::LIKE; |
|
651 | - } |
|
652 | - } |
|
653 | - |
|
654 | - return $this->addUsingAlias(SubscriptionTableMap::COL_TITLE, $title, $comparison); |
|
655 | - } |
|
656 | - |
|
657 | - /** |
|
658 | - * Filter the query on the service column |
|
659 | - * |
|
660 | - * Example usage: |
|
661 | - * <code> |
|
662 | - * $query->filterByService('fooValue'); // WHERE service = 'fooValue' |
|
663 | - * $query->filterByService('%fooValue%'); // WHERE service LIKE '%fooValue%' |
|
664 | - * </code> |
|
665 | - * |
|
666 | - * @param string $service The value to use as filter. |
|
667 | - * Accepts wildcards (* and % trigger a LIKE) |
|
668 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
669 | - * |
|
670 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
671 | - */ |
|
672 | - public function filterByService($service = null, $comparison = null) |
|
673 | - { |
|
674 | - if (null === $comparison) { |
|
675 | - if (is_array($service)) { |
|
676 | - $comparison = Criteria::IN; |
|
677 | - } elseif (preg_match('/[\%\*]/', $service)) { |
|
678 | - $service = str_replace('*', '%', $service); |
|
679 | - $comparison = Criteria::LIKE; |
|
680 | - } |
|
681 | - } |
|
682 | - |
|
683 | - return $this->addUsingAlias(SubscriptionTableMap::COL_SERVICE, $service, $comparison); |
|
684 | - } |
|
685 | - |
|
686 | - /** |
|
687 | - * Filter the query by a related \Jalle19\StatusManager\Database\Instance object |
|
688 | - * |
|
689 | - * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter |
|
690 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
691 | - * |
|
692 | - * @throws \Propel\Runtime\Exception\PropelException |
|
693 | - * |
|
694 | - * @return ChildSubscriptionQuery The current query, for fluid interface |
|
695 | - */ |
|
696 | - public function filterByInstance($instance, $comparison = null) |
|
697 | - { |
|
698 | - if ($instance instanceof \Jalle19\StatusManager\Database\Instance) { |
|
699 | - return $this |
|
700 | - ->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instance->getName(), $comparison); |
|
701 | - } elseif ($instance instanceof ObjectCollection) { |
|
702 | - if (null === $comparison) { |
|
703 | - $comparison = Criteria::IN; |
|
704 | - } |
|
705 | - |
|
706 | - return $this |
|
707 | - ->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instance->toKeyValue('PrimaryKey', 'Name'), $comparison); |
|
708 | - } else { |
|
709 | - throw new PropelException('filterByInstance() only accepts arguments of type \Jalle19\StatusManager\Database\Instance or Collection'); |
|
710 | - } |
|
711 | - } |
|
712 | - |
|
713 | - /** |
|
714 | - * Adds a JOIN clause to the query using the Instance relation |
|
715 | - * |
|
716 | - * @param string $relationAlias optional alias for the relation |
|
717 | - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
718 | - * |
|
719 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
720 | - */ |
|
721 | - public function joinInstance($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
722 | - { |
|
723 | - $tableMap = $this->getTableMap(); |
|
724 | - $relationMap = $tableMap->getRelation('Instance'); |
|
725 | - |
|
726 | - // create a ModelJoin object for this join |
|
727 | - $join = new ModelJoin(); |
|
728 | - $join->setJoinType($joinType); |
|
729 | - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
|
730 | - if ($previousJoin = $this->getPreviousJoin()) { |
|
731 | - $join->setPreviousJoin($previousJoin); |
|
732 | - } |
|
733 | - |
|
734 | - // add the ModelJoin to the current object |
|
735 | - if ($relationAlias) { |
|
736 | - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
|
737 | - $this->addJoinObject($join, $relationAlias); |
|
738 | - } else { |
|
739 | - $this->addJoinObject($join, 'Instance'); |
|
740 | - } |
|
741 | - |
|
742 | - return $this; |
|
743 | - } |
|
744 | - |
|
745 | - /** |
|
746 | - * Use the Instance relation Instance object |
|
747 | - * |
|
748 | - * @see useQuery() |
|
749 | - * |
|
750 | - * @param string $relationAlias optional alias for the relation, |
|
751 | - * to be used as main alias in the secondary query |
|
752 | - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
753 | - * |
|
754 | - * @return \Jalle19\StatusManager\Database\InstanceQuery A secondary query class using the current class as primary query |
|
755 | - */ |
|
756 | - public function useInstanceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
757 | - { |
|
758 | - return $this |
|
759 | - ->joinInstance($relationAlias, $joinType) |
|
760 | - ->useQuery($relationAlias ? $relationAlias : 'Instance', '\Jalle19\StatusManager\Database\InstanceQuery'); |
|
761 | - } |
|
762 | - |
|
763 | - /** |
|
764 | - * Filter the query by a related \Jalle19\StatusManager\Database\Input object |
|
765 | - * |
|
766 | - * @param \Jalle19\StatusManager\Database\Input|ObjectCollection $input The related object(s) to use as filter |
|
767 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
768 | - * |
|
769 | - * @throws \Propel\Runtime\Exception\PropelException |
|
770 | - * |
|
771 | - * @return ChildSubscriptionQuery The current query, for fluid interface |
|
772 | - */ |
|
773 | - public function filterByInput($input, $comparison = null) |
|
774 | - { |
|
775 | - if ($input instanceof \Jalle19\StatusManager\Database\Input) { |
|
776 | - return $this |
|
777 | - ->addUsingAlias(SubscriptionTableMap::COL_INPUT_UUID, $input->getUuid(), $comparison); |
|
778 | - } elseif ($input instanceof ObjectCollection) { |
|
779 | - if (null === $comparison) { |
|
780 | - $comparison = Criteria::IN; |
|
781 | - } |
|
782 | - |
|
783 | - return $this |
|
784 | - ->addUsingAlias(SubscriptionTableMap::COL_INPUT_UUID, $input->toKeyValue('PrimaryKey', 'Uuid'), $comparison); |
|
785 | - } else { |
|
786 | - throw new PropelException('filterByInput() only accepts arguments of type \Jalle19\StatusManager\Database\Input or Collection'); |
|
787 | - } |
|
788 | - } |
|
789 | - |
|
790 | - /** |
|
791 | - * Adds a JOIN clause to the query using the Input relation |
|
792 | - * |
|
793 | - * @param string $relationAlias optional alias for the relation |
|
794 | - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
795 | - * |
|
796 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
797 | - */ |
|
798 | - public function joinInput($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
799 | - { |
|
800 | - $tableMap = $this->getTableMap(); |
|
801 | - $relationMap = $tableMap->getRelation('Input'); |
|
802 | - |
|
803 | - // create a ModelJoin object for this join |
|
804 | - $join = new ModelJoin(); |
|
805 | - $join->setJoinType($joinType); |
|
806 | - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
|
807 | - if ($previousJoin = $this->getPreviousJoin()) { |
|
808 | - $join->setPreviousJoin($previousJoin); |
|
809 | - } |
|
810 | - |
|
811 | - // add the ModelJoin to the current object |
|
812 | - if ($relationAlias) { |
|
813 | - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
|
814 | - $this->addJoinObject($join, $relationAlias); |
|
815 | - } else { |
|
816 | - $this->addJoinObject($join, 'Input'); |
|
817 | - } |
|
818 | - |
|
819 | - return $this; |
|
820 | - } |
|
821 | - |
|
822 | - /** |
|
823 | - * Use the Input relation Input object |
|
824 | - * |
|
825 | - * @see useQuery() |
|
826 | - * |
|
827 | - * @param string $relationAlias optional alias for the relation, |
|
828 | - * to be used as main alias in the secondary query |
|
829 | - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
830 | - * |
|
831 | - * @return \Jalle19\StatusManager\Database\InputQuery A secondary query class using the current class as primary query |
|
832 | - */ |
|
833 | - public function useInputQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
834 | - { |
|
835 | - return $this |
|
836 | - ->joinInput($relationAlias, $joinType) |
|
837 | - ->useQuery($relationAlias ? $relationAlias : 'Input', '\Jalle19\StatusManager\Database\InputQuery'); |
|
838 | - } |
|
839 | - |
|
840 | - /** |
|
841 | - * Filter the query by a related \Jalle19\StatusManager\Database\User object |
|
842 | - * |
|
843 | - * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user The related object(s) to use as filter |
|
844 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
845 | - * |
|
846 | - * @throws \Propel\Runtime\Exception\PropelException |
|
847 | - * |
|
848 | - * @return ChildSubscriptionQuery The current query, for fluid interface |
|
849 | - */ |
|
850 | - public function filterByUser($user, $comparison = null) |
|
851 | - { |
|
852 | - if ($user instanceof \Jalle19\StatusManager\Database\User) { |
|
853 | - return $this |
|
854 | - ->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $user->getId(), $comparison); |
|
855 | - } elseif ($user instanceof ObjectCollection) { |
|
856 | - if (null === $comparison) { |
|
857 | - $comparison = Criteria::IN; |
|
858 | - } |
|
859 | - |
|
860 | - return $this |
|
861 | - ->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); |
|
862 | - } else { |
|
863 | - throw new PropelException('filterByUser() only accepts arguments of type \Jalle19\StatusManager\Database\User or Collection'); |
|
864 | - } |
|
865 | - } |
|
866 | - |
|
867 | - /** |
|
868 | - * Adds a JOIN clause to the query using the User relation |
|
869 | - * |
|
870 | - * @param string $relationAlias optional alias for the relation |
|
871 | - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
872 | - * |
|
873 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
874 | - */ |
|
875 | - public function joinUser($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
876 | - { |
|
877 | - $tableMap = $this->getTableMap(); |
|
878 | - $relationMap = $tableMap->getRelation('User'); |
|
879 | - |
|
880 | - // create a ModelJoin object for this join |
|
881 | - $join = new ModelJoin(); |
|
882 | - $join->setJoinType($joinType); |
|
883 | - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
|
884 | - if ($previousJoin = $this->getPreviousJoin()) { |
|
885 | - $join->setPreviousJoin($previousJoin); |
|
886 | - } |
|
887 | - |
|
888 | - // add the ModelJoin to the current object |
|
889 | - if ($relationAlias) { |
|
890 | - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
|
891 | - $this->addJoinObject($join, $relationAlias); |
|
892 | - } else { |
|
893 | - $this->addJoinObject($join, 'User'); |
|
894 | - } |
|
895 | - |
|
896 | - return $this; |
|
897 | - } |
|
898 | - |
|
899 | - /** |
|
900 | - * Use the User relation User object |
|
901 | - * |
|
902 | - * @see useQuery() |
|
903 | - * |
|
904 | - * @param string $relationAlias optional alias for the relation, |
|
905 | - * to be used as main alias in the secondary query |
|
906 | - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
907 | - * |
|
908 | - * @return \Jalle19\StatusManager\Database\UserQuery A secondary query class using the current class as primary query |
|
909 | - */ |
|
910 | - public function useUserQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
911 | - { |
|
912 | - return $this |
|
913 | - ->joinUser($relationAlias, $joinType) |
|
914 | - ->useQuery($relationAlias ? $relationAlias : 'User', '\Jalle19\StatusManager\Database\UserQuery'); |
|
915 | - } |
|
916 | - |
|
917 | - /** |
|
918 | - * Filter the query by a related \Jalle19\StatusManager\Database\Channel object |
|
919 | - * |
|
920 | - * @param \Jalle19\StatusManager\Database\Channel|ObjectCollection $channel The related object(s) to use as filter |
|
921 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
922 | - * |
|
923 | - * @throws \Propel\Runtime\Exception\PropelException |
|
924 | - * |
|
925 | - * @return ChildSubscriptionQuery The current query, for fluid interface |
|
926 | - */ |
|
927 | - public function filterByChannel($channel, $comparison = null) |
|
928 | - { |
|
929 | - if ($channel instanceof \Jalle19\StatusManager\Database\Channel) { |
|
930 | - return $this |
|
931 | - ->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channel->getId(), $comparison); |
|
932 | - } elseif ($channel instanceof ObjectCollection) { |
|
933 | - if (null === $comparison) { |
|
934 | - $comparison = Criteria::IN; |
|
935 | - } |
|
936 | - |
|
937 | - return $this |
|
938 | - ->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channel->toKeyValue('PrimaryKey', 'Id'), $comparison); |
|
939 | - } else { |
|
940 | - throw new PropelException('filterByChannel() only accepts arguments of type \Jalle19\StatusManager\Database\Channel or Collection'); |
|
941 | - } |
|
942 | - } |
|
943 | - |
|
944 | - /** |
|
945 | - * Adds a JOIN clause to the query using the Channel relation |
|
946 | - * |
|
947 | - * @param string $relationAlias optional alias for the relation |
|
948 | - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
949 | - * |
|
950 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
951 | - */ |
|
952 | - public function joinChannel($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
953 | - { |
|
954 | - $tableMap = $this->getTableMap(); |
|
955 | - $relationMap = $tableMap->getRelation('Channel'); |
|
956 | - |
|
957 | - // create a ModelJoin object for this join |
|
958 | - $join = new ModelJoin(); |
|
959 | - $join->setJoinType($joinType); |
|
960 | - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
|
961 | - if ($previousJoin = $this->getPreviousJoin()) { |
|
962 | - $join->setPreviousJoin($previousJoin); |
|
963 | - } |
|
964 | - |
|
965 | - // add the ModelJoin to the current object |
|
966 | - if ($relationAlias) { |
|
967 | - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
|
968 | - $this->addJoinObject($join, $relationAlias); |
|
969 | - } else { |
|
970 | - $this->addJoinObject($join, 'Channel'); |
|
971 | - } |
|
972 | - |
|
973 | - return $this; |
|
974 | - } |
|
975 | - |
|
976 | - /** |
|
977 | - * Use the Channel relation Channel object |
|
978 | - * |
|
979 | - * @see useQuery() |
|
980 | - * |
|
981 | - * @param string $relationAlias optional alias for the relation, |
|
982 | - * to be used as main alias in the secondary query |
|
983 | - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
984 | - * |
|
985 | - * @return \Jalle19\StatusManager\Database\ChannelQuery A secondary query class using the current class as primary query |
|
986 | - */ |
|
987 | - public function useChannelQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
988 | - { |
|
989 | - return $this |
|
990 | - ->joinChannel($relationAlias, $joinType) |
|
991 | - ->useQuery($relationAlias ? $relationAlias : 'Channel', '\Jalle19\StatusManager\Database\ChannelQuery'); |
|
992 | - } |
|
993 | - |
|
994 | - /** |
|
995 | - * Exclude object from result |
|
996 | - * |
|
997 | - * @param ChildSubscription $subscription Object to remove from the list of results |
|
998 | - * |
|
999 | - * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
1000 | - */ |
|
1001 | - public function prune($subscription = null) |
|
1002 | - { |
|
1003 | - if ($subscription) { |
|
1004 | - $this->addUsingAlias(SubscriptionTableMap::COL_ID, $subscription->getId(), Criteria::NOT_EQUAL); |
|
1005 | - } |
|
1006 | - |
|
1007 | - return $this; |
|
1008 | - } |
|
1009 | - |
|
1010 | - /** |
|
1011 | - * Deletes all rows from the subscription table. |
|
1012 | - * |
|
1013 | - * @param ConnectionInterface $con the connection to use |
|
1014 | - * @return int The number of affected rows (if supported by underlying database driver). |
|
1015 | - */ |
|
1016 | - public function doDeleteAll(ConnectionInterface $con = null) |
|
1017 | - { |
|
1018 | - if (null === $con) { |
|
1019 | - $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME); |
|
1020 | - } |
|
1021 | - |
|
1022 | - // use transaction because $criteria could contain info |
|
1023 | - // for more than one table or we could emulating ON DELETE CASCADE, etc. |
|
1024 | - return $con->transaction(function () use ($con) { |
|
1025 | - $affectedRows = 0; // initialize var to track total num of affected rows |
|
1026 | - $affectedRows += parent::doDeleteAll($con); |
|
1027 | - // Because this db requires some delete cascade/set null emulation, we have to |
|
1028 | - // clear the cached instance *after* the emulation has happened (since |
|
1029 | - // instances get re-added by the select statement contained therein). |
|
1030 | - SubscriptionTableMap::clearInstancePool(); |
|
1031 | - SubscriptionTableMap::clearRelatedInstancePool(); |
|
1032 | - |
|
1033 | - return $affectedRows; |
|
1034 | - }); |
|
1035 | - } |
|
1036 | - |
|
1037 | - /** |
|
1038 | - * Performs a DELETE on the database based on the current ModelCriteria |
|
1039 | - * |
|
1040 | - * @param ConnectionInterface $con the connection to use |
|
1041 | - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
1042 | - * if supported by native driver or if emulated using Propel. |
|
1043 | - * @throws PropelException Any exceptions caught during processing will be |
|
1044 | - * rethrown wrapped into a PropelException. |
|
1045 | - */ |
|
1046 | - public function delete(ConnectionInterface $con = null) |
|
1047 | - { |
|
1048 | - if (null === $con) { |
|
1049 | - $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME); |
|
1050 | - } |
|
1051 | - |
|
1052 | - $criteria = $this; |
|
1053 | - |
|
1054 | - // Set the correct dbName |
|
1055 | - $criteria->setDbName(SubscriptionTableMap::DATABASE_NAME); |
|
1056 | - |
|
1057 | - // use transaction because $criteria could contain info |
|
1058 | - // for more than one table or we could emulating ON DELETE CASCADE, etc. |
|
1059 | - return $con->transaction(function () use ($con, $criteria) { |
|
1060 | - $affectedRows = 0; // initialize var to track total num of affected rows |
|
1061 | - |
|
1062 | - SubscriptionTableMap::removeInstanceFromPool($criteria); |
|
1063 | - |
|
1064 | - $affectedRows += ModelCriteria::delete($con); |
|
1065 | - SubscriptionTableMap::clearRelatedInstancePool(); |
|
1066 | - |
|
1067 | - return $affectedRows; |
|
1068 | - }); |
|
1069 | - } |
|
138 | + protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException'; |
|
139 | + |
|
140 | + /** |
|
141 | + * Initializes internal state of \Jalle19\StatusManager\Database\Base\SubscriptionQuery object. |
|
142 | + * |
|
143 | + * @param string $dbName The database name |
|
144 | + * @param string $modelName The phpName of a model, e.g. 'Book' |
|
145 | + * @param string $modelAlias The alias for the model in this query, e.g. 'b' |
|
146 | + */ |
|
147 | + public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Subscription', $modelAlias = null) |
|
148 | + { |
|
149 | + parent::__construct($dbName, $modelName, $modelAlias); |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | + * Returns a new ChildSubscriptionQuery object. |
|
154 | + * |
|
155 | + * @param string $modelAlias The alias of a model in the query |
|
156 | + * @param Criteria $criteria Optional Criteria to build the query from |
|
157 | + * |
|
158 | + * @return ChildSubscriptionQuery |
|
159 | + */ |
|
160 | + public static function create($modelAlias = null, Criteria $criteria = null) |
|
161 | + { |
|
162 | + if ($criteria instanceof ChildSubscriptionQuery) { |
|
163 | + return $criteria; |
|
164 | + } |
|
165 | + $query = new ChildSubscriptionQuery(); |
|
166 | + if (null !== $modelAlias) { |
|
167 | + $query->setModelAlias($modelAlias); |
|
168 | + } |
|
169 | + if ($criteria instanceof Criteria) { |
|
170 | + $query->mergeWith($criteria); |
|
171 | + } |
|
172 | + |
|
173 | + return $query; |
|
174 | + } |
|
175 | + |
|
176 | + /** |
|
177 | + * Find object by primary key. |
|
178 | + * Propel uses the instance pool to skip the database if the object exists. |
|
179 | + * Go fast if the query is untouched. |
|
180 | + * |
|
181 | + * <code> |
|
182 | + * $obj = $c->findPk(12, $con); |
|
183 | + * </code> |
|
184 | + * |
|
185 | + * @param mixed $key Primary key to use for the query |
|
186 | + * @param ConnectionInterface $con an optional connection object |
|
187 | + * |
|
188 | + * @return ChildSubscription|array|mixed the result, formatted by the current formatter |
|
189 | + */ |
|
190 | + public function findPk($key, ConnectionInterface $con = null) |
|
191 | + { |
|
192 | + if ($key === null) { |
|
193 | + return null; |
|
194 | + } |
|
195 | + if ((null !== ($obj = SubscriptionTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) { |
|
196 | + // the object is already in the instance pool |
|
197 | + return $obj; |
|
198 | + } |
|
199 | + if ($con === null) { |
|
200 | + $con = Propel::getServiceContainer()->getReadConnection(SubscriptionTableMap::DATABASE_NAME); |
|
201 | + } |
|
202 | + $this->basePreSelect($con); |
|
203 | + if ($this->formatter || $this->modelAlias || $this->with || $this->select |
|
204 | + || $this->selectColumns || $this->asColumns || $this->selectModifiers |
|
205 | + || $this->map || $this->having || $this->joins) { |
|
206 | + return $this->findPkComplex($key, $con); |
|
207 | + } else { |
|
208 | + return $this->findPkSimple($key, $con); |
|
209 | + } |
|
210 | + } |
|
211 | + |
|
212 | + /** |
|
213 | + * Find object by primary key using raw SQL to go fast. |
|
214 | + * Bypass doSelect() and the object formatter by using generated code. |
|
215 | + * |
|
216 | + * @param mixed $key Primary key to use for the query |
|
217 | + * @param ConnectionInterface $con A connection object |
|
218 | + * |
|
219 | + * @throws \Propel\Runtime\Exception\PropelException |
|
220 | + * |
|
221 | + * @return ChildSubscription A model object, or null if the key is not found |
|
222 | + */ |
|
223 | + protected function findPkSimple($key, ConnectionInterface $con) |
|
224 | + { |
|
225 | + $sql = 'SELECT id, instance_name, input_uuid, user_id, channel_id, subscription_id, started, stopped, title, service FROM subscription WHERE id = :p0'; |
|
226 | + try { |
|
227 | + $stmt = $con->prepare($sql); |
|
228 | + $stmt->bindValue(':p0', $key, PDO::PARAM_INT); |
|
229 | + $stmt->execute(); |
|
230 | + } catch (Exception $e) { |
|
231 | + Propel::log($e->getMessage(), Propel::LOG_ERR); |
|
232 | + throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); |
|
233 | + } |
|
234 | + $obj = null; |
|
235 | + if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { |
|
236 | + /** @var ChildSubscription $obj */ |
|
237 | + $obj = new ChildSubscription(); |
|
238 | + $obj->hydrate($row); |
|
239 | + SubscriptionTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key); |
|
240 | + } |
|
241 | + $stmt->closeCursor(); |
|
242 | + |
|
243 | + return $obj; |
|
244 | + } |
|
245 | + |
|
246 | + /** |
|
247 | + * Find object by primary key. |
|
248 | + * |
|
249 | + * @param mixed $key Primary key to use for the query |
|
250 | + * @param ConnectionInterface $con A connection object |
|
251 | + * |
|
252 | + * @return ChildSubscription|array|mixed the result, formatted by the current formatter |
|
253 | + */ |
|
254 | + protected function findPkComplex($key, ConnectionInterface $con) |
|
255 | + { |
|
256 | + // As the query uses a PK condition, no limit(1) is necessary. |
|
257 | + $criteria = $this->isKeepQuery() ? clone $this : $this; |
|
258 | + $dataFetcher = $criteria |
|
259 | + ->filterByPrimaryKey($key) |
|
260 | + ->doSelect($con); |
|
261 | + |
|
262 | + return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); |
|
263 | + } |
|
264 | + |
|
265 | + /** |
|
266 | + * Find objects by primary key |
|
267 | + * <code> |
|
268 | + * $objs = $c->findPks(array(12, 56, 832), $con); |
|
269 | + * </code> |
|
270 | + * @param array $keys Primary keys to use for the query |
|
271 | + * @param ConnectionInterface $con an optional connection object |
|
272 | + * |
|
273 | + * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter |
|
274 | + */ |
|
275 | + public function findPks($keys, ConnectionInterface $con = null) |
|
276 | + { |
|
277 | + if (null === $con) { |
|
278 | + $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); |
|
279 | + } |
|
280 | + $this->basePreSelect($con); |
|
281 | + $criteria = $this->isKeepQuery() ? clone $this : $this; |
|
282 | + $dataFetcher = $criteria |
|
283 | + ->filterByPrimaryKeys($keys) |
|
284 | + ->doSelect($con); |
|
285 | + |
|
286 | + return $criteria->getFormatter()->init($criteria)->format($dataFetcher); |
|
287 | + } |
|
288 | + |
|
289 | + /** |
|
290 | + * Filter the query by primary key |
|
291 | + * |
|
292 | + * @param mixed $key Primary key to use for the query |
|
293 | + * |
|
294 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
295 | + */ |
|
296 | + public function filterByPrimaryKey($key) |
|
297 | + { |
|
298 | + |
|
299 | + return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $key, Criteria::EQUAL); |
|
300 | + } |
|
301 | + |
|
302 | + /** |
|
303 | + * Filter the query by a list of primary keys |
|
304 | + * |
|
305 | + * @param array $keys The list of primary key to use for the query |
|
306 | + * |
|
307 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
308 | + */ |
|
309 | + public function filterByPrimaryKeys($keys) |
|
310 | + { |
|
311 | + |
|
312 | + return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $keys, Criteria::IN); |
|
313 | + } |
|
314 | + |
|
315 | + /** |
|
316 | + * Filter the query on the id column |
|
317 | + * |
|
318 | + * Example usage: |
|
319 | + * <code> |
|
320 | + * $query->filterById(1234); // WHERE id = 1234 |
|
321 | + * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) |
|
322 | + * $query->filterById(array('min' => 12)); // WHERE id > 12 |
|
323 | + * </code> |
|
324 | + * |
|
325 | + * @param mixed $id The value to use as filter. |
|
326 | + * Use scalar values for equality. |
|
327 | + * Use array values for in_array() equivalent. |
|
328 | + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
329 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
330 | + * |
|
331 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
332 | + */ |
|
333 | + public function filterById($id = null, $comparison = null) |
|
334 | + { |
|
335 | + if (is_array($id)) { |
|
336 | + $useMinMax = false; |
|
337 | + if (isset($id['min'])) { |
|
338 | + $this->addUsingAlias(SubscriptionTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL); |
|
339 | + $useMinMax = true; |
|
340 | + } |
|
341 | + if (isset($id['max'])) { |
|
342 | + $this->addUsingAlias(SubscriptionTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL); |
|
343 | + $useMinMax = true; |
|
344 | + } |
|
345 | + if ($useMinMax) { |
|
346 | + return $this; |
|
347 | + } |
|
348 | + if (null === $comparison) { |
|
349 | + $comparison = Criteria::IN; |
|
350 | + } |
|
351 | + } |
|
352 | + |
|
353 | + return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $id, $comparison); |
|
354 | + } |
|
355 | + |
|
356 | + /** |
|
357 | + * Filter the query on the instance_name column |
|
358 | + * |
|
359 | + * Example usage: |
|
360 | + * <code> |
|
361 | + * $query->filterByInstanceName('fooValue'); // WHERE instance_name = 'fooValue' |
|
362 | + * $query->filterByInstanceName('%fooValue%'); // WHERE instance_name LIKE '%fooValue%' |
|
363 | + * </code> |
|
364 | + * |
|
365 | + * @param string $instanceName The value to use as filter. |
|
366 | + * Accepts wildcards (* and % trigger a LIKE) |
|
367 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
368 | + * |
|
369 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
370 | + */ |
|
371 | + public function filterByInstanceName($instanceName = null, $comparison = null) |
|
372 | + { |
|
373 | + if (null === $comparison) { |
|
374 | + if (is_array($instanceName)) { |
|
375 | + $comparison = Criteria::IN; |
|
376 | + } elseif (preg_match('/[\%\*]/', $instanceName)) { |
|
377 | + $instanceName = str_replace('*', '%', $instanceName); |
|
378 | + $comparison = Criteria::LIKE; |
|
379 | + } |
|
380 | + } |
|
381 | + |
|
382 | + return $this->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instanceName, $comparison); |
|
383 | + } |
|
384 | + |
|
385 | + /** |
|
386 | + * Filter the query on the input_uuid column |
|
387 | + * |
|
388 | + * Example usage: |
|
389 | + * <code> |
|
390 | + * $query->filterByInputUuid('fooValue'); // WHERE input_uuid = 'fooValue' |
|
391 | + * $query->filterByInputUuid('%fooValue%'); // WHERE input_uuid LIKE '%fooValue%' |
|
392 | + * </code> |
|
393 | + * |
|
394 | + * @param string $inputUuid The value to use as filter. |
|
395 | + * Accepts wildcards (* and % trigger a LIKE) |
|
396 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
397 | + * |
|
398 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
399 | + */ |
|
400 | + public function filterByInputUuid($inputUuid = null, $comparison = null) |
|
401 | + { |
|
402 | + if (null === $comparison) { |
|
403 | + if (is_array($inputUuid)) { |
|
404 | + $comparison = Criteria::IN; |
|
405 | + } elseif (preg_match('/[\%\*]/', $inputUuid)) { |
|
406 | + $inputUuid = str_replace('*', '%', $inputUuid); |
|
407 | + $comparison = Criteria::LIKE; |
|
408 | + } |
|
409 | + } |
|
410 | + |
|
411 | + return $this->addUsingAlias(SubscriptionTableMap::COL_INPUT_UUID, $inputUuid, $comparison); |
|
412 | + } |
|
413 | + |
|
414 | + /** |
|
415 | + * Filter the query on the user_id column |
|
416 | + * |
|
417 | + * Example usage: |
|
418 | + * <code> |
|
419 | + * $query->filterByUserId(1234); // WHERE user_id = 1234 |
|
420 | + * $query->filterByUserId(array(12, 34)); // WHERE user_id IN (12, 34) |
|
421 | + * $query->filterByUserId(array('min' => 12)); // WHERE user_id > 12 |
|
422 | + * </code> |
|
423 | + * |
|
424 | + * @see filterByUser() |
|
425 | + * |
|
426 | + * @param mixed $userId 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 | + public function filterByUserId($userId = null, $comparison = null) |
|
435 | + { |
|
436 | + if (is_array($userId)) { |
|
437 | + $useMinMax = false; |
|
438 | + if (isset($userId['min'])) { |
|
439 | + $this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId['min'], Criteria::GREATER_EQUAL); |
|
440 | + $useMinMax = true; |
|
441 | + } |
|
442 | + if (isset($userId['max'])) { |
|
443 | + $this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId['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_USER_ID, $userId, $comparison); |
|
455 | + } |
|
456 | + |
|
457 | + /** |
|
458 | + * Filter the query on the channel_id column |
|
459 | + * |
|
460 | + * Example usage: |
|
461 | + * <code> |
|
462 | + * $query->filterByChannelId(1234); // WHERE channel_id = 1234 |
|
463 | + * $query->filterByChannelId(array(12, 34)); // WHERE channel_id IN (12, 34) |
|
464 | + * $query->filterByChannelId(array('min' => 12)); // WHERE channel_id > 12 |
|
465 | + * </code> |
|
466 | + * |
|
467 | + * @see filterByChannel() |
|
468 | + * |
|
469 | + * @param mixed $channelId The value to use as filter. |
|
470 | + * Use scalar values for equality. |
|
471 | + * Use array values for in_array() equivalent. |
|
472 | + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
473 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
474 | + * |
|
475 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
476 | + */ |
|
477 | + public function filterByChannelId($channelId = null, $comparison = null) |
|
478 | + { |
|
479 | + if (is_array($channelId)) { |
|
480 | + $useMinMax = false; |
|
481 | + if (isset($channelId['min'])) { |
|
482 | + $this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId['min'], Criteria::GREATER_EQUAL); |
|
483 | + $useMinMax = true; |
|
484 | + } |
|
485 | + if (isset($channelId['max'])) { |
|
486 | + $this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId['max'], Criteria::LESS_EQUAL); |
|
487 | + $useMinMax = true; |
|
488 | + } |
|
489 | + if ($useMinMax) { |
|
490 | + return $this; |
|
491 | + } |
|
492 | + if (null === $comparison) { |
|
493 | + $comparison = Criteria::IN; |
|
494 | + } |
|
495 | + } |
|
496 | + |
|
497 | + return $this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId, $comparison); |
|
498 | + } |
|
499 | + |
|
500 | + /** |
|
501 | + * Filter the query on the subscription_id column |
|
502 | + * |
|
503 | + * Example usage: |
|
504 | + * <code> |
|
505 | + * $query->filterBySubscriptionId(1234); // WHERE subscription_id = 1234 |
|
506 | + * $query->filterBySubscriptionId(array(12, 34)); // WHERE subscription_id IN (12, 34) |
|
507 | + * $query->filterBySubscriptionId(array('min' => 12)); // WHERE subscription_id > 12 |
|
508 | + * </code> |
|
509 | + * |
|
510 | + * @param mixed $subscriptionId The value to use as filter. |
|
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 | + public function filterBySubscriptionId($subscriptionId = null, $comparison = null) |
|
519 | + { |
|
520 | + if (is_array($subscriptionId)) { |
|
521 | + $useMinMax = false; |
|
522 | + if (isset($subscriptionId['min'])) { |
|
523 | + $this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId['min'], Criteria::GREATER_EQUAL); |
|
524 | + $useMinMax = true; |
|
525 | + } |
|
526 | + if (isset($subscriptionId['max'])) { |
|
527 | + $this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId['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_SUBSCRIPTION_ID, $subscriptionId, $comparison); |
|
539 | + } |
|
540 | + |
|
541 | + /** |
|
542 | + * Filter the query on the started column |
|
543 | + * |
|
544 | + * Example usage: |
|
545 | + * <code> |
|
546 | + * $query->filterByStarted('2011-03-14'); // WHERE started = '2011-03-14' |
|
547 | + * $query->filterByStarted('now'); // WHERE started = '2011-03-14' |
|
548 | + * $query->filterByStarted(array('max' => 'yesterday')); // WHERE started > '2011-03-13' |
|
549 | + * </code> |
|
550 | + * |
|
551 | + * @param mixed $started 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 | + public function filterByStarted($started = null, $comparison = null) |
|
562 | + { |
|
563 | + if (is_array($started)) { |
|
564 | + $useMinMax = false; |
|
565 | + if (isset($started['min'])) { |
|
566 | + $this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started['min'], Criteria::GREATER_EQUAL); |
|
567 | + $useMinMax = true; |
|
568 | + } |
|
569 | + if (isset($started['max'])) { |
|
570 | + $this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started['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_STARTED, $started, $comparison); |
|
582 | + } |
|
583 | + |
|
584 | + /** |
|
585 | + * Filter the query on the stopped column |
|
586 | + * |
|
587 | + * Example usage: |
|
588 | + * <code> |
|
589 | + * $query->filterByStopped('2011-03-14'); // WHERE stopped = '2011-03-14' |
|
590 | + * $query->filterByStopped('now'); // WHERE stopped = '2011-03-14' |
|
591 | + * $query->filterByStopped(array('max' => 'yesterday')); // WHERE stopped > '2011-03-13' |
|
592 | + * </code> |
|
593 | + * |
|
594 | + * @param mixed $stopped The value to use as filter. |
|
595 | + * Values can be integers (unix timestamps), DateTime objects, or strings. |
|
596 | + * Empty strings are treated as NULL. |
|
597 | + * Use scalar values for equality. |
|
598 | + * Use array values for in_array() equivalent. |
|
599 | + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
600 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
601 | + * |
|
602 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
603 | + */ |
|
604 | + public function filterByStopped($stopped = null, $comparison = null) |
|
605 | + { |
|
606 | + if (is_array($stopped)) { |
|
607 | + $useMinMax = false; |
|
608 | + if (isset($stopped['min'])) { |
|
609 | + $this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped['min'], Criteria::GREATER_EQUAL); |
|
610 | + $useMinMax = true; |
|
611 | + } |
|
612 | + if (isset($stopped['max'])) { |
|
613 | + $this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped['max'], Criteria::LESS_EQUAL); |
|
614 | + $useMinMax = true; |
|
615 | + } |
|
616 | + if ($useMinMax) { |
|
617 | + return $this; |
|
618 | + } |
|
619 | + if (null === $comparison) { |
|
620 | + $comparison = Criteria::IN; |
|
621 | + } |
|
622 | + } |
|
623 | + |
|
624 | + return $this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped, $comparison); |
|
625 | + } |
|
626 | + |
|
627 | + /** |
|
628 | + * Filter the query on the title column |
|
629 | + * |
|
630 | + * Example usage: |
|
631 | + * <code> |
|
632 | + * $query->filterByTitle('fooValue'); // WHERE title = 'fooValue' |
|
633 | + * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%' |
|
634 | + * </code> |
|
635 | + * |
|
636 | + * @param string $title The value to use as filter. |
|
637 | + * Accepts wildcards (* and % trigger a LIKE) |
|
638 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
639 | + * |
|
640 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
641 | + */ |
|
642 | + public function filterByTitle($title = null, $comparison = null) |
|
643 | + { |
|
644 | + if (null === $comparison) { |
|
645 | + if (is_array($title)) { |
|
646 | + $comparison = Criteria::IN; |
|
647 | + } elseif (preg_match('/[\%\*]/', $title)) { |
|
648 | + $title = str_replace('*', '%', $title); |
|
649 | + $comparison = Criteria::LIKE; |
|
650 | + } |
|
651 | + } |
|
652 | + |
|
653 | + return $this->addUsingAlias(SubscriptionTableMap::COL_TITLE, $title, $comparison); |
|
654 | + } |
|
655 | + |
|
656 | + /** |
|
657 | + * Filter the query on the service column |
|
658 | + * |
|
659 | + * Example usage: |
|
660 | + * <code> |
|
661 | + * $query->filterByService('fooValue'); // WHERE service = 'fooValue' |
|
662 | + * $query->filterByService('%fooValue%'); // WHERE service LIKE '%fooValue%' |
|
663 | + * </code> |
|
664 | + * |
|
665 | + * @param string $service The value to use as filter. |
|
666 | + * Accepts wildcards (* and % trigger a LIKE) |
|
667 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
668 | + * |
|
669 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
670 | + */ |
|
671 | + public function filterByService($service = null, $comparison = null) |
|
672 | + { |
|
673 | + if (null === $comparison) { |
|
674 | + if (is_array($service)) { |
|
675 | + $comparison = Criteria::IN; |
|
676 | + } elseif (preg_match('/[\%\*]/', $service)) { |
|
677 | + $service = str_replace('*', '%', $service); |
|
678 | + $comparison = Criteria::LIKE; |
|
679 | + } |
|
680 | + } |
|
681 | + |
|
682 | + return $this->addUsingAlias(SubscriptionTableMap::COL_SERVICE, $service, $comparison); |
|
683 | + } |
|
684 | + |
|
685 | + /** |
|
686 | + * Filter the query by a related \Jalle19\StatusManager\Database\Instance object |
|
687 | + * |
|
688 | + * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter |
|
689 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
690 | + * |
|
691 | + * @throws \Propel\Runtime\Exception\PropelException |
|
692 | + * |
|
693 | + * @return ChildSubscriptionQuery The current query, for fluid interface |
|
694 | + */ |
|
695 | + public function filterByInstance($instance, $comparison = null) |
|
696 | + { |
|
697 | + if ($instance instanceof \Jalle19\StatusManager\Database\Instance) { |
|
698 | + return $this |
|
699 | + ->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instance->getName(), $comparison); |
|
700 | + } elseif ($instance instanceof ObjectCollection) { |
|
701 | + if (null === $comparison) { |
|
702 | + $comparison = Criteria::IN; |
|
703 | + } |
|
704 | + |
|
705 | + return $this |
|
706 | + ->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instance->toKeyValue('PrimaryKey', 'Name'), $comparison); |
|
707 | + } else { |
|
708 | + throw new PropelException('filterByInstance() only accepts arguments of type \Jalle19\StatusManager\Database\Instance or Collection'); |
|
709 | + } |
|
710 | + } |
|
711 | + |
|
712 | + /** |
|
713 | + * Adds a JOIN clause to the query using the Instance relation |
|
714 | + * |
|
715 | + * @param string $relationAlias optional alias for the relation |
|
716 | + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
717 | + * |
|
718 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
719 | + */ |
|
720 | + public function joinInstance($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
721 | + { |
|
722 | + $tableMap = $this->getTableMap(); |
|
723 | + $relationMap = $tableMap->getRelation('Instance'); |
|
724 | + |
|
725 | + // create a ModelJoin object for this join |
|
726 | + $join = new ModelJoin(); |
|
727 | + $join->setJoinType($joinType); |
|
728 | + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
|
729 | + if ($previousJoin = $this->getPreviousJoin()) { |
|
730 | + $join->setPreviousJoin($previousJoin); |
|
731 | + } |
|
732 | + |
|
733 | + // add the ModelJoin to the current object |
|
734 | + if ($relationAlias) { |
|
735 | + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
|
736 | + $this->addJoinObject($join, $relationAlias); |
|
737 | + } else { |
|
738 | + $this->addJoinObject($join, 'Instance'); |
|
739 | + } |
|
740 | + |
|
741 | + return $this; |
|
742 | + } |
|
743 | + |
|
744 | + /** |
|
745 | + * Use the Instance relation Instance object |
|
746 | + * |
|
747 | + * @see useQuery() |
|
748 | + * |
|
749 | + * @param string $relationAlias optional alias for the relation, |
|
750 | + * to be used as main alias in the secondary query |
|
751 | + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
752 | + * |
|
753 | + * @return \Jalle19\StatusManager\Database\InstanceQuery A secondary query class using the current class as primary query |
|
754 | + */ |
|
755 | + public function useInstanceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
756 | + { |
|
757 | + return $this |
|
758 | + ->joinInstance($relationAlias, $joinType) |
|
759 | + ->useQuery($relationAlias ? $relationAlias : 'Instance', '\Jalle19\StatusManager\Database\InstanceQuery'); |
|
760 | + } |
|
761 | + |
|
762 | + /** |
|
763 | + * Filter the query by a related \Jalle19\StatusManager\Database\Input object |
|
764 | + * |
|
765 | + * @param \Jalle19\StatusManager\Database\Input|ObjectCollection $input The related object(s) to use as filter |
|
766 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
767 | + * |
|
768 | + * @throws \Propel\Runtime\Exception\PropelException |
|
769 | + * |
|
770 | + * @return ChildSubscriptionQuery The current query, for fluid interface |
|
771 | + */ |
|
772 | + public function filterByInput($input, $comparison = null) |
|
773 | + { |
|
774 | + if ($input instanceof \Jalle19\StatusManager\Database\Input) { |
|
775 | + return $this |
|
776 | + ->addUsingAlias(SubscriptionTableMap::COL_INPUT_UUID, $input->getUuid(), $comparison); |
|
777 | + } elseif ($input instanceof ObjectCollection) { |
|
778 | + if (null === $comparison) { |
|
779 | + $comparison = Criteria::IN; |
|
780 | + } |
|
781 | + |
|
782 | + return $this |
|
783 | + ->addUsingAlias(SubscriptionTableMap::COL_INPUT_UUID, $input->toKeyValue('PrimaryKey', 'Uuid'), $comparison); |
|
784 | + } else { |
|
785 | + throw new PropelException('filterByInput() only accepts arguments of type \Jalle19\StatusManager\Database\Input or Collection'); |
|
786 | + } |
|
787 | + } |
|
788 | + |
|
789 | + /** |
|
790 | + * Adds a JOIN clause to the query using the Input relation |
|
791 | + * |
|
792 | + * @param string $relationAlias optional alias for the relation |
|
793 | + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
794 | + * |
|
795 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
796 | + */ |
|
797 | + public function joinInput($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
798 | + { |
|
799 | + $tableMap = $this->getTableMap(); |
|
800 | + $relationMap = $tableMap->getRelation('Input'); |
|
801 | + |
|
802 | + // create a ModelJoin object for this join |
|
803 | + $join = new ModelJoin(); |
|
804 | + $join->setJoinType($joinType); |
|
805 | + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
|
806 | + if ($previousJoin = $this->getPreviousJoin()) { |
|
807 | + $join->setPreviousJoin($previousJoin); |
|
808 | + } |
|
809 | + |
|
810 | + // add the ModelJoin to the current object |
|
811 | + if ($relationAlias) { |
|
812 | + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
|
813 | + $this->addJoinObject($join, $relationAlias); |
|
814 | + } else { |
|
815 | + $this->addJoinObject($join, 'Input'); |
|
816 | + } |
|
817 | + |
|
818 | + return $this; |
|
819 | + } |
|
820 | + |
|
821 | + /** |
|
822 | + * Use the Input relation Input object |
|
823 | + * |
|
824 | + * @see useQuery() |
|
825 | + * |
|
826 | + * @param string $relationAlias optional alias for the relation, |
|
827 | + * to be used as main alias in the secondary query |
|
828 | + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
829 | + * |
|
830 | + * @return \Jalle19\StatusManager\Database\InputQuery A secondary query class using the current class as primary query |
|
831 | + */ |
|
832 | + public function useInputQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
833 | + { |
|
834 | + return $this |
|
835 | + ->joinInput($relationAlias, $joinType) |
|
836 | + ->useQuery($relationAlias ? $relationAlias : 'Input', '\Jalle19\StatusManager\Database\InputQuery'); |
|
837 | + } |
|
838 | + |
|
839 | + /** |
|
840 | + * Filter the query by a related \Jalle19\StatusManager\Database\User object |
|
841 | + * |
|
842 | + * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user The related object(s) to use as filter |
|
843 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
844 | + * |
|
845 | + * @throws \Propel\Runtime\Exception\PropelException |
|
846 | + * |
|
847 | + * @return ChildSubscriptionQuery The current query, for fluid interface |
|
848 | + */ |
|
849 | + public function filterByUser($user, $comparison = null) |
|
850 | + { |
|
851 | + if ($user instanceof \Jalle19\StatusManager\Database\User) { |
|
852 | + return $this |
|
853 | + ->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $user->getId(), $comparison); |
|
854 | + } elseif ($user instanceof ObjectCollection) { |
|
855 | + if (null === $comparison) { |
|
856 | + $comparison = Criteria::IN; |
|
857 | + } |
|
858 | + |
|
859 | + return $this |
|
860 | + ->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison); |
|
861 | + } else { |
|
862 | + throw new PropelException('filterByUser() only accepts arguments of type \Jalle19\StatusManager\Database\User or Collection'); |
|
863 | + } |
|
864 | + } |
|
865 | + |
|
866 | + /** |
|
867 | + * Adds a JOIN clause to the query using the User relation |
|
868 | + * |
|
869 | + * @param string $relationAlias optional alias for the relation |
|
870 | + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
871 | + * |
|
872 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
873 | + */ |
|
874 | + public function joinUser($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
875 | + { |
|
876 | + $tableMap = $this->getTableMap(); |
|
877 | + $relationMap = $tableMap->getRelation('User'); |
|
878 | + |
|
879 | + // create a ModelJoin object for this join |
|
880 | + $join = new ModelJoin(); |
|
881 | + $join->setJoinType($joinType); |
|
882 | + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
|
883 | + if ($previousJoin = $this->getPreviousJoin()) { |
|
884 | + $join->setPreviousJoin($previousJoin); |
|
885 | + } |
|
886 | + |
|
887 | + // add the ModelJoin to the current object |
|
888 | + if ($relationAlias) { |
|
889 | + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
|
890 | + $this->addJoinObject($join, $relationAlias); |
|
891 | + } else { |
|
892 | + $this->addJoinObject($join, 'User'); |
|
893 | + } |
|
894 | + |
|
895 | + return $this; |
|
896 | + } |
|
897 | + |
|
898 | + /** |
|
899 | + * Use the User relation User object |
|
900 | + * |
|
901 | + * @see useQuery() |
|
902 | + * |
|
903 | + * @param string $relationAlias optional alias for the relation, |
|
904 | + * to be used as main alias in the secondary query |
|
905 | + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
906 | + * |
|
907 | + * @return \Jalle19\StatusManager\Database\UserQuery A secondary query class using the current class as primary query |
|
908 | + */ |
|
909 | + public function useUserQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
910 | + { |
|
911 | + return $this |
|
912 | + ->joinUser($relationAlias, $joinType) |
|
913 | + ->useQuery($relationAlias ? $relationAlias : 'User', '\Jalle19\StatusManager\Database\UserQuery'); |
|
914 | + } |
|
915 | + |
|
916 | + /** |
|
917 | + * Filter the query by a related \Jalle19\StatusManager\Database\Channel object |
|
918 | + * |
|
919 | + * @param \Jalle19\StatusManager\Database\Channel|ObjectCollection $channel The related object(s) to use as filter |
|
920 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
921 | + * |
|
922 | + * @throws \Propel\Runtime\Exception\PropelException |
|
923 | + * |
|
924 | + * @return ChildSubscriptionQuery The current query, for fluid interface |
|
925 | + */ |
|
926 | + public function filterByChannel($channel, $comparison = null) |
|
927 | + { |
|
928 | + if ($channel instanceof \Jalle19\StatusManager\Database\Channel) { |
|
929 | + return $this |
|
930 | + ->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channel->getId(), $comparison); |
|
931 | + } elseif ($channel instanceof ObjectCollection) { |
|
932 | + if (null === $comparison) { |
|
933 | + $comparison = Criteria::IN; |
|
934 | + } |
|
935 | + |
|
936 | + return $this |
|
937 | + ->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channel->toKeyValue('PrimaryKey', 'Id'), $comparison); |
|
938 | + } else { |
|
939 | + throw new PropelException('filterByChannel() only accepts arguments of type \Jalle19\StatusManager\Database\Channel or Collection'); |
|
940 | + } |
|
941 | + } |
|
942 | + |
|
943 | + /** |
|
944 | + * Adds a JOIN clause to the query using the Channel relation |
|
945 | + * |
|
946 | + * @param string $relationAlias optional alias for the relation |
|
947 | + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
948 | + * |
|
949 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
950 | + */ |
|
951 | + public function joinChannel($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
952 | + { |
|
953 | + $tableMap = $this->getTableMap(); |
|
954 | + $relationMap = $tableMap->getRelation('Channel'); |
|
955 | + |
|
956 | + // create a ModelJoin object for this join |
|
957 | + $join = new ModelJoin(); |
|
958 | + $join->setJoinType($joinType); |
|
959 | + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
|
960 | + if ($previousJoin = $this->getPreviousJoin()) { |
|
961 | + $join->setPreviousJoin($previousJoin); |
|
962 | + } |
|
963 | + |
|
964 | + // add the ModelJoin to the current object |
|
965 | + if ($relationAlias) { |
|
966 | + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
|
967 | + $this->addJoinObject($join, $relationAlias); |
|
968 | + } else { |
|
969 | + $this->addJoinObject($join, 'Channel'); |
|
970 | + } |
|
971 | + |
|
972 | + return $this; |
|
973 | + } |
|
974 | + |
|
975 | + /** |
|
976 | + * Use the Channel relation Channel object |
|
977 | + * |
|
978 | + * @see useQuery() |
|
979 | + * |
|
980 | + * @param string $relationAlias optional alias for the relation, |
|
981 | + * to be used as main alias in the secondary query |
|
982 | + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
983 | + * |
|
984 | + * @return \Jalle19\StatusManager\Database\ChannelQuery A secondary query class using the current class as primary query |
|
985 | + */ |
|
986 | + public function useChannelQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
987 | + { |
|
988 | + return $this |
|
989 | + ->joinChannel($relationAlias, $joinType) |
|
990 | + ->useQuery($relationAlias ? $relationAlias : 'Channel', '\Jalle19\StatusManager\Database\ChannelQuery'); |
|
991 | + } |
|
992 | + |
|
993 | + /** |
|
994 | + * Exclude object from result |
|
995 | + * |
|
996 | + * @param ChildSubscription $subscription Object to remove from the list of results |
|
997 | + * |
|
998 | + * @return $this|ChildSubscriptionQuery The current query, for fluid interface |
|
999 | + */ |
|
1000 | + public function prune($subscription = null) |
|
1001 | + { |
|
1002 | + if ($subscription) { |
|
1003 | + $this->addUsingAlias(SubscriptionTableMap::COL_ID, $subscription->getId(), Criteria::NOT_EQUAL); |
|
1004 | + } |
|
1005 | + |
|
1006 | + return $this; |
|
1007 | + } |
|
1008 | + |
|
1009 | + /** |
|
1010 | + * Deletes all rows from the subscription table. |
|
1011 | + * |
|
1012 | + * @param ConnectionInterface $con the connection to use |
|
1013 | + * @return int The number of affected rows (if supported by underlying database driver). |
|
1014 | + */ |
|
1015 | + public function doDeleteAll(ConnectionInterface $con = null) |
|
1016 | + { |
|
1017 | + if (null === $con) { |
|
1018 | + $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME); |
|
1019 | + } |
|
1020 | + |
|
1021 | + // use transaction because $criteria could contain info |
|
1022 | + // for more than one table or we could emulating ON DELETE CASCADE, etc. |
|
1023 | + return $con->transaction(function () use ($con) { |
|
1024 | + $affectedRows = 0; // initialize var to track total num of affected rows |
|
1025 | + $affectedRows += parent::doDeleteAll($con); |
|
1026 | + // Because this db requires some delete cascade/set null emulation, we have to |
|
1027 | + // clear the cached instance *after* the emulation has happened (since |
|
1028 | + // instances get re-added by the select statement contained therein). |
|
1029 | + SubscriptionTableMap::clearInstancePool(); |
|
1030 | + SubscriptionTableMap::clearRelatedInstancePool(); |
|
1031 | + |
|
1032 | + return $affectedRows; |
|
1033 | + }); |
|
1034 | + } |
|
1035 | + |
|
1036 | + /** |
|
1037 | + * Performs a DELETE on the database based on the current ModelCriteria |
|
1038 | + * |
|
1039 | + * @param ConnectionInterface $con the connection to use |
|
1040 | + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
1041 | + * if supported by native driver or if emulated using Propel. |
|
1042 | + * @throws PropelException Any exceptions caught during processing will be |
|
1043 | + * rethrown wrapped into a PropelException. |
|
1044 | + */ |
|
1045 | + public function delete(ConnectionInterface $con = null) |
|
1046 | + { |
|
1047 | + if (null === $con) { |
|
1048 | + $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME); |
|
1049 | + } |
|
1050 | + |
|
1051 | + $criteria = $this; |
|
1052 | + |
|
1053 | + // Set the correct dbName |
|
1054 | + $criteria->setDbName(SubscriptionTableMap::DATABASE_NAME); |
|
1055 | + |
|
1056 | + // use transaction because $criteria could contain info |
|
1057 | + // for more than one table or we could emulating ON DELETE CASCADE, etc. |
|
1058 | + return $con->transaction(function () use ($con, $criteria) { |
|
1059 | + $affectedRows = 0; // initialize var to track total num of affected rows |
|
1060 | + |
|
1061 | + SubscriptionTableMap::removeInstanceFromPool($criteria); |
|
1062 | + |
|
1063 | + $affectedRows += ModelCriteria::delete($con); |
|
1064 | + SubscriptionTableMap::clearRelatedInstancePool(); |
|
1065 | + |
|
1066 | + return $affectedRows; |
|
1067 | + }); |
|
1068 | + } |
|
1070 | 1069 | |
1071 | 1070 | } // SubscriptionQuery |
@@ -28,401 +28,401 @@ |
||
28 | 28 | */ |
29 | 29 | class ChannelTableMap extends TableMap |
30 | 30 | { |
31 | - use InstancePoolTrait; |
|
32 | - use TableMapTrait; |
|
33 | - |
|
34 | - /** |
|
35 | - * The (dot-path) name of this class |
|
36 | - */ |
|
37 | - const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.ChannelTableMap'; |
|
38 | - |
|
39 | - /** |
|
40 | - * The default database name for this class |
|
41 | - */ |
|
42 | - const DATABASE_NAME = 'tvheadend_status_manager'; |
|
43 | - |
|
44 | - /** |
|
45 | - * The table name for this class |
|
46 | - */ |
|
47 | - const TABLE_NAME = 'channel'; |
|
48 | - |
|
49 | - /** |
|
50 | - * The related Propel class for this table |
|
51 | - */ |
|
52 | - const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Channel'; |
|
53 | - |
|
54 | - /** |
|
55 | - * A class that can be returned by this tableMap |
|
56 | - */ |
|
57 | - const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Channel'; |
|
58 | - |
|
59 | - /** |
|
60 | - * The total number of columns |
|
61 | - */ |
|
62 | - const NUM_COLUMNS = 3; |
|
63 | - |
|
64 | - /** |
|
65 | - * The number of lazy-loaded columns |
|
66 | - */ |
|
67 | - const NUM_LAZY_LOAD_COLUMNS = 0; |
|
68 | - |
|
69 | - /** |
|
70 | - * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) |
|
71 | - */ |
|
72 | - const NUM_HYDRATE_COLUMNS = 3; |
|
73 | - |
|
74 | - /** |
|
75 | - * the column name for the id field |
|
76 | - */ |
|
77 | - const COL_ID = 'channel.id'; |
|
78 | - |
|
79 | - /** |
|
80 | - * the column name for the instance_name field |
|
81 | - */ |
|
82 | - const COL_INSTANCE_NAME = 'channel.instance_name'; |
|
83 | - |
|
84 | - /** |
|
85 | - * the column name for the name field |
|
86 | - */ |
|
87 | - const COL_NAME = 'channel.name'; |
|
88 | - |
|
89 | - /** |
|
90 | - * The default string format for model objects of the related table |
|
91 | - */ |
|
92 | - const DEFAULT_STRING_FORMAT = 'YAML'; |
|
93 | - |
|
94 | - /** |
|
95 | - * holds an array of fieldnames |
|
96 | - * |
|
97 | - * first dimension keys are the type constants |
|
98 | - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
99 | - */ |
|
100 | - protected static $fieldNames = array ( |
|
101 | - self::TYPE_PHPNAME => array('Id', 'InstanceName', 'Name', ), |
|
102 | - self::TYPE_CAMELNAME => array('id', 'instanceName', 'name', ), |
|
103 | - self::TYPE_COLNAME => array(ChannelTableMap::COL_ID, ChannelTableMap::COL_INSTANCE_NAME, ChannelTableMap::COL_NAME, ), |
|
104 | - self::TYPE_FIELDNAME => array('id', 'instance_name', 'name', ), |
|
105 | - self::TYPE_NUM => array(0, 1, 2, ) |
|
106 | - ); |
|
107 | - |
|
108 | - /** |
|
109 | - * holds an array of keys for quick access to the fieldnames array |
|
110 | - * |
|
111 | - * first dimension keys are the type constants |
|
112 | - * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
113 | - */ |
|
114 | - protected static $fieldKeys = array ( |
|
115 | - self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2, ), |
|
116 | - self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'name' => 2, ), |
|
117 | - self::TYPE_COLNAME => array(ChannelTableMap::COL_ID => 0, ChannelTableMap::COL_INSTANCE_NAME => 1, ChannelTableMap::COL_NAME => 2, ), |
|
118 | - self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'name' => 2, ), |
|
119 | - self::TYPE_NUM => array(0, 1, 2, ) |
|
120 | - ); |
|
121 | - |
|
122 | - /** |
|
123 | - * Initialize the table attributes and columns |
|
124 | - * Relations are not initialized by this method since they are lazy loaded |
|
125 | - * |
|
126 | - * @return void |
|
127 | - * @throws PropelException |
|
128 | - */ |
|
129 | - public function initialize() |
|
130 | - { |
|
131 | - // attributes |
|
132 | - $this->setName('channel'); |
|
133 | - $this->setPhpName('Channel'); |
|
134 | - $this->setIdentifierQuoting(false); |
|
135 | - $this->setClassName('\\Jalle19\\StatusManager\\Database\\Channel'); |
|
136 | - $this->setPackage('Jalle19.StatusManager.Database'); |
|
137 | - $this->setUseIdGenerator(true); |
|
138 | - // columns |
|
139 | - $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); |
|
140 | - $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null); |
|
141 | - $this->addColumn('name', 'Name', 'VARCHAR', true, 255, null); |
|
142 | - } // initialize() |
|
143 | - |
|
144 | - /** |
|
145 | - * Build the RelationMap objects for this table relationships |
|
146 | - */ |
|
147 | - public function buildRelations() |
|
148 | - { |
|
149 | - $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
31 | + use InstancePoolTrait; |
|
32 | + use TableMapTrait; |
|
33 | + |
|
34 | + /** |
|
35 | + * The (dot-path) name of this class |
|
36 | + */ |
|
37 | + const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.ChannelTableMap'; |
|
38 | + |
|
39 | + /** |
|
40 | + * The default database name for this class |
|
41 | + */ |
|
42 | + const DATABASE_NAME = 'tvheadend_status_manager'; |
|
43 | + |
|
44 | + /** |
|
45 | + * The table name for this class |
|
46 | + */ |
|
47 | + const TABLE_NAME = 'channel'; |
|
48 | + |
|
49 | + /** |
|
50 | + * The related Propel class for this table |
|
51 | + */ |
|
52 | + const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Channel'; |
|
53 | + |
|
54 | + /** |
|
55 | + * A class that can be returned by this tableMap |
|
56 | + */ |
|
57 | + const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Channel'; |
|
58 | + |
|
59 | + /** |
|
60 | + * The total number of columns |
|
61 | + */ |
|
62 | + const NUM_COLUMNS = 3; |
|
63 | + |
|
64 | + /** |
|
65 | + * The number of lazy-loaded columns |
|
66 | + */ |
|
67 | + const NUM_LAZY_LOAD_COLUMNS = 0; |
|
68 | + |
|
69 | + /** |
|
70 | + * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) |
|
71 | + */ |
|
72 | + const NUM_HYDRATE_COLUMNS = 3; |
|
73 | + |
|
74 | + /** |
|
75 | + * the column name for the id field |
|
76 | + */ |
|
77 | + const COL_ID = 'channel.id'; |
|
78 | + |
|
79 | + /** |
|
80 | + * the column name for the instance_name field |
|
81 | + */ |
|
82 | + const COL_INSTANCE_NAME = 'channel.instance_name'; |
|
83 | + |
|
84 | + /** |
|
85 | + * the column name for the name field |
|
86 | + */ |
|
87 | + const COL_NAME = 'channel.name'; |
|
88 | + |
|
89 | + /** |
|
90 | + * The default string format for model objects of the related table |
|
91 | + */ |
|
92 | + const DEFAULT_STRING_FORMAT = 'YAML'; |
|
93 | + |
|
94 | + /** |
|
95 | + * holds an array of fieldnames |
|
96 | + * |
|
97 | + * first dimension keys are the type constants |
|
98 | + * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
99 | + */ |
|
100 | + protected static $fieldNames = array ( |
|
101 | + self::TYPE_PHPNAME => array('Id', 'InstanceName', 'Name', ), |
|
102 | + self::TYPE_CAMELNAME => array('id', 'instanceName', 'name', ), |
|
103 | + self::TYPE_COLNAME => array(ChannelTableMap::COL_ID, ChannelTableMap::COL_INSTANCE_NAME, ChannelTableMap::COL_NAME, ), |
|
104 | + self::TYPE_FIELDNAME => array('id', 'instance_name', 'name', ), |
|
105 | + self::TYPE_NUM => array(0, 1, 2, ) |
|
106 | + ); |
|
107 | + |
|
108 | + /** |
|
109 | + * holds an array of keys for quick access to the fieldnames array |
|
110 | + * |
|
111 | + * first dimension keys are the type constants |
|
112 | + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
113 | + */ |
|
114 | + protected static $fieldKeys = array ( |
|
115 | + self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2, ), |
|
116 | + self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'name' => 2, ), |
|
117 | + self::TYPE_COLNAME => array(ChannelTableMap::COL_ID => 0, ChannelTableMap::COL_INSTANCE_NAME => 1, ChannelTableMap::COL_NAME => 2, ), |
|
118 | + self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'name' => 2, ), |
|
119 | + self::TYPE_NUM => array(0, 1, 2, ) |
|
120 | + ); |
|
121 | + |
|
122 | + /** |
|
123 | + * Initialize the table attributes and columns |
|
124 | + * Relations are not initialized by this method since they are lazy loaded |
|
125 | + * |
|
126 | + * @return void |
|
127 | + * @throws PropelException |
|
128 | + */ |
|
129 | + public function initialize() |
|
130 | + { |
|
131 | + // attributes |
|
132 | + $this->setName('channel'); |
|
133 | + $this->setPhpName('Channel'); |
|
134 | + $this->setIdentifierQuoting(false); |
|
135 | + $this->setClassName('\\Jalle19\\StatusManager\\Database\\Channel'); |
|
136 | + $this->setPackage('Jalle19.StatusManager.Database'); |
|
137 | + $this->setUseIdGenerator(true); |
|
138 | + // columns |
|
139 | + $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); |
|
140 | + $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null); |
|
141 | + $this->addColumn('name', 'Name', 'VARCHAR', true, 255, null); |
|
142 | + } // initialize() |
|
143 | + |
|
144 | + /** |
|
145 | + * Build the RelationMap objects for this table relationships |
|
146 | + */ |
|
147 | + public function buildRelations() |
|
148 | + { |
|
149 | + $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
150 | 150 | 0 => |
151 | 151 | array ( |
152 | - 0 => ':instance_name', |
|
153 | - 1 => ':name', |
|
152 | + 0 => ':instance_name', |
|
153 | + 1 => ':name', |
|
154 | 154 | ), |
155 | 155 | ), null, null, null, false); |
156 | - $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array ( |
|
156 | + $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array ( |
|
157 | 157 | 0 => |
158 | 158 | array ( |
159 | - 0 => ':channel_id', |
|
160 | - 1 => ':id', |
|
159 | + 0 => ':channel_id', |
|
160 | + 1 => ':id', |
|
161 | 161 | ), |
162 | 162 | ), null, null, 'Subscriptions', false); |
163 | - } // buildRelations() |
|
164 | - |
|
165 | - /** |
|
166 | - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. |
|
167 | - * |
|
168 | - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
169 | - * a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
170 | - * |
|
171 | - * @param array $row resultset row. |
|
172 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
173 | - * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
174 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
175 | - * |
|
176 | - * @return string The primary key hash of the row |
|
177 | - */ |
|
178 | - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
179 | - { |
|
180 | - // If the PK cannot be derived from the row, return NULL. |
|
181 | - if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
182 | - return null; |
|
183 | - } |
|
184 | - |
|
185 | - return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; |
|
186 | - } |
|
187 | - |
|
188 | - /** |
|
189 | - * Retrieves the primary key from the DB resultset row |
|
190 | - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
191 | - * a multi-column primary key, an array of the primary key columns will be returned. |
|
192 | - * |
|
193 | - * @param array $row resultset row. |
|
194 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
195 | - * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
196 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
197 | - * |
|
198 | - * @return mixed The primary key of the row |
|
199 | - */ |
|
200 | - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
201 | - { |
|
202 | - return (int) $row[ |
|
203 | - $indexType == TableMap::TYPE_NUM |
|
204 | - ? 0 + $offset |
|
205 | - : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) |
|
206 | - ]; |
|
207 | - } |
|
208 | - |
|
209 | - /** |
|
210 | - * The class that the tableMap will make instances of. |
|
211 | - * |
|
212 | - * If $withPrefix is true, the returned path |
|
213 | - * uses a dot-path notation which is translated into a path |
|
214 | - * relative to a location on the PHP include_path. |
|
215 | - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
216 | - * |
|
217 | - * @param boolean $withPrefix Whether or not to return the path with the class name |
|
218 | - * @return string path.to.ClassName |
|
219 | - */ |
|
220 | - public static function getOMClass($withPrefix = true) |
|
221 | - { |
|
222 | - return $withPrefix ? ChannelTableMap::CLASS_DEFAULT : ChannelTableMap::OM_CLASS; |
|
223 | - } |
|
224 | - |
|
225 | - /** |
|
226 | - * Populates an object of the default type or an object that inherit from the default. |
|
227 | - * |
|
228 | - * @param array $row row returned by DataFetcher->fetch(). |
|
229 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
230 | - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
163 | + } // buildRelations() |
|
164 | + |
|
165 | + /** |
|
166 | + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. |
|
167 | + * |
|
168 | + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
169 | + * a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
170 | + * |
|
171 | + * @param array $row resultset row. |
|
172 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
173 | + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
174 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
175 | + * |
|
176 | + * @return string The primary key hash of the row |
|
177 | + */ |
|
178 | + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
179 | + { |
|
180 | + // If the PK cannot be derived from the row, return NULL. |
|
181 | + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
182 | + return null; |
|
183 | + } |
|
184 | + |
|
185 | + return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; |
|
186 | + } |
|
187 | + |
|
188 | + /** |
|
189 | + * Retrieves the primary key from the DB resultset row |
|
190 | + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
191 | + * a multi-column primary key, an array of the primary key columns will be returned. |
|
192 | + * |
|
193 | + * @param array $row resultset row. |
|
194 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
195 | + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
196 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
197 | + * |
|
198 | + * @return mixed The primary key of the row |
|
199 | + */ |
|
200 | + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
201 | + { |
|
202 | + return (int) $row[ |
|
203 | + $indexType == TableMap::TYPE_NUM |
|
204 | + ? 0 + $offset |
|
205 | + : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) |
|
206 | + ]; |
|
207 | + } |
|
208 | + |
|
209 | + /** |
|
210 | + * The class that the tableMap will make instances of. |
|
211 | + * |
|
212 | + * If $withPrefix is true, the returned path |
|
213 | + * uses a dot-path notation which is translated into a path |
|
214 | + * relative to a location on the PHP include_path. |
|
215 | + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
216 | + * |
|
217 | + * @param boolean $withPrefix Whether or not to return the path with the class name |
|
218 | + * @return string path.to.ClassName |
|
219 | + */ |
|
220 | + public static function getOMClass($withPrefix = true) |
|
221 | + { |
|
222 | + return $withPrefix ? ChannelTableMap::CLASS_DEFAULT : ChannelTableMap::OM_CLASS; |
|
223 | + } |
|
224 | + |
|
225 | + /** |
|
226 | + * Populates an object of the default type or an object that inherit from the default. |
|
227 | + * |
|
228 | + * @param array $row row returned by DataFetcher->fetch(). |
|
229 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
230 | + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
231 | 231 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
232 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
233 | - * |
|
234 | - * @throws PropelException Any exceptions caught during processing will be |
|
235 | - * rethrown wrapped into a PropelException. |
|
236 | - * @return array (Channel object, last column rank) |
|
237 | - */ |
|
238 | - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
239 | - { |
|
240 | - $key = ChannelTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
241 | - if (null !== ($obj = ChannelTableMap::getInstanceFromPool($key))) { |
|
242 | - // We no longer rehydrate the object, since this can cause data loss. |
|
243 | - // See http://www.propelorm.org/ticket/509 |
|
244 | - // $obj->hydrate($row, $offset, true); // rehydrate |
|
245 | - $col = $offset + ChannelTableMap::NUM_HYDRATE_COLUMNS; |
|
246 | - } else { |
|
247 | - $cls = ChannelTableMap::OM_CLASS; |
|
248 | - /** @var Channel $obj */ |
|
249 | - $obj = new $cls(); |
|
250 | - $col = $obj->hydrate($row, $offset, false, $indexType); |
|
251 | - ChannelTableMap::addInstanceToPool($obj, $key); |
|
252 | - } |
|
253 | - |
|
254 | - return array($obj, $col); |
|
255 | - } |
|
256 | - |
|
257 | - /** |
|
258 | - * The returned array will contain objects of the default type or |
|
259 | - * objects that inherit from the default. |
|
260 | - * |
|
261 | - * @param DataFetcherInterface $dataFetcher |
|
262 | - * @return array |
|
263 | - * @throws PropelException Any exceptions caught during processing will be |
|
264 | - * rethrown wrapped into a PropelException. |
|
265 | - */ |
|
266 | - public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
267 | - { |
|
268 | - $results = array(); |
|
269 | - |
|
270 | - // set the class once to avoid overhead in the loop |
|
271 | - $cls = static::getOMClass(false); |
|
272 | - // populate the object(s) |
|
273 | - while ($row = $dataFetcher->fetch()) { |
|
274 | - $key = ChannelTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
275 | - if (null !== ($obj = ChannelTableMap::getInstanceFromPool($key))) { |
|
276 | - // We no longer rehydrate the object, since this can cause data loss. |
|
277 | - // See http://www.propelorm.org/ticket/509 |
|
278 | - // $obj->hydrate($row, 0, true); // rehydrate |
|
279 | - $results[] = $obj; |
|
280 | - } else { |
|
281 | - /** @var Channel $obj */ |
|
282 | - $obj = new $cls(); |
|
283 | - $obj->hydrate($row); |
|
284 | - $results[] = $obj; |
|
285 | - ChannelTableMap::addInstanceToPool($obj, $key); |
|
286 | - } // if key exists |
|
287 | - } |
|
288 | - |
|
289 | - return $results; |
|
290 | - } |
|
291 | - /** |
|
292 | - * Add all the columns needed to create a new object. |
|
293 | - * |
|
294 | - * Note: any columns that were marked with lazyLoad="true" in the |
|
295 | - * XML schema will not be added to the select list and only loaded |
|
296 | - * on demand. |
|
297 | - * |
|
298 | - * @param Criteria $criteria object containing the columns to add. |
|
299 | - * @param string $alias optional table alias |
|
300 | - * @throws PropelException Any exceptions caught during processing will be |
|
301 | - * rethrown wrapped into a PropelException. |
|
302 | - */ |
|
303 | - public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
304 | - { |
|
305 | - if (null === $alias) { |
|
306 | - $criteria->addSelectColumn(ChannelTableMap::COL_ID); |
|
307 | - $criteria->addSelectColumn(ChannelTableMap::COL_INSTANCE_NAME); |
|
308 | - $criteria->addSelectColumn(ChannelTableMap::COL_NAME); |
|
309 | - } else { |
|
310 | - $criteria->addSelectColumn($alias . '.id'); |
|
311 | - $criteria->addSelectColumn($alias . '.instance_name'); |
|
312 | - $criteria->addSelectColumn($alias . '.name'); |
|
313 | - } |
|
314 | - } |
|
315 | - |
|
316 | - /** |
|
317 | - * Returns the TableMap related to this object. |
|
318 | - * This method is not needed for general use but a specific application could have a need. |
|
319 | - * @return TableMap |
|
320 | - * @throws PropelException Any exceptions caught during processing will be |
|
321 | - * rethrown wrapped into a PropelException. |
|
322 | - */ |
|
323 | - public static function getTableMap() |
|
324 | - { |
|
325 | - return Propel::getServiceContainer()->getDatabaseMap(ChannelTableMap::DATABASE_NAME)->getTable(ChannelTableMap::TABLE_NAME); |
|
326 | - } |
|
327 | - |
|
328 | - /** |
|
329 | - * Add a TableMap instance to the database for this tableMap class. |
|
330 | - */ |
|
331 | - public static function buildTableMap() |
|
332 | - { |
|
333 | - $dbMap = Propel::getServiceContainer()->getDatabaseMap(ChannelTableMap::DATABASE_NAME); |
|
334 | - if (!$dbMap->hasTable(ChannelTableMap::TABLE_NAME)) { |
|
335 | - $dbMap->addTableObject(new ChannelTableMap()); |
|
336 | - } |
|
337 | - } |
|
338 | - |
|
339 | - /** |
|
340 | - * Performs a DELETE on the database, given a Channel or Criteria object OR a primary key value. |
|
341 | - * |
|
342 | - * @param mixed $values Criteria or Channel object or primary key or array of primary keys |
|
343 | - * which is used to create the DELETE statement |
|
344 | - * @param ConnectionInterface $con the connection to use |
|
345 | - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
346 | - * if supported by native driver or if emulated using Propel. |
|
347 | - * @throws PropelException Any exceptions caught during processing will be |
|
348 | - * rethrown wrapped into a PropelException. |
|
349 | - */ |
|
350 | - public static function doDelete($values, ConnectionInterface $con = null) |
|
351 | - { |
|
352 | - if (null === $con) { |
|
353 | - $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME); |
|
354 | - } |
|
355 | - |
|
356 | - if ($values instanceof Criteria) { |
|
357 | - // rename for clarity |
|
358 | - $criteria = $values; |
|
359 | - } elseif ($values instanceof \Jalle19\StatusManager\Database\Channel) { // it's a model object |
|
360 | - // create criteria based on pk values |
|
361 | - $criteria = $values->buildPkeyCriteria(); |
|
362 | - } else { // it's a primary key, or an array of pks |
|
363 | - $criteria = new Criteria(ChannelTableMap::DATABASE_NAME); |
|
364 | - $criteria->add(ChannelTableMap::COL_ID, (array) $values, Criteria::IN); |
|
365 | - } |
|
366 | - |
|
367 | - $query = ChannelQuery::create()->mergeWith($criteria); |
|
368 | - |
|
369 | - if ($values instanceof Criteria) { |
|
370 | - ChannelTableMap::clearInstancePool(); |
|
371 | - } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
372 | - foreach ((array) $values as $singleval) { |
|
373 | - ChannelTableMap::removeInstanceFromPool($singleval); |
|
374 | - } |
|
375 | - } |
|
376 | - |
|
377 | - return $query->delete($con); |
|
378 | - } |
|
379 | - |
|
380 | - /** |
|
381 | - * Deletes all rows from the channel table. |
|
382 | - * |
|
383 | - * @param ConnectionInterface $con the connection to use |
|
384 | - * @return int The number of affected rows (if supported by underlying database driver). |
|
385 | - */ |
|
386 | - public static function doDeleteAll(ConnectionInterface $con = null) |
|
387 | - { |
|
388 | - return ChannelQuery::create()->doDeleteAll($con); |
|
389 | - } |
|
390 | - |
|
391 | - /** |
|
392 | - * Performs an INSERT on the database, given a Channel or Criteria object. |
|
393 | - * |
|
394 | - * @param mixed $criteria Criteria or Channel object containing data that is used to create the INSERT statement. |
|
395 | - * @param ConnectionInterface $con the ConnectionInterface connection to use |
|
396 | - * @return mixed The new primary key. |
|
397 | - * @throws PropelException Any exceptions caught during processing will be |
|
398 | - * rethrown wrapped into a PropelException. |
|
399 | - */ |
|
400 | - public static function doInsert($criteria, ConnectionInterface $con = null) |
|
401 | - { |
|
402 | - if (null === $con) { |
|
403 | - $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME); |
|
404 | - } |
|
405 | - |
|
406 | - if ($criteria instanceof Criteria) { |
|
407 | - $criteria = clone $criteria; // rename for clarity |
|
408 | - } else { |
|
409 | - $criteria = $criteria->buildCriteria(); // build Criteria from Channel object |
|
410 | - } |
|
411 | - |
|
412 | - if ($criteria->containsKey(ChannelTableMap::COL_ID) && $criteria->keyContainsValue(ChannelTableMap::COL_ID) ) { |
|
413 | - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChannelTableMap::COL_ID.')'); |
|
414 | - } |
|
415 | - |
|
416 | - |
|
417 | - // Set the correct dbName |
|
418 | - $query = ChannelQuery::create()->mergeWith($criteria); |
|
419 | - |
|
420 | - // use transaction because $criteria could contain info |
|
421 | - // for more than one table (I guess, conceivably) |
|
422 | - return $con->transaction(function () use ($con, $query) { |
|
423 | - return $query->doInsert($con); |
|
424 | - }); |
|
425 | - } |
|
232 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
233 | + * |
|
234 | + * @throws PropelException Any exceptions caught during processing will be |
|
235 | + * rethrown wrapped into a PropelException. |
|
236 | + * @return array (Channel object, last column rank) |
|
237 | + */ |
|
238 | + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
239 | + { |
|
240 | + $key = ChannelTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
241 | + if (null !== ($obj = ChannelTableMap::getInstanceFromPool($key))) { |
|
242 | + // We no longer rehydrate the object, since this can cause data loss. |
|
243 | + // See http://www.propelorm.org/ticket/509 |
|
244 | + // $obj->hydrate($row, $offset, true); // rehydrate |
|
245 | + $col = $offset + ChannelTableMap::NUM_HYDRATE_COLUMNS; |
|
246 | + } else { |
|
247 | + $cls = ChannelTableMap::OM_CLASS; |
|
248 | + /** @var Channel $obj */ |
|
249 | + $obj = new $cls(); |
|
250 | + $col = $obj->hydrate($row, $offset, false, $indexType); |
|
251 | + ChannelTableMap::addInstanceToPool($obj, $key); |
|
252 | + } |
|
253 | + |
|
254 | + return array($obj, $col); |
|
255 | + } |
|
256 | + |
|
257 | + /** |
|
258 | + * The returned array will contain objects of the default type or |
|
259 | + * objects that inherit from the default. |
|
260 | + * |
|
261 | + * @param DataFetcherInterface $dataFetcher |
|
262 | + * @return array |
|
263 | + * @throws PropelException Any exceptions caught during processing will be |
|
264 | + * rethrown wrapped into a PropelException. |
|
265 | + */ |
|
266 | + public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
267 | + { |
|
268 | + $results = array(); |
|
269 | + |
|
270 | + // set the class once to avoid overhead in the loop |
|
271 | + $cls = static::getOMClass(false); |
|
272 | + // populate the object(s) |
|
273 | + while ($row = $dataFetcher->fetch()) { |
|
274 | + $key = ChannelTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
275 | + if (null !== ($obj = ChannelTableMap::getInstanceFromPool($key))) { |
|
276 | + // We no longer rehydrate the object, since this can cause data loss. |
|
277 | + // See http://www.propelorm.org/ticket/509 |
|
278 | + // $obj->hydrate($row, 0, true); // rehydrate |
|
279 | + $results[] = $obj; |
|
280 | + } else { |
|
281 | + /** @var Channel $obj */ |
|
282 | + $obj = new $cls(); |
|
283 | + $obj->hydrate($row); |
|
284 | + $results[] = $obj; |
|
285 | + ChannelTableMap::addInstanceToPool($obj, $key); |
|
286 | + } // if key exists |
|
287 | + } |
|
288 | + |
|
289 | + return $results; |
|
290 | + } |
|
291 | + /** |
|
292 | + * Add all the columns needed to create a new object. |
|
293 | + * |
|
294 | + * Note: any columns that were marked with lazyLoad="true" in the |
|
295 | + * XML schema will not be added to the select list and only loaded |
|
296 | + * on demand. |
|
297 | + * |
|
298 | + * @param Criteria $criteria object containing the columns to add. |
|
299 | + * @param string $alias optional table alias |
|
300 | + * @throws PropelException Any exceptions caught during processing will be |
|
301 | + * rethrown wrapped into a PropelException. |
|
302 | + */ |
|
303 | + public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
304 | + { |
|
305 | + if (null === $alias) { |
|
306 | + $criteria->addSelectColumn(ChannelTableMap::COL_ID); |
|
307 | + $criteria->addSelectColumn(ChannelTableMap::COL_INSTANCE_NAME); |
|
308 | + $criteria->addSelectColumn(ChannelTableMap::COL_NAME); |
|
309 | + } else { |
|
310 | + $criteria->addSelectColumn($alias . '.id'); |
|
311 | + $criteria->addSelectColumn($alias . '.instance_name'); |
|
312 | + $criteria->addSelectColumn($alias . '.name'); |
|
313 | + } |
|
314 | + } |
|
315 | + |
|
316 | + /** |
|
317 | + * Returns the TableMap related to this object. |
|
318 | + * This method is not needed for general use but a specific application could have a need. |
|
319 | + * @return TableMap |
|
320 | + * @throws PropelException Any exceptions caught during processing will be |
|
321 | + * rethrown wrapped into a PropelException. |
|
322 | + */ |
|
323 | + public static function getTableMap() |
|
324 | + { |
|
325 | + return Propel::getServiceContainer()->getDatabaseMap(ChannelTableMap::DATABASE_NAME)->getTable(ChannelTableMap::TABLE_NAME); |
|
326 | + } |
|
327 | + |
|
328 | + /** |
|
329 | + * Add a TableMap instance to the database for this tableMap class. |
|
330 | + */ |
|
331 | + public static function buildTableMap() |
|
332 | + { |
|
333 | + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ChannelTableMap::DATABASE_NAME); |
|
334 | + if (!$dbMap->hasTable(ChannelTableMap::TABLE_NAME)) { |
|
335 | + $dbMap->addTableObject(new ChannelTableMap()); |
|
336 | + } |
|
337 | + } |
|
338 | + |
|
339 | + /** |
|
340 | + * Performs a DELETE on the database, given a Channel or Criteria object OR a primary key value. |
|
341 | + * |
|
342 | + * @param mixed $values Criteria or Channel object or primary key or array of primary keys |
|
343 | + * which is used to create the DELETE statement |
|
344 | + * @param ConnectionInterface $con the connection to use |
|
345 | + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
346 | + * if supported by native driver or if emulated using Propel. |
|
347 | + * @throws PropelException Any exceptions caught during processing will be |
|
348 | + * rethrown wrapped into a PropelException. |
|
349 | + */ |
|
350 | + public static function doDelete($values, ConnectionInterface $con = null) |
|
351 | + { |
|
352 | + if (null === $con) { |
|
353 | + $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME); |
|
354 | + } |
|
355 | + |
|
356 | + if ($values instanceof Criteria) { |
|
357 | + // rename for clarity |
|
358 | + $criteria = $values; |
|
359 | + } elseif ($values instanceof \Jalle19\StatusManager\Database\Channel) { // it's a model object |
|
360 | + // create criteria based on pk values |
|
361 | + $criteria = $values->buildPkeyCriteria(); |
|
362 | + } else { // it's a primary key, or an array of pks |
|
363 | + $criteria = new Criteria(ChannelTableMap::DATABASE_NAME); |
|
364 | + $criteria->add(ChannelTableMap::COL_ID, (array) $values, Criteria::IN); |
|
365 | + } |
|
366 | + |
|
367 | + $query = ChannelQuery::create()->mergeWith($criteria); |
|
368 | + |
|
369 | + if ($values instanceof Criteria) { |
|
370 | + ChannelTableMap::clearInstancePool(); |
|
371 | + } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
372 | + foreach ((array) $values as $singleval) { |
|
373 | + ChannelTableMap::removeInstanceFromPool($singleval); |
|
374 | + } |
|
375 | + } |
|
376 | + |
|
377 | + return $query->delete($con); |
|
378 | + } |
|
379 | + |
|
380 | + /** |
|
381 | + * Deletes all rows from the channel table. |
|
382 | + * |
|
383 | + * @param ConnectionInterface $con the connection to use |
|
384 | + * @return int The number of affected rows (if supported by underlying database driver). |
|
385 | + */ |
|
386 | + public static function doDeleteAll(ConnectionInterface $con = null) |
|
387 | + { |
|
388 | + return ChannelQuery::create()->doDeleteAll($con); |
|
389 | + } |
|
390 | + |
|
391 | + /** |
|
392 | + * Performs an INSERT on the database, given a Channel or Criteria object. |
|
393 | + * |
|
394 | + * @param mixed $criteria Criteria or Channel object containing data that is used to create the INSERT statement. |
|
395 | + * @param ConnectionInterface $con the ConnectionInterface connection to use |
|
396 | + * @return mixed The new primary key. |
|
397 | + * @throws PropelException Any exceptions caught during processing will be |
|
398 | + * rethrown wrapped into a PropelException. |
|
399 | + */ |
|
400 | + public static function doInsert($criteria, ConnectionInterface $con = null) |
|
401 | + { |
|
402 | + if (null === $con) { |
|
403 | + $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME); |
|
404 | + } |
|
405 | + |
|
406 | + if ($criteria instanceof Criteria) { |
|
407 | + $criteria = clone $criteria; // rename for clarity |
|
408 | + } else { |
|
409 | + $criteria = $criteria->buildCriteria(); // build Criteria from Channel object |
|
410 | + } |
|
411 | + |
|
412 | + if ($criteria->containsKey(ChannelTableMap::COL_ID) && $criteria->keyContainsValue(ChannelTableMap::COL_ID) ) { |
|
413 | + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChannelTableMap::COL_ID.')'); |
|
414 | + } |
|
415 | + |
|
416 | + |
|
417 | + // Set the correct dbName |
|
418 | + $query = ChannelQuery::create()->mergeWith($criteria); |
|
419 | + |
|
420 | + // use transaction because $criteria could contain info |
|
421 | + // for more than one table (I guess, conceivably) |
|
422 | + return $con->transaction(function () use ($con, $query) { |
|
423 | + return $query->doInsert($con); |
|
424 | + }); |
|
425 | + } |
|
426 | 426 | |
427 | 427 | } // ChannelTableMap |
428 | 428 | // This is the static code needed to register the TableMap for this table with the main Propel class. |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | * first dimension keys are the type constants |
98 | 98 | * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
99 | 99 | */ |
100 | - protected static $fieldNames = array ( |
|
101 | - self::TYPE_PHPNAME => array('Id', 'InstanceName', 'Name', ), |
|
102 | - self::TYPE_CAMELNAME => array('id', 'instanceName', 'name', ), |
|
103 | - self::TYPE_COLNAME => array(ChannelTableMap::COL_ID, ChannelTableMap::COL_INSTANCE_NAME, ChannelTableMap::COL_NAME, ), |
|
104 | - self::TYPE_FIELDNAME => array('id', 'instance_name', 'name', ), |
|
105 | - self::TYPE_NUM => array(0, 1, 2, ) |
|
100 | + protected static $fieldNames = array( |
|
101 | + self::TYPE_PHPNAME => array('Id', 'InstanceName', 'Name',), |
|
102 | + self::TYPE_CAMELNAME => array('id', 'instanceName', 'name',), |
|
103 | + self::TYPE_COLNAME => array(ChannelTableMap::COL_ID, ChannelTableMap::COL_INSTANCE_NAME, ChannelTableMap::COL_NAME,), |
|
104 | + self::TYPE_FIELDNAME => array('id', 'instance_name', 'name',), |
|
105 | + self::TYPE_NUM => array(0, 1, 2,) |
|
106 | 106 | ); |
107 | 107 | |
108 | 108 | /** |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | * first dimension keys are the type constants |
112 | 112 | * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
113 | 113 | */ |
114 | - protected static $fieldKeys = array ( |
|
115 | - self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2, ), |
|
116 | - self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'name' => 2, ), |
|
117 | - self::TYPE_COLNAME => array(ChannelTableMap::COL_ID => 0, ChannelTableMap::COL_INSTANCE_NAME => 1, ChannelTableMap::COL_NAME => 2, ), |
|
118 | - self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'name' => 2, ), |
|
119 | - self::TYPE_NUM => array(0, 1, 2, ) |
|
114 | + protected static $fieldKeys = array( |
|
115 | + self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2,), |
|
116 | + self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'name' => 2,), |
|
117 | + self::TYPE_COLNAME => array(ChannelTableMap::COL_ID => 0, ChannelTableMap::COL_INSTANCE_NAME => 1, ChannelTableMap::COL_NAME => 2,), |
|
118 | + self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'name' => 2,), |
|
119 | + self::TYPE_NUM => array(0, 1, 2,) |
|
120 | 120 | ); |
121 | 121 | |
122 | 122 | /** |
@@ -146,16 +146,16 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function buildRelations() |
148 | 148 | { |
149 | - $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
149 | + $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array( |
|
150 | 150 | 0 => |
151 | - array ( |
|
151 | + array( |
|
152 | 152 | 0 => ':instance_name', |
153 | 153 | 1 => ':name', |
154 | 154 | ), |
155 | 155 | ), null, null, null, false); |
156 | - $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array ( |
|
156 | + $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array( |
|
157 | 157 | 0 => |
158 | - array ( |
|
158 | + array( |
|
159 | 159 | 0 => ':channel_id', |
160 | 160 | 1 => ':id', |
161 | 161 | ), |
@@ -409,8 +409,8 @@ discard block |
||
409 | 409 | $criteria = $criteria->buildCriteria(); // build Criteria from Channel object |
410 | 410 | } |
411 | 411 | |
412 | - if ($criteria->containsKey(ChannelTableMap::COL_ID) && $criteria->keyContainsValue(ChannelTableMap::COL_ID) ) { |
|
413 | - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChannelTableMap::COL_ID.')'); |
|
412 | + if ($criteria->containsKey(ChannelTableMap::COL_ID) && $criteria->keyContainsValue(ChannelTableMap::COL_ID)) { |
|
413 | + throw new PropelException('Cannot insert a value for auto-increment primary key (' . ChannelTableMap::COL_ID . ')'); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | |
420 | 420 | // use transaction because $criteria could contain info |
421 | 421 | // for more than one table (I guess, conceivably) |
422 | - return $con->transaction(function () use ($con, $query) { |
|
422 | + return $con->transaction(function() use ($con, $query) { |
|
423 | 423 | return $query->doInsert($con); |
424 | 424 | }); |
425 | 425 | } |
@@ -28,425 +28,425 @@ |
||
28 | 28 | */ |
29 | 29 | class ConnectionTableMap extends TableMap |
30 | 30 | { |
31 | - use InstancePoolTrait; |
|
32 | - use TableMapTrait; |
|
33 | - |
|
34 | - /** |
|
35 | - * The (dot-path) name of this class |
|
36 | - */ |
|
37 | - const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.ConnectionTableMap'; |
|
38 | - |
|
39 | - /** |
|
40 | - * The default database name for this class |
|
41 | - */ |
|
42 | - const DATABASE_NAME = 'tvheadend_status_manager'; |
|
43 | - |
|
44 | - /** |
|
45 | - * The table name for this class |
|
46 | - */ |
|
47 | - const TABLE_NAME = 'connection'; |
|
48 | - |
|
49 | - /** |
|
50 | - * The related Propel class for this table |
|
51 | - */ |
|
52 | - const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Connection'; |
|
53 | - |
|
54 | - /** |
|
55 | - * A class that can be returned by this tableMap |
|
56 | - */ |
|
57 | - const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Connection'; |
|
58 | - |
|
59 | - /** |
|
60 | - * The total number of columns |
|
61 | - */ |
|
62 | - const NUM_COLUMNS = 6; |
|
63 | - |
|
64 | - /** |
|
65 | - * The number of lazy-loaded columns |
|
66 | - */ |
|
67 | - const NUM_LAZY_LOAD_COLUMNS = 0; |
|
68 | - |
|
69 | - /** |
|
70 | - * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) |
|
71 | - */ |
|
72 | - const NUM_HYDRATE_COLUMNS = 6; |
|
73 | - |
|
74 | - /** |
|
75 | - * the column name for the id field |
|
76 | - */ |
|
77 | - const COL_ID = 'connection.id'; |
|
78 | - |
|
79 | - /** |
|
80 | - * the column name for the instance_name field |
|
81 | - */ |
|
82 | - const COL_INSTANCE_NAME = 'connection.instance_name'; |
|
83 | - |
|
84 | - /** |
|
85 | - * the column name for the user_id field |
|
86 | - */ |
|
87 | - const COL_USER_ID = 'connection.user_id'; |
|
88 | - |
|
89 | - /** |
|
90 | - * the column name for the peer field |
|
91 | - */ |
|
92 | - const COL_PEER = 'connection.peer'; |
|
93 | - |
|
94 | - /** |
|
95 | - * the column name for the started field |
|
96 | - */ |
|
97 | - const COL_STARTED = 'connection.started'; |
|
98 | - |
|
99 | - /** |
|
100 | - * the column name for the type field |
|
101 | - */ |
|
102 | - const COL_TYPE = 'connection.type'; |
|
103 | - |
|
104 | - /** |
|
105 | - * The default string format for model objects of the related table |
|
106 | - */ |
|
107 | - const DEFAULT_STRING_FORMAT = 'YAML'; |
|
108 | - |
|
109 | - /** |
|
110 | - * holds an array of fieldnames |
|
111 | - * |
|
112 | - * first dimension keys are the type constants |
|
113 | - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
114 | - */ |
|
115 | - protected static $fieldNames = array ( |
|
116 | - self::TYPE_PHPNAME => array('Id', 'InstanceName', 'UserId', 'Peer', 'Started', 'Type', ), |
|
117 | - self::TYPE_CAMELNAME => array('id', 'instanceName', 'userId', 'peer', 'started', 'type', ), |
|
118 | - self::TYPE_COLNAME => array(ConnectionTableMap::COL_ID, ConnectionTableMap::COL_INSTANCE_NAME, ConnectionTableMap::COL_USER_ID, ConnectionTableMap::COL_PEER, ConnectionTableMap::COL_STARTED, ConnectionTableMap::COL_TYPE, ), |
|
119 | - self::TYPE_FIELDNAME => array('id', 'instance_name', 'user_id', 'peer', 'started', 'type', ), |
|
120 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) |
|
121 | - ); |
|
122 | - |
|
123 | - /** |
|
124 | - * holds an array of keys for quick access to the fieldnames array |
|
125 | - * |
|
126 | - * first dimension keys are the type constants |
|
127 | - * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
128 | - */ |
|
129 | - protected static $fieldKeys = array ( |
|
130 | - self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'UserId' => 2, 'Peer' => 3, 'Started' => 4, 'Type' => 5, ), |
|
131 | - self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'userId' => 2, 'peer' => 3, 'started' => 4, 'type' => 5, ), |
|
132 | - self::TYPE_COLNAME => array(ConnectionTableMap::COL_ID => 0, ConnectionTableMap::COL_INSTANCE_NAME => 1, ConnectionTableMap::COL_USER_ID => 2, ConnectionTableMap::COL_PEER => 3, ConnectionTableMap::COL_STARTED => 4, ConnectionTableMap::COL_TYPE => 5, ), |
|
133 | - self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'user_id' => 2, 'peer' => 3, 'started' => 4, 'type' => 5, ), |
|
134 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) |
|
135 | - ); |
|
136 | - |
|
137 | - /** |
|
138 | - * Initialize the table attributes and columns |
|
139 | - * Relations are not initialized by this method since they are lazy loaded |
|
140 | - * |
|
141 | - * @return void |
|
142 | - * @throws PropelException |
|
143 | - */ |
|
144 | - public function initialize() |
|
145 | - { |
|
146 | - // attributes |
|
147 | - $this->setName('connection'); |
|
148 | - $this->setPhpName('Connection'); |
|
149 | - $this->setIdentifierQuoting(false); |
|
150 | - $this->setClassName('\\Jalle19\\StatusManager\\Database\\Connection'); |
|
151 | - $this->setPackage('Jalle19.StatusManager.Database'); |
|
152 | - $this->setUseIdGenerator(true); |
|
153 | - // columns |
|
154 | - $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); |
|
155 | - $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null); |
|
156 | - $this->addForeignKey('user_id', 'UserId', 'INTEGER', 'user', 'id', false, null, null); |
|
157 | - $this->addColumn('peer', 'Peer', 'VARCHAR', true, 255, null); |
|
158 | - $this->addColumn('started', 'Started', 'TIMESTAMP', true, null, null); |
|
159 | - $this->addColumn('type', 'Type', 'VARCHAR', true, 255, null); |
|
160 | - } // initialize() |
|
161 | - |
|
162 | - /** |
|
163 | - * Build the RelationMap objects for this table relationships |
|
164 | - */ |
|
165 | - public function buildRelations() |
|
166 | - { |
|
167 | - $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
31 | + use InstancePoolTrait; |
|
32 | + use TableMapTrait; |
|
33 | + |
|
34 | + /** |
|
35 | + * The (dot-path) name of this class |
|
36 | + */ |
|
37 | + const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.ConnectionTableMap'; |
|
38 | + |
|
39 | + /** |
|
40 | + * The default database name for this class |
|
41 | + */ |
|
42 | + const DATABASE_NAME = 'tvheadend_status_manager'; |
|
43 | + |
|
44 | + /** |
|
45 | + * The table name for this class |
|
46 | + */ |
|
47 | + const TABLE_NAME = 'connection'; |
|
48 | + |
|
49 | + /** |
|
50 | + * The related Propel class for this table |
|
51 | + */ |
|
52 | + const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Connection'; |
|
53 | + |
|
54 | + /** |
|
55 | + * A class that can be returned by this tableMap |
|
56 | + */ |
|
57 | + const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Connection'; |
|
58 | + |
|
59 | + /** |
|
60 | + * The total number of columns |
|
61 | + */ |
|
62 | + const NUM_COLUMNS = 6; |
|
63 | + |
|
64 | + /** |
|
65 | + * The number of lazy-loaded columns |
|
66 | + */ |
|
67 | + const NUM_LAZY_LOAD_COLUMNS = 0; |
|
68 | + |
|
69 | + /** |
|
70 | + * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) |
|
71 | + */ |
|
72 | + const NUM_HYDRATE_COLUMNS = 6; |
|
73 | + |
|
74 | + /** |
|
75 | + * the column name for the id field |
|
76 | + */ |
|
77 | + const COL_ID = 'connection.id'; |
|
78 | + |
|
79 | + /** |
|
80 | + * the column name for the instance_name field |
|
81 | + */ |
|
82 | + const COL_INSTANCE_NAME = 'connection.instance_name'; |
|
83 | + |
|
84 | + /** |
|
85 | + * the column name for the user_id field |
|
86 | + */ |
|
87 | + const COL_USER_ID = 'connection.user_id'; |
|
88 | + |
|
89 | + /** |
|
90 | + * the column name for the peer field |
|
91 | + */ |
|
92 | + const COL_PEER = 'connection.peer'; |
|
93 | + |
|
94 | + /** |
|
95 | + * the column name for the started field |
|
96 | + */ |
|
97 | + const COL_STARTED = 'connection.started'; |
|
98 | + |
|
99 | + /** |
|
100 | + * the column name for the type field |
|
101 | + */ |
|
102 | + const COL_TYPE = 'connection.type'; |
|
103 | + |
|
104 | + /** |
|
105 | + * The default string format for model objects of the related table |
|
106 | + */ |
|
107 | + const DEFAULT_STRING_FORMAT = 'YAML'; |
|
108 | + |
|
109 | + /** |
|
110 | + * holds an array of fieldnames |
|
111 | + * |
|
112 | + * first dimension keys are the type constants |
|
113 | + * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
114 | + */ |
|
115 | + protected static $fieldNames = array ( |
|
116 | + self::TYPE_PHPNAME => array('Id', 'InstanceName', 'UserId', 'Peer', 'Started', 'Type', ), |
|
117 | + self::TYPE_CAMELNAME => array('id', 'instanceName', 'userId', 'peer', 'started', 'type', ), |
|
118 | + self::TYPE_COLNAME => array(ConnectionTableMap::COL_ID, ConnectionTableMap::COL_INSTANCE_NAME, ConnectionTableMap::COL_USER_ID, ConnectionTableMap::COL_PEER, ConnectionTableMap::COL_STARTED, ConnectionTableMap::COL_TYPE, ), |
|
119 | + self::TYPE_FIELDNAME => array('id', 'instance_name', 'user_id', 'peer', 'started', 'type', ), |
|
120 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) |
|
121 | + ); |
|
122 | + |
|
123 | + /** |
|
124 | + * holds an array of keys for quick access to the fieldnames array |
|
125 | + * |
|
126 | + * first dimension keys are the type constants |
|
127 | + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
128 | + */ |
|
129 | + protected static $fieldKeys = array ( |
|
130 | + self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'UserId' => 2, 'Peer' => 3, 'Started' => 4, 'Type' => 5, ), |
|
131 | + self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'userId' => 2, 'peer' => 3, 'started' => 4, 'type' => 5, ), |
|
132 | + self::TYPE_COLNAME => array(ConnectionTableMap::COL_ID => 0, ConnectionTableMap::COL_INSTANCE_NAME => 1, ConnectionTableMap::COL_USER_ID => 2, ConnectionTableMap::COL_PEER => 3, ConnectionTableMap::COL_STARTED => 4, ConnectionTableMap::COL_TYPE => 5, ), |
|
133 | + self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'user_id' => 2, 'peer' => 3, 'started' => 4, 'type' => 5, ), |
|
134 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) |
|
135 | + ); |
|
136 | + |
|
137 | + /** |
|
138 | + * Initialize the table attributes and columns |
|
139 | + * Relations are not initialized by this method since they are lazy loaded |
|
140 | + * |
|
141 | + * @return void |
|
142 | + * @throws PropelException |
|
143 | + */ |
|
144 | + public function initialize() |
|
145 | + { |
|
146 | + // attributes |
|
147 | + $this->setName('connection'); |
|
148 | + $this->setPhpName('Connection'); |
|
149 | + $this->setIdentifierQuoting(false); |
|
150 | + $this->setClassName('\\Jalle19\\StatusManager\\Database\\Connection'); |
|
151 | + $this->setPackage('Jalle19.StatusManager.Database'); |
|
152 | + $this->setUseIdGenerator(true); |
|
153 | + // columns |
|
154 | + $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); |
|
155 | + $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null); |
|
156 | + $this->addForeignKey('user_id', 'UserId', 'INTEGER', 'user', 'id', false, null, null); |
|
157 | + $this->addColumn('peer', 'Peer', 'VARCHAR', true, 255, null); |
|
158 | + $this->addColumn('started', 'Started', 'TIMESTAMP', true, null, null); |
|
159 | + $this->addColumn('type', 'Type', 'VARCHAR', true, 255, null); |
|
160 | + } // initialize() |
|
161 | + |
|
162 | + /** |
|
163 | + * Build the RelationMap objects for this table relationships |
|
164 | + */ |
|
165 | + public function buildRelations() |
|
166 | + { |
|
167 | + $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
168 | 168 | 0 => |
169 | 169 | array ( |
170 | - 0 => ':instance_name', |
|
171 | - 1 => ':name', |
|
170 | + 0 => ':instance_name', |
|
171 | + 1 => ':name', |
|
172 | 172 | ), |
173 | 173 | ), null, null, null, false); |
174 | - $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array ( |
|
174 | + $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array ( |
|
175 | 175 | 0 => |
176 | 176 | array ( |
177 | - 0 => ':user_id', |
|
178 | - 1 => ':id', |
|
177 | + 0 => ':user_id', |
|
178 | + 1 => ':id', |
|
179 | 179 | ), |
180 | 180 | ), null, null, null, false); |
181 | - } // buildRelations() |
|
182 | - |
|
183 | - /** |
|
184 | - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. |
|
185 | - * |
|
186 | - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
187 | - * a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
188 | - * |
|
189 | - * @param array $row resultset row. |
|
190 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
191 | - * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
192 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
193 | - * |
|
194 | - * @return string The primary key hash of the row |
|
195 | - */ |
|
196 | - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
197 | - { |
|
198 | - // If the PK cannot be derived from the row, return NULL. |
|
199 | - if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
200 | - return null; |
|
201 | - } |
|
202 | - |
|
203 | - return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; |
|
204 | - } |
|
205 | - |
|
206 | - /** |
|
207 | - * Retrieves the primary key from the DB resultset row |
|
208 | - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
209 | - * a multi-column primary key, an array of the primary key columns will be returned. |
|
210 | - * |
|
211 | - * @param array $row resultset row. |
|
212 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
213 | - * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
214 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
215 | - * |
|
216 | - * @return mixed The primary key of the row |
|
217 | - */ |
|
218 | - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
219 | - { |
|
220 | - return (int) $row[ |
|
221 | - $indexType == TableMap::TYPE_NUM |
|
222 | - ? 0 + $offset |
|
223 | - : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) |
|
224 | - ]; |
|
225 | - } |
|
226 | - |
|
227 | - /** |
|
228 | - * The class that the tableMap will make instances of. |
|
229 | - * |
|
230 | - * If $withPrefix is true, the returned path |
|
231 | - * uses a dot-path notation which is translated into a path |
|
232 | - * relative to a location on the PHP include_path. |
|
233 | - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
234 | - * |
|
235 | - * @param boolean $withPrefix Whether or not to return the path with the class name |
|
236 | - * @return string path.to.ClassName |
|
237 | - */ |
|
238 | - public static function getOMClass($withPrefix = true) |
|
239 | - { |
|
240 | - return $withPrefix ? ConnectionTableMap::CLASS_DEFAULT : ConnectionTableMap::OM_CLASS; |
|
241 | - } |
|
242 | - |
|
243 | - /** |
|
244 | - * Populates an object of the default type or an object that inherit from the default. |
|
245 | - * |
|
246 | - * @param array $row row returned by DataFetcher->fetch(). |
|
247 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
248 | - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
181 | + } // buildRelations() |
|
182 | + |
|
183 | + /** |
|
184 | + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. |
|
185 | + * |
|
186 | + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
187 | + * a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
188 | + * |
|
189 | + * @param array $row resultset row. |
|
190 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
191 | + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
192 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
193 | + * |
|
194 | + * @return string The primary key hash of the row |
|
195 | + */ |
|
196 | + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
197 | + { |
|
198 | + // If the PK cannot be derived from the row, return NULL. |
|
199 | + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
200 | + return null; |
|
201 | + } |
|
202 | + |
|
203 | + return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; |
|
204 | + } |
|
205 | + |
|
206 | + /** |
|
207 | + * Retrieves the primary key from the DB resultset row |
|
208 | + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
209 | + * a multi-column primary key, an array of the primary key columns will be returned. |
|
210 | + * |
|
211 | + * @param array $row resultset row. |
|
212 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
213 | + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
214 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
215 | + * |
|
216 | + * @return mixed The primary key of the row |
|
217 | + */ |
|
218 | + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
219 | + { |
|
220 | + return (int) $row[ |
|
221 | + $indexType == TableMap::TYPE_NUM |
|
222 | + ? 0 + $offset |
|
223 | + : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) |
|
224 | + ]; |
|
225 | + } |
|
226 | + |
|
227 | + /** |
|
228 | + * The class that the tableMap will make instances of. |
|
229 | + * |
|
230 | + * If $withPrefix is true, the returned path |
|
231 | + * uses a dot-path notation which is translated into a path |
|
232 | + * relative to a location on the PHP include_path. |
|
233 | + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
234 | + * |
|
235 | + * @param boolean $withPrefix Whether or not to return the path with the class name |
|
236 | + * @return string path.to.ClassName |
|
237 | + */ |
|
238 | + public static function getOMClass($withPrefix = true) |
|
239 | + { |
|
240 | + return $withPrefix ? ConnectionTableMap::CLASS_DEFAULT : ConnectionTableMap::OM_CLASS; |
|
241 | + } |
|
242 | + |
|
243 | + /** |
|
244 | + * Populates an object of the default type or an object that inherit from the default. |
|
245 | + * |
|
246 | + * @param array $row row returned by DataFetcher->fetch(). |
|
247 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
248 | + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
249 | 249 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
250 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
251 | - * |
|
252 | - * @throws PropelException Any exceptions caught during processing will be |
|
253 | - * rethrown wrapped into a PropelException. |
|
254 | - * @return array (Connection object, last column rank) |
|
255 | - */ |
|
256 | - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
257 | - { |
|
258 | - $key = ConnectionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
259 | - if (null !== ($obj = ConnectionTableMap::getInstanceFromPool($key))) { |
|
260 | - // We no longer rehydrate the object, since this can cause data loss. |
|
261 | - // See http://www.propelorm.org/ticket/509 |
|
262 | - // $obj->hydrate($row, $offset, true); // rehydrate |
|
263 | - $col = $offset + ConnectionTableMap::NUM_HYDRATE_COLUMNS; |
|
264 | - } else { |
|
265 | - $cls = ConnectionTableMap::OM_CLASS; |
|
266 | - /** @var Connection $obj */ |
|
267 | - $obj = new $cls(); |
|
268 | - $col = $obj->hydrate($row, $offset, false, $indexType); |
|
269 | - ConnectionTableMap::addInstanceToPool($obj, $key); |
|
270 | - } |
|
271 | - |
|
272 | - return array($obj, $col); |
|
273 | - } |
|
274 | - |
|
275 | - /** |
|
276 | - * The returned array will contain objects of the default type or |
|
277 | - * objects that inherit from the default. |
|
278 | - * |
|
279 | - * @param DataFetcherInterface $dataFetcher |
|
280 | - * @return array |
|
281 | - * @throws PropelException Any exceptions caught during processing will be |
|
282 | - * rethrown wrapped into a PropelException. |
|
283 | - */ |
|
284 | - public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
285 | - { |
|
286 | - $results = array(); |
|
287 | - |
|
288 | - // set the class once to avoid overhead in the loop |
|
289 | - $cls = static::getOMClass(false); |
|
290 | - // populate the object(s) |
|
291 | - while ($row = $dataFetcher->fetch()) { |
|
292 | - $key = ConnectionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
293 | - if (null !== ($obj = ConnectionTableMap::getInstanceFromPool($key))) { |
|
294 | - // We no longer rehydrate the object, since this can cause data loss. |
|
295 | - // See http://www.propelorm.org/ticket/509 |
|
296 | - // $obj->hydrate($row, 0, true); // rehydrate |
|
297 | - $results[] = $obj; |
|
298 | - } else { |
|
299 | - /** @var Connection $obj */ |
|
300 | - $obj = new $cls(); |
|
301 | - $obj->hydrate($row); |
|
302 | - $results[] = $obj; |
|
303 | - ConnectionTableMap::addInstanceToPool($obj, $key); |
|
304 | - } // if key exists |
|
305 | - } |
|
306 | - |
|
307 | - return $results; |
|
308 | - } |
|
309 | - /** |
|
310 | - * Add all the columns needed to create a new object. |
|
311 | - * |
|
312 | - * Note: any columns that were marked with lazyLoad="true" in the |
|
313 | - * XML schema will not be added to the select list and only loaded |
|
314 | - * on demand. |
|
315 | - * |
|
316 | - * @param Criteria $criteria object containing the columns to add. |
|
317 | - * @param string $alias optional table alias |
|
318 | - * @throws PropelException Any exceptions caught during processing will be |
|
319 | - * rethrown wrapped into a PropelException. |
|
320 | - */ |
|
321 | - public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
322 | - { |
|
323 | - if (null === $alias) { |
|
324 | - $criteria->addSelectColumn(ConnectionTableMap::COL_ID); |
|
325 | - $criteria->addSelectColumn(ConnectionTableMap::COL_INSTANCE_NAME); |
|
326 | - $criteria->addSelectColumn(ConnectionTableMap::COL_USER_ID); |
|
327 | - $criteria->addSelectColumn(ConnectionTableMap::COL_PEER); |
|
328 | - $criteria->addSelectColumn(ConnectionTableMap::COL_STARTED); |
|
329 | - $criteria->addSelectColumn(ConnectionTableMap::COL_TYPE); |
|
330 | - } else { |
|
331 | - $criteria->addSelectColumn($alias . '.id'); |
|
332 | - $criteria->addSelectColumn($alias . '.instance_name'); |
|
333 | - $criteria->addSelectColumn($alias . '.user_id'); |
|
334 | - $criteria->addSelectColumn($alias . '.peer'); |
|
335 | - $criteria->addSelectColumn($alias . '.started'); |
|
336 | - $criteria->addSelectColumn($alias . '.type'); |
|
337 | - } |
|
338 | - } |
|
339 | - |
|
340 | - /** |
|
341 | - * Returns the TableMap related to this object. |
|
342 | - * This method is not needed for general use but a specific application could have a need. |
|
343 | - * @return TableMap |
|
344 | - * @throws PropelException Any exceptions caught during processing will be |
|
345 | - * rethrown wrapped into a PropelException. |
|
346 | - */ |
|
347 | - public static function getTableMap() |
|
348 | - { |
|
349 | - return Propel::getServiceContainer()->getDatabaseMap(ConnectionTableMap::DATABASE_NAME)->getTable(ConnectionTableMap::TABLE_NAME); |
|
350 | - } |
|
351 | - |
|
352 | - /** |
|
353 | - * Add a TableMap instance to the database for this tableMap class. |
|
354 | - */ |
|
355 | - public static function buildTableMap() |
|
356 | - { |
|
357 | - $dbMap = Propel::getServiceContainer()->getDatabaseMap(ConnectionTableMap::DATABASE_NAME); |
|
358 | - if (!$dbMap->hasTable(ConnectionTableMap::TABLE_NAME)) { |
|
359 | - $dbMap->addTableObject(new ConnectionTableMap()); |
|
360 | - } |
|
361 | - } |
|
362 | - |
|
363 | - /** |
|
364 | - * Performs a DELETE on the database, given a Connection or Criteria object OR a primary key value. |
|
365 | - * |
|
366 | - * @param mixed $values Criteria or Connection object or primary key or array of primary keys |
|
367 | - * which is used to create the DELETE statement |
|
368 | - * @param ConnectionInterface $con the connection to use |
|
369 | - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
370 | - * if supported by native driver or if emulated using Propel. |
|
371 | - * @throws PropelException Any exceptions caught during processing will be |
|
372 | - * rethrown wrapped into a PropelException. |
|
373 | - */ |
|
374 | - public static function doDelete($values, ConnectionInterface $con = null) |
|
375 | - { |
|
376 | - if (null === $con) { |
|
377 | - $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME); |
|
378 | - } |
|
379 | - |
|
380 | - if ($values instanceof Criteria) { |
|
381 | - // rename for clarity |
|
382 | - $criteria = $values; |
|
383 | - } elseif ($values instanceof \Jalle19\StatusManager\Database\Connection) { // it's a model object |
|
384 | - // create criteria based on pk values |
|
385 | - $criteria = $values->buildPkeyCriteria(); |
|
386 | - } else { // it's a primary key, or an array of pks |
|
387 | - $criteria = new Criteria(ConnectionTableMap::DATABASE_NAME); |
|
388 | - $criteria->add(ConnectionTableMap::COL_ID, (array) $values, Criteria::IN); |
|
389 | - } |
|
390 | - |
|
391 | - $query = ConnectionQuery::create()->mergeWith($criteria); |
|
392 | - |
|
393 | - if ($values instanceof Criteria) { |
|
394 | - ConnectionTableMap::clearInstancePool(); |
|
395 | - } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
396 | - foreach ((array) $values as $singleval) { |
|
397 | - ConnectionTableMap::removeInstanceFromPool($singleval); |
|
398 | - } |
|
399 | - } |
|
400 | - |
|
401 | - return $query->delete($con); |
|
402 | - } |
|
403 | - |
|
404 | - /** |
|
405 | - * Deletes all rows from the connection table. |
|
406 | - * |
|
407 | - * @param ConnectionInterface $con the connection to use |
|
408 | - * @return int The number of affected rows (if supported by underlying database driver). |
|
409 | - */ |
|
410 | - public static function doDeleteAll(ConnectionInterface $con = null) |
|
411 | - { |
|
412 | - return ConnectionQuery::create()->doDeleteAll($con); |
|
413 | - } |
|
414 | - |
|
415 | - /** |
|
416 | - * Performs an INSERT on the database, given a Connection or Criteria object. |
|
417 | - * |
|
418 | - * @param mixed $criteria Criteria or Connection object containing data that is used to create the INSERT statement. |
|
419 | - * @param ConnectionInterface $con the ConnectionInterface connection to use |
|
420 | - * @return mixed The new primary key. |
|
421 | - * @throws PropelException Any exceptions caught during processing will be |
|
422 | - * rethrown wrapped into a PropelException. |
|
423 | - */ |
|
424 | - public static function doInsert($criteria, ConnectionInterface $con = null) |
|
425 | - { |
|
426 | - if (null === $con) { |
|
427 | - $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME); |
|
428 | - } |
|
429 | - |
|
430 | - if ($criteria instanceof Criteria) { |
|
431 | - $criteria = clone $criteria; // rename for clarity |
|
432 | - } else { |
|
433 | - $criteria = $criteria->buildCriteria(); // build Criteria from Connection object |
|
434 | - } |
|
435 | - |
|
436 | - if ($criteria->containsKey(ConnectionTableMap::COL_ID) && $criteria->keyContainsValue(ConnectionTableMap::COL_ID) ) { |
|
437 | - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ConnectionTableMap::COL_ID.')'); |
|
438 | - } |
|
439 | - |
|
440 | - |
|
441 | - // Set the correct dbName |
|
442 | - $query = ConnectionQuery::create()->mergeWith($criteria); |
|
443 | - |
|
444 | - // use transaction because $criteria could contain info |
|
445 | - // for more than one table (I guess, conceivably) |
|
446 | - return $con->transaction(function () use ($con, $query) { |
|
447 | - return $query->doInsert($con); |
|
448 | - }); |
|
449 | - } |
|
250 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
251 | + * |
|
252 | + * @throws PropelException Any exceptions caught during processing will be |
|
253 | + * rethrown wrapped into a PropelException. |
|
254 | + * @return array (Connection object, last column rank) |
|
255 | + */ |
|
256 | + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
257 | + { |
|
258 | + $key = ConnectionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
259 | + if (null !== ($obj = ConnectionTableMap::getInstanceFromPool($key))) { |
|
260 | + // We no longer rehydrate the object, since this can cause data loss. |
|
261 | + // See http://www.propelorm.org/ticket/509 |
|
262 | + // $obj->hydrate($row, $offset, true); // rehydrate |
|
263 | + $col = $offset + ConnectionTableMap::NUM_HYDRATE_COLUMNS; |
|
264 | + } else { |
|
265 | + $cls = ConnectionTableMap::OM_CLASS; |
|
266 | + /** @var Connection $obj */ |
|
267 | + $obj = new $cls(); |
|
268 | + $col = $obj->hydrate($row, $offset, false, $indexType); |
|
269 | + ConnectionTableMap::addInstanceToPool($obj, $key); |
|
270 | + } |
|
271 | + |
|
272 | + return array($obj, $col); |
|
273 | + } |
|
274 | + |
|
275 | + /** |
|
276 | + * The returned array will contain objects of the default type or |
|
277 | + * objects that inherit from the default. |
|
278 | + * |
|
279 | + * @param DataFetcherInterface $dataFetcher |
|
280 | + * @return array |
|
281 | + * @throws PropelException Any exceptions caught during processing will be |
|
282 | + * rethrown wrapped into a PropelException. |
|
283 | + */ |
|
284 | + public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
285 | + { |
|
286 | + $results = array(); |
|
287 | + |
|
288 | + // set the class once to avoid overhead in the loop |
|
289 | + $cls = static::getOMClass(false); |
|
290 | + // populate the object(s) |
|
291 | + while ($row = $dataFetcher->fetch()) { |
|
292 | + $key = ConnectionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
293 | + if (null !== ($obj = ConnectionTableMap::getInstanceFromPool($key))) { |
|
294 | + // We no longer rehydrate the object, since this can cause data loss. |
|
295 | + // See http://www.propelorm.org/ticket/509 |
|
296 | + // $obj->hydrate($row, 0, true); // rehydrate |
|
297 | + $results[] = $obj; |
|
298 | + } else { |
|
299 | + /** @var Connection $obj */ |
|
300 | + $obj = new $cls(); |
|
301 | + $obj->hydrate($row); |
|
302 | + $results[] = $obj; |
|
303 | + ConnectionTableMap::addInstanceToPool($obj, $key); |
|
304 | + } // if key exists |
|
305 | + } |
|
306 | + |
|
307 | + return $results; |
|
308 | + } |
|
309 | + /** |
|
310 | + * Add all the columns needed to create a new object. |
|
311 | + * |
|
312 | + * Note: any columns that were marked with lazyLoad="true" in the |
|
313 | + * XML schema will not be added to the select list and only loaded |
|
314 | + * on demand. |
|
315 | + * |
|
316 | + * @param Criteria $criteria object containing the columns to add. |
|
317 | + * @param string $alias optional table alias |
|
318 | + * @throws PropelException Any exceptions caught during processing will be |
|
319 | + * rethrown wrapped into a PropelException. |
|
320 | + */ |
|
321 | + public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
322 | + { |
|
323 | + if (null === $alias) { |
|
324 | + $criteria->addSelectColumn(ConnectionTableMap::COL_ID); |
|
325 | + $criteria->addSelectColumn(ConnectionTableMap::COL_INSTANCE_NAME); |
|
326 | + $criteria->addSelectColumn(ConnectionTableMap::COL_USER_ID); |
|
327 | + $criteria->addSelectColumn(ConnectionTableMap::COL_PEER); |
|
328 | + $criteria->addSelectColumn(ConnectionTableMap::COL_STARTED); |
|
329 | + $criteria->addSelectColumn(ConnectionTableMap::COL_TYPE); |
|
330 | + } else { |
|
331 | + $criteria->addSelectColumn($alias . '.id'); |
|
332 | + $criteria->addSelectColumn($alias . '.instance_name'); |
|
333 | + $criteria->addSelectColumn($alias . '.user_id'); |
|
334 | + $criteria->addSelectColumn($alias . '.peer'); |
|
335 | + $criteria->addSelectColumn($alias . '.started'); |
|
336 | + $criteria->addSelectColumn($alias . '.type'); |
|
337 | + } |
|
338 | + } |
|
339 | + |
|
340 | + /** |
|
341 | + * Returns the TableMap related to this object. |
|
342 | + * This method is not needed for general use but a specific application could have a need. |
|
343 | + * @return TableMap |
|
344 | + * @throws PropelException Any exceptions caught during processing will be |
|
345 | + * rethrown wrapped into a PropelException. |
|
346 | + */ |
|
347 | + public static function getTableMap() |
|
348 | + { |
|
349 | + return Propel::getServiceContainer()->getDatabaseMap(ConnectionTableMap::DATABASE_NAME)->getTable(ConnectionTableMap::TABLE_NAME); |
|
350 | + } |
|
351 | + |
|
352 | + /** |
|
353 | + * Add a TableMap instance to the database for this tableMap class. |
|
354 | + */ |
|
355 | + public static function buildTableMap() |
|
356 | + { |
|
357 | + $dbMap = Propel::getServiceContainer()->getDatabaseMap(ConnectionTableMap::DATABASE_NAME); |
|
358 | + if (!$dbMap->hasTable(ConnectionTableMap::TABLE_NAME)) { |
|
359 | + $dbMap->addTableObject(new ConnectionTableMap()); |
|
360 | + } |
|
361 | + } |
|
362 | + |
|
363 | + /** |
|
364 | + * Performs a DELETE on the database, given a Connection or Criteria object OR a primary key value. |
|
365 | + * |
|
366 | + * @param mixed $values Criteria or Connection object or primary key or array of primary keys |
|
367 | + * which is used to create the DELETE statement |
|
368 | + * @param ConnectionInterface $con the connection to use |
|
369 | + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
370 | + * if supported by native driver or if emulated using Propel. |
|
371 | + * @throws PropelException Any exceptions caught during processing will be |
|
372 | + * rethrown wrapped into a PropelException. |
|
373 | + */ |
|
374 | + public static function doDelete($values, ConnectionInterface $con = null) |
|
375 | + { |
|
376 | + if (null === $con) { |
|
377 | + $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME); |
|
378 | + } |
|
379 | + |
|
380 | + if ($values instanceof Criteria) { |
|
381 | + // rename for clarity |
|
382 | + $criteria = $values; |
|
383 | + } elseif ($values instanceof \Jalle19\StatusManager\Database\Connection) { // it's a model object |
|
384 | + // create criteria based on pk values |
|
385 | + $criteria = $values->buildPkeyCriteria(); |
|
386 | + } else { // it's a primary key, or an array of pks |
|
387 | + $criteria = new Criteria(ConnectionTableMap::DATABASE_NAME); |
|
388 | + $criteria->add(ConnectionTableMap::COL_ID, (array) $values, Criteria::IN); |
|
389 | + } |
|
390 | + |
|
391 | + $query = ConnectionQuery::create()->mergeWith($criteria); |
|
392 | + |
|
393 | + if ($values instanceof Criteria) { |
|
394 | + ConnectionTableMap::clearInstancePool(); |
|
395 | + } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
396 | + foreach ((array) $values as $singleval) { |
|
397 | + ConnectionTableMap::removeInstanceFromPool($singleval); |
|
398 | + } |
|
399 | + } |
|
400 | + |
|
401 | + return $query->delete($con); |
|
402 | + } |
|
403 | + |
|
404 | + /** |
|
405 | + * Deletes all rows from the connection table. |
|
406 | + * |
|
407 | + * @param ConnectionInterface $con the connection to use |
|
408 | + * @return int The number of affected rows (if supported by underlying database driver). |
|
409 | + */ |
|
410 | + public static function doDeleteAll(ConnectionInterface $con = null) |
|
411 | + { |
|
412 | + return ConnectionQuery::create()->doDeleteAll($con); |
|
413 | + } |
|
414 | + |
|
415 | + /** |
|
416 | + * Performs an INSERT on the database, given a Connection or Criteria object. |
|
417 | + * |
|
418 | + * @param mixed $criteria Criteria or Connection object containing data that is used to create the INSERT statement. |
|
419 | + * @param ConnectionInterface $con the ConnectionInterface connection to use |
|
420 | + * @return mixed The new primary key. |
|
421 | + * @throws PropelException Any exceptions caught during processing will be |
|
422 | + * rethrown wrapped into a PropelException. |
|
423 | + */ |
|
424 | + public static function doInsert($criteria, ConnectionInterface $con = null) |
|
425 | + { |
|
426 | + if (null === $con) { |
|
427 | + $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME); |
|
428 | + } |
|
429 | + |
|
430 | + if ($criteria instanceof Criteria) { |
|
431 | + $criteria = clone $criteria; // rename for clarity |
|
432 | + } else { |
|
433 | + $criteria = $criteria->buildCriteria(); // build Criteria from Connection object |
|
434 | + } |
|
435 | + |
|
436 | + if ($criteria->containsKey(ConnectionTableMap::COL_ID) && $criteria->keyContainsValue(ConnectionTableMap::COL_ID) ) { |
|
437 | + throw new PropelException('Cannot insert a value for auto-increment primary key ('.ConnectionTableMap::COL_ID.')'); |
|
438 | + } |
|
439 | + |
|
440 | + |
|
441 | + // Set the correct dbName |
|
442 | + $query = ConnectionQuery::create()->mergeWith($criteria); |
|
443 | + |
|
444 | + // use transaction because $criteria could contain info |
|
445 | + // for more than one table (I guess, conceivably) |
|
446 | + return $con->transaction(function () use ($con, $query) { |
|
447 | + return $query->doInsert($con); |
|
448 | + }); |
|
449 | + } |
|
450 | 450 | |
451 | 451 | } // ConnectionTableMap |
452 | 452 | // This is the static code needed to register the TableMap for this table with the main Propel class. |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | * first dimension keys are the type constants |
113 | 113 | * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
114 | 114 | */ |
115 | - protected static $fieldNames = array ( |
|
116 | - self::TYPE_PHPNAME => array('Id', 'InstanceName', 'UserId', 'Peer', 'Started', 'Type', ), |
|
117 | - self::TYPE_CAMELNAME => array('id', 'instanceName', 'userId', 'peer', 'started', 'type', ), |
|
118 | - self::TYPE_COLNAME => array(ConnectionTableMap::COL_ID, ConnectionTableMap::COL_INSTANCE_NAME, ConnectionTableMap::COL_USER_ID, ConnectionTableMap::COL_PEER, ConnectionTableMap::COL_STARTED, ConnectionTableMap::COL_TYPE, ), |
|
119 | - self::TYPE_FIELDNAME => array('id', 'instance_name', 'user_id', 'peer', 'started', 'type', ), |
|
120 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) |
|
115 | + protected static $fieldNames = array( |
|
116 | + self::TYPE_PHPNAME => array('Id', 'InstanceName', 'UserId', 'Peer', 'Started', 'Type',), |
|
117 | + self::TYPE_CAMELNAME => array('id', 'instanceName', 'userId', 'peer', 'started', 'type',), |
|
118 | + self::TYPE_COLNAME => array(ConnectionTableMap::COL_ID, ConnectionTableMap::COL_INSTANCE_NAME, ConnectionTableMap::COL_USER_ID, ConnectionTableMap::COL_PEER, ConnectionTableMap::COL_STARTED, ConnectionTableMap::COL_TYPE,), |
|
119 | + self::TYPE_FIELDNAME => array('id', 'instance_name', 'user_id', 'peer', 'started', 'type',), |
|
120 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5,) |
|
121 | 121 | ); |
122 | 122 | |
123 | 123 | /** |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | * first dimension keys are the type constants |
127 | 127 | * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
128 | 128 | */ |
129 | - protected static $fieldKeys = array ( |
|
130 | - self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'UserId' => 2, 'Peer' => 3, 'Started' => 4, 'Type' => 5, ), |
|
131 | - self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'userId' => 2, 'peer' => 3, 'started' => 4, 'type' => 5, ), |
|
132 | - self::TYPE_COLNAME => array(ConnectionTableMap::COL_ID => 0, ConnectionTableMap::COL_INSTANCE_NAME => 1, ConnectionTableMap::COL_USER_ID => 2, ConnectionTableMap::COL_PEER => 3, ConnectionTableMap::COL_STARTED => 4, ConnectionTableMap::COL_TYPE => 5, ), |
|
133 | - self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'user_id' => 2, 'peer' => 3, 'started' => 4, 'type' => 5, ), |
|
134 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) |
|
129 | + protected static $fieldKeys = array( |
|
130 | + self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'UserId' => 2, 'Peer' => 3, 'Started' => 4, 'Type' => 5,), |
|
131 | + self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'userId' => 2, 'peer' => 3, 'started' => 4, 'type' => 5,), |
|
132 | + self::TYPE_COLNAME => array(ConnectionTableMap::COL_ID => 0, ConnectionTableMap::COL_INSTANCE_NAME => 1, ConnectionTableMap::COL_USER_ID => 2, ConnectionTableMap::COL_PEER => 3, ConnectionTableMap::COL_STARTED => 4, ConnectionTableMap::COL_TYPE => 5,), |
|
133 | + self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'user_id' => 2, 'peer' => 3, 'started' => 4, 'type' => 5,), |
|
134 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5,) |
|
135 | 135 | ); |
136 | 136 | |
137 | 137 | /** |
@@ -164,16 +164,16 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function buildRelations() |
166 | 166 | { |
167 | - $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
167 | + $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array( |
|
168 | 168 | 0 => |
169 | - array ( |
|
169 | + array( |
|
170 | 170 | 0 => ':instance_name', |
171 | 171 | 1 => ':name', |
172 | 172 | ), |
173 | 173 | ), null, null, null, false); |
174 | - $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array ( |
|
174 | + $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array( |
|
175 | 175 | 0 => |
176 | - array ( |
|
176 | + array( |
|
177 | 177 | 0 => ':user_id', |
178 | 178 | 1 => ':id', |
179 | 179 | ), |
@@ -433,8 +433,8 @@ discard block |
||
433 | 433 | $criteria = $criteria->buildCriteria(); // build Criteria from Connection object |
434 | 434 | } |
435 | 435 | |
436 | - if ($criteria->containsKey(ConnectionTableMap::COL_ID) && $criteria->keyContainsValue(ConnectionTableMap::COL_ID) ) { |
|
437 | - throw new PropelException('Cannot insert a value for auto-increment primary key ('.ConnectionTableMap::COL_ID.')'); |
|
436 | + if ($criteria->containsKey(ConnectionTableMap::COL_ID) && $criteria->keyContainsValue(ConnectionTableMap::COL_ID)) { |
|
437 | + throw new PropelException('Cannot insert a value for auto-increment primary key (' . ConnectionTableMap::COL_ID . ')'); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | |
444 | 444 | // use transaction because $criteria could contain info |
445 | 445 | // for more than one table (I guess, conceivably) |
446 | - return $con->transaction(function () use ($con, $query) { |
|
446 | + return $con->transaction(function() use ($con, $query) { |
|
447 | 447 | return $query->doInsert($con); |
448 | 448 | }); |
449 | 449 | } |
@@ -28,408 +28,408 @@ |
||
28 | 28 | */ |
29 | 29 | class UserTableMap extends TableMap |
30 | 30 | { |
31 | - use InstancePoolTrait; |
|
32 | - use TableMapTrait; |
|
33 | - |
|
34 | - /** |
|
35 | - * The (dot-path) name of this class |
|
36 | - */ |
|
37 | - const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.UserTableMap'; |
|
38 | - |
|
39 | - /** |
|
40 | - * The default database name for this class |
|
41 | - */ |
|
42 | - const DATABASE_NAME = 'tvheadend_status_manager'; |
|
43 | - |
|
44 | - /** |
|
45 | - * The table name for this class |
|
46 | - */ |
|
47 | - const TABLE_NAME = 'user'; |
|
48 | - |
|
49 | - /** |
|
50 | - * The related Propel class for this table |
|
51 | - */ |
|
52 | - const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\User'; |
|
53 | - |
|
54 | - /** |
|
55 | - * A class that can be returned by this tableMap |
|
56 | - */ |
|
57 | - const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.User'; |
|
58 | - |
|
59 | - /** |
|
60 | - * The total number of columns |
|
61 | - */ |
|
62 | - const NUM_COLUMNS = 3; |
|
63 | - |
|
64 | - /** |
|
65 | - * The number of lazy-loaded columns |
|
66 | - */ |
|
67 | - const NUM_LAZY_LOAD_COLUMNS = 0; |
|
68 | - |
|
69 | - /** |
|
70 | - * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) |
|
71 | - */ |
|
72 | - const NUM_HYDRATE_COLUMNS = 3; |
|
73 | - |
|
74 | - /** |
|
75 | - * the column name for the id field |
|
76 | - */ |
|
77 | - const COL_ID = 'user.id'; |
|
78 | - |
|
79 | - /** |
|
80 | - * the column name for the instance_name field |
|
81 | - */ |
|
82 | - const COL_INSTANCE_NAME = 'user.instance_name'; |
|
83 | - |
|
84 | - /** |
|
85 | - * the column name for the name field |
|
86 | - */ |
|
87 | - const COL_NAME = 'user.name'; |
|
88 | - |
|
89 | - /** |
|
90 | - * The default string format for model objects of the related table |
|
91 | - */ |
|
92 | - const DEFAULT_STRING_FORMAT = 'YAML'; |
|
93 | - |
|
94 | - /** |
|
95 | - * holds an array of fieldnames |
|
96 | - * |
|
97 | - * first dimension keys are the type constants |
|
98 | - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
99 | - */ |
|
100 | - protected static $fieldNames = array ( |
|
101 | - self::TYPE_PHPNAME => array('Id', 'InstanceName', 'Name', ), |
|
102 | - self::TYPE_CAMELNAME => array('id', 'instanceName', 'name', ), |
|
103 | - self::TYPE_COLNAME => array(UserTableMap::COL_ID, UserTableMap::COL_INSTANCE_NAME, UserTableMap::COL_NAME, ), |
|
104 | - self::TYPE_FIELDNAME => array('id', 'instance_name', 'name', ), |
|
105 | - self::TYPE_NUM => array(0, 1, 2, ) |
|
106 | - ); |
|
107 | - |
|
108 | - /** |
|
109 | - * holds an array of keys for quick access to the fieldnames array |
|
110 | - * |
|
111 | - * first dimension keys are the type constants |
|
112 | - * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
113 | - */ |
|
114 | - protected static $fieldKeys = array ( |
|
115 | - self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2, ), |
|
116 | - self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'name' => 2, ), |
|
117 | - self::TYPE_COLNAME => array(UserTableMap::COL_ID => 0, UserTableMap::COL_INSTANCE_NAME => 1, UserTableMap::COL_NAME => 2, ), |
|
118 | - self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'name' => 2, ), |
|
119 | - self::TYPE_NUM => array(0, 1, 2, ) |
|
120 | - ); |
|
121 | - |
|
122 | - /** |
|
123 | - * Initialize the table attributes and columns |
|
124 | - * Relations are not initialized by this method since they are lazy loaded |
|
125 | - * |
|
126 | - * @return void |
|
127 | - * @throws PropelException |
|
128 | - */ |
|
129 | - public function initialize() |
|
130 | - { |
|
131 | - // attributes |
|
132 | - $this->setName('user'); |
|
133 | - $this->setPhpName('User'); |
|
134 | - $this->setIdentifierQuoting(false); |
|
135 | - $this->setClassName('\\Jalle19\\StatusManager\\Database\\User'); |
|
136 | - $this->setPackage('Jalle19.StatusManager.Database'); |
|
137 | - $this->setUseIdGenerator(true); |
|
138 | - // columns |
|
139 | - $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); |
|
140 | - $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null); |
|
141 | - $this->addColumn('name', 'Name', 'VARCHAR', true, 255, null); |
|
142 | - } // initialize() |
|
143 | - |
|
144 | - /** |
|
145 | - * Build the RelationMap objects for this table relationships |
|
146 | - */ |
|
147 | - public function buildRelations() |
|
148 | - { |
|
149 | - $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
31 | + use InstancePoolTrait; |
|
32 | + use TableMapTrait; |
|
33 | + |
|
34 | + /** |
|
35 | + * The (dot-path) name of this class |
|
36 | + */ |
|
37 | + const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.UserTableMap'; |
|
38 | + |
|
39 | + /** |
|
40 | + * The default database name for this class |
|
41 | + */ |
|
42 | + const DATABASE_NAME = 'tvheadend_status_manager'; |
|
43 | + |
|
44 | + /** |
|
45 | + * The table name for this class |
|
46 | + */ |
|
47 | + const TABLE_NAME = 'user'; |
|
48 | + |
|
49 | + /** |
|
50 | + * The related Propel class for this table |
|
51 | + */ |
|
52 | + const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\User'; |
|
53 | + |
|
54 | + /** |
|
55 | + * A class that can be returned by this tableMap |
|
56 | + */ |
|
57 | + const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.User'; |
|
58 | + |
|
59 | + /** |
|
60 | + * The total number of columns |
|
61 | + */ |
|
62 | + const NUM_COLUMNS = 3; |
|
63 | + |
|
64 | + /** |
|
65 | + * The number of lazy-loaded columns |
|
66 | + */ |
|
67 | + const NUM_LAZY_LOAD_COLUMNS = 0; |
|
68 | + |
|
69 | + /** |
|
70 | + * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) |
|
71 | + */ |
|
72 | + const NUM_HYDRATE_COLUMNS = 3; |
|
73 | + |
|
74 | + /** |
|
75 | + * the column name for the id field |
|
76 | + */ |
|
77 | + const COL_ID = 'user.id'; |
|
78 | + |
|
79 | + /** |
|
80 | + * the column name for the instance_name field |
|
81 | + */ |
|
82 | + const COL_INSTANCE_NAME = 'user.instance_name'; |
|
83 | + |
|
84 | + /** |
|
85 | + * the column name for the name field |
|
86 | + */ |
|
87 | + const COL_NAME = 'user.name'; |
|
88 | + |
|
89 | + /** |
|
90 | + * The default string format for model objects of the related table |
|
91 | + */ |
|
92 | + const DEFAULT_STRING_FORMAT = 'YAML'; |
|
93 | + |
|
94 | + /** |
|
95 | + * holds an array of fieldnames |
|
96 | + * |
|
97 | + * first dimension keys are the type constants |
|
98 | + * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
99 | + */ |
|
100 | + protected static $fieldNames = array ( |
|
101 | + self::TYPE_PHPNAME => array('Id', 'InstanceName', 'Name', ), |
|
102 | + self::TYPE_CAMELNAME => array('id', 'instanceName', 'name', ), |
|
103 | + self::TYPE_COLNAME => array(UserTableMap::COL_ID, UserTableMap::COL_INSTANCE_NAME, UserTableMap::COL_NAME, ), |
|
104 | + self::TYPE_FIELDNAME => array('id', 'instance_name', 'name', ), |
|
105 | + self::TYPE_NUM => array(0, 1, 2, ) |
|
106 | + ); |
|
107 | + |
|
108 | + /** |
|
109 | + * holds an array of keys for quick access to the fieldnames array |
|
110 | + * |
|
111 | + * first dimension keys are the type constants |
|
112 | + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
113 | + */ |
|
114 | + protected static $fieldKeys = array ( |
|
115 | + self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2, ), |
|
116 | + self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'name' => 2, ), |
|
117 | + self::TYPE_COLNAME => array(UserTableMap::COL_ID => 0, UserTableMap::COL_INSTANCE_NAME => 1, UserTableMap::COL_NAME => 2, ), |
|
118 | + self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'name' => 2, ), |
|
119 | + self::TYPE_NUM => array(0, 1, 2, ) |
|
120 | + ); |
|
121 | + |
|
122 | + /** |
|
123 | + * Initialize the table attributes and columns |
|
124 | + * Relations are not initialized by this method since they are lazy loaded |
|
125 | + * |
|
126 | + * @return void |
|
127 | + * @throws PropelException |
|
128 | + */ |
|
129 | + public function initialize() |
|
130 | + { |
|
131 | + // attributes |
|
132 | + $this->setName('user'); |
|
133 | + $this->setPhpName('User'); |
|
134 | + $this->setIdentifierQuoting(false); |
|
135 | + $this->setClassName('\\Jalle19\\StatusManager\\Database\\User'); |
|
136 | + $this->setPackage('Jalle19.StatusManager.Database'); |
|
137 | + $this->setUseIdGenerator(true); |
|
138 | + // columns |
|
139 | + $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); |
|
140 | + $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null); |
|
141 | + $this->addColumn('name', 'Name', 'VARCHAR', true, 255, null); |
|
142 | + } // initialize() |
|
143 | + |
|
144 | + /** |
|
145 | + * Build the RelationMap objects for this table relationships |
|
146 | + */ |
|
147 | + public function buildRelations() |
|
148 | + { |
|
149 | + $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
150 | 150 | 0 => |
151 | 151 | array ( |
152 | - 0 => ':instance_name', |
|
153 | - 1 => ':name', |
|
152 | + 0 => ':instance_name', |
|
153 | + 1 => ':name', |
|
154 | 154 | ), |
155 | 155 | ), null, null, null, false); |
156 | - $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array ( |
|
156 | + $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array ( |
|
157 | 157 | 0 => |
158 | 158 | array ( |
159 | - 0 => ':user_id', |
|
160 | - 1 => ':id', |
|
159 | + 0 => ':user_id', |
|
160 | + 1 => ':id', |
|
161 | 161 | ), |
162 | 162 | ), null, null, 'Connections', false); |
163 | - $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array ( |
|
163 | + $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array ( |
|
164 | 164 | 0 => |
165 | 165 | array ( |
166 | - 0 => ':user_id', |
|
167 | - 1 => ':id', |
|
166 | + 0 => ':user_id', |
|
167 | + 1 => ':id', |
|
168 | 168 | ), |
169 | 169 | ), null, null, 'Subscriptions', false); |
170 | - } // buildRelations() |
|
171 | - |
|
172 | - /** |
|
173 | - * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. |
|
174 | - * |
|
175 | - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
176 | - * a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
177 | - * |
|
178 | - * @param array $row resultset row. |
|
179 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
180 | - * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
181 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
182 | - * |
|
183 | - * @return string The primary key hash of the row |
|
184 | - */ |
|
185 | - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
186 | - { |
|
187 | - // If the PK cannot be derived from the row, return NULL. |
|
188 | - if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
189 | - return null; |
|
190 | - } |
|
191 | - |
|
192 | - return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * Retrieves the primary key from the DB resultset row |
|
197 | - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
198 | - * a multi-column primary key, an array of the primary key columns will be returned. |
|
199 | - * |
|
200 | - * @param array $row resultset row. |
|
201 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
202 | - * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
203 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
204 | - * |
|
205 | - * @return mixed The primary key of the row |
|
206 | - */ |
|
207 | - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
208 | - { |
|
209 | - return (int) $row[ |
|
210 | - $indexType == TableMap::TYPE_NUM |
|
211 | - ? 0 + $offset |
|
212 | - : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) |
|
213 | - ]; |
|
214 | - } |
|
215 | - |
|
216 | - /** |
|
217 | - * The class that the tableMap will make instances of. |
|
218 | - * |
|
219 | - * If $withPrefix is true, the returned path |
|
220 | - * uses a dot-path notation which is translated into a path |
|
221 | - * relative to a location on the PHP include_path. |
|
222 | - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
223 | - * |
|
224 | - * @param boolean $withPrefix Whether or not to return the path with the class name |
|
225 | - * @return string path.to.ClassName |
|
226 | - */ |
|
227 | - public static function getOMClass($withPrefix = true) |
|
228 | - { |
|
229 | - return $withPrefix ? UserTableMap::CLASS_DEFAULT : UserTableMap::OM_CLASS; |
|
230 | - } |
|
231 | - |
|
232 | - /** |
|
233 | - * Populates an object of the default type or an object that inherit from the default. |
|
234 | - * |
|
235 | - * @param array $row row returned by DataFetcher->fetch(). |
|
236 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
237 | - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
170 | + } // buildRelations() |
|
171 | + |
|
172 | + /** |
|
173 | + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. |
|
174 | + * |
|
175 | + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
176 | + * a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
177 | + * |
|
178 | + * @param array $row resultset row. |
|
179 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
180 | + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
181 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
182 | + * |
|
183 | + * @return string The primary key hash of the row |
|
184 | + */ |
|
185 | + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
186 | + { |
|
187 | + // If the PK cannot be derived from the row, return NULL. |
|
188 | + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
189 | + return null; |
|
190 | + } |
|
191 | + |
|
192 | + return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * Retrieves the primary key from the DB resultset row |
|
197 | + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
198 | + * a multi-column primary key, an array of the primary key columns will be returned. |
|
199 | + * |
|
200 | + * @param array $row resultset row. |
|
201 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
202 | + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
203 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
204 | + * |
|
205 | + * @return mixed The primary key of the row |
|
206 | + */ |
|
207 | + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
208 | + { |
|
209 | + return (int) $row[ |
|
210 | + $indexType == TableMap::TYPE_NUM |
|
211 | + ? 0 + $offset |
|
212 | + : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) |
|
213 | + ]; |
|
214 | + } |
|
215 | + |
|
216 | + /** |
|
217 | + * The class that the tableMap will make instances of. |
|
218 | + * |
|
219 | + * If $withPrefix is true, the returned path |
|
220 | + * uses a dot-path notation which is translated into a path |
|
221 | + * relative to a location on the PHP include_path. |
|
222 | + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
223 | + * |
|
224 | + * @param boolean $withPrefix Whether or not to return the path with the class name |
|
225 | + * @return string path.to.ClassName |
|
226 | + */ |
|
227 | + public static function getOMClass($withPrefix = true) |
|
228 | + { |
|
229 | + return $withPrefix ? UserTableMap::CLASS_DEFAULT : UserTableMap::OM_CLASS; |
|
230 | + } |
|
231 | + |
|
232 | + /** |
|
233 | + * Populates an object of the default type or an object that inherit from the default. |
|
234 | + * |
|
235 | + * @param array $row row returned by DataFetcher->fetch(). |
|
236 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
237 | + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
238 | 238 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
239 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
240 | - * |
|
241 | - * @throws PropelException Any exceptions caught during processing will be |
|
242 | - * rethrown wrapped into a PropelException. |
|
243 | - * @return array (User object, last column rank) |
|
244 | - */ |
|
245 | - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
246 | - { |
|
247 | - $key = UserTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
248 | - if (null !== ($obj = UserTableMap::getInstanceFromPool($key))) { |
|
249 | - // We no longer rehydrate the object, since this can cause data loss. |
|
250 | - // See http://www.propelorm.org/ticket/509 |
|
251 | - // $obj->hydrate($row, $offset, true); // rehydrate |
|
252 | - $col = $offset + UserTableMap::NUM_HYDRATE_COLUMNS; |
|
253 | - } else { |
|
254 | - $cls = UserTableMap::OM_CLASS; |
|
255 | - /** @var User $obj */ |
|
256 | - $obj = new $cls(); |
|
257 | - $col = $obj->hydrate($row, $offset, false, $indexType); |
|
258 | - UserTableMap::addInstanceToPool($obj, $key); |
|
259 | - } |
|
260 | - |
|
261 | - return array($obj, $col); |
|
262 | - } |
|
263 | - |
|
264 | - /** |
|
265 | - * The returned array will contain objects of the default type or |
|
266 | - * objects that inherit from the default. |
|
267 | - * |
|
268 | - * @param DataFetcherInterface $dataFetcher |
|
269 | - * @return array |
|
270 | - * @throws PropelException Any exceptions caught during processing will be |
|
271 | - * rethrown wrapped into a PropelException. |
|
272 | - */ |
|
273 | - public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
274 | - { |
|
275 | - $results = array(); |
|
276 | - |
|
277 | - // set the class once to avoid overhead in the loop |
|
278 | - $cls = static::getOMClass(false); |
|
279 | - // populate the object(s) |
|
280 | - while ($row = $dataFetcher->fetch()) { |
|
281 | - $key = UserTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
282 | - if (null !== ($obj = UserTableMap::getInstanceFromPool($key))) { |
|
283 | - // We no longer rehydrate the object, since this can cause data loss. |
|
284 | - // See http://www.propelorm.org/ticket/509 |
|
285 | - // $obj->hydrate($row, 0, true); // rehydrate |
|
286 | - $results[] = $obj; |
|
287 | - } else { |
|
288 | - /** @var User $obj */ |
|
289 | - $obj = new $cls(); |
|
290 | - $obj->hydrate($row); |
|
291 | - $results[] = $obj; |
|
292 | - UserTableMap::addInstanceToPool($obj, $key); |
|
293 | - } // if key exists |
|
294 | - } |
|
295 | - |
|
296 | - return $results; |
|
297 | - } |
|
298 | - /** |
|
299 | - * Add all the columns needed to create a new object. |
|
300 | - * |
|
301 | - * Note: any columns that were marked with lazyLoad="true" in the |
|
302 | - * XML schema will not be added to the select list and only loaded |
|
303 | - * on demand. |
|
304 | - * |
|
305 | - * @param Criteria $criteria object containing the columns to add. |
|
306 | - * @param string $alias optional table alias |
|
307 | - * @throws PropelException Any exceptions caught during processing will be |
|
308 | - * rethrown wrapped into a PropelException. |
|
309 | - */ |
|
310 | - public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
311 | - { |
|
312 | - if (null === $alias) { |
|
313 | - $criteria->addSelectColumn(UserTableMap::COL_ID); |
|
314 | - $criteria->addSelectColumn(UserTableMap::COL_INSTANCE_NAME); |
|
315 | - $criteria->addSelectColumn(UserTableMap::COL_NAME); |
|
316 | - } else { |
|
317 | - $criteria->addSelectColumn($alias . '.id'); |
|
318 | - $criteria->addSelectColumn($alias . '.instance_name'); |
|
319 | - $criteria->addSelectColumn($alias . '.name'); |
|
320 | - } |
|
321 | - } |
|
322 | - |
|
323 | - /** |
|
324 | - * Returns the TableMap related to this object. |
|
325 | - * This method is not needed for general use but a specific application could have a need. |
|
326 | - * @return TableMap |
|
327 | - * @throws PropelException Any exceptions caught during processing will be |
|
328 | - * rethrown wrapped into a PropelException. |
|
329 | - */ |
|
330 | - public static function getTableMap() |
|
331 | - { |
|
332 | - return Propel::getServiceContainer()->getDatabaseMap(UserTableMap::DATABASE_NAME)->getTable(UserTableMap::TABLE_NAME); |
|
333 | - } |
|
334 | - |
|
335 | - /** |
|
336 | - * Add a TableMap instance to the database for this tableMap class. |
|
337 | - */ |
|
338 | - public static function buildTableMap() |
|
339 | - { |
|
340 | - $dbMap = Propel::getServiceContainer()->getDatabaseMap(UserTableMap::DATABASE_NAME); |
|
341 | - if (!$dbMap->hasTable(UserTableMap::TABLE_NAME)) { |
|
342 | - $dbMap->addTableObject(new UserTableMap()); |
|
343 | - } |
|
344 | - } |
|
345 | - |
|
346 | - /** |
|
347 | - * Performs a DELETE on the database, given a User or Criteria object OR a primary key value. |
|
348 | - * |
|
349 | - * @param mixed $values Criteria or User object or primary key or array of primary keys |
|
350 | - * which is used to create the DELETE statement |
|
351 | - * @param ConnectionInterface $con the connection to use |
|
352 | - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
353 | - * if supported by native driver or if emulated using Propel. |
|
354 | - * @throws PropelException Any exceptions caught during processing will be |
|
355 | - * rethrown wrapped into a PropelException. |
|
356 | - */ |
|
357 | - public static function doDelete($values, ConnectionInterface $con = null) |
|
358 | - { |
|
359 | - if (null === $con) { |
|
360 | - $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
|
361 | - } |
|
362 | - |
|
363 | - if ($values instanceof Criteria) { |
|
364 | - // rename for clarity |
|
365 | - $criteria = $values; |
|
366 | - } elseif ($values instanceof \Jalle19\StatusManager\Database\User) { // it's a model object |
|
367 | - // create criteria based on pk values |
|
368 | - $criteria = $values->buildPkeyCriteria(); |
|
369 | - } else { // it's a primary key, or an array of pks |
|
370 | - $criteria = new Criteria(UserTableMap::DATABASE_NAME); |
|
371 | - $criteria->add(UserTableMap::COL_ID, (array) $values, Criteria::IN); |
|
372 | - } |
|
373 | - |
|
374 | - $query = UserQuery::create()->mergeWith($criteria); |
|
375 | - |
|
376 | - if ($values instanceof Criteria) { |
|
377 | - UserTableMap::clearInstancePool(); |
|
378 | - } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
379 | - foreach ((array) $values as $singleval) { |
|
380 | - UserTableMap::removeInstanceFromPool($singleval); |
|
381 | - } |
|
382 | - } |
|
383 | - |
|
384 | - return $query->delete($con); |
|
385 | - } |
|
386 | - |
|
387 | - /** |
|
388 | - * Deletes all rows from the user table. |
|
389 | - * |
|
390 | - * @param ConnectionInterface $con the connection to use |
|
391 | - * @return int The number of affected rows (if supported by underlying database driver). |
|
392 | - */ |
|
393 | - public static function doDeleteAll(ConnectionInterface $con = null) |
|
394 | - { |
|
395 | - return UserQuery::create()->doDeleteAll($con); |
|
396 | - } |
|
397 | - |
|
398 | - /** |
|
399 | - * Performs an INSERT on the database, given a User or Criteria object. |
|
400 | - * |
|
401 | - * @param mixed $criteria Criteria or User object containing data that is used to create the INSERT statement. |
|
402 | - * @param ConnectionInterface $con the ConnectionInterface connection to use |
|
403 | - * @return mixed The new primary key. |
|
404 | - * @throws PropelException Any exceptions caught during processing will be |
|
405 | - * rethrown wrapped into a PropelException. |
|
406 | - */ |
|
407 | - public static function doInsert($criteria, ConnectionInterface $con = null) |
|
408 | - { |
|
409 | - if (null === $con) { |
|
410 | - $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
|
411 | - } |
|
412 | - |
|
413 | - if ($criteria instanceof Criteria) { |
|
414 | - $criteria = clone $criteria; // rename for clarity |
|
415 | - } else { |
|
416 | - $criteria = $criteria->buildCriteria(); // build Criteria from User object |
|
417 | - } |
|
418 | - |
|
419 | - if ($criteria->containsKey(UserTableMap::COL_ID) && $criteria->keyContainsValue(UserTableMap::COL_ID) ) { |
|
420 | - throw new PropelException('Cannot insert a value for auto-increment primary key ('.UserTableMap::COL_ID.')'); |
|
421 | - } |
|
422 | - |
|
423 | - |
|
424 | - // Set the correct dbName |
|
425 | - $query = UserQuery::create()->mergeWith($criteria); |
|
426 | - |
|
427 | - // use transaction because $criteria could contain info |
|
428 | - // for more than one table (I guess, conceivably) |
|
429 | - return $con->transaction(function () use ($con, $query) { |
|
430 | - return $query->doInsert($con); |
|
431 | - }); |
|
432 | - } |
|
239 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
240 | + * |
|
241 | + * @throws PropelException Any exceptions caught during processing will be |
|
242 | + * rethrown wrapped into a PropelException. |
|
243 | + * @return array (User object, last column rank) |
|
244 | + */ |
|
245 | + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
246 | + { |
|
247 | + $key = UserTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
248 | + if (null !== ($obj = UserTableMap::getInstanceFromPool($key))) { |
|
249 | + // We no longer rehydrate the object, since this can cause data loss. |
|
250 | + // See http://www.propelorm.org/ticket/509 |
|
251 | + // $obj->hydrate($row, $offset, true); // rehydrate |
|
252 | + $col = $offset + UserTableMap::NUM_HYDRATE_COLUMNS; |
|
253 | + } else { |
|
254 | + $cls = UserTableMap::OM_CLASS; |
|
255 | + /** @var User $obj */ |
|
256 | + $obj = new $cls(); |
|
257 | + $col = $obj->hydrate($row, $offset, false, $indexType); |
|
258 | + UserTableMap::addInstanceToPool($obj, $key); |
|
259 | + } |
|
260 | + |
|
261 | + return array($obj, $col); |
|
262 | + } |
|
263 | + |
|
264 | + /** |
|
265 | + * The returned array will contain objects of the default type or |
|
266 | + * objects that inherit from the default. |
|
267 | + * |
|
268 | + * @param DataFetcherInterface $dataFetcher |
|
269 | + * @return array |
|
270 | + * @throws PropelException Any exceptions caught during processing will be |
|
271 | + * rethrown wrapped into a PropelException. |
|
272 | + */ |
|
273 | + public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
274 | + { |
|
275 | + $results = array(); |
|
276 | + |
|
277 | + // set the class once to avoid overhead in the loop |
|
278 | + $cls = static::getOMClass(false); |
|
279 | + // populate the object(s) |
|
280 | + while ($row = $dataFetcher->fetch()) { |
|
281 | + $key = UserTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
282 | + if (null !== ($obj = UserTableMap::getInstanceFromPool($key))) { |
|
283 | + // We no longer rehydrate the object, since this can cause data loss. |
|
284 | + // See http://www.propelorm.org/ticket/509 |
|
285 | + // $obj->hydrate($row, 0, true); // rehydrate |
|
286 | + $results[] = $obj; |
|
287 | + } else { |
|
288 | + /** @var User $obj */ |
|
289 | + $obj = new $cls(); |
|
290 | + $obj->hydrate($row); |
|
291 | + $results[] = $obj; |
|
292 | + UserTableMap::addInstanceToPool($obj, $key); |
|
293 | + } // if key exists |
|
294 | + } |
|
295 | + |
|
296 | + return $results; |
|
297 | + } |
|
298 | + /** |
|
299 | + * Add all the columns needed to create a new object. |
|
300 | + * |
|
301 | + * Note: any columns that were marked with lazyLoad="true" in the |
|
302 | + * XML schema will not be added to the select list and only loaded |
|
303 | + * on demand. |
|
304 | + * |
|
305 | + * @param Criteria $criteria object containing the columns to add. |
|
306 | + * @param string $alias optional table alias |
|
307 | + * @throws PropelException Any exceptions caught during processing will be |
|
308 | + * rethrown wrapped into a PropelException. |
|
309 | + */ |
|
310 | + public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
311 | + { |
|
312 | + if (null === $alias) { |
|
313 | + $criteria->addSelectColumn(UserTableMap::COL_ID); |
|
314 | + $criteria->addSelectColumn(UserTableMap::COL_INSTANCE_NAME); |
|
315 | + $criteria->addSelectColumn(UserTableMap::COL_NAME); |
|
316 | + } else { |
|
317 | + $criteria->addSelectColumn($alias . '.id'); |
|
318 | + $criteria->addSelectColumn($alias . '.instance_name'); |
|
319 | + $criteria->addSelectColumn($alias . '.name'); |
|
320 | + } |
|
321 | + } |
|
322 | + |
|
323 | + /** |
|
324 | + * Returns the TableMap related to this object. |
|
325 | + * This method is not needed for general use but a specific application could have a need. |
|
326 | + * @return TableMap |
|
327 | + * @throws PropelException Any exceptions caught during processing will be |
|
328 | + * rethrown wrapped into a PropelException. |
|
329 | + */ |
|
330 | + public static function getTableMap() |
|
331 | + { |
|
332 | + return Propel::getServiceContainer()->getDatabaseMap(UserTableMap::DATABASE_NAME)->getTable(UserTableMap::TABLE_NAME); |
|
333 | + } |
|
334 | + |
|
335 | + /** |
|
336 | + * Add a TableMap instance to the database for this tableMap class. |
|
337 | + */ |
|
338 | + public static function buildTableMap() |
|
339 | + { |
|
340 | + $dbMap = Propel::getServiceContainer()->getDatabaseMap(UserTableMap::DATABASE_NAME); |
|
341 | + if (!$dbMap->hasTable(UserTableMap::TABLE_NAME)) { |
|
342 | + $dbMap->addTableObject(new UserTableMap()); |
|
343 | + } |
|
344 | + } |
|
345 | + |
|
346 | + /** |
|
347 | + * Performs a DELETE on the database, given a User or Criteria object OR a primary key value. |
|
348 | + * |
|
349 | + * @param mixed $values Criteria or User object or primary key or array of primary keys |
|
350 | + * which is used to create the DELETE statement |
|
351 | + * @param ConnectionInterface $con the connection to use |
|
352 | + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
353 | + * if supported by native driver or if emulated using Propel. |
|
354 | + * @throws PropelException Any exceptions caught during processing will be |
|
355 | + * rethrown wrapped into a PropelException. |
|
356 | + */ |
|
357 | + public static function doDelete($values, ConnectionInterface $con = null) |
|
358 | + { |
|
359 | + if (null === $con) { |
|
360 | + $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
|
361 | + } |
|
362 | + |
|
363 | + if ($values instanceof Criteria) { |
|
364 | + // rename for clarity |
|
365 | + $criteria = $values; |
|
366 | + } elseif ($values instanceof \Jalle19\StatusManager\Database\User) { // it's a model object |
|
367 | + // create criteria based on pk values |
|
368 | + $criteria = $values->buildPkeyCriteria(); |
|
369 | + } else { // it's a primary key, or an array of pks |
|
370 | + $criteria = new Criteria(UserTableMap::DATABASE_NAME); |
|
371 | + $criteria->add(UserTableMap::COL_ID, (array) $values, Criteria::IN); |
|
372 | + } |
|
373 | + |
|
374 | + $query = UserQuery::create()->mergeWith($criteria); |
|
375 | + |
|
376 | + if ($values instanceof Criteria) { |
|
377 | + UserTableMap::clearInstancePool(); |
|
378 | + } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
379 | + foreach ((array) $values as $singleval) { |
|
380 | + UserTableMap::removeInstanceFromPool($singleval); |
|
381 | + } |
|
382 | + } |
|
383 | + |
|
384 | + return $query->delete($con); |
|
385 | + } |
|
386 | + |
|
387 | + /** |
|
388 | + * Deletes all rows from the user table. |
|
389 | + * |
|
390 | + * @param ConnectionInterface $con the connection to use |
|
391 | + * @return int The number of affected rows (if supported by underlying database driver). |
|
392 | + */ |
|
393 | + public static function doDeleteAll(ConnectionInterface $con = null) |
|
394 | + { |
|
395 | + return UserQuery::create()->doDeleteAll($con); |
|
396 | + } |
|
397 | + |
|
398 | + /** |
|
399 | + * Performs an INSERT on the database, given a User or Criteria object. |
|
400 | + * |
|
401 | + * @param mixed $criteria Criteria or User object containing data that is used to create the INSERT statement. |
|
402 | + * @param ConnectionInterface $con the ConnectionInterface connection to use |
|
403 | + * @return mixed The new primary key. |
|
404 | + * @throws PropelException Any exceptions caught during processing will be |
|
405 | + * rethrown wrapped into a PropelException. |
|
406 | + */ |
|
407 | + public static function doInsert($criteria, ConnectionInterface $con = null) |
|
408 | + { |
|
409 | + if (null === $con) { |
|
410 | + $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME); |
|
411 | + } |
|
412 | + |
|
413 | + if ($criteria instanceof Criteria) { |
|
414 | + $criteria = clone $criteria; // rename for clarity |
|
415 | + } else { |
|
416 | + $criteria = $criteria->buildCriteria(); // build Criteria from User object |
|
417 | + } |
|
418 | + |
|
419 | + if ($criteria->containsKey(UserTableMap::COL_ID) && $criteria->keyContainsValue(UserTableMap::COL_ID) ) { |
|
420 | + throw new PropelException('Cannot insert a value for auto-increment primary key ('.UserTableMap::COL_ID.')'); |
|
421 | + } |
|
422 | + |
|
423 | + |
|
424 | + // Set the correct dbName |
|
425 | + $query = UserQuery::create()->mergeWith($criteria); |
|
426 | + |
|
427 | + // use transaction because $criteria could contain info |
|
428 | + // for more than one table (I guess, conceivably) |
|
429 | + return $con->transaction(function () use ($con, $query) { |
|
430 | + return $query->doInsert($con); |
|
431 | + }); |
|
432 | + } |
|
433 | 433 | |
434 | 434 | } // UserTableMap |
435 | 435 | // This is the static code needed to register the TableMap for this table with the main Propel class. |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | * first dimension keys are the type constants |
98 | 98 | * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
99 | 99 | */ |
100 | - protected static $fieldNames = array ( |
|
101 | - self::TYPE_PHPNAME => array('Id', 'InstanceName', 'Name', ), |
|
102 | - self::TYPE_CAMELNAME => array('id', 'instanceName', 'name', ), |
|
103 | - self::TYPE_COLNAME => array(UserTableMap::COL_ID, UserTableMap::COL_INSTANCE_NAME, UserTableMap::COL_NAME, ), |
|
104 | - self::TYPE_FIELDNAME => array('id', 'instance_name', 'name', ), |
|
105 | - self::TYPE_NUM => array(0, 1, 2, ) |
|
100 | + protected static $fieldNames = array( |
|
101 | + self::TYPE_PHPNAME => array('Id', 'InstanceName', 'Name',), |
|
102 | + self::TYPE_CAMELNAME => array('id', 'instanceName', 'name',), |
|
103 | + self::TYPE_COLNAME => array(UserTableMap::COL_ID, UserTableMap::COL_INSTANCE_NAME, UserTableMap::COL_NAME,), |
|
104 | + self::TYPE_FIELDNAME => array('id', 'instance_name', 'name',), |
|
105 | + self::TYPE_NUM => array(0, 1, 2,) |
|
106 | 106 | ); |
107 | 107 | |
108 | 108 | /** |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | * first dimension keys are the type constants |
112 | 112 | * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
113 | 113 | */ |
114 | - protected static $fieldKeys = array ( |
|
115 | - self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2, ), |
|
116 | - self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'name' => 2, ), |
|
117 | - self::TYPE_COLNAME => array(UserTableMap::COL_ID => 0, UserTableMap::COL_INSTANCE_NAME => 1, UserTableMap::COL_NAME => 2, ), |
|
118 | - self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'name' => 2, ), |
|
119 | - self::TYPE_NUM => array(0, 1, 2, ) |
|
114 | + protected static $fieldKeys = array( |
|
115 | + self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2,), |
|
116 | + self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'name' => 2,), |
|
117 | + self::TYPE_COLNAME => array(UserTableMap::COL_ID => 0, UserTableMap::COL_INSTANCE_NAME => 1, UserTableMap::COL_NAME => 2,), |
|
118 | + self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'name' => 2,), |
|
119 | + self::TYPE_NUM => array(0, 1, 2,) |
|
120 | 120 | ); |
121 | 121 | |
122 | 122 | /** |
@@ -146,23 +146,23 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function buildRelations() |
148 | 148 | { |
149 | - $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
149 | + $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array( |
|
150 | 150 | 0 => |
151 | - array ( |
|
151 | + array( |
|
152 | 152 | 0 => ':instance_name', |
153 | 153 | 1 => ':name', |
154 | 154 | ), |
155 | 155 | ), null, null, null, false); |
156 | - $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array ( |
|
156 | + $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array( |
|
157 | 157 | 0 => |
158 | - array ( |
|
158 | + array( |
|
159 | 159 | 0 => ':user_id', |
160 | 160 | 1 => ':id', |
161 | 161 | ), |
162 | 162 | ), null, null, 'Connections', false); |
163 | - $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array ( |
|
163 | + $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array( |
|
164 | 164 | 0 => |
165 | - array ( |
|
165 | + array( |
|
166 | 166 | 0 => ':user_id', |
167 | 167 | 1 => ':id', |
168 | 168 | ), |
@@ -416,8 +416,8 @@ discard block |
||
416 | 416 | $criteria = $criteria->buildCriteria(); // build Criteria from User object |
417 | 417 | } |
418 | 418 | |
419 | - if ($criteria->containsKey(UserTableMap::COL_ID) && $criteria->keyContainsValue(UserTableMap::COL_ID) ) { |
|
420 | - throw new PropelException('Cannot insert a value for auto-increment primary key ('.UserTableMap::COL_ID.')'); |
|
419 | + if ($criteria->containsKey(UserTableMap::COL_ID) && $criteria->keyContainsValue(UserTableMap::COL_ID)) { |
|
420 | + throw new PropelException('Cannot insert a value for auto-increment primary key (' . UserTableMap::COL_ID . ')'); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | |
427 | 427 | // use transaction because $criteria could contain info |
428 | 428 | // for more than one table (I guess, conceivably) |
429 | - return $con->transaction(function () use ($con, $query) { |
|
429 | + return $con->transaction(function() use ($con, $query) { |
|
430 | 430 | return $query->doInsert($con); |
431 | 431 | }); |
432 | 432 | } |
@@ -50,8 +50,9 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function onInstanceSeen(Tvheadend $instance) |
52 | 52 | { |
53 | - if ($this->hasInstance($instance)) |
|
54 | - return; |
|
53 | + if ($this->hasInstance($instance)) { |
|
54 | + return; |
|
55 | + } |
|
55 | 56 | |
56 | 57 | $instanceModel = new Database\Instance(); |
57 | 58 | $instanceModel->setPrimaryKey($instance->getHostname()); |
@@ -80,8 +81,9 @@ discard block |
||
80 | 81 | */ |
81 | 82 | public function onConnectionSeen($instanceName, ConnectionStatus $connectionStatus) |
82 | 83 | { |
83 | - if ($this->hasConnection($instanceName, $connectionStatus)) |
|
84 | - return; |
|
84 | + if ($this->hasConnection($instanceName, $connectionStatus)) { |
|
85 | + return; |
|
86 | + } |
|
85 | 87 | |
86 | 88 | $user = null; |
87 | 89 | |
@@ -114,8 +116,9 @@ discard block |
||
114 | 116 | */ |
115 | 117 | public function onUserSeen($instanceName, $userName) |
116 | 118 | { |
117 | - if ($this->hasUser($instanceName, $userName)) |
|
118 | - return; |
|
119 | + if ($this->hasUser($instanceName, $userName)) { |
|
120 | + return; |
|
121 | + } |
|
119 | 122 | |
120 | 123 | $user = new User(); |
121 | 124 | $user->setInstanceName($instanceName)->setName($userName); |
@@ -136,8 +139,9 @@ discard block |
||
136 | 139 | */ |
137 | 140 | public function onChannelSeen($instanceName, $channelName) |
138 | 141 | { |
139 | - if ($this->hasChannel($instanceName, $channelName)) |
|
140 | - return; |
|
142 | + if ($this->hasChannel($instanceName, $channelName)) { |
|
143 | + return; |
|
144 | + } |
|
141 | 145 | |
142 | 146 | $channel = new Channel(); |
143 | 147 | $channel->setInstanceName($instanceName)->setName($channelName); |
@@ -159,8 +163,9 @@ discard block |
||
159 | 163 | public function onSubscriptionSeen($instanceName, SubscriptionStatus $status) |
160 | 164 | { |
161 | 165 | // Ignore EPG grabber subscriptions |
162 | - if ($status->getType() === SubscriptionStatus::TYPE_EPGGRAB) |
|
163 | - return; |
|
166 | + if ($status->getType() === SubscriptionStatus::TYPE_EPGGRAB) { |
|
167 | + return; |
|
168 | + } |
|
164 | 169 | |
165 | 170 | // Determine the username to store for the subscription |
166 | 171 | $username = $status->username; |
@@ -180,8 +185,9 @@ discard block |
||
180 | 185 | $this->onChannelSeen($instanceName, $status->channel); |
181 | 186 | $channel = ChannelQuery::create()->filterByInstance($instance)->filterByName($status->channel)->findOne(); |
182 | 187 | |
183 | - if ($this->hasSubscription($instance, $user, $channel, $status)) |
|
184 | - return; |
|
188 | + if ($this->hasSubscription($instance, $user, $channel, $status)) { |
|
189 | + return; |
|
190 | + } |
|
185 | 191 | |
186 | 192 | $subscription = new Subscription(); |
187 | 193 | $subscription->setInstance($instance)->setUser($user)->setChannel($channel) |
@@ -205,8 +211,9 @@ discard block |
||
205 | 211 | public function onSubscriptionStateChange($instanceName, StateChange $stateChange) |
206 | 212 | { |
207 | 213 | // We only need to persist subscription stops |
208 | - if ($stateChange->getState() === StateChange::STATE_SUBSCRIPTION_STARTED) |
|
209 | - return; |
|
214 | + if ($stateChange->getState() === StateChange::STATE_SUBSCRIPTION_STARTED) { |
|
215 | + return; |
|
216 | + } |
|
210 | 217 | |
211 | 218 | // Find the latest matching subscription |
212 | 219 | $subscription = SubscriptionQuery::create()->filterByInstanceName($instanceName) |
@@ -251,7 +251,7 @@ |
||
251 | 251 | |
252 | 252 | |
253 | 253 | /** |
254 | - * @param $instanceName |
|
254 | + * @param string $instanceName |
|
255 | 255 | * @param ConnectionStatus $connectionStatus |
256 | 256 | * |
257 | 257 | * @return bool whether the connection exists in the database |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | $this->onUserSeen($instanceName, $connectionStatus->user); |
95 | 95 | |
96 | 96 | $user = UserQuery::create()->filterByInstanceName($instanceName)->filterByName($connectionStatus->user) |
97 | - ->findOne(); |
|
97 | + ->findOne(); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $connection = new Connection(); |
101 | 101 | $connection->setInstanceName($instanceName)->setPeer($connectionStatus->peer) |
102 | - ->setUser($user) |
|
103 | - ->setStarted($connectionStatus->started)->setType($connectionStatus->type)->save(); |
|
102 | + ->setUser($user) |
|
103 | + ->setStarted($connectionStatus->started)->setType($connectionStatus->type)->save(); |
|
104 | 104 | |
105 | 105 | $this->_logger->info('Stored new connection (instance: {instanceName}, peer: {peer})', [ |
106 | 106 | 'instanceName' => $instanceName, |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | $input = new Input(); |
128 | 128 | $input->setPrimaryKey($inputStatus->uuid); |
129 | 129 | $input->setInstanceName($instanceName) |
130 | - ->setStarted(new \DateTime()) |
|
131 | - ->setInput($inputStatus->input) |
|
132 | - ->setWeight($inputStatus->weight) |
|
133 | - ->setNetwork(Input::parseNetwork($inputStatus)) |
|
134 | - ->setMux(Input::parseMux($inputStatus))->save(); |
|
130 | + ->setStarted(new \DateTime()) |
|
131 | + ->setInput($inputStatus->input) |
|
132 | + ->setWeight($inputStatus->weight) |
|
133 | + ->setNetwork(Input::parseNetwork($inputStatus)) |
|
134 | + ->setMux(Input::parseMux($inputStatus))->save(); |
|
135 | 135 | |
136 | 136 | $this->_logger->info('Stored new input (instance: {instanceName}, network: {network}, mux: {mux}, weight: {weight})', |
137 | 137 | [ |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | |
238 | 238 | $subscription = new Subscription(); |
239 | 239 | $subscription->setInstance($instance)->setInput($input)->setUser($user)->setChannel($channel) |
240 | - ->setSubscriptionId($status->id)->setStarted($status->start)->setTitle($status->title) |
|
241 | - ->setService($status->service); |
|
240 | + ->setSubscriptionId($status->id)->setStarted($status->start)->setTitle($status->title) |
|
241 | + ->setService($status->service); |
|
242 | 242 | $subscription->save(); |
243 | 243 | |
244 | 244 | $this->_logger->info('Stored new subscription (instance: {instanceName}, user: {userName}, channel: {channelName})', |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | |
263 | 263 | // Find the latest matching subscription |
264 | 264 | $subscription = SubscriptionQuery::create()->filterByInstanceName($instanceName) |
265 | - ->filterBySubscriptionId($stateChange->getSubscriptionId()) |
|
266 | - ->addDescendingOrderByColumn('started')->findOne(); |
|
265 | + ->filterBySubscriptionId($stateChange->getSubscriptionId()) |
|
266 | + ->addDescendingOrderByColumn('started')->findOne(); |
|
267 | 267 | |
268 | 268 | // EPG grab subscriptions are not stored so we don't want to log these with a high level |
269 | 269 | if ($subscription === null) |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | private function hasConnection($instanceName, ConnectionStatus $connectionStatus) |
313 | 313 | { |
314 | 314 | return ConnectionQuery::create()->filterByInstanceName($instanceName)->filterByPeer($connectionStatus->peer) |
315 | - ->filterByStarted($connectionStatus->started)->findOne() !== null; |
|
315 | + ->filterByStarted($connectionStatus->started)->findOne() !== null; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | private function hasChannel($instanceName, $channelName) |
349 | 349 | { |
350 | 350 | return ChannelQuery::create()->filterByInstanceName($instanceName)->filterByName($channelName) |
351 | - ->findOne() !== null; |
|
351 | + ->findOne() !== null; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | |
@@ -371,9 +371,9 @@ discard block |
||
371 | 371 | $userId = $user !== null ? $user->getId() : null; |
372 | 372 | |
373 | 373 | return SubscriptionQuery::create()->filterByInstance($instance)->filterByUserId($userId) |
374 | - ->filterByChannel($channel) |
|
375 | - ->filterBySubscriptionId($subscription->id)->filterByStarted($subscription->start) |
|
376 | - ->findOne() !== null; |
|
374 | + ->filterByChannel($channel) |
|
375 | + ->filterBySubscriptionId($subscription->id)->filterByStarted($subscription->start) |
|
376 | + ->findOne() !== null; |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | } |
@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | { |
30 | 30 | $stateChange = self::parseMessage($logMessage->logtxt); |
31 | 31 | |
32 | - if ($stateChange !== null) |
|
33 | - $stateChanges[] = $stateChange; |
|
32 | + if ($stateChange !== null) { |
|
33 | + $stateChanges[] = $stateChange; |
|
34 | + } |
|
34 | 35 | } |
35 | 36 | |
36 | 37 | return $stateChanges; |
@@ -54,10 +55,11 @@ discard block |
||
54 | 55 | $stateChange = new StateChange(self::getSubscriptionId($messageParts[3])); |
55 | 56 | |
56 | 57 | // Check the state |
57 | - if (strpos($message, 'subscribing on channel') !== false) |
|
58 | - $stateChange->setState(StateChange::STATE_SUBSCRIPTION_STARTED); |
|
59 | - else if (strpos($message, 'unsubscribing from')) |
|
60 | - $stateChange->setState(StateChange::STATE_SUBSCRIPTION_STOPPED); |
|
58 | + if (strpos($message, 'subscribing on channel') !== false) { |
|
59 | + $stateChange->setState(StateChange::STATE_SUBSCRIPTION_STARTED); |
|
60 | + } else if (strpos($message, 'unsubscribing from')) { |
|
61 | + $stateChange->setState(StateChange::STATE_SUBSCRIPTION_STOPPED); |
|
62 | + } |
|
61 | 63 | |
62 | 64 | return $stateChange; |
63 | 65 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * |
306 | 306 | * @param string $msg |
307 | 307 | * @param int $priority One of the Propel::LOG_* logging levels |
308 | - * @return boolean |
|
308 | + * @return boolean|null |
|
309 | 309 | */ |
310 | 310 | protected function log($msg, $priority = Propel::LOG_INFO) |
311 | 311 | { |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
1029 | 1029 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
1030 | 1030 | * |
1031 | - * @param mixed $parser A AbstractParser instance, |
|
1031 | + * @param string $parser A AbstractParser instance, |
|
1032 | 1032 | * or a format name ('XML', 'YAML', 'JSON', 'CSV') |
1033 | 1033 | * @param string $data The source data to import from |
1034 | 1034 | * @param string $keyType The type of keys the array uses. |
@@ -36,1898 +36,1898 @@ |
||
36 | 36 | */ |
37 | 37 | abstract class Input implements ActiveRecordInterface |
38 | 38 | { |
39 | - /** |
|
40 | - * TableMap class name |
|
41 | - */ |
|
42 | - const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\InputTableMap'; |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * attribute to determine if this object has previously been saved. |
|
47 | - * @var boolean |
|
48 | - */ |
|
49 | - protected $new = true; |
|
50 | - |
|
51 | - /** |
|
52 | - * attribute to determine whether this object has been deleted. |
|
53 | - * @var boolean |
|
54 | - */ |
|
55 | - protected $deleted = false; |
|
56 | - |
|
57 | - /** |
|
58 | - * The columns that have been modified in current object. |
|
59 | - * Tracking modified columns allows us to only update modified columns. |
|
60 | - * @var array |
|
61 | - */ |
|
62 | - protected $modifiedColumns = array(); |
|
63 | - |
|
64 | - /** |
|
65 | - * The (virtual) columns that are added at runtime |
|
66 | - * The formatters can add supplementary columns based on a resultset |
|
67 | - * @var array |
|
68 | - */ |
|
69 | - protected $virtualColumns = array(); |
|
70 | - |
|
71 | - /** |
|
72 | - * The value for the uuid field. |
|
73 | - * |
|
74 | - * @var string |
|
75 | - */ |
|
76 | - protected $uuid; |
|
77 | - |
|
78 | - /** |
|
79 | - * The value for the instance_name field. |
|
80 | - * |
|
81 | - * @var string |
|
82 | - */ |
|
83 | - protected $instance_name; |
|
84 | - |
|
85 | - /** |
|
86 | - * The value for the started field. |
|
87 | - * |
|
88 | - * @var \DateTime |
|
89 | - */ |
|
90 | - protected $started; |
|
91 | - |
|
92 | - /** |
|
93 | - * The value for the input field. |
|
94 | - * |
|
95 | - * @var string |
|
96 | - */ |
|
97 | - protected $input; |
|
98 | - |
|
99 | - /** |
|
100 | - * The value for the network field. |
|
101 | - * |
|
102 | - * @var string |
|
103 | - */ |
|
104 | - protected $network; |
|
105 | - |
|
106 | - /** |
|
107 | - * The value for the mux field. |
|
108 | - * |
|
109 | - * @var string |
|
110 | - */ |
|
111 | - protected $mux; |
|
112 | - |
|
113 | - /** |
|
114 | - * The value for the weight field. |
|
115 | - * |
|
116 | - * @var int |
|
117 | - */ |
|
118 | - protected $weight; |
|
119 | - |
|
120 | - /** |
|
121 | - * @var ChildInstance |
|
122 | - */ |
|
123 | - protected $aInstance; |
|
124 | - |
|
125 | - /** |
|
126 | - * @var ObjectCollection|ChildSubscription[] Collection to store aggregation of ChildSubscription objects. |
|
127 | - */ |
|
128 | - protected $collSubscriptions; |
|
129 | - protected $collSubscriptionsPartial; |
|
130 | - |
|
131 | - /** |
|
132 | - * Flag to prevent endless save loop, if this object is referenced |
|
133 | - * by another object which falls in this transaction. |
|
134 | - * |
|
135 | - * @var boolean |
|
136 | - */ |
|
137 | - protected $alreadyInSave = false; |
|
138 | - |
|
139 | - /** |
|
140 | - * An array of objects scheduled for deletion. |
|
141 | - * @var ObjectCollection|ChildSubscription[] |
|
142 | - */ |
|
143 | - protected $subscriptionsScheduledForDeletion = null; |
|
144 | - |
|
145 | - /** |
|
146 | - * Initializes internal state of Jalle19\StatusManager\Database\Base\Input object. |
|
147 | - */ |
|
148 | - public function __construct() |
|
149 | - { |
|
150 | - } |
|
151 | - |
|
152 | - /** |
|
153 | - * Returns whether the object has been modified. |
|
154 | - * |
|
155 | - * @return boolean True if the object has been modified. |
|
156 | - */ |
|
157 | - public function isModified() |
|
158 | - { |
|
159 | - return !!$this->modifiedColumns; |
|
160 | - } |
|
161 | - |
|
162 | - /** |
|
163 | - * Has specified column been modified? |
|
164 | - * |
|
165 | - * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID |
|
166 | - * @return boolean True if $col has been modified. |
|
167 | - */ |
|
168 | - public function isColumnModified($col) |
|
169 | - { |
|
170 | - return $this->modifiedColumns && isset($this->modifiedColumns[$col]); |
|
171 | - } |
|
172 | - |
|
173 | - /** |
|
174 | - * Get the columns that have been modified in this object. |
|
175 | - * @return array A unique list of the modified column names for this object. |
|
176 | - */ |
|
177 | - public function getModifiedColumns() |
|
178 | - { |
|
179 | - return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; |
|
180 | - } |
|
181 | - |
|
182 | - /** |
|
183 | - * Returns whether the object has ever been saved. This will |
|
184 | - * be false, if the object was retrieved from storage or was created |
|
185 | - * and then saved. |
|
186 | - * |
|
187 | - * @return boolean true, if the object has never been persisted. |
|
188 | - */ |
|
189 | - public function isNew() |
|
190 | - { |
|
191 | - return $this->new; |
|
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * Setter for the isNew attribute. This method will be called |
|
196 | - * by Propel-generated children and objects. |
|
197 | - * |
|
198 | - * @param boolean $b the state of the object. |
|
199 | - */ |
|
200 | - public function setNew($b) |
|
201 | - { |
|
202 | - $this->new = (boolean) $b; |
|
203 | - } |
|
204 | - |
|
205 | - /** |
|
206 | - * Whether this object has been deleted. |
|
207 | - * @return boolean The deleted state of this object. |
|
208 | - */ |
|
209 | - public function isDeleted() |
|
210 | - { |
|
211 | - return $this->deleted; |
|
212 | - } |
|
213 | - |
|
214 | - /** |
|
215 | - * Specify whether this object has been deleted. |
|
216 | - * @param boolean $b The deleted state of this object. |
|
217 | - * @return void |
|
218 | - */ |
|
219 | - public function setDeleted($b) |
|
220 | - { |
|
221 | - $this->deleted = (boolean) $b; |
|
222 | - } |
|
223 | - |
|
224 | - /** |
|
225 | - * Sets the modified state for the object to be false. |
|
226 | - * @param string $col If supplied, only the specified column is reset. |
|
227 | - * @return void |
|
228 | - */ |
|
229 | - public function resetModified($col = null) |
|
230 | - { |
|
231 | - if (null !== $col) { |
|
232 | - if (isset($this->modifiedColumns[$col])) { |
|
233 | - unset($this->modifiedColumns[$col]); |
|
234 | - } |
|
235 | - } else { |
|
236 | - $this->modifiedColumns = array(); |
|
237 | - } |
|
238 | - } |
|
239 | - |
|
240 | - /** |
|
241 | - * Compares this with another <code>Input</code> instance. If |
|
242 | - * <code>obj</code> is an instance of <code>Input</code>, delegates to |
|
243 | - * <code>equals(Input)</code>. Otherwise, returns <code>false</code>. |
|
244 | - * |
|
245 | - * @param mixed $obj The object to compare to. |
|
246 | - * @return boolean Whether equal to the object specified. |
|
247 | - */ |
|
248 | - public function equals($obj) |
|
249 | - { |
|
250 | - if (!$obj instanceof static) { |
|
251 | - return false; |
|
252 | - } |
|
253 | - |
|
254 | - if ($this === $obj) { |
|
255 | - return true; |
|
256 | - } |
|
257 | - |
|
258 | - if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) { |
|
259 | - return false; |
|
260 | - } |
|
261 | - |
|
262 | - return $this->getPrimaryKey() === $obj->getPrimaryKey(); |
|
263 | - } |
|
264 | - |
|
265 | - /** |
|
266 | - * Get the associative array of the virtual columns in this object |
|
267 | - * |
|
268 | - * @return array |
|
269 | - */ |
|
270 | - public function getVirtualColumns() |
|
271 | - { |
|
272 | - return $this->virtualColumns; |
|
273 | - } |
|
274 | - |
|
275 | - /** |
|
276 | - * Checks the existence of a virtual column in this object |
|
277 | - * |
|
278 | - * @param string $name The virtual column name |
|
279 | - * @return boolean |
|
280 | - */ |
|
281 | - public function hasVirtualColumn($name) |
|
282 | - { |
|
283 | - return array_key_exists($name, $this->virtualColumns); |
|
284 | - } |
|
285 | - |
|
286 | - /** |
|
287 | - * Get the value of a virtual column in this object |
|
288 | - * |
|
289 | - * @param string $name The virtual column name |
|
290 | - * @return mixed |
|
291 | - * |
|
292 | - * @throws PropelException |
|
293 | - */ |
|
294 | - public function getVirtualColumn($name) |
|
295 | - { |
|
296 | - if (!$this->hasVirtualColumn($name)) { |
|
297 | - throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); |
|
298 | - } |
|
299 | - |
|
300 | - return $this->virtualColumns[$name]; |
|
301 | - } |
|
302 | - |
|
303 | - /** |
|
304 | - * Set the value of a virtual column in this object |
|
305 | - * |
|
306 | - * @param string $name The virtual column name |
|
307 | - * @param mixed $value The value to give to the virtual column |
|
308 | - * |
|
309 | - * @return $this|Input The current object, for fluid interface |
|
310 | - */ |
|
311 | - public function setVirtualColumn($name, $value) |
|
312 | - { |
|
313 | - $this->virtualColumns[$name] = $value; |
|
314 | - |
|
315 | - return $this; |
|
316 | - } |
|
317 | - |
|
318 | - /** |
|
319 | - * Logs a message using Propel::log(). |
|
320 | - * |
|
321 | - * @param string $msg |
|
322 | - * @param int $priority One of the Propel::LOG_* logging levels |
|
323 | - * @return boolean |
|
324 | - */ |
|
325 | - protected function log($msg, $priority = Propel::LOG_INFO) |
|
326 | - { |
|
327 | - return Propel::log(get_class($this) . ': ' . $msg, $priority); |
|
328 | - } |
|
329 | - |
|
330 | - /** |
|
331 | - * Export the current object properties to a string, using a given parser format |
|
332 | - * <code> |
|
333 | - * $book = BookQuery::create()->findPk(9012); |
|
334 | - * echo $book->exportTo('JSON'); |
|
335 | - * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
|
336 | - * </code> |
|
337 | - * |
|
338 | - * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') |
|
339 | - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. |
|
340 | - * @return string The exported data |
|
341 | - */ |
|
342 | - public function exportTo($parser, $includeLazyLoadColumns = true) |
|
343 | - { |
|
344 | - if (!$parser instanceof AbstractParser) { |
|
345 | - $parser = AbstractParser::getParser($parser); |
|
346 | - } |
|
347 | - |
|
348 | - return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); |
|
349 | - } |
|
350 | - |
|
351 | - /** |
|
352 | - * Clean up internal collections prior to serializing |
|
353 | - * Avoids recursive loops that turn into segmentation faults when serializing |
|
354 | - */ |
|
355 | - public function __sleep() |
|
356 | - { |
|
357 | - $this->clearAllReferences(); |
|
358 | - |
|
359 | - $cls = new \ReflectionClass($this); |
|
360 | - $propertyNames = []; |
|
361 | - $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); |
|
362 | - |
|
363 | - foreach($serializableProperties as $property) { |
|
364 | - $propertyNames[] = $property->getName(); |
|
365 | - } |
|
366 | - |
|
367 | - return $propertyNames; |
|
368 | - } |
|
369 | - |
|
370 | - /** |
|
371 | - * Get the [uuid] column value. |
|
372 | - * |
|
373 | - * @return string |
|
374 | - */ |
|
375 | - public function getUuid() |
|
376 | - { |
|
377 | - return $this->uuid; |
|
378 | - } |
|
379 | - |
|
380 | - /** |
|
381 | - * Get the [instance_name] column value. |
|
382 | - * |
|
383 | - * @return string |
|
384 | - */ |
|
385 | - public function getInstanceName() |
|
386 | - { |
|
387 | - return $this->instance_name; |
|
388 | - } |
|
389 | - |
|
390 | - /** |
|
391 | - * Get the [optionally formatted] temporal [started] column value. |
|
392 | - * |
|
393 | - * |
|
394 | - * @param string $format The date/time format string (either date()-style or strftime()-style). |
|
395 | - * If format is NULL, then the raw DateTime object will be returned. |
|
396 | - * |
|
397 | - * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL |
|
398 | - * |
|
399 | - * @throws PropelException - if unable to parse/validate the date/time value. |
|
400 | - */ |
|
401 | - public function getStarted($format = NULL) |
|
402 | - { |
|
403 | - if ($format === null) { |
|
404 | - return $this->started; |
|
405 | - } else { |
|
406 | - return $this->started instanceof \DateTime ? $this->started->format($format) : null; |
|
407 | - } |
|
408 | - } |
|
409 | - |
|
410 | - /** |
|
411 | - * Get the [input] column value. |
|
412 | - * |
|
413 | - * @return string |
|
414 | - */ |
|
415 | - public function getInput() |
|
416 | - { |
|
417 | - return $this->input; |
|
418 | - } |
|
419 | - |
|
420 | - /** |
|
421 | - * Get the [network] column value. |
|
422 | - * |
|
423 | - * @return string |
|
424 | - */ |
|
425 | - public function getNetwork() |
|
426 | - { |
|
427 | - return $this->network; |
|
428 | - } |
|
429 | - |
|
430 | - /** |
|
431 | - * Get the [mux] column value. |
|
432 | - * |
|
433 | - * @return string |
|
434 | - */ |
|
435 | - public function getMux() |
|
436 | - { |
|
437 | - return $this->mux; |
|
438 | - } |
|
439 | - |
|
440 | - /** |
|
441 | - * Get the [weight] column value. |
|
442 | - * |
|
443 | - * @return int |
|
444 | - */ |
|
445 | - public function getWeight() |
|
446 | - { |
|
447 | - return $this->weight; |
|
448 | - } |
|
449 | - |
|
450 | - /** |
|
451 | - * Set the value of [uuid] column. |
|
452 | - * |
|
453 | - * @param string $v new value |
|
454 | - * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
455 | - */ |
|
456 | - public function setUuid($v) |
|
457 | - { |
|
458 | - if ($v !== null) { |
|
459 | - $v = (string) $v; |
|
460 | - } |
|
461 | - |
|
462 | - if ($this->uuid !== $v) { |
|
463 | - $this->uuid = $v; |
|
464 | - $this->modifiedColumns[InputTableMap::COL_UUID] = true; |
|
465 | - } |
|
466 | - |
|
467 | - return $this; |
|
468 | - } // setUuid() |
|
469 | - |
|
470 | - /** |
|
471 | - * Set the value of [instance_name] column. |
|
472 | - * |
|
473 | - * @param string $v new value |
|
474 | - * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
475 | - */ |
|
476 | - public function setInstanceName($v) |
|
477 | - { |
|
478 | - if ($v !== null) { |
|
479 | - $v = (string) $v; |
|
480 | - } |
|
481 | - |
|
482 | - if ($this->instance_name !== $v) { |
|
483 | - $this->instance_name = $v; |
|
484 | - $this->modifiedColumns[InputTableMap::COL_INSTANCE_NAME] = true; |
|
485 | - } |
|
486 | - |
|
487 | - if ($this->aInstance !== null && $this->aInstance->getName() !== $v) { |
|
488 | - $this->aInstance = null; |
|
489 | - } |
|
490 | - |
|
491 | - return $this; |
|
492 | - } // setInstanceName() |
|
493 | - |
|
494 | - /** |
|
495 | - * Sets the value of [started] column to a normalized version of the date/time value specified. |
|
496 | - * |
|
497 | - * @param mixed $v string, integer (timestamp), or \DateTime value. |
|
498 | - * Empty strings are treated as NULL. |
|
499 | - * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
500 | - */ |
|
501 | - public function setStarted($v) |
|
502 | - { |
|
503 | - $dt = PropelDateTime::newInstance($v, null, 'DateTime'); |
|
504 | - if ($this->started !== null || $dt !== null) { |
|
505 | - if ($this->started === null || $dt === null || $dt->format("Y-m-d H:i:s") !== $this->started->format("Y-m-d H:i:s")) { |
|
506 | - $this->started = $dt === null ? null : clone $dt; |
|
507 | - $this->modifiedColumns[InputTableMap::COL_STARTED] = true; |
|
508 | - } |
|
509 | - } // if either are not null |
|
510 | - |
|
511 | - return $this; |
|
512 | - } // setStarted() |
|
513 | - |
|
514 | - /** |
|
515 | - * Set the value of [input] column. |
|
516 | - * |
|
517 | - * @param string $v new value |
|
518 | - * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
519 | - */ |
|
520 | - public function setInput($v) |
|
521 | - { |
|
522 | - if ($v !== null) { |
|
523 | - $v = (string) $v; |
|
524 | - } |
|
525 | - |
|
526 | - if ($this->input !== $v) { |
|
527 | - $this->input = $v; |
|
528 | - $this->modifiedColumns[InputTableMap::COL_INPUT] = true; |
|
529 | - } |
|
530 | - |
|
531 | - return $this; |
|
532 | - } // setInput() |
|
533 | - |
|
534 | - /** |
|
535 | - * Set the value of [network] column. |
|
536 | - * |
|
537 | - * @param string $v new value |
|
538 | - * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
539 | - */ |
|
540 | - public function setNetwork($v) |
|
541 | - { |
|
542 | - if ($v !== null) { |
|
543 | - $v = (string) $v; |
|
544 | - } |
|
545 | - |
|
546 | - if ($this->network !== $v) { |
|
547 | - $this->network = $v; |
|
548 | - $this->modifiedColumns[InputTableMap::COL_NETWORK] = true; |
|
549 | - } |
|
550 | - |
|
551 | - return $this; |
|
552 | - } // setNetwork() |
|
553 | - |
|
554 | - /** |
|
555 | - * Set the value of [mux] column. |
|
556 | - * |
|
557 | - * @param string $v new value |
|
558 | - * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
559 | - */ |
|
560 | - public function setMux($v) |
|
561 | - { |
|
562 | - if ($v !== null) { |
|
563 | - $v = (string) $v; |
|
564 | - } |
|
565 | - |
|
566 | - if ($this->mux !== $v) { |
|
567 | - $this->mux = $v; |
|
568 | - $this->modifiedColumns[InputTableMap::COL_MUX] = true; |
|
569 | - } |
|
570 | - |
|
571 | - return $this; |
|
572 | - } // setMux() |
|
573 | - |
|
574 | - /** |
|
575 | - * Set the value of [weight] column. |
|
576 | - * |
|
577 | - * @param int $v new value |
|
578 | - * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
579 | - */ |
|
580 | - public function setWeight($v) |
|
581 | - { |
|
582 | - if ($v !== null) { |
|
583 | - $v = (int) $v; |
|
584 | - } |
|
585 | - |
|
586 | - if ($this->weight !== $v) { |
|
587 | - $this->weight = $v; |
|
588 | - $this->modifiedColumns[InputTableMap::COL_WEIGHT] = true; |
|
589 | - } |
|
590 | - |
|
591 | - return $this; |
|
592 | - } // setWeight() |
|
593 | - |
|
594 | - /** |
|
595 | - * Indicates whether the columns in this object are only set to default values. |
|
596 | - * |
|
597 | - * This method can be used in conjunction with isModified() to indicate whether an object is both |
|
598 | - * modified _and_ has some values set which are non-default. |
|
599 | - * |
|
600 | - * @return boolean Whether the columns in this object are only been set with default values. |
|
601 | - */ |
|
602 | - public function hasOnlyDefaultValues() |
|
603 | - { |
|
604 | - // otherwise, everything was equal, so return TRUE |
|
605 | - return true; |
|
606 | - } // hasOnlyDefaultValues() |
|
607 | - |
|
608 | - /** |
|
609 | - * Hydrates (populates) the object variables with values from the database resultset. |
|
610 | - * |
|
611 | - * An offset (0-based "start column") is specified so that objects can be hydrated |
|
612 | - * with a subset of the columns in the resultset rows. This is needed, for example, |
|
613 | - * for results of JOIN queries where the resultset row includes columns from two or |
|
614 | - * more tables. |
|
615 | - * |
|
616 | - * @param array $row The row returned by DataFetcher->fetch(). |
|
617 | - * @param int $startcol 0-based offset column which indicates which restultset column to start with. |
|
618 | - * @param boolean $rehydrate Whether this object is being re-hydrated from the database. |
|
619 | - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
39 | + /** |
|
40 | + * TableMap class name |
|
41 | + */ |
|
42 | + const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\InputTableMap'; |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * attribute to determine if this object has previously been saved. |
|
47 | + * @var boolean |
|
48 | + */ |
|
49 | + protected $new = true; |
|
50 | + |
|
51 | + /** |
|
52 | + * attribute to determine whether this object has been deleted. |
|
53 | + * @var boolean |
|
54 | + */ |
|
55 | + protected $deleted = false; |
|
56 | + |
|
57 | + /** |
|
58 | + * The columns that have been modified in current object. |
|
59 | + * Tracking modified columns allows us to only update modified columns. |
|
60 | + * @var array |
|
61 | + */ |
|
62 | + protected $modifiedColumns = array(); |
|
63 | + |
|
64 | + /** |
|
65 | + * The (virtual) columns that are added at runtime |
|
66 | + * The formatters can add supplementary columns based on a resultset |
|
67 | + * @var array |
|
68 | + */ |
|
69 | + protected $virtualColumns = array(); |
|
70 | + |
|
71 | + /** |
|
72 | + * The value for the uuid field. |
|
73 | + * |
|
74 | + * @var string |
|
75 | + */ |
|
76 | + protected $uuid; |
|
77 | + |
|
78 | + /** |
|
79 | + * The value for the instance_name field. |
|
80 | + * |
|
81 | + * @var string |
|
82 | + */ |
|
83 | + protected $instance_name; |
|
84 | + |
|
85 | + /** |
|
86 | + * The value for the started field. |
|
87 | + * |
|
88 | + * @var \DateTime |
|
89 | + */ |
|
90 | + protected $started; |
|
91 | + |
|
92 | + /** |
|
93 | + * The value for the input field. |
|
94 | + * |
|
95 | + * @var string |
|
96 | + */ |
|
97 | + protected $input; |
|
98 | + |
|
99 | + /** |
|
100 | + * The value for the network field. |
|
101 | + * |
|
102 | + * @var string |
|
103 | + */ |
|
104 | + protected $network; |
|
105 | + |
|
106 | + /** |
|
107 | + * The value for the mux field. |
|
108 | + * |
|
109 | + * @var string |
|
110 | + */ |
|
111 | + protected $mux; |
|
112 | + |
|
113 | + /** |
|
114 | + * The value for the weight field. |
|
115 | + * |
|
116 | + * @var int |
|
117 | + */ |
|
118 | + protected $weight; |
|
119 | + |
|
120 | + /** |
|
121 | + * @var ChildInstance |
|
122 | + */ |
|
123 | + protected $aInstance; |
|
124 | + |
|
125 | + /** |
|
126 | + * @var ObjectCollection|ChildSubscription[] Collection to store aggregation of ChildSubscription objects. |
|
127 | + */ |
|
128 | + protected $collSubscriptions; |
|
129 | + protected $collSubscriptionsPartial; |
|
130 | + |
|
131 | + /** |
|
132 | + * Flag to prevent endless save loop, if this object is referenced |
|
133 | + * by another object which falls in this transaction. |
|
134 | + * |
|
135 | + * @var boolean |
|
136 | + */ |
|
137 | + protected $alreadyInSave = false; |
|
138 | + |
|
139 | + /** |
|
140 | + * An array of objects scheduled for deletion. |
|
141 | + * @var ObjectCollection|ChildSubscription[] |
|
142 | + */ |
|
143 | + protected $subscriptionsScheduledForDeletion = null; |
|
144 | + |
|
145 | + /** |
|
146 | + * Initializes internal state of Jalle19\StatusManager\Database\Base\Input object. |
|
147 | + */ |
|
148 | + public function __construct() |
|
149 | + { |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | + * Returns whether the object has been modified. |
|
154 | + * |
|
155 | + * @return boolean True if the object has been modified. |
|
156 | + */ |
|
157 | + public function isModified() |
|
158 | + { |
|
159 | + return !!$this->modifiedColumns; |
|
160 | + } |
|
161 | + |
|
162 | + /** |
|
163 | + * Has specified column been modified? |
|
164 | + * |
|
165 | + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID |
|
166 | + * @return boolean True if $col has been modified. |
|
167 | + */ |
|
168 | + public function isColumnModified($col) |
|
169 | + { |
|
170 | + return $this->modifiedColumns && isset($this->modifiedColumns[$col]); |
|
171 | + } |
|
172 | + |
|
173 | + /** |
|
174 | + * Get the columns that have been modified in this object. |
|
175 | + * @return array A unique list of the modified column names for this object. |
|
176 | + */ |
|
177 | + public function getModifiedColumns() |
|
178 | + { |
|
179 | + return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; |
|
180 | + } |
|
181 | + |
|
182 | + /** |
|
183 | + * Returns whether the object has ever been saved. This will |
|
184 | + * be false, if the object was retrieved from storage or was created |
|
185 | + * and then saved. |
|
186 | + * |
|
187 | + * @return boolean true, if the object has never been persisted. |
|
188 | + */ |
|
189 | + public function isNew() |
|
190 | + { |
|
191 | + return $this->new; |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * Setter for the isNew attribute. This method will be called |
|
196 | + * by Propel-generated children and objects. |
|
197 | + * |
|
198 | + * @param boolean $b the state of the object. |
|
199 | + */ |
|
200 | + public function setNew($b) |
|
201 | + { |
|
202 | + $this->new = (boolean) $b; |
|
203 | + } |
|
204 | + |
|
205 | + /** |
|
206 | + * Whether this object has been deleted. |
|
207 | + * @return boolean The deleted state of this object. |
|
208 | + */ |
|
209 | + public function isDeleted() |
|
210 | + { |
|
211 | + return $this->deleted; |
|
212 | + } |
|
213 | + |
|
214 | + /** |
|
215 | + * Specify whether this object has been deleted. |
|
216 | + * @param boolean $b The deleted state of this object. |
|
217 | + * @return void |
|
218 | + */ |
|
219 | + public function setDeleted($b) |
|
220 | + { |
|
221 | + $this->deleted = (boolean) $b; |
|
222 | + } |
|
223 | + |
|
224 | + /** |
|
225 | + * Sets the modified state for the object to be false. |
|
226 | + * @param string $col If supplied, only the specified column is reset. |
|
227 | + * @return void |
|
228 | + */ |
|
229 | + public function resetModified($col = null) |
|
230 | + { |
|
231 | + if (null !== $col) { |
|
232 | + if (isset($this->modifiedColumns[$col])) { |
|
233 | + unset($this->modifiedColumns[$col]); |
|
234 | + } |
|
235 | + } else { |
|
236 | + $this->modifiedColumns = array(); |
|
237 | + } |
|
238 | + } |
|
239 | + |
|
240 | + /** |
|
241 | + * Compares this with another <code>Input</code> instance. If |
|
242 | + * <code>obj</code> is an instance of <code>Input</code>, delegates to |
|
243 | + * <code>equals(Input)</code>. Otherwise, returns <code>false</code>. |
|
244 | + * |
|
245 | + * @param mixed $obj The object to compare to. |
|
246 | + * @return boolean Whether equal to the object specified. |
|
247 | + */ |
|
248 | + public function equals($obj) |
|
249 | + { |
|
250 | + if (!$obj instanceof static) { |
|
251 | + return false; |
|
252 | + } |
|
253 | + |
|
254 | + if ($this === $obj) { |
|
255 | + return true; |
|
256 | + } |
|
257 | + |
|
258 | + if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) { |
|
259 | + return false; |
|
260 | + } |
|
261 | + |
|
262 | + return $this->getPrimaryKey() === $obj->getPrimaryKey(); |
|
263 | + } |
|
264 | + |
|
265 | + /** |
|
266 | + * Get the associative array of the virtual columns in this object |
|
267 | + * |
|
268 | + * @return array |
|
269 | + */ |
|
270 | + public function getVirtualColumns() |
|
271 | + { |
|
272 | + return $this->virtualColumns; |
|
273 | + } |
|
274 | + |
|
275 | + /** |
|
276 | + * Checks the existence of a virtual column in this object |
|
277 | + * |
|
278 | + * @param string $name The virtual column name |
|
279 | + * @return boolean |
|
280 | + */ |
|
281 | + public function hasVirtualColumn($name) |
|
282 | + { |
|
283 | + return array_key_exists($name, $this->virtualColumns); |
|
284 | + } |
|
285 | + |
|
286 | + /** |
|
287 | + * Get the value of a virtual column in this object |
|
288 | + * |
|
289 | + * @param string $name The virtual column name |
|
290 | + * @return mixed |
|
291 | + * |
|
292 | + * @throws PropelException |
|
293 | + */ |
|
294 | + public function getVirtualColumn($name) |
|
295 | + { |
|
296 | + if (!$this->hasVirtualColumn($name)) { |
|
297 | + throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); |
|
298 | + } |
|
299 | + |
|
300 | + return $this->virtualColumns[$name]; |
|
301 | + } |
|
302 | + |
|
303 | + /** |
|
304 | + * Set the value of a virtual column in this object |
|
305 | + * |
|
306 | + * @param string $name The virtual column name |
|
307 | + * @param mixed $value The value to give to the virtual column |
|
308 | + * |
|
309 | + * @return $this|Input The current object, for fluid interface |
|
310 | + */ |
|
311 | + public function setVirtualColumn($name, $value) |
|
312 | + { |
|
313 | + $this->virtualColumns[$name] = $value; |
|
314 | + |
|
315 | + return $this; |
|
316 | + } |
|
317 | + |
|
318 | + /** |
|
319 | + * Logs a message using Propel::log(). |
|
320 | + * |
|
321 | + * @param string $msg |
|
322 | + * @param int $priority One of the Propel::LOG_* logging levels |
|
323 | + * @return boolean |
|
324 | + */ |
|
325 | + protected function log($msg, $priority = Propel::LOG_INFO) |
|
326 | + { |
|
327 | + return Propel::log(get_class($this) . ': ' . $msg, $priority); |
|
328 | + } |
|
329 | + |
|
330 | + /** |
|
331 | + * Export the current object properties to a string, using a given parser format |
|
332 | + * <code> |
|
333 | + * $book = BookQuery::create()->findPk(9012); |
|
334 | + * echo $book->exportTo('JSON'); |
|
335 | + * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
|
336 | + * </code> |
|
337 | + * |
|
338 | + * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') |
|
339 | + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. |
|
340 | + * @return string The exported data |
|
341 | + */ |
|
342 | + public function exportTo($parser, $includeLazyLoadColumns = true) |
|
343 | + { |
|
344 | + if (!$parser instanceof AbstractParser) { |
|
345 | + $parser = AbstractParser::getParser($parser); |
|
346 | + } |
|
347 | + |
|
348 | + return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); |
|
349 | + } |
|
350 | + |
|
351 | + /** |
|
352 | + * Clean up internal collections prior to serializing |
|
353 | + * Avoids recursive loops that turn into segmentation faults when serializing |
|
354 | + */ |
|
355 | + public function __sleep() |
|
356 | + { |
|
357 | + $this->clearAllReferences(); |
|
358 | + |
|
359 | + $cls = new \ReflectionClass($this); |
|
360 | + $propertyNames = []; |
|
361 | + $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); |
|
362 | + |
|
363 | + foreach($serializableProperties as $property) { |
|
364 | + $propertyNames[] = $property->getName(); |
|
365 | + } |
|
366 | + |
|
367 | + return $propertyNames; |
|
368 | + } |
|
369 | + |
|
370 | + /** |
|
371 | + * Get the [uuid] column value. |
|
372 | + * |
|
373 | + * @return string |
|
374 | + */ |
|
375 | + public function getUuid() |
|
376 | + { |
|
377 | + return $this->uuid; |
|
378 | + } |
|
379 | + |
|
380 | + /** |
|
381 | + * Get the [instance_name] column value. |
|
382 | + * |
|
383 | + * @return string |
|
384 | + */ |
|
385 | + public function getInstanceName() |
|
386 | + { |
|
387 | + return $this->instance_name; |
|
388 | + } |
|
389 | + |
|
390 | + /** |
|
391 | + * Get the [optionally formatted] temporal [started] column value. |
|
392 | + * |
|
393 | + * |
|
394 | + * @param string $format The date/time format string (either date()-style or strftime()-style). |
|
395 | + * If format is NULL, then the raw DateTime object will be returned. |
|
396 | + * |
|
397 | + * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL |
|
398 | + * |
|
399 | + * @throws PropelException - if unable to parse/validate the date/time value. |
|
400 | + */ |
|
401 | + public function getStarted($format = NULL) |
|
402 | + { |
|
403 | + if ($format === null) { |
|
404 | + return $this->started; |
|
405 | + } else { |
|
406 | + return $this->started instanceof \DateTime ? $this->started->format($format) : null; |
|
407 | + } |
|
408 | + } |
|
409 | + |
|
410 | + /** |
|
411 | + * Get the [input] column value. |
|
412 | + * |
|
413 | + * @return string |
|
414 | + */ |
|
415 | + public function getInput() |
|
416 | + { |
|
417 | + return $this->input; |
|
418 | + } |
|
419 | + |
|
420 | + /** |
|
421 | + * Get the [network] column value. |
|
422 | + * |
|
423 | + * @return string |
|
424 | + */ |
|
425 | + public function getNetwork() |
|
426 | + { |
|
427 | + return $this->network; |
|
428 | + } |
|
429 | + |
|
430 | + /** |
|
431 | + * Get the [mux] column value. |
|
432 | + * |
|
433 | + * @return string |
|
434 | + */ |
|
435 | + public function getMux() |
|
436 | + { |
|
437 | + return $this->mux; |
|
438 | + } |
|
439 | + |
|
440 | + /** |
|
441 | + * Get the [weight] column value. |
|
442 | + * |
|
443 | + * @return int |
|
444 | + */ |
|
445 | + public function getWeight() |
|
446 | + { |
|
447 | + return $this->weight; |
|
448 | + } |
|
449 | + |
|
450 | + /** |
|
451 | + * Set the value of [uuid] column. |
|
452 | + * |
|
453 | + * @param string $v new value |
|
454 | + * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
455 | + */ |
|
456 | + public function setUuid($v) |
|
457 | + { |
|
458 | + if ($v !== null) { |
|
459 | + $v = (string) $v; |
|
460 | + } |
|
461 | + |
|
462 | + if ($this->uuid !== $v) { |
|
463 | + $this->uuid = $v; |
|
464 | + $this->modifiedColumns[InputTableMap::COL_UUID] = true; |
|
465 | + } |
|
466 | + |
|
467 | + return $this; |
|
468 | + } // setUuid() |
|
469 | + |
|
470 | + /** |
|
471 | + * Set the value of [instance_name] column. |
|
472 | + * |
|
473 | + * @param string $v new value |
|
474 | + * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
475 | + */ |
|
476 | + public function setInstanceName($v) |
|
477 | + { |
|
478 | + if ($v !== null) { |
|
479 | + $v = (string) $v; |
|
480 | + } |
|
481 | + |
|
482 | + if ($this->instance_name !== $v) { |
|
483 | + $this->instance_name = $v; |
|
484 | + $this->modifiedColumns[InputTableMap::COL_INSTANCE_NAME] = true; |
|
485 | + } |
|
486 | + |
|
487 | + if ($this->aInstance !== null && $this->aInstance->getName() !== $v) { |
|
488 | + $this->aInstance = null; |
|
489 | + } |
|
490 | + |
|
491 | + return $this; |
|
492 | + } // setInstanceName() |
|
493 | + |
|
494 | + /** |
|
495 | + * Sets the value of [started] column to a normalized version of the date/time value specified. |
|
496 | + * |
|
497 | + * @param mixed $v string, integer (timestamp), or \DateTime value. |
|
498 | + * Empty strings are treated as NULL. |
|
499 | + * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
500 | + */ |
|
501 | + public function setStarted($v) |
|
502 | + { |
|
503 | + $dt = PropelDateTime::newInstance($v, null, 'DateTime'); |
|
504 | + if ($this->started !== null || $dt !== null) { |
|
505 | + if ($this->started === null || $dt === null || $dt->format("Y-m-d H:i:s") !== $this->started->format("Y-m-d H:i:s")) { |
|
506 | + $this->started = $dt === null ? null : clone $dt; |
|
507 | + $this->modifiedColumns[InputTableMap::COL_STARTED] = true; |
|
508 | + } |
|
509 | + } // if either are not null |
|
510 | + |
|
511 | + return $this; |
|
512 | + } // setStarted() |
|
513 | + |
|
514 | + /** |
|
515 | + * Set the value of [input] column. |
|
516 | + * |
|
517 | + * @param string $v new value |
|
518 | + * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
519 | + */ |
|
520 | + public function setInput($v) |
|
521 | + { |
|
522 | + if ($v !== null) { |
|
523 | + $v = (string) $v; |
|
524 | + } |
|
525 | + |
|
526 | + if ($this->input !== $v) { |
|
527 | + $this->input = $v; |
|
528 | + $this->modifiedColumns[InputTableMap::COL_INPUT] = true; |
|
529 | + } |
|
530 | + |
|
531 | + return $this; |
|
532 | + } // setInput() |
|
533 | + |
|
534 | + /** |
|
535 | + * Set the value of [network] column. |
|
536 | + * |
|
537 | + * @param string $v new value |
|
538 | + * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
539 | + */ |
|
540 | + public function setNetwork($v) |
|
541 | + { |
|
542 | + if ($v !== null) { |
|
543 | + $v = (string) $v; |
|
544 | + } |
|
545 | + |
|
546 | + if ($this->network !== $v) { |
|
547 | + $this->network = $v; |
|
548 | + $this->modifiedColumns[InputTableMap::COL_NETWORK] = true; |
|
549 | + } |
|
550 | + |
|
551 | + return $this; |
|
552 | + } // setNetwork() |
|
553 | + |
|
554 | + /** |
|
555 | + * Set the value of [mux] column. |
|
556 | + * |
|
557 | + * @param string $v new value |
|
558 | + * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
559 | + */ |
|
560 | + public function setMux($v) |
|
561 | + { |
|
562 | + if ($v !== null) { |
|
563 | + $v = (string) $v; |
|
564 | + } |
|
565 | + |
|
566 | + if ($this->mux !== $v) { |
|
567 | + $this->mux = $v; |
|
568 | + $this->modifiedColumns[InputTableMap::COL_MUX] = true; |
|
569 | + } |
|
570 | + |
|
571 | + return $this; |
|
572 | + } // setMux() |
|
573 | + |
|
574 | + /** |
|
575 | + * Set the value of [weight] column. |
|
576 | + * |
|
577 | + * @param int $v new value |
|
578 | + * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
579 | + */ |
|
580 | + public function setWeight($v) |
|
581 | + { |
|
582 | + if ($v !== null) { |
|
583 | + $v = (int) $v; |
|
584 | + } |
|
585 | + |
|
586 | + if ($this->weight !== $v) { |
|
587 | + $this->weight = $v; |
|
588 | + $this->modifiedColumns[InputTableMap::COL_WEIGHT] = true; |
|
589 | + } |
|
590 | + |
|
591 | + return $this; |
|
592 | + } // setWeight() |
|
593 | + |
|
594 | + /** |
|
595 | + * Indicates whether the columns in this object are only set to default values. |
|
596 | + * |
|
597 | + * This method can be used in conjunction with isModified() to indicate whether an object is both |
|
598 | + * modified _and_ has some values set which are non-default. |
|
599 | + * |
|
600 | + * @return boolean Whether the columns in this object are only been set with default values. |
|
601 | + */ |
|
602 | + public function hasOnlyDefaultValues() |
|
603 | + { |
|
604 | + // otherwise, everything was equal, so return TRUE |
|
605 | + return true; |
|
606 | + } // hasOnlyDefaultValues() |
|
607 | + |
|
608 | + /** |
|
609 | + * Hydrates (populates) the object variables with values from the database resultset. |
|
610 | + * |
|
611 | + * An offset (0-based "start column") is specified so that objects can be hydrated |
|
612 | + * with a subset of the columns in the resultset rows. This is needed, for example, |
|
613 | + * for results of JOIN queries where the resultset row includes columns from two or |
|
614 | + * more tables. |
|
615 | + * |
|
616 | + * @param array $row The row returned by DataFetcher->fetch(). |
|
617 | + * @param int $startcol 0-based offset column which indicates which restultset column to start with. |
|
618 | + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. |
|
619 | + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
620 | 620 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
621 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
622 | - * |
|
623 | - * @return int next starting column |
|
624 | - * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. |
|
625 | - */ |
|
626 | - public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) |
|
627 | - { |
|
628 | - try { |
|
629 | - |
|
630 | - $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : InputTableMap::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)]; |
|
631 | - $this->uuid = (null !== $col) ? (string) $col : null; |
|
632 | - |
|
633 | - $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : InputTableMap::translateFieldName('InstanceName', TableMap::TYPE_PHPNAME, $indexType)]; |
|
634 | - $this->instance_name = (null !== $col) ? (string) $col : null; |
|
635 | - |
|
636 | - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : InputTableMap::translateFieldName('Started', TableMap::TYPE_PHPNAME, $indexType)]; |
|
637 | - $this->started = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; |
|
638 | - |
|
639 | - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : InputTableMap::translateFieldName('Input', TableMap::TYPE_PHPNAME, $indexType)]; |
|
640 | - $this->input = (null !== $col) ? (string) $col : null; |
|
641 | - |
|
642 | - $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : InputTableMap::translateFieldName('Network', TableMap::TYPE_PHPNAME, $indexType)]; |
|
643 | - $this->network = (null !== $col) ? (string) $col : null; |
|
644 | - |
|
645 | - $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : InputTableMap::translateFieldName('Mux', TableMap::TYPE_PHPNAME, $indexType)]; |
|
646 | - $this->mux = (null !== $col) ? (string) $col : null; |
|
647 | - |
|
648 | - $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : InputTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)]; |
|
649 | - $this->weight = (null !== $col) ? (int) $col : null; |
|
650 | - $this->resetModified(); |
|
651 | - |
|
652 | - $this->setNew(false); |
|
653 | - |
|
654 | - if ($rehydrate) { |
|
655 | - $this->ensureConsistency(); |
|
656 | - } |
|
657 | - |
|
658 | - return $startcol + 7; // 7 = InputTableMap::NUM_HYDRATE_COLUMNS. |
|
659 | - |
|
660 | - } catch (Exception $e) { |
|
661 | - throw new PropelException(sprintf('Error populating %s object', '\\Jalle19\\StatusManager\\Database\\Input'), 0, $e); |
|
662 | - } |
|
663 | - } |
|
664 | - |
|
665 | - /** |
|
666 | - * Checks and repairs the internal consistency of the object. |
|
667 | - * |
|
668 | - * This method is executed after an already-instantiated object is re-hydrated |
|
669 | - * from the database. It exists to check any foreign keys to make sure that |
|
670 | - * the objects related to the current object are correct based on foreign key. |
|
671 | - * |
|
672 | - * You can override this method in the stub class, but you should always invoke |
|
673 | - * the base method from the overridden method (i.e. parent::ensureConsistency()), |
|
674 | - * in case your model changes. |
|
675 | - * |
|
676 | - * @throws PropelException |
|
677 | - */ |
|
678 | - public function ensureConsistency() |
|
679 | - { |
|
680 | - if ($this->aInstance !== null && $this->instance_name !== $this->aInstance->getName()) { |
|
681 | - $this->aInstance = null; |
|
682 | - } |
|
683 | - } // ensureConsistency |
|
684 | - |
|
685 | - /** |
|
686 | - * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. |
|
687 | - * |
|
688 | - * This will only work if the object has been saved and has a valid primary key set. |
|
689 | - * |
|
690 | - * @param boolean $deep (optional) Whether to also de-associated any related objects. |
|
691 | - * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. |
|
692 | - * @return void |
|
693 | - * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db |
|
694 | - */ |
|
695 | - public function reload($deep = false, ConnectionInterface $con = null) |
|
696 | - { |
|
697 | - if ($this->isDeleted()) { |
|
698 | - throw new PropelException("Cannot reload a deleted object."); |
|
699 | - } |
|
700 | - |
|
701 | - if ($this->isNew()) { |
|
702 | - throw new PropelException("Cannot reload an unsaved object."); |
|
703 | - } |
|
704 | - |
|
705 | - if ($con === null) { |
|
706 | - $con = Propel::getServiceContainer()->getReadConnection(InputTableMap::DATABASE_NAME); |
|
707 | - } |
|
708 | - |
|
709 | - // We don't need to alter the object instance pool; we're just modifying this instance |
|
710 | - // already in the pool. |
|
711 | - |
|
712 | - $dataFetcher = ChildInputQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); |
|
713 | - $row = $dataFetcher->fetch(); |
|
714 | - $dataFetcher->close(); |
|
715 | - if (!$row) { |
|
716 | - throw new PropelException('Cannot find matching row in the database to reload object values.'); |
|
717 | - } |
|
718 | - $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate |
|
719 | - |
|
720 | - if ($deep) { // also de-associate any related objects? |
|
721 | - |
|
722 | - $this->aInstance = null; |
|
723 | - $this->collSubscriptions = null; |
|
724 | - |
|
725 | - } // if (deep) |
|
726 | - } |
|
727 | - |
|
728 | - /** |
|
729 | - * Removes this object from datastore and sets delete attribute. |
|
730 | - * |
|
731 | - * @param ConnectionInterface $con |
|
732 | - * @return void |
|
733 | - * @throws PropelException |
|
734 | - * @see Input::setDeleted() |
|
735 | - * @see Input::isDeleted() |
|
736 | - */ |
|
737 | - public function delete(ConnectionInterface $con = null) |
|
738 | - { |
|
739 | - if ($this->isDeleted()) { |
|
740 | - throw new PropelException("This object has already been deleted."); |
|
741 | - } |
|
742 | - |
|
743 | - if ($con === null) { |
|
744 | - $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
|
745 | - } |
|
746 | - |
|
747 | - $con->transaction(function () use ($con) { |
|
748 | - $deleteQuery = ChildInputQuery::create() |
|
749 | - ->filterByPrimaryKey($this->getPrimaryKey()); |
|
750 | - $ret = $this->preDelete($con); |
|
751 | - if ($ret) { |
|
752 | - $deleteQuery->delete($con); |
|
753 | - $this->postDelete($con); |
|
754 | - $this->setDeleted(true); |
|
755 | - } |
|
756 | - }); |
|
757 | - } |
|
758 | - |
|
759 | - /** |
|
760 | - * Persists this object to the database. |
|
761 | - * |
|
762 | - * If the object is new, it inserts it; otherwise an update is performed. |
|
763 | - * All modified related objects will also be persisted in the doSave() |
|
764 | - * method. This method wraps all precipitate database operations in a |
|
765 | - * single transaction. |
|
766 | - * |
|
767 | - * @param ConnectionInterface $con |
|
768 | - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
|
769 | - * @throws PropelException |
|
770 | - * @see doSave() |
|
771 | - */ |
|
772 | - public function save(ConnectionInterface $con = null) |
|
773 | - { |
|
774 | - if ($this->isDeleted()) { |
|
775 | - throw new PropelException("You cannot save an object that has been deleted."); |
|
776 | - } |
|
777 | - |
|
778 | - if ($con === null) { |
|
779 | - $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
|
780 | - } |
|
781 | - |
|
782 | - return $con->transaction(function () use ($con) { |
|
783 | - $isInsert = $this->isNew(); |
|
784 | - $ret = $this->preSave($con); |
|
785 | - if ($isInsert) { |
|
786 | - $ret = $ret && $this->preInsert($con); |
|
787 | - } else { |
|
788 | - $ret = $ret && $this->preUpdate($con); |
|
789 | - } |
|
790 | - if ($ret) { |
|
791 | - $affectedRows = $this->doSave($con); |
|
792 | - if ($isInsert) { |
|
793 | - $this->postInsert($con); |
|
794 | - } else { |
|
795 | - $this->postUpdate($con); |
|
796 | - } |
|
797 | - $this->postSave($con); |
|
798 | - InputTableMap::addInstanceToPool($this); |
|
799 | - } else { |
|
800 | - $affectedRows = 0; |
|
801 | - } |
|
802 | - |
|
803 | - return $affectedRows; |
|
804 | - }); |
|
805 | - } |
|
806 | - |
|
807 | - /** |
|
808 | - * Performs the work of inserting or updating the row in the database. |
|
809 | - * |
|
810 | - * If the object is new, it inserts it; otherwise an update is performed. |
|
811 | - * All related objects are also updated in this method. |
|
812 | - * |
|
813 | - * @param ConnectionInterface $con |
|
814 | - * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
|
815 | - * @throws PropelException |
|
816 | - * @see save() |
|
817 | - */ |
|
818 | - protected function doSave(ConnectionInterface $con) |
|
819 | - { |
|
820 | - $affectedRows = 0; // initialize var to track total num of affected rows |
|
821 | - if (!$this->alreadyInSave) { |
|
822 | - $this->alreadyInSave = true; |
|
823 | - |
|
824 | - // We call the save method on the following object(s) if they |
|
825 | - // were passed to this object by their corresponding set |
|
826 | - // method. This object relates to these object(s) by a |
|
827 | - // foreign key reference. |
|
828 | - |
|
829 | - if ($this->aInstance !== null) { |
|
830 | - if ($this->aInstance->isModified() || $this->aInstance->isNew()) { |
|
831 | - $affectedRows += $this->aInstance->save($con); |
|
832 | - } |
|
833 | - $this->setInstance($this->aInstance); |
|
834 | - } |
|
835 | - |
|
836 | - if ($this->isNew() || $this->isModified()) { |
|
837 | - // persist changes |
|
838 | - if ($this->isNew()) { |
|
839 | - $this->doInsert($con); |
|
840 | - $affectedRows += 1; |
|
841 | - } else { |
|
842 | - $affectedRows += $this->doUpdate($con); |
|
843 | - } |
|
844 | - $this->resetModified(); |
|
845 | - } |
|
846 | - |
|
847 | - if ($this->subscriptionsScheduledForDeletion !== null) { |
|
848 | - if (!$this->subscriptionsScheduledForDeletion->isEmpty()) { |
|
849 | - foreach ($this->subscriptionsScheduledForDeletion as $subscription) { |
|
850 | - // need to save related object because we set the relation to null |
|
851 | - $subscription->save($con); |
|
852 | - } |
|
853 | - $this->subscriptionsScheduledForDeletion = null; |
|
854 | - } |
|
855 | - } |
|
856 | - |
|
857 | - if ($this->collSubscriptions !== null) { |
|
858 | - foreach ($this->collSubscriptions as $referrerFK) { |
|
859 | - if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { |
|
860 | - $affectedRows += $referrerFK->save($con); |
|
861 | - } |
|
862 | - } |
|
863 | - } |
|
864 | - |
|
865 | - $this->alreadyInSave = false; |
|
866 | - |
|
867 | - } |
|
868 | - |
|
869 | - return $affectedRows; |
|
870 | - } // doSave() |
|
871 | - |
|
872 | - /** |
|
873 | - * Insert the row in the database. |
|
874 | - * |
|
875 | - * @param ConnectionInterface $con |
|
876 | - * |
|
877 | - * @throws PropelException |
|
878 | - * @see doSave() |
|
879 | - */ |
|
880 | - protected function doInsert(ConnectionInterface $con) |
|
881 | - { |
|
882 | - $modifiedColumns = array(); |
|
883 | - $index = 0; |
|
884 | - |
|
885 | - |
|
886 | - // check the columns in natural order for more readable SQL queries |
|
887 | - if ($this->isColumnModified(InputTableMap::COL_UUID)) { |
|
888 | - $modifiedColumns[':p' . $index++] = 'uuid'; |
|
889 | - } |
|
890 | - if ($this->isColumnModified(InputTableMap::COL_INSTANCE_NAME)) { |
|
891 | - $modifiedColumns[':p' . $index++] = 'instance_name'; |
|
892 | - } |
|
893 | - if ($this->isColumnModified(InputTableMap::COL_STARTED)) { |
|
894 | - $modifiedColumns[':p' . $index++] = 'started'; |
|
895 | - } |
|
896 | - if ($this->isColumnModified(InputTableMap::COL_INPUT)) { |
|
897 | - $modifiedColumns[':p' . $index++] = 'input'; |
|
898 | - } |
|
899 | - if ($this->isColumnModified(InputTableMap::COL_NETWORK)) { |
|
900 | - $modifiedColumns[':p' . $index++] = 'network'; |
|
901 | - } |
|
902 | - if ($this->isColumnModified(InputTableMap::COL_MUX)) { |
|
903 | - $modifiedColumns[':p' . $index++] = 'mux'; |
|
904 | - } |
|
905 | - if ($this->isColumnModified(InputTableMap::COL_WEIGHT)) { |
|
906 | - $modifiedColumns[':p' . $index++] = 'weight'; |
|
907 | - } |
|
908 | - |
|
909 | - $sql = sprintf( |
|
910 | - 'INSERT INTO input (%s) VALUES (%s)', |
|
911 | - implode(', ', $modifiedColumns), |
|
912 | - implode(', ', array_keys($modifiedColumns)) |
|
913 | - ); |
|
914 | - |
|
915 | - try { |
|
916 | - $stmt = $con->prepare($sql); |
|
917 | - foreach ($modifiedColumns as $identifier => $columnName) { |
|
918 | - switch ($columnName) { |
|
919 | - case 'uuid': |
|
920 | - $stmt->bindValue($identifier, $this->uuid, PDO::PARAM_STR); |
|
921 | - break; |
|
922 | - case 'instance_name': |
|
923 | - $stmt->bindValue($identifier, $this->instance_name, PDO::PARAM_STR); |
|
924 | - break; |
|
925 | - case 'started': |
|
926 | - $stmt->bindValue($identifier, $this->started ? $this->started->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); |
|
927 | - break; |
|
928 | - case 'input': |
|
929 | - $stmt->bindValue($identifier, $this->input, PDO::PARAM_STR); |
|
930 | - break; |
|
931 | - case 'network': |
|
932 | - $stmt->bindValue($identifier, $this->network, PDO::PARAM_STR); |
|
933 | - break; |
|
934 | - case 'mux': |
|
935 | - $stmt->bindValue($identifier, $this->mux, PDO::PARAM_STR); |
|
936 | - break; |
|
937 | - case 'weight': |
|
938 | - $stmt->bindValue($identifier, $this->weight, PDO::PARAM_INT); |
|
939 | - break; |
|
940 | - } |
|
941 | - } |
|
942 | - $stmt->execute(); |
|
943 | - } catch (Exception $e) { |
|
944 | - Propel::log($e->getMessage(), Propel::LOG_ERR); |
|
945 | - throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); |
|
946 | - } |
|
947 | - |
|
948 | - $this->setNew(false); |
|
949 | - } |
|
950 | - |
|
951 | - /** |
|
952 | - * Update the row in the database. |
|
953 | - * |
|
954 | - * @param ConnectionInterface $con |
|
955 | - * |
|
956 | - * @return Integer Number of updated rows |
|
957 | - * @see doSave() |
|
958 | - */ |
|
959 | - protected function doUpdate(ConnectionInterface $con) |
|
960 | - { |
|
961 | - $selectCriteria = $this->buildPkeyCriteria(); |
|
962 | - $valuesCriteria = $this->buildCriteria(); |
|
963 | - |
|
964 | - return $selectCriteria->doUpdate($valuesCriteria, $con); |
|
965 | - } |
|
966 | - |
|
967 | - /** |
|
968 | - * Retrieves a field from the object by name passed in as a string. |
|
969 | - * |
|
970 | - * @param string $name name |
|
971 | - * @param string $type The type of fieldname the $name is of: |
|
972 | - * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
973 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
974 | - * Defaults to TableMap::TYPE_PHPNAME. |
|
975 | - * @return mixed Value of field. |
|
976 | - */ |
|
977 | - public function getByName($name, $type = TableMap::TYPE_PHPNAME) |
|
978 | - { |
|
979 | - $pos = InputTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); |
|
980 | - $field = $this->getByPosition($pos); |
|
981 | - |
|
982 | - return $field; |
|
983 | - } |
|
984 | - |
|
985 | - /** |
|
986 | - * Retrieves a field from the object by Position as specified in the xml schema. |
|
987 | - * Zero-based. |
|
988 | - * |
|
989 | - * @param int $pos position in xml schema |
|
990 | - * @return mixed Value of field at $pos |
|
991 | - */ |
|
992 | - public function getByPosition($pos) |
|
993 | - { |
|
994 | - switch ($pos) { |
|
995 | - case 0: |
|
996 | - return $this->getUuid(); |
|
997 | - break; |
|
998 | - case 1: |
|
999 | - return $this->getInstanceName(); |
|
1000 | - break; |
|
1001 | - case 2: |
|
1002 | - return $this->getStarted(); |
|
1003 | - break; |
|
1004 | - case 3: |
|
1005 | - return $this->getInput(); |
|
1006 | - break; |
|
1007 | - case 4: |
|
1008 | - return $this->getNetwork(); |
|
1009 | - break; |
|
1010 | - case 5: |
|
1011 | - return $this->getMux(); |
|
1012 | - break; |
|
1013 | - case 6: |
|
1014 | - return $this->getWeight(); |
|
1015 | - break; |
|
1016 | - default: |
|
1017 | - return null; |
|
1018 | - break; |
|
1019 | - } // switch() |
|
1020 | - } |
|
1021 | - |
|
1022 | - /** |
|
1023 | - * Exports the object as an array. |
|
1024 | - * |
|
1025 | - * You can specify the key type of the array by passing one of the class |
|
1026 | - * type constants. |
|
1027 | - * |
|
1028 | - * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
|
1029 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
1030 | - * Defaults to TableMap::TYPE_PHPNAME. |
|
1031 | - * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. |
|
1032 | - * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion |
|
1033 | - * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. |
|
1034 | - * |
|
1035 | - * @return array an associative array containing the field names (as keys) and field values |
|
1036 | - */ |
|
1037 | - public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) |
|
1038 | - { |
|
1039 | - |
|
1040 | - if (isset($alreadyDumpedObjects['Input'][$this->hashCode()])) { |
|
1041 | - return '*RECURSION*'; |
|
1042 | - } |
|
1043 | - $alreadyDumpedObjects['Input'][$this->hashCode()] = true; |
|
1044 | - $keys = InputTableMap::getFieldNames($keyType); |
|
1045 | - $result = array( |
|
1046 | - $keys[0] => $this->getUuid(), |
|
1047 | - $keys[1] => $this->getInstanceName(), |
|
1048 | - $keys[2] => $this->getStarted(), |
|
1049 | - $keys[3] => $this->getInput(), |
|
1050 | - $keys[4] => $this->getNetwork(), |
|
1051 | - $keys[5] => $this->getMux(), |
|
1052 | - $keys[6] => $this->getWeight(), |
|
1053 | - ); |
|
1054 | - if ($result[$keys[2]] instanceof \DateTime) { |
|
1055 | - $result[$keys[2]] = $result[$keys[2]]->format('c'); |
|
1056 | - } |
|
1057 | - |
|
1058 | - $virtualColumns = $this->virtualColumns; |
|
1059 | - foreach ($virtualColumns as $key => $virtualColumn) { |
|
1060 | - $result[$key] = $virtualColumn; |
|
1061 | - } |
|
1062 | - |
|
1063 | - if ($includeForeignObjects) { |
|
1064 | - if (null !== $this->aInstance) { |
|
1065 | - |
|
1066 | - switch ($keyType) { |
|
1067 | - case TableMap::TYPE_CAMELNAME: |
|
1068 | - $key = 'instance'; |
|
1069 | - break; |
|
1070 | - case TableMap::TYPE_FIELDNAME: |
|
1071 | - $key = 'instance'; |
|
1072 | - break; |
|
1073 | - default: |
|
1074 | - $key = 'Instance'; |
|
1075 | - } |
|
1076 | - |
|
1077 | - $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
|
1078 | - } |
|
1079 | - if (null !== $this->collSubscriptions) { |
|
1080 | - |
|
1081 | - switch ($keyType) { |
|
1082 | - case TableMap::TYPE_CAMELNAME: |
|
1083 | - $key = 'subscriptions'; |
|
1084 | - break; |
|
1085 | - case TableMap::TYPE_FIELDNAME: |
|
1086 | - $key = 'subscriptions'; |
|
1087 | - break; |
|
1088 | - default: |
|
1089 | - $key = 'Subscriptions'; |
|
1090 | - } |
|
1091 | - |
|
1092 | - $result[$key] = $this->collSubscriptions->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); |
|
1093 | - } |
|
1094 | - } |
|
1095 | - |
|
1096 | - return $result; |
|
1097 | - } |
|
1098 | - |
|
1099 | - /** |
|
1100 | - * Sets a field from the object by name passed in as a string. |
|
1101 | - * |
|
1102 | - * @param string $name |
|
1103 | - * @param mixed $value field value |
|
1104 | - * @param string $type The type of fieldname the $name is of: |
|
1105 | - * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
1106 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
1107 | - * Defaults to TableMap::TYPE_PHPNAME. |
|
1108 | - * @return $this|\Jalle19\StatusManager\Database\Input |
|
1109 | - */ |
|
1110 | - public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) |
|
1111 | - { |
|
1112 | - $pos = InputTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); |
|
1113 | - |
|
1114 | - return $this->setByPosition($pos, $value); |
|
1115 | - } |
|
1116 | - |
|
1117 | - /** |
|
1118 | - * Sets a field from the object by Position as specified in the xml schema. |
|
1119 | - * Zero-based. |
|
1120 | - * |
|
1121 | - * @param int $pos position in xml schema |
|
1122 | - * @param mixed $value field value |
|
1123 | - * @return $this|\Jalle19\StatusManager\Database\Input |
|
1124 | - */ |
|
1125 | - public function setByPosition($pos, $value) |
|
1126 | - { |
|
1127 | - switch ($pos) { |
|
1128 | - case 0: |
|
1129 | - $this->setUuid($value); |
|
1130 | - break; |
|
1131 | - case 1: |
|
1132 | - $this->setInstanceName($value); |
|
1133 | - break; |
|
1134 | - case 2: |
|
1135 | - $this->setStarted($value); |
|
1136 | - break; |
|
1137 | - case 3: |
|
1138 | - $this->setInput($value); |
|
1139 | - break; |
|
1140 | - case 4: |
|
1141 | - $this->setNetwork($value); |
|
1142 | - break; |
|
1143 | - case 5: |
|
1144 | - $this->setMux($value); |
|
1145 | - break; |
|
1146 | - case 6: |
|
1147 | - $this->setWeight($value); |
|
1148 | - break; |
|
1149 | - } // switch() |
|
1150 | - |
|
1151 | - return $this; |
|
1152 | - } |
|
1153 | - |
|
1154 | - /** |
|
1155 | - * Populates the object using an array. |
|
1156 | - * |
|
1157 | - * This is particularly useful when populating an object from one of the |
|
1158 | - * request arrays (e.g. $_POST). This method goes through the column |
|
1159 | - * names, checking to see whether a matching key exists in populated |
|
1160 | - * array. If so the setByName() method is called for that column. |
|
1161 | - * |
|
1162 | - * You can specify the key type of the array by additionally passing one |
|
1163 | - * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
|
1164 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
1165 | - * The default key type is the column's TableMap::TYPE_PHPNAME. |
|
1166 | - * |
|
1167 | - * @param array $arr An array to populate the object from. |
|
1168 | - * @param string $keyType The type of keys the array uses. |
|
1169 | - * @return void |
|
1170 | - */ |
|
1171 | - public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) |
|
1172 | - { |
|
1173 | - $keys = InputTableMap::getFieldNames($keyType); |
|
1174 | - |
|
1175 | - if (array_key_exists($keys[0], $arr)) { |
|
1176 | - $this->setUuid($arr[$keys[0]]); |
|
1177 | - } |
|
1178 | - if (array_key_exists($keys[1], $arr)) { |
|
1179 | - $this->setInstanceName($arr[$keys[1]]); |
|
1180 | - } |
|
1181 | - if (array_key_exists($keys[2], $arr)) { |
|
1182 | - $this->setStarted($arr[$keys[2]]); |
|
1183 | - } |
|
1184 | - if (array_key_exists($keys[3], $arr)) { |
|
1185 | - $this->setInput($arr[$keys[3]]); |
|
1186 | - } |
|
1187 | - if (array_key_exists($keys[4], $arr)) { |
|
1188 | - $this->setNetwork($arr[$keys[4]]); |
|
1189 | - } |
|
1190 | - if (array_key_exists($keys[5], $arr)) { |
|
1191 | - $this->setMux($arr[$keys[5]]); |
|
1192 | - } |
|
1193 | - if (array_key_exists($keys[6], $arr)) { |
|
1194 | - $this->setWeight($arr[$keys[6]]); |
|
1195 | - } |
|
1196 | - } |
|
1197 | - |
|
1198 | - /** |
|
1199 | - * Populate the current object from a string, using a given parser format |
|
1200 | - * <code> |
|
1201 | - * $book = new Book(); |
|
1202 | - * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
|
1203 | - * </code> |
|
1204 | - * |
|
1205 | - * You can specify the key type of the array by additionally passing one |
|
1206 | - * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
|
1207 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
1208 | - * The default key type is the column's TableMap::TYPE_PHPNAME. |
|
1209 | - * |
|
1210 | - * @param mixed $parser A AbstractParser instance, |
|
1211 | - * or a format name ('XML', 'YAML', 'JSON', 'CSV') |
|
1212 | - * @param string $data The source data to import from |
|
1213 | - * @param string $keyType The type of keys the array uses. |
|
1214 | - * |
|
1215 | - * @return $this|\Jalle19\StatusManager\Database\Input The current object, for fluid interface |
|
1216 | - */ |
|
1217 | - public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) |
|
1218 | - { |
|
1219 | - if (!$parser instanceof AbstractParser) { |
|
1220 | - $parser = AbstractParser::getParser($parser); |
|
1221 | - } |
|
1222 | - |
|
1223 | - $this->fromArray($parser->toArray($data), $keyType); |
|
1224 | - |
|
1225 | - return $this; |
|
1226 | - } |
|
1227 | - |
|
1228 | - /** |
|
1229 | - * Build a Criteria object containing the values of all modified columns in this object. |
|
1230 | - * |
|
1231 | - * @return Criteria The Criteria object containing all modified values. |
|
1232 | - */ |
|
1233 | - public function buildCriteria() |
|
1234 | - { |
|
1235 | - $criteria = new Criteria(InputTableMap::DATABASE_NAME); |
|
1236 | - |
|
1237 | - if ($this->isColumnModified(InputTableMap::COL_UUID)) { |
|
1238 | - $criteria->add(InputTableMap::COL_UUID, $this->uuid); |
|
1239 | - } |
|
1240 | - if ($this->isColumnModified(InputTableMap::COL_INSTANCE_NAME)) { |
|
1241 | - $criteria->add(InputTableMap::COL_INSTANCE_NAME, $this->instance_name); |
|
1242 | - } |
|
1243 | - if ($this->isColumnModified(InputTableMap::COL_STARTED)) { |
|
1244 | - $criteria->add(InputTableMap::COL_STARTED, $this->started); |
|
1245 | - } |
|
1246 | - if ($this->isColumnModified(InputTableMap::COL_INPUT)) { |
|
1247 | - $criteria->add(InputTableMap::COL_INPUT, $this->input); |
|
1248 | - } |
|
1249 | - if ($this->isColumnModified(InputTableMap::COL_NETWORK)) { |
|
1250 | - $criteria->add(InputTableMap::COL_NETWORK, $this->network); |
|
1251 | - } |
|
1252 | - if ($this->isColumnModified(InputTableMap::COL_MUX)) { |
|
1253 | - $criteria->add(InputTableMap::COL_MUX, $this->mux); |
|
1254 | - } |
|
1255 | - if ($this->isColumnModified(InputTableMap::COL_WEIGHT)) { |
|
1256 | - $criteria->add(InputTableMap::COL_WEIGHT, $this->weight); |
|
1257 | - } |
|
1258 | - |
|
1259 | - return $criteria; |
|
1260 | - } |
|
1261 | - |
|
1262 | - /** |
|
1263 | - * Builds a Criteria object containing the primary key for this object. |
|
1264 | - * |
|
1265 | - * Unlike buildCriteria() this method includes the primary key values regardless |
|
1266 | - * of whether or not they have been modified. |
|
1267 | - * |
|
1268 | - * @throws LogicException if no primary key is defined |
|
1269 | - * |
|
1270 | - * @return Criteria The Criteria object containing value(s) for primary key(s). |
|
1271 | - */ |
|
1272 | - public function buildPkeyCriteria() |
|
1273 | - { |
|
1274 | - $criteria = ChildInputQuery::create(); |
|
1275 | - $criteria->add(InputTableMap::COL_UUID, $this->uuid); |
|
1276 | - |
|
1277 | - return $criteria; |
|
1278 | - } |
|
1279 | - |
|
1280 | - /** |
|
1281 | - * If the primary key is not null, return the hashcode of the |
|
1282 | - * primary key. Otherwise, return the hash code of the object. |
|
1283 | - * |
|
1284 | - * @return int Hashcode |
|
1285 | - */ |
|
1286 | - public function hashCode() |
|
1287 | - { |
|
1288 | - $validPk = null !== $this->getUuid(); |
|
1289 | - |
|
1290 | - $validPrimaryKeyFKs = 0; |
|
1291 | - $primaryKeyFKs = []; |
|
1292 | - |
|
1293 | - if ($validPk) { |
|
1294 | - return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE)); |
|
1295 | - } elseif ($validPrimaryKeyFKs) { |
|
1296 | - return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE)); |
|
1297 | - } |
|
1298 | - |
|
1299 | - return spl_object_hash($this); |
|
1300 | - } |
|
1301 | - |
|
1302 | - /** |
|
1303 | - * Returns the primary key for this object (row). |
|
1304 | - * @return string |
|
1305 | - */ |
|
1306 | - public function getPrimaryKey() |
|
1307 | - { |
|
1308 | - return $this->getUuid(); |
|
1309 | - } |
|
1310 | - |
|
1311 | - /** |
|
1312 | - * Generic method to set the primary key (uuid column). |
|
1313 | - * |
|
1314 | - * @param string $key Primary key. |
|
1315 | - * @return void |
|
1316 | - */ |
|
1317 | - public function setPrimaryKey($key) |
|
1318 | - { |
|
1319 | - $this->setUuid($key); |
|
1320 | - } |
|
1321 | - |
|
1322 | - /** |
|
1323 | - * Returns true if the primary key for this object is null. |
|
1324 | - * @return boolean |
|
1325 | - */ |
|
1326 | - public function isPrimaryKeyNull() |
|
1327 | - { |
|
1328 | - return null === $this->getUuid(); |
|
1329 | - } |
|
1330 | - |
|
1331 | - /** |
|
1332 | - * Sets contents of passed object to values from current object. |
|
1333 | - * |
|
1334 | - * If desired, this method can also make copies of all associated (fkey referrers) |
|
1335 | - * objects. |
|
1336 | - * |
|
1337 | - * @param object $copyObj An object of \Jalle19\StatusManager\Database\Input (or compatible) type. |
|
1338 | - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
|
1339 | - * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. |
|
1340 | - * @throws PropelException |
|
1341 | - */ |
|
1342 | - public function copyInto($copyObj, $deepCopy = false, $makeNew = true) |
|
1343 | - { |
|
1344 | - $copyObj->setUuid($this->getUuid()); |
|
1345 | - $copyObj->setInstanceName($this->getInstanceName()); |
|
1346 | - $copyObj->setStarted($this->getStarted()); |
|
1347 | - $copyObj->setInput($this->getInput()); |
|
1348 | - $copyObj->setNetwork($this->getNetwork()); |
|
1349 | - $copyObj->setMux($this->getMux()); |
|
1350 | - $copyObj->setWeight($this->getWeight()); |
|
1351 | - |
|
1352 | - if ($deepCopy) { |
|
1353 | - // important: temporarily setNew(false) because this affects the behavior of |
|
1354 | - // the getter/setter methods for fkey referrer objects. |
|
1355 | - $copyObj->setNew(false); |
|
1356 | - |
|
1357 | - foreach ($this->getSubscriptions() as $relObj) { |
|
1358 | - if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves |
|
1359 | - $copyObj->addSubscription($relObj->copy($deepCopy)); |
|
1360 | - } |
|
1361 | - } |
|
1362 | - |
|
1363 | - } // if ($deepCopy) |
|
1364 | - |
|
1365 | - if ($makeNew) { |
|
1366 | - $copyObj->setNew(true); |
|
1367 | - } |
|
1368 | - } |
|
1369 | - |
|
1370 | - /** |
|
1371 | - * Makes a copy of this object that will be inserted as a new row in table when saved. |
|
1372 | - * It creates a new object filling in the simple attributes, but skipping any primary |
|
1373 | - * keys that are defined for the table. |
|
1374 | - * |
|
1375 | - * If desired, this method can also make copies of all associated (fkey referrers) |
|
1376 | - * objects. |
|
1377 | - * |
|
1378 | - * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
|
1379 | - * @return \Jalle19\StatusManager\Database\Input Clone of current object. |
|
1380 | - * @throws PropelException |
|
1381 | - */ |
|
1382 | - public function copy($deepCopy = false) |
|
1383 | - { |
|
1384 | - // we use get_class(), because this might be a subclass |
|
1385 | - $clazz = get_class($this); |
|
1386 | - $copyObj = new $clazz(); |
|
1387 | - $this->copyInto($copyObj, $deepCopy); |
|
1388 | - |
|
1389 | - return $copyObj; |
|
1390 | - } |
|
1391 | - |
|
1392 | - /** |
|
1393 | - * Declares an association between this object and a ChildInstance object. |
|
1394 | - * |
|
1395 | - * @param ChildInstance $v |
|
1396 | - * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
1397 | - * @throws PropelException |
|
1398 | - */ |
|
1399 | - public function setInstance(ChildInstance $v = null) |
|
1400 | - { |
|
1401 | - if ($v === null) { |
|
1402 | - $this->setInstanceName(NULL); |
|
1403 | - } else { |
|
1404 | - $this->setInstanceName($v->getName()); |
|
1405 | - } |
|
1406 | - |
|
1407 | - $this->aInstance = $v; |
|
1408 | - |
|
1409 | - // Add binding for other direction of this n:n relationship. |
|
1410 | - // If this object has already been added to the ChildInstance object, it will not be re-added. |
|
1411 | - if ($v !== null) { |
|
1412 | - $v->addInput($this); |
|
1413 | - } |
|
1414 | - |
|
1415 | - |
|
1416 | - return $this; |
|
1417 | - } |
|
1418 | - |
|
1419 | - |
|
1420 | - /** |
|
1421 | - * Get the associated ChildInstance object |
|
1422 | - * |
|
1423 | - * @param ConnectionInterface $con Optional Connection object. |
|
1424 | - * @return ChildInstance The associated ChildInstance object. |
|
1425 | - * @throws PropelException |
|
1426 | - */ |
|
1427 | - public function getInstance(ConnectionInterface $con = null) |
|
1428 | - { |
|
1429 | - if ($this->aInstance === null && (($this->instance_name !== "" && $this->instance_name !== null))) { |
|
1430 | - $this->aInstance = ChildInstanceQuery::create()->findPk($this->instance_name, $con); |
|
1431 | - /* The following can be used additionally to |
|
621 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
622 | + * |
|
623 | + * @return int next starting column |
|
624 | + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. |
|
625 | + */ |
|
626 | + public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) |
|
627 | + { |
|
628 | + try { |
|
629 | + |
|
630 | + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : InputTableMap::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)]; |
|
631 | + $this->uuid = (null !== $col) ? (string) $col : null; |
|
632 | + |
|
633 | + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : InputTableMap::translateFieldName('InstanceName', TableMap::TYPE_PHPNAME, $indexType)]; |
|
634 | + $this->instance_name = (null !== $col) ? (string) $col : null; |
|
635 | + |
|
636 | + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : InputTableMap::translateFieldName('Started', TableMap::TYPE_PHPNAME, $indexType)]; |
|
637 | + $this->started = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null; |
|
638 | + |
|
639 | + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : InputTableMap::translateFieldName('Input', TableMap::TYPE_PHPNAME, $indexType)]; |
|
640 | + $this->input = (null !== $col) ? (string) $col : null; |
|
641 | + |
|
642 | + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : InputTableMap::translateFieldName('Network', TableMap::TYPE_PHPNAME, $indexType)]; |
|
643 | + $this->network = (null !== $col) ? (string) $col : null; |
|
644 | + |
|
645 | + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : InputTableMap::translateFieldName('Mux', TableMap::TYPE_PHPNAME, $indexType)]; |
|
646 | + $this->mux = (null !== $col) ? (string) $col : null; |
|
647 | + |
|
648 | + $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : InputTableMap::translateFieldName('Weight', TableMap::TYPE_PHPNAME, $indexType)]; |
|
649 | + $this->weight = (null !== $col) ? (int) $col : null; |
|
650 | + $this->resetModified(); |
|
651 | + |
|
652 | + $this->setNew(false); |
|
653 | + |
|
654 | + if ($rehydrate) { |
|
655 | + $this->ensureConsistency(); |
|
656 | + } |
|
657 | + |
|
658 | + return $startcol + 7; // 7 = InputTableMap::NUM_HYDRATE_COLUMNS. |
|
659 | + |
|
660 | + } catch (Exception $e) { |
|
661 | + throw new PropelException(sprintf('Error populating %s object', '\\Jalle19\\StatusManager\\Database\\Input'), 0, $e); |
|
662 | + } |
|
663 | + } |
|
664 | + |
|
665 | + /** |
|
666 | + * Checks and repairs the internal consistency of the object. |
|
667 | + * |
|
668 | + * This method is executed after an already-instantiated object is re-hydrated |
|
669 | + * from the database. It exists to check any foreign keys to make sure that |
|
670 | + * the objects related to the current object are correct based on foreign key. |
|
671 | + * |
|
672 | + * You can override this method in the stub class, but you should always invoke |
|
673 | + * the base method from the overridden method (i.e. parent::ensureConsistency()), |
|
674 | + * in case your model changes. |
|
675 | + * |
|
676 | + * @throws PropelException |
|
677 | + */ |
|
678 | + public function ensureConsistency() |
|
679 | + { |
|
680 | + if ($this->aInstance !== null && $this->instance_name !== $this->aInstance->getName()) { |
|
681 | + $this->aInstance = null; |
|
682 | + } |
|
683 | + } // ensureConsistency |
|
684 | + |
|
685 | + /** |
|
686 | + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. |
|
687 | + * |
|
688 | + * This will only work if the object has been saved and has a valid primary key set. |
|
689 | + * |
|
690 | + * @param boolean $deep (optional) Whether to also de-associated any related objects. |
|
691 | + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. |
|
692 | + * @return void |
|
693 | + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db |
|
694 | + */ |
|
695 | + public function reload($deep = false, ConnectionInterface $con = null) |
|
696 | + { |
|
697 | + if ($this->isDeleted()) { |
|
698 | + throw new PropelException("Cannot reload a deleted object."); |
|
699 | + } |
|
700 | + |
|
701 | + if ($this->isNew()) { |
|
702 | + throw new PropelException("Cannot reload an unsaved object."); |
|
703 | + } |
|
704 | + |
|
705 | + if ($con === null) { |
|
706 | + $con = Propel::getServiceContainer()->getReadConnection(InputTableMap::DATABASE_NAME); |
|
707 | + } |
|
708 | + |
|
709 | + // We don't need to alter the object instance pool; we're just modifying this instance |
|
710 | + // already in the pool. |
|
711 | + |
|
712 | + $dataFetcher = ChildInputQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); |
|
713 | + $row = $dataFetcher->fetch(); |
|
714 | + $dataFetcher->close(); |
|
715 | + if (!$row) { |
|
716 | + throw new PropelException('Cannot find matching row in the database to reload object values.'); |
|
717 | + } |
|
718 | + $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate |
|
719 | + |
|
720 | + if ($deep) { // also de-associate any related objects? |
|
721 | + |
|
722 | + $this->aInstance = null; |
|
723 | + $this->collSubscriptions = null; |
|
724 | + |
|
725 | + } // if (deep) |
|
726 | + } |
|
727 | + |
|
728 | + /** |
|
729 | + * Removes this object from datastore and sets delete attribute. |
|
730 | + * |
|
731 | + * @param ConnectionInterface $con |
|
732 | + * @return void |
|
733 | + * @throws PropelException |
|
734 | + * @see Input::setDeleted() |
|
735 | + * @see Input::isDeleted() |
|
736 | + */ |
|
737 | + public function delete(ConnectionInterface $con = null) |
|
738 | + { |
|
739 | + if ($this->isDeleted()) { |
|
740 | + throw new PropelException("This object has already been deleted."); |
|
741 | + } |
|
742 | + |
|
743 | + if ($con === null) { |
|
744 | + $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
|
745 | + } |
|
746 | + |
|
747 | + $con->transaction(function () use ($con) { |
|
748 | + $deleteQuery = ChildInputQuery::create() |
|
749 | + ->filterByPrimaryKey($this->getPrimaryKey()); |
|
750 | + $ret = $this->preDelete($con); |
|
751 | + if ($ret) { |
|
752 | + $deleteQuery->delete($con); |
|
753 | + $this->postDelete($con); |
|
754 | + $this->setDeleted(true); |
|
755 | + } |
|
756 | + }); |
|
757 | + } |
|
758 | + |
|
759 | + /** |
|
760 | + * Persists this object to the database. |
|
761 | + * |
|
762 | + * If the object is new, it inserts it; otherwise an update is performed. |
|
763 | + * All modified related objects will also be persisted in the doSave() |
|
764 | + * method. This method wraps all precipitate database operations in a |
|
765 | + * single transaction. |
|
766 | + * |
|
767 | + * @param ConnectionInterface $con |
|
768 | + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
|
769 | + * @throws PropelException |
|
770 | + * @see doSave() |
|
771 | + */ |
|
772 | + public function save(ConnectionInterface $con = null) |
|
773 | + { |
|
774 | + if ($this->isDeleted()) { |
|
775 | + throw new PropelException("You cannot save an object that has been deleted."); |
|
776 | + } |
|
777 | + |
|
778 | + if ($con === null) { |
|
779 | + $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
|
780 | + } |
|
781 | + |
|
782 | + return $con->transaction(function () use ($con) { |
|
783 | + $isInsert = $this->isNew(); |
|
784 | + $ret = $this->preSave($con); |
|
785 | + if ($isInsert) { |
|
786 | + $ret = $ret && $this->preInsert($con); |
|
787 | + } else { |
|
788 | + $ret = $ret && $this->preUpdate($con); |
|
789 | + } |
|
790 | + if ($ret) { |
|
791 | + $affectedRows = $this->doSave($con); |
|
792 | + if ($isInsert) { |
|
793 | + $this->postInsert($con); |
|
794 | + } else { |
|
795 | + $this->postUpdate($con); |
|
796 | + } |
|
797 | + $this->postSave($con); |
|
798 | + InputTableMap::addInstanceToPool($this); |
|
799 | + } else { |
|
800 | + $affectedRows = 0; |
|
801 | + } |
|
802 | + |
|
803 | + return $affectedRows; |
|
804 | + }); |
|
805 | + } |
|
806 | + |
|
807 | + /** |
|
808 | + * Performs the work of inserting or updating the row in the database. |
|
809 | + * |
|
810 | + * If the object is new, it inserts it; otherwise an update is performed. |
|
811 | + * All related objects are also updated in this method. |
|
812 | + * |
|
813 | + * @param ConnectionInterface $con |
|
814 | + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
|
815 | + * @throws PropelException |
|
816 | + * @see save() |
|
817 | + */ |
|
818 | + protected function doSave(ConnectionInterface $con) |
|
819 | + { |
|
820 | + $affectedRows = 0; // initialize var to track total num of affected rows |
|
821 | + if (!$this->alreadyInSave) { |
|
822 | + $this->alreadyInSave = true; |
|
823 | + |
|
824 | + // We call the save method on the following object(s) if they |
|
825 | + // were passed to this object by their corresponding set |
|
826 | + // method. This object relates to these object(s) by a |
|
827 | + // foreign key reference. |
|
828 | + |
|
829 | + if ($this->aInstance !== null) { |
|
830 | + if ($this->aInstance->isModified() || $this->aInstance->isNew()) { |
|
831 | + $affectedRows += $this->aInstance->save($con); |
|
832 | + } |
|
833 | + $this->setInstance($this->aInstance); |
|
834 | + } |
|
835 | + |
|
836 | + if ($this->isNew() || $this->isModified()) { |
|
837 | + // persist changes |
|
838 | + if ($this->isNew()) { |
|
839 | + $this->doInsert($con); |
|
840 | + $affectedRows += 1; |
|
841 | + } else { |
|
842 | + $affectedRows += $this->doUpdate($con); |
|
843 | + } |
|
844 | + $this->resetModified(); |
|
845 | + } |
|
846 | + |
|
847 | + if ($this->subscriptionsScheduledForDeletion !== null) { |
|
848 | + if (!$this->subscriptionsScheduledForDeletion->isEmpty()) { |
|
849 | + foreach ($this->subscriptionsScheduledForDeletion as $subscription) { |
|
850 | + // need to save related object because we set the relation to null |
|
851 | + $subscription->save($con); |
|
852 | + } |
|
853 | + $this->subscriptionsScheduledForDeletion = null; |
|
854 | + } |
|
855 | + } |
|
856 | + |
|
857 | + if ($this->collSubscriptions !== null) { |
|
858 | + foreach ($this->collSubscriptions as $referrerFK) { |
|
859 | + if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) { |
|
860 | + $affectedRows += $referrerFK->save($con); |
|
861 | + } |
|
862 | + } |
|
863 | + } |
|
864 | + |
|
865 | + $this->alreadyInSave = false; |
|
866 | + |
|
867 | + } |
|
868 | + |
|
869 | + return $affectedRows; |
|
870 | + } // doSave() |
|
871 | + |
|
872 | + /** |
|
873 | + * Insert the row in the database. |
|
874 | + * |
|
875 | + * @param ConnectionInterface $con |
|
876 | + * |
|
877 | + * @throws PropelException |
|
878 | + * @see doSave() |
|
879 | + */ |
|
880 | + protected function doInsert(ConnectionInterface $con) |
|
881 | + { |
|
882 | + $modifiedColumns = array(); |
|
883 | + $index = 0; |
|
884 | + |
|
885 | + |
|
886 | + // check the columns in natural order for more readable SQL queries |
|
887 | + if ($this->isColumnModified(InputTableMap::COL_UUID)) { |
|
888 | + $modifiedColumns[':p' . $index++] = 'uuid'; |
|
889 | + } |
|
890 | + if ($this->isColumnModified(InputTableMap::COL_INSTANCE_NAME)) { |
|
891 | + $modifiedColumns[':p' . $index++] = 'instance_name'; |
|
892 | + } |
|
893 | + if ($this->isColumnModified(InputTableMap::COL_STARTED)) { |
|
894 | + $modifiedColumns[':p' . $index++] = 'started'; |
|
895 | + } |
|
896 | + if ($this->isColumnModified(InputTableMap::COL_INPUT)) { |
|
897 | + $modifiedColumns[':p' . $index++] = 'input'; |
|
898 | + } |
|
899 | + if ($this->isColumnModified(InputTableMap::COL_NETWORK)) { |
|
900 | + $modifiedColumns[':p' . $index++] = 'network'; |
|
901 | + } |
|
902 | + if ($this->isColumnModified(InputTableMap::COL_MUX)) { |
|
903 | + $modifiedColumns[':p' . $index++] = 'mux'; |
|
904 | + } |
|
905 | + if ($this->isColumnModified(InputTableMap::COL_WEIGHT)) { |
|
906 | + $modifiedColumns[':p' . $index++] = 'weight'; |
|
907 | + } |
|
908 | + |
|
909 | + $sql = sprintf( |
|
910 | + 'INSERT INTO input (%s) VALUES (%s)', |
|
911 | + implode(', ', $modifiedColumns), |
|
912 | + implode(', ', array_keys($modifiedColumns)) |
|
913 | + ); |
|
914 | + |
|
915 | + try { |
|
916 | + $stmt = $con->prepare($sql); |
|
917 | + foreach ($modifiedColumns as $identifier => $columnName) { |
|
918 | + switch ($columnName) { |
|
919 | + case 'uuid': |
|
920 | + $stmt->bindValue($identifier, $this->uuid, PDO::PARAM_STR); |
|
921 | + break; |
|
922 | + case 'instance_name': |
|
923 | + $stmt->bindValue($identifier, $this->instance_name, PDO::PARAM_STR); |
|
924 | + break; |
|
925 | + case 'started': |
|
926 | + $stmt->bindValue($identifier, $this->started ? $this->started->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); |
|
927 | + break; |
|
928 | + case 'input': |
|
929 | + $stmt->bindValue($identifier, $this->input, PDO::PARAM_STR); |
|
930 | + break; |
|
931 | + case 'network': |
|
932 | + $stmt->bindValue($identifier, $this->network, PDO::PARAM_STR); |
|
933 | + break; |
|
934 | + case 'mux': |
|
935 | + $stmt->bindValue($identifier, $this->mux, PDO::PARAM_STR); |
|
936 | + break; |
|
937 | + case 'weight': |
|
938 | + $stmt->bindValue($identifier, $this->weight, PDO::PARAM_INT); |
|
939 | + break; |
|
940 | + } |
|
941 | + } |
|
942 | + $stmt->execute(); |
|
943 | + } catch (Exception $e) { |
|
944 | + Propel::log($e->getMessage(), Propel::LOG_ERR); |
|
945 | + throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); |
|
946 | + } |
|
947 | + |
|
948 | + $this->setNew(false); |
|
949 | + } |
|
950 | + |
|
951 | + /** |
|
952 | + * Update the row in the database. |
|
953 | + * |
|
954 | + * @param ConnectionInterface $con |
|
955 | + * |
|
956 | + * @return Integer Number of updated rows |
|
957 | + * @see doSave() |
|
958 | + */ |
|
959 | + protected function doUpdate(ConnectionInterface $con) |
|
960 | + { |
|
961 | + $selectCriteria = $this->buildPkeyCriteria(); |
|
962 | + $valuesCriteria = $this->buildCriteria(); |
|
963 | + |
|
964 | + return $selectCriteria->doUpdate($valuesCriteria, $con); |
|
965 | + } |
|
966 | + |
|
967 | + /** |
|
968 | + * Retrieves a field from the object by name passed in as a string. |
|
969 | + * |
|
970 | + * @param string $name name |
|
971 | + * @param string $type The type of fieldname the $name is of: |
|
972 | + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
973 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
974 | + * Defaults to TableMap::TYPE_PHPNAME. |
|
975 | + * @return mixed Value of field. |
|
976 | + */ |
|
977 | + public function getByName($name, $type = TableMap::TYPE_PHPNAME) |
|
978 | + { |
|
979 | + $pos = InputTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); |
|
980 | + $field = $this->getByPosition($pos); |
|
981 | + |
|
982 | + return $field; |
|
983 | + } |
|
984 | + |
|
985 | + /** |
|
986 | + * Retrieves a field from the object by Position as specified in the xml schema. |
|
987 | + * Zero-based. |
|
988 | + * |
|
989 | + * @param int $pos position in xml schema |
|
990 | + * @return mixed Value of field at $pos |
|
991 | + */ |
|
992 | + public function getByPosition($pos) |
|
993 | + { |
|
994 | + switch ($pos) { |
|
995 | + case 0: |
|
996 | + return $this->getUuid(); |
|
997 | + break; |
|
998 | + case 1: |
|
999 | + return $this->getInstanceName(); |
|
1000 | + break; |
|
1001 | + case 2: |
|
1002 | + return $this->getStarted(); |
|
1003 | + break; |
|
1004 | + case 3: |
|
1005 | + return $this->getInput(); |
|
1006 | + break; |
|
1007 | + case 4: |
|
1008 | + return $this->getNetwork(); |
|
1009 | + break; |
|
1010 | + case 5: |
|
1011 | + return $this->getMux(); |
|
1012 | + break; |
|
1013 | + case 6: |
|
1014 | + return $this->getWeight(); |
|
1015 | + break; |
|
1016 | + default: |
|
1017 | + return null; |
|
1018 | + break; |
|
1019 | + } // switch() |
|
1020 | + } |
|
1021 | + |
|
1022 | + /** |
|
1023 | + * Exports the object as an array. |
|
1024 | + * |
|
1025 | + * You can specify the key type of the array by passing one of the class |
|
1026 | + * type constants. |
|
1027 | + * |
|
1028 | + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
|
1029 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
1030 | + * Defaults to TableMap::TYPE_PHPNAME. |
|
1031 | + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. |
|
1032 | + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion |
|
1033 | + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. |
|
1034 | + * |
|
1035 | + * @return array an associative array containing the field names (as keys) and field values |
|
1036 | + */ |
|
1037 | + public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) |
|
1038 | + { |
|
1039 | + |
|
1040 | + if (isset($alreadyDumpedObjects['Input'][$this->hashCode()])) { |
|
1041 | + return '*RECURSION*'; |
|
1042 | + } |
|
1043 | + $alreadyDumpedObjects['Input'][$this->hashCode()] = true; |
|
1044 | + $keys = InputTableMap::getFieldNames($keyType); |
|
1045 | + $result = array( |
|
1046 | + $keys[0] => $this->getUuid(), |
|
1047 | + $keys[1] => $this->getInstanceName(), |
|
1048 | + $keys[2] => $this->getStarted(), |
|
1049 | + $keys[3] => $this->getInput(), |
|
1050 | + $keys[4] => $this->getNetwork(), |
|
1051 | + $keys[5] => $this->getMux(), |
|
1052 | + $keys[6] => $this->getWeight(), |
|
1053 | + ); |
|
1054 | + if ($result[$keys[2]] instanceof \DateTime) { |
|
1055 | + $result[$keys[2]] = $result[$keys[2]]->format('c'); |
|
1056 | + } |
|
1057 | + |
|
1058 | + $virtualColumns = $this->virtualColumns; |
|
1059 | + foreach ($virtualColumns as $key => $virtualColumn) { |
|
1060 | + $result[$key] = $virtualColumn; |
|
1061 | + } |
|
1062 | + |
|
1063 | + if ($includeForeignObjects) { |
|
1064 | + if (null !== $this->aInstance) { |
|
1065 | + |
|
1066 | + switch ($keyType) { |
|
1067 | + case TableMap::TYPE_CAMELNAME: |
|
1068 | + $key = 'instance'; |
|
1069 | + break; |
|
1070 | + case TableMap::TYPE_FIELDNAME: |
|
1071 | + $key = 'instance'; |
|
1072 | + break; |
|
1073 | + default: |
|
1074 | + $key = 'Instance'; |
|
1075 | + } |
|
1076 | + |
|
1077 | + $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
|
1078 | + } |
|
1079 | + if (null !== $this->collSubscriptions) { |
|
1080 | + |
|
1081 | + switch ($keyType) { |
|
1082 | + case TableMap::TYPE_CAMELNAME: |
|
1083 | + $key = 'subscriptions'; |
|
1084 | + break; |
|
1085 | + case TableMap::TYPE_FIELDNAME: |
|
1086 | + $key = 'subscriptions'; |
|
1087 | + break; |
|
1088 | + default: |
|
1089 | + $key = 'Subscriptions'; |
|
1090 | + } |
|
1091 | + |
|
1092 | + $result[$key] = $this->collSubscriptions->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects); |
|
1093 | + } |
|
1094 | + } |
|
1095 | + |
|
1096 | + return $result; |
|
1097 | + } |
|
1098 | + |
|
1099 | + /** |
|
1100 | + * Sets a field from the object by name passed in as a string. |
|
1101 | + * |
|
1102 | + * @param string $name |
|
1103 | + * @param mixed $value field value |
|
1104 | + * @param string $type The type of fieldname the $name is of: |
|
1105 | + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
1106 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
1107 | + * Defaults to TableMap::TYPE_PHPNAME. |
|
1108 | + * @return $this|\Jalle19\StatusManager\Database\Input |
|
1109 | + */ |
|
1110 | + public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) |
|
1111 | + { |
|
1112 | + $pos = InputTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); |
|
1113 | + |
|
1114 | + return $this->setByPosition($pos, $value); |
|
1115 | + } |
|
1116 | + |
|
1117 | + /** |
|
1118 | + * Sets a field from the object by Position as specified in the xml schema. |
|
1119 | + * Zero-based. |
|
1120 | + * |
|
1121 | + * @param int $pos position in xml schema |
|
1122 | + * @param mixed $value field value |
|
1123 | + * @return $this|\Jalle19\StatusManager\Database\Input |
|
1124 | + */ |
|
1125 | + public function setByPosition($pos, $value) |
|
1126 | + { |
|
1127 | + switch ($pos) { |
|
1128 | + case 0: |
|
1129 | + $this->setUuid($value); |
|
1130 | + break; |
|
1131 | + case 1: |
|
1132 | + $this->setInstanceName($value); |
|
1133 | + break; |
|
1134 | + case 2: |
|
1135 | + $this->setStarted($value); |
|
1136 | + break; |
|
1137 | + case 3: |
|
1138 | + $this->setInput($value); |
|
1139 | + break; |
|
1140 | + case 4: |
|
1141 | + $this->setNetwork($value); |
|
1142 | + break; |
|
1143 | + case 5: |
|
1144 | + $this->setMux($value); |
|
1145 | + break; |
|
1146 | + case 6: |
|
1147 | + $this->setWeight($value); |
|
1148 | + break; |
|
1149 | + } // switch() |
|
1150 | + |
|
1151 | + return $this; |
|
1152 | + } |
|
1153 | + |
|
1154 | + /** |
|
1155 | + * Populates the object using an array. |
|
1156 | + * |
|
1157 | + * This is particularly useful when populating an object from one of the |
|
1158 | + * request arrays (e.g. $_POST). This method goes through the column |
|
1159 | + * names, checking to see whether a matching key exists in populated |
|
1160 | + * array. If so the setByName() method is called for that column. |
|
1161 | + * |
|
1162 | + * You can specify the key type of the array by additionally passing one |
|
1163 | + * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
|
1164 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
1165 | + * The default key type is the column's TableMap::TYPE_PHPNAME. |
|
1166 | + * |
|
1167 | + * @param array $arr An array to populate the object from. |
|
1168 | + * @param string $keyType The type of keys the array uses. |
|
1169 | + * @return void |
|
1170 | + */ |
|
1171 | + public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) |
|
1172 | + { |
|
1173 | + $keys = InputTableMap::getFieldNames($keyType); |
|
1174 | + |
|
1175 | + if (array_key_exists($keys[0], $arr)) { |
|
1176 | + $this->setUuid($arr[$keys[0]]); |
|
1177 | + } |
|
1178 | + if (array_key_exists($keys[1], $arr)) { |
|
1179 | + $this->setInstanceName($arr[$keys[1]]); |
|
1180 | + } |
|
1181 | + if (array_key_exists($keys[2], $arr)) { |
|
1182 | + $this->setStarted($arr[$keys[2]]); |
|
1183 | + } |
|
1184 | + if (array_key_exists($keys[3], $arr)) { |
|
1185 | + $this->setInput($arr[$keys[3]]); |
|
1186 | + } |
|
1187 | + if (array_key_exists($keys[4], $arr)) { |
|
1188 | + $this->setNetwork($arr[$keys[4]]); |
|
1189 | + } |
|
1190 | + if (array_key_exists($keys[5], $arr)) { |
|
1191 | + $this->setMux($arr[$keys[5]]); |
|
1192 | + } |
|
1193 | + if (array_key_exists($keys[6], $arr)) { |
|
1194 | + $this->setWeight($arr[$keys[6]]); |
|
1195 | + } |
|
1196 | + } |
|
1197 | + |
|
1198 | + /** |
|
1199 | + * Populate the current object from a string, using a given parser format |
|
1200 | + * <code> |
|
1201 | + * $book = new Book(); |
|
1202 | + * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
|
1203 | + * </code> |
|
1204 | + * |
|
1205 | + * You can specify the key type of the array by additionally passing one |
|
1206 | + * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
|
1207 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
1208 | + * The default key type is the column's TableMap::TYPE_PHPNAME. |
|
1209 | + * |
|
1210 | + * @param mixed $parser A AbstractParser instance, |
|
1211 | + * or a format name ('XML', 'YAML', 'JSON', 'CSV') |
|
1212 | + * @param string $data The source data to import from |
|
1213 | + * @param string $keyType The type of keys the array uses. |
|
1214 | + * |
|
1215 | + * @return $this|\Jalle19\StatusManager\Database\Input The current object, for fluid interface |
|
1216 | + */ |
|
1217 | + public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) |
|
1218 | + { |
|
1219 | + if (!$parser instanceof AbstractParser) { |
|
1220 | + $parser = AbstractParser::getParser($parser); |
|
1221 | + } |
|
1222 | + |
|
1223 | + $this->fromArray($parser->toArray($data), $keyType); |
|
1224 | + |
|
1225 | + return $this; |
|
1226 | + } |
|
1227 | + |
|
1228 | + /** |
|
1229 | + * Build a Criteria object containing the values of all modified columns in this object. |
|
1230 | + * |
|
1231 | + * @return Criteria The Criteria object containing all modified values. |
|
1232 | + */ |
|
1233 | + public function buildCriteria() |
|
1234 | + { |
|
1235 | + $criteria = new Criteria(InputTableMap::DATABASE_NAME); |
|
1236 | + |
|
1237 | + if ($this->isColumnModified(InputTableMap::COL_UUID)) { |
|
1238 | + $criteria->add(InputTableMap::COL_UUID, $this->uuid); |
|
1239 | + } |
|
1240 | + if ($this->isColumnModified(InputTableMap::COL_INSTANCE_NAME)) { |
|
1241 | + $criteria->add(InputTableMap::COL_INSTANCE_NAME, $this->instance_name); |
|
1242 | + } |
|
1243 | + if ($this->isColumnModified(InputTableMap::COL_STARTED)) { |
|
1244 | + $criteria->add(InputTableMap::COL_STARTED, $this->started); |
|
1245 | + } |
|
1246 | + if ($this->isColumnModified(InputTableMap::COL_INPUT)) { |
|
1247 | + $criteria->add(InputTableMap::COL_INPUT, $this->input); |
|
1248 | + } |
|
1249 | + if ($this->isColumnModified(InputTableMap::COL_NETWORK)) { |
|
1250 | + $criteria->add(InputTableMap::COL_NETWORK, $this->network); |
|
1251 | + } |
|
1252 | + if ($this->isColumnModified(InputTableMap::COL_MUX)) { |
|
1253 | + $criteria->add(InputTableMap::COL_MUX, $this->mux); |
|
1254 | + } |
|
1255 | + if ($this->isColumnModified(InputTableMap::COL_WEIGHT)) { |
|
1256 | + $criteria->add(InputTableMap::COL_WEIGHT, $this->weight); |
|
1257 | + } |
|
1258 | + |
|
1259 | + return $criteria; |
|
1260 | + } |
|
1261 | + |
|
1262 | + /** |
|
1263 | + * Builds a Criteria object containing the primary key for this object. |
|
1264 | + * |
|
1265 | + * Unlike buildCriteria() this method includes the primary key values regardless |
|
1266 | + * of whether or not they have been modified. |
|
1267 | + * |
|
1268 | + * @throws LogicException if no primary key is defined |
|
1269 | + * |
|
1270 | + * @return Criteria The Criteria object containing value(s) for primary key(s). |
|
1271 | + */ |
|
1272 | + public function buildPkeyCriteria() |
|
1273 | + { |
|
1274 | + $criteria = ChildInputQuery::create(); |
|
1275 | + $criteria->add(InputTableMap::COL_UUID, $this->uuid); |
|
1276 | + |
|
1277 | + return $criteria; |
|
1278 | + } |
|
1279 | + |
|
1280 | + /** |
|
1281 | + * If the primary key is not null, return the hashcode of the |
|
1282 | + * primary key. Otherwise, return the hash code of the object. |
|
1283 | + * |
|
1284 | + * @return int Hashcode |
|
1285 | + */ |
|
1286 | + public function hashCode() |
|
1287 | + { |
|
1288 | + $validPk = null !== $this->getUuid(); |
|
1289 | + |
|
1290 | + $validPrimaryKeyFKs = 0; |
|
1291 | + $primaryKeyFKs = []; |
|
1292 | + |
|
1293 | + if ($validPk) { |
|
1294 | + return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE)); |
|
1295 | + } elseif ($validPrimaryKeyFKs) { |
|
1296 | + return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE)); |
|
1297 | + } |
|
1298 | + |
|
1299 | + return spl_object_hash($this); |
|
1300 | + } |
|
1301 | + |
|
1302 | + /** |
|
1303 | + * Returns the primary key for this object (row). |
|
1304 | + * @return string |
|
1305 | + */ |
|
1306 | + public function getPrimaryKey() |
|
1307 | + { |
|
1308 | + return $this->getUuid(); |
|
1309 | + } |
|
1310 | + |
|
1311 | + /** |
|
1312 | + * Generic method to set the primary key (uuid column). |
|
1313 | + * |
|
1314 | + * @param string $key Primary key. |
|
1315 | + * @return void |
|
1316 | + */ |
|
1317 | + public function setPrimaryKey($key) |
|
1318 | + { |
|
1319 | + $this->setUuid($key); |
|
1320 | + } |
|
1321 | + |
|
1322 | + /** |
|
1323 | + * Returns true if the primary key for this object is null. |
|
1324 | + * @return boolean |
|
1325 | + */ |
|
1326 | + public function isPrimaryKeyNull() |
|
1327 | + { |
|
1328 | + return null === $this->getUuid(); |
|
1329 | + } |
|
1330 | + |
|
1331 | + /** |
|
1332 | + * Sets contents of passed object to values from current object. |
|
1333 | + * |
|
1334 | + * If desired, this method can also make copies of all associated (fkey referrers) |
|
1335 | + * objects. |
|
1336 | + * |
|
1337 | + * @param object $copyObj An object of \Jalle19\StatusManager\Database\Input (or compatible) type. |
|
1338 | + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
|
1339 | + * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. |
|
1340 | + * @throws PropelException |
|
1341 | + */ |
|
1342 | + public function copyInto($copyObj, $deepCopy = false, $makeNew = true) |
|
1343 | + { |
|
1344 | + $copyObj->setUuid($this->getUuid()); |
|
1345 | + $copyObj->setInstanceName($this->getInstanceName()); |
|
1346 | + $copyObj->setStarted($this->getStarted()); |
|
1347 | + $copyObj->setInput($this->getInput()); |
|
1348 | + $copyObj->setNetwork($this->getNetwork()); |
|
1349 | + $copyObj->setMux($this->getMux()); |
|
1350 | + $copyObj->setWeight($this->getWeight()); |
|
1351 | + |
|
1352 | + if ($deepCopy) { |
|
1353 | + // important: temporarily setNew(false) because this affects the behavior of |
|
1354 | + // the getter/setter methods for fkey referrer objects. |
|
1355 | + $copyObj->setNew(false); |
|
1356 | + |
|
1357 | + foreach ($this->getSubscriptions() as $relObj) { |
|
1358 | + if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves |
|
1359 | + $copyObj->addSubscription($relObj->copy($deepCopy)); |
|
1360 | + } |
|
1361 | + } |
|
1362 | + |
|
1363 | + } // if ($deepCopy) |
|
1364 | + |
|
1365 | + if ($makeNew) { |
|
1366 | + $copyObj->setNew(true); |
|
1367 | + } |
|
1368 | + } |
|
1369 | + |
|
1370 | + /** |
|
1371 | + * Makes a copy of this object that will be inserted as a new row in table when saved. |
|
1372 | + * It creates a new object filling in the simple attributes, but skipping any primary |
|
1373 | + * keys that are defined for the table. |
|
1374 | + * |
|
1375 | + * If desired, this method can also make copies of all associated (fkey referrers) |
|
1376 | + * objects. |
|
1377 | + * |
|
1378 | + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
|
1379 | + * @return \Jalle19\StatusManager\Database\Input Clone of current object. |
|
1380 | + * @throws PropelException |
|
1381 | + */ |
|
1382 | + public function copy($deepCopy = false) |
|
1383 | + { |
|
1384 | + // we use get_class(), because this might be a subclass |
|
1385 | + $clazz = get_class($this); |
|
1386 | + $copyObj = new $clazz(); |
|
1387 | + $this->copyInto($copyObj, $deepCopy); |
|
1388 | + |
|
1389 | + return $copyObj; |
|
1390 | + } |
|
1391 | + |
|
1392 | + /** |
|
1393 | + * Declares an association between this object and a ChildInstance object. |
|
1394 | + * |
|
1395 | + * @param ChildInstance $v |
|
1396 | + * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
1397 | + * @throws PropelException |
|
1398 | + */ |
|
1399 | + public function setInstance(ChildInstance $v = null) |
|
1400 | + { |
|
1401 | + if ($v === null) { |
|
1402 | + $this->setInstanceName(NULL); |
|
1403 | + } else { |
|
1404 | + $this->setInstanceName($v->getName()); |
|
1405 | + } |
|
1406 | + |
|
1407 | + $this->aInstance = $v; |
|
1408 | + |
|
1409 | + // Add binding for other direction of this n:n relationship. |
|
1410 | + // If this object has already been added to the ChildInstance object, it will not be re-added. |
|
1411 | + if ($v !== null) { |
|
1412 | + $v->addInput($this); |
|
1413 | + } |
|
1414 | + |
|
1415 | + |
|
1416 | + return $this; |
|
1417 | + } |
|
1418 | + |
|
1419 | + |
|
1420 | + /** |
|
1421 | + * Get the associated ChildInstance object |
|
1422 | + * |
|
1423 | + * @param ConnectionInterface $con Optional Connection object. |
|
1424 | + * @return ChildInstance The associated ChildInstance object. |
|
1425 | + * @throws PropelException |
|
1426 | + */ |
|
1427 | + public function getInstance(ConnectionInterface $con = null) |
|
1428 | + { |
|
1429 | + if ($this->aInstance === null && (($this->instance_name !== "" && $this->instance_name !== null))) { |
|
1430 | + $this->aInstance = ChildInstanceQuery::create()->findPk($this->instance_name, $con); |
|
1431 | + /* The following can be used additionally to |
|
1432 | 1432 | guarantee the related object contains a reference |
1433 | 1433 | to this object. This level of coupling may, however, be |
1434 | 1434 | undesirable since it could result in an only partially populated collection |
1435 | 1435 | in the referenced object. |
1436 | 1436 | $this->aInstance->addInputs($this); |
1437 | 1437 | */ |
1438 | - } |
|
1439 | - |
|
1440 | - return $this->aInstance; |
|
1441 | - } |
|
1442 | - |
|
1443 | - |
|
1444 | - /** |
|
1445 | - * Initializes a collection based on the name of a relation. |
|
1446 | - * Avoids crafting an 'init[$relationName]s' method name |
|
1447 | - * that wouldn't work when StandardEnglishPluralizer is used. |
|
1448 | - * |
|
1449 | - * @param string $relationName The name of the relation to initialize |
|
1450 | - * @return void |
|
1451 | - */ |
|
1452 | - public function initRelation($relationName) |
|
1453 | - { |
|
1454 | - if ('Subscription' == $relationName) { |
|
1455 | - return $this->initSubscriptions(); |
|
1456 | - } |
|
1457 | - } |
|
1458 | - |
|
1459 | - /** |
|
1460 | - * Clears out the collSubscriptions collection |
|
1461 | - * |
|
1462 | - * This does not modify the database; however, it will remove any associated objects, causing |
|
1463 | - * them to be refetched by subsequent calls to accessor method. |
|
1464 | - * |
|
1465 | - * @return void |
|
1466 | - * @see addSubscriptions() |
|
1467 | - */ |
|
1468 | - public function clearSubscriptions() |
|
1469 | - { |
|
1470 | - $this->collSubscriptions = null; // important to set this to NULL since that means it is uninitialized |
|
1471 | - } |
|
1472 | - |
|
1473 | - /** |
|
1474 | - * Reset is the collSubscriptions collection loaded partially. |
|
1475 | - */ |
|
1476 | - public function resetPartialSubscriptions($v = true) |
|
1477 | - { |
|
1478 | - $this->collSubscriptionsPartial = $v; |
|
1479 | - } |
|
1480 | - |
|
1481 | - /** |
|
1482 | - * Initializes the collSubscriptions collection. |
|
1483 | - * |
|
1484 | - * By default this just sets the collSubscriptions collection to an empty array (like clearcollSubscriptions()); |
|
1485 | - * however, you may wish to override this method in your stub class to provide setting appropriate |
|
1486 | - * to your application -- for example, setting the initial array to the values stored in database. |
|
1487 | - * |
|
1488 | - * @param boolean $overrideExisting If set to true, the method call initializes |
|
1489 | - * the collection even if it is not empty |
|
1490 | - * |
|
1491 | - * @return void |
|
1492 | - */ |
|
1493 | - public function initSubscriptions($overrideExisting = true) |
|
1494 | - { |
|
1495 | - if (null !== $this->collSubscriptions && !$overrideExisting) { |
|
1496 | - return; |
|
1497 | - } |
|
1498 | - |
|
1499 | - $collectionClassName = SubscriptionTableMap::getTableMap()->getCollectionClassName(); |
|
1500 | - |
|
1501 | - $this->collSubscriptions = new $collectionClassName; |
|
1502 | - $this->collSubscriptions->setModel('\Jalle19\StatusManager\Database\Subscription'); |
|
1503 | - } |
|
1504 | - |
|
1505 | - /** |
|
1506 | - * Gets an array of ChildSubscription objects which contain a foreign key that references this object. |
|
1507 | - * |
|
1508 | - * If the $criteria is not null, it is used to always fetch the results from the database. |
|
1509 | - * Otherwise the results are fetched from the database the first time, then cached. |
|
1510 | - * Next time the same method is called without $criteria, the cached collection is returned. |
|
1511 | - * If this ChildInput is new, it will return |
|
1512 | - * an empty collection or the current collection; the criteria is ignored on a new object. |
|
1513 | - * |
|
1514 | - * @param Criteria $criteria optional Criteria object to narrow the query |
|
1515 | - * @param ConnectionInterface $con optional connection object |
|
1516 | - * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects |
|
1517 | - * @throws PropelException |
|
1518 | - */ |
|
1519 | - public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null) |
|
1520 | - { |
|
1521 | - $partial = $this->collSubscriptionsPartial && !$this->isNew(); |
|
1522 | - if (null === $this->collSubscriptions || null !== $criteria || $partial) { |
|
1523 | - if ($this->isNew() && null === $this->collSubscriptions) { |
|
1524 | - // return empty collection |
|
1525 | - $this->initSubscriptions(); |
|
1526 | - } else { |
|
1527 | - $collSubscriptions = ChildSubscriptionQuery::create(null, $criteria) |
|
1528 | - ->filterByInput($this) |
|
1529 | - ->find($con); |
|
1530 | - |
|
1531 | - if (null !== $criteria) { |
|
1532 | - if (false !== $this->collSubscriptionsPartial && count($collSubscriptions)) { |
|
1533 | - $this->initSubscriptions(false); |
|
1534 | - |
|
1535 | - foreach ($collSubscriptions as $obj) { |
|
1536 | - if (false == $this->collSubscriptions->contains($obj)) { |
|
1537 | - $this->collSubscriptions->append($obj); |
|
1538 | - } |
|
1539 | - } |
|
1540 | - |
|
1541 | - $this->collSubscriptionsPartial = true; |
|
1542 | - } |
|
1543 | - |
|
1544 | - return $collSubscriptions; |
|
1545 | - } |
|
1546 | - |
|
1547 | - if ($partial && $this->collSubscriptions) { |
|
1548 | - foreach ($this->collSubscriptions as $obj) { |
|
1549 | - if ($obj->isNew()) { |
|
1550 | - $collSubscriptions[] = $obj; |
|
1551 | - } |
|
1552 | - } |
|
1553 | - } |
|
1554 | - |
|
1555 | - $this->collSubscriptions = $collSubscriptions; |
|
1556 | - $this->collSubscriptionsPartial = false; |
|
1557 | - } |
|
1558 | - } |
|
1559 | - |
|
1560 | - return $this->collSubscriptions; |
|
1561 | - } |
|
1562 | - |
|
1563 | - /** |
|
1564 | - * Sets a collection of ChildSubscription objects related by a one-to-many relationship |
|
1565 | - * to the current object. |
|
1566 | - * It will also schedule objects for deletion based on a diff between old objects (aka persisted) |
|
1567 | - * and new objects from the given Propel collection. |
|
1568 | - * |
|
1569 | - * @param Collection $subscriptions A Propel collection. |
|
1570 | - * @param ConnectionInterface $con Optional connection object |
|
1571 | - * @return $this|ChildInput The current object (for fluent API support) |
|
1572 | - */ |
|
1573 | - public function setSubscriptions(Collection $subscriptions, ConnectionInterface $con = null) |
|
1574 | - { |
|
1575 | - /** @var ChildSubscription[] $subscriptionsToDelete */ |
|
1576 | - $subscriptionsToDelete = $this->getSubscriptions(new Criteria(), $con)->diff($subscriptions); |
|
1577 | - |
|
1578 | - |
|
1579 | - $this->subscriptionsScheduledForDeletion = $subscriptionsToDelete; |
|
1580 | - |
|
1581 | - foreach ($subscriptionsToDelete as $subscriptionRemoved) { |
|
1582 | - $subscriptionRemoved->setInput(null); |
|
1583 | - } |
|
1584 | - |
|
1585 | - $this->collSubscriptions = null; |
|
1586 | - foreach ($subscriptions as $subscription) { |
|
1587 | - $this->addSubscription($subscription); |
|
1588 | - } |
|
1589 | - |
|
1590 | - $this->collSubscriptions = $subscriptions; |
|
1591 | - $this->collSubscriptionsPartial = false; |
|
1592 | - |
|
1593 | - return $this; |
|
1594 | - } |
|
1595 | - |
|
1596 | - /** |
|
1597 | - * Returns the number of related Subscription objects. |
|
1598 | - * |
|
1599 | - * @param Criteria $criteria |
|
1600 | - * @param boolean $distinct |
|
1601 | - * @param ConnectionInterface $con |
|
1602 | - * @return int Count of related Subscription objects. |
|
1603 | - * @throws PropelException |
|
1604 | - */ |
|
1605 | - public function countSubscriptions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) |
|
1606 | - { |
|
1607 | - $partial = $this->collSubscriptionsPartial && !$this->isNew(); |
|
1608 | - if (null === $this->collSubscriptions || null !== $criteria || $partial) { |
|
1609 | - if ($this->isNew() && null === $this->collSubscriptions) { |
|
1610 | - return 0; |
|
1611 | - } |
|
1612 | - |
|
1613 | - if ($partial && !$criteria) { |
|
1614 | - return count($this->getSubscriptions()); |
|
1615 | - } |
|
1616 | - |
|
1617 | - $query = ChildSubscriptionQuery::create(null, $criteria); |
|
1618 | - if ($distinct) { |
|
1619 | - $query->distinct(); |
|
1620 | - } |
|
1621 | - |
|
1622 | - return $query |
|
1623 | - ->filterByInput($this) |
|
1624 | - ->count($con); |
|
1625 | - } |
|
1626 | - |
|
1627 | - return count($this->collSubscriptions); |
|
1628 | - } |
|
1629 | - |
|
1630 | - /** |
|
1631 | - * Method called to associate a ChildSubscription object to this object |
|
1632 | - * through the ChildSubscription foreign key attribute. |
|
1633 | - * |
|
1634 | - * @param ChildSubscription $l ChildSubscription |
|
1635 | - * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
1636 | - */ |
|
1637 | - public function addSubscription(ChildSubscription $l) |
|
1638 | - { |
|
1639 | - if ($this->collSubscriptions === null) { |
|
1640 | - $this->initSubscriptions(); |
|
1641 | - $this->collSubscriptionsPartial = true; |
|
1642 | - } |
|
1643 | - |
|
1644 | - if (!$this->collSubscriptions->contains($l)) { |
|
1645 | - $this->doAddSubscription($l); |
|
1646 | - |
|
1647 | - if ($this->subscriptionsScheduledForDeletion and $this->subscriptionsScheduledForDeletion->contains($l)) { |
|
1648 | - $this->subscriptionsScheduledForDeletion->remove($this->subscriptionsScheduledForDeletion->search($l)); |
|
1649 | - } |
|
1650 | - } |
|
1651 | - |
|
1652 | - return $this; |
|
1653 | - } |
|
1654 | - |
|
1655 | - /** |
|
1656 | - * @param ChildSubscription $subscription The ChildSubscription object to add. |
|
1657 | - */ |
|
1658 | - protected function doAddSubscription(ChildSubscription $subscription) |
|
1659 | - { |
|
1660 | - $this->collSubscriptions[]= $subscription; |
|
1661 | - $subscription->setInput($this); |
|
1662 | - } |
|
1663 | - |
|
1664 | - /** |
|
1665 | - * @param ChildSubscription $subscription The ChildSubscription object to remove. |
|
1666 | - * @return $this|ChildInput The current object (for fluent API support) |
|
1667 | - */ |
|
1668 | - public function removeSubscription(ChildSubscription $subscription) |
|
1669 | - { |
|
1670 | - if ($this->getSubscriptions()->contains($subscription)) { |
|
1671 | - $pos = $this->collSubscriptions->search($subscription); |
|
1672 | - $this->collSubscriptions->remove($pos); |
|
1673 | - if (null === $this->subscriptionsScheduledForDeletion) { |
|
1674 | - $this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions; |
|
1675 | - $this->subscriptionsScheduledForDeletion->clear(); |
|
1676 | - } |
|
1677 | - $this->subscriptionsScheduledForDeletion[]= $subscription; |
|
1678 | - $subscription->setInput(null); |
|
1679 | - } |
|
1680 | - |
|
1681 | - return $this; |
|
1682 | - } |
|
1683 | - |
|
1684 | - |
|
1685 | - /** |
|
1686 | - * If this collection has already been initialized with |
|
1687 | - * an identical criteria, it returns the collection. |
|
1688 | - * Otherwise if this Input is new, it will return |
|
1689 | - * an empty collection; or if this Input has previously |
|
1690 | - * been saved, it will retrieve related Subscriptions from storage. |
|
1691 | - * |
|
1692 | - * This method is protected by default in order to keep the public |
|
1693 | - * api reasonable. You can provide public methods for those you |
|
1694 | - * actually need in Input. |
|
1695 | - * |
|
1696 | - * @param Criteria $criteria optional Criteria object to narrow the query |
|
1697 | - * @param ConnectionInterface $con optional connection object |
|
1698 | - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
|
1699 | - * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects |
|
1700 | - */ |
|
1701 | - public function getSubscriptionsJoinInstance(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
1702 | - { |
|
1703 | - $query = ChildSubscriptionQuery::create(null, $criteria); |
|
1704 | - $query->joinWith('Instance', $joinBehavior); |
|
1705 | - |
|
1706 | - return $this->getSubscriptions($query, $con); |
|
1707 | - } |
|
1708 | - |
|
1709 | - |
|
1710 | - /** |
|
1711 | - * If this collection has already been initialized with |
|
1712 | - * an identical criteria, it returns the collection. |
|
1713 | - * Otherwise if this Input is new, it will return |
|
1714 | - * an empty collection; or if this Input has previously |
|
1715 | - * been saved, it will retrieve related Subscriptions from storage. |
|
1716 | - * |
|
1717 | - * This method is protected by default in order to keep the public |
|
1718 | - * api reasonable. You can provide public methods for those you |
|
1719 | - * actually need in Input. |
|
1720 | - * |
|
1721 | - * @param Criteria $criteria optional Criteria object to narrow the query |
|
1722 | - * @param ConnectionInterface $con optional connection object |
|
1723 | - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
|
1724 | - * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects |
|
1725 | - */ |
|
1726 | - public function getSubscriptionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
1727 | - { |
|
1728 | - $query = ChildSubscriptionQuery::create(null, $criteria); |
|
1729 | - $query->joinWith('User', $joinBehavior); |
|
1730 | - |
|
1731 | - return $this->getSubscriptions($query, $con); |
|
1732 | - } |
|
1733 | - |
|
1734 | - |
|
1735 | - /** |
|
1736 | - * If this collection has already been initialized with |
|
1737 | - * an identical criteria, it returns the collection. |
|
1738 | - * Otherwise if this Input is new, it will return |
|
1739 | - * an empty collection; or if this Input has previously |
|
1740 | - * been saved, it will retrieve related Subscriptions from storage. |
|
1741 | - * |
|
1742 | - * This method is protected by default in order to keep the public |
|
1743 | - * api reasonable. You can provide public methods for those you |
|
1744 | - * actually need in Input. |
|
1745 | - * |
|
1746 | - * @param Criteria $criteria optional Criteria object to narrow the query |
|
1747 | - * @param ConnectionInterface $con optional connection object |
|
1748 | - * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
|
1749 | - * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects |
|
1750 | - */ |
|
1751 | - public function getSubscriptionsJoinChannel(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
1752 | - { |
|
1753 | - $query = ChildSubscriptionQuery::create(null, $criteria); |
|
1754 | - $query->joinWith('Channel', $joinBehavior); |
|
1755 | - |
|
1756 | - return $this->getSubscriptions($query, $con); |
|
1757 | - } |
|
1758 | - |
|
1759 | - /** |
|
1760 | - * Clears the current object, sets all attributes to their default values and removes |
|
1761 | - * outgoing references as well as back-references (from other objects to this one. Results probably in a database |
|
1762 | - * change of those foreign objects when you call `save` there). |
|
1763 | - */ |
|
1764 | - public function clear() |
|
1765 | - { |
|
1766 | - if (null !== $this->aInstance) { |
|
1767 | - $this->aInstance->removeInput($this); |
|
1768 | - } |
|
1769 | - $this->uuid = null; |
|
1770 | - $this->instance_name = null; |
|
1771 | - $this->started = null; |
|
1772 | - $this->input = null; |
|
1773 | - $this->network = null; |
|
1774 | - $this->mux = null; |
|
1775 | - $this->weight = null; |
|
1776 | - $this->alreadyInSave = false; |
|
1777 | - $this->clearAllReferences(); |
|
1778 | - $this->resetModified(); |
|
1779 | - $this->setNew(true); |
|
1780 | - $this->setDeleted(false); |
|
1781 | - } |
|
1782 | - |
|
1783 | - /** |
|
1784 | - * Resets all references and back-references to other model objects or collections of model objects. |
|
1785 | - * |
|
1786 | - * This method is used to reset all php object references (not the actual reference in the database). |
|
1787 | - * Necessary for object serialisation. |
|
1788 | - * |
|
1789 | - * @param boolean $deep Whether to also clear the references on all referrer objects. |
|
1790 | - */ |
|
1791 | - public function clearAllReferences($deep = false) |
|
1792 | - { |
|
1793 | - if ($deep) { |
|
1794 | - if ($this->collSubscriptions) { |
|
1795 | - foreach ($this->collSubscriptions as $o) { |
|
1796 | - $o->clearAllReferences($deep); |
|
1797 | - } |
|
1798 | - } |
|
1799 | - } // if ($deep) |
|
1800 | - |
|
1801 | - $this->collSubscriptions = null; |
|
1802 | - $this->aInstance = null; |
|
1803 | - } |
|
1804 | - |
|
1805 | - /** |
|
1806 | - * Return the string representation of this object |
|
1807 | - * |
|
1808 | - * @return string |
|
1809 | - */ |
|
1810 | - public function __toString() |
|
1811 | - { |
|
1812 | - return (string) $this->exportTo(InputTableMap::DEFAULT_STRING_FORMAT); |
|
1813 | - } |
|
1814 | - |
|
1815 | - /** |
|
1816 | - * Code to be run before persisting the object |
|
1817 | - * @param ConnectionInterface $con |
|
1818 | - * @return boolean |
|
1819 | - */ |
|
1820 | - public function preSave(ConnectionInterface $con = null) |
|
1821 | - { |
|
1822 | - return true; |
|
1823 | - } |
|
1824 | - |
|
1825 | - /** |
|
1826 | - * Code to be run after persisting the object |
|
1827 | - * @param ConnectionInterface $con |
|
1828 | - */ |
|
1829 | - public function postSave(ConnectionInterface $con = null) |
|
1830 | - { |
|
1831 | - |
|
1832 | - } |
|
1833 | - |
|
1834 | - /** |
|
1835 | - * Code to be run before inserting to database |
|
1836 | - * @param ConnectionInterface $con |
|
1837 | - * @return boolean |
|
1838 | - */ |
|
1839 | - public function preInsert(ConnectionInterface $con = null) |
|
1840 | - { |
|
1841 | - return true; |
|
1842 | - } |
|
1843 | - |
|
1844 | - /** |
|
1845 | - * Code to be run after inserting to database |
|
1846 | - * @param ConnectionInterface $con |
|
1847 | - */ |
|
1848 | - public function postInsert(ConnectionInterface $con = null) |
|
1849 | - { |
|
1850 | - |
|
1851 | - } |
|
1852 | - |
|
1853 | - /** |
|
1854 | - * Code to be run before updating the object in database |
|
1855 | - * @param ConnectionInterface $con |
|
1856 | - * @return boolean |
|
1857 | - */ |
|
1858 | - public function preUpdate(ConnectionInterface $con = null) |
|
1859 | - { |
|
1860 | - return true; |
|
1861 | - } |
|
1862 | - |
|
1863 | - /** |
|
1864 | - * Code to be run after updating the object in database |
|
1865 | - * @param ConnectionInterface $con |
|
1866 | - */ |
|
1867 | - public function postUpdate(ConnectionInterface $con = null) |
|
1868 | - { |
|
1869 | - |
|
1870 | - } |
|
1871 | - |
|
1872 | - /** |
|
1873 | - * Code to be run before deleting the object in database |
|
1874 | - * @param ConnectionInterface $con |
|
1875 | - * @return boolean |
|
1876 | - */ |
|
1877 | - public function preDelete(ConnectionInterface $con = null) |
|
1878 | - { |
|
1879 | - return true; |
|
1880 | - } |
|
1881 | - |
|
1882 | - /** |
|
1883 | - * Code to be run after deleting the object in database |
|
1884 | - * @param ConnectionInterface $con |
|
1885 | - */ |
|
1886 | - public function postDelete(ConnectionInterface $con = null) |
|
1887 | - { |
|
1888 | - |
|
1889 | - } |
|
1890 | - |
|
1891 | - |
|
1892 | - /** |
|
1893 | - * Derived method to catches calls to undefined methods. |
|
1894 | - * |
|
1895 | - * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). |
|
1896 | - * Allows to define default __call() behavior if you overwrite __call() |
|
1897 | - * |
|
1898 | - * @param string $name |
|
1899 | - * @param mixed $params |
|
1900 | - * |
|
1901 | - * @return array|string |
|
1902 | - */ |
|
1903 | - public function __call($name, $params) |
|
1904 | - { |
|
1905 | - if (0 === strpos($name, 'get')) { |
|
1906 | - $virtualColumn = substr($name, 3); |
|
1907 | - if ($this->hasVirtualColumn($virtualColumn)) { |
|
1908 | - return $this->getVirtualColumn($virtualColumn); |
|
1909 | - } |
|
1910 | - |
|
1911 | - $virtualColumn = lcfirst($virtualColumn); |
|
1912 | - if ($this->hasVirtualColumn($virtualColumn)) { |
|
1913 | - return $this->getVirtualColumn($virtualColumn); |
|
1914 | - } |
|
1915 | - } |
|
1916 | - |
|
1917 | - if (0 === strpos($name, 'from')) { |
|
1918 | - $format = substr($name, 4); |
|
1919 | - |
|
1920 | - return $this->importFrom($format, reset($params)); |
|
1921 | - } |
|
1922 | - |
|
1923 | - if (0 === strpos($name, 'to')) { |
|
1924 | - $format = substr($name, 2); |
|
1925 | - $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; |
|
1926 | - |
|
1927 | - return $this->exportTo($format, $includeLazyLoadColumns); |
|
1928 | - } |
|
1929 | - |
|
1930 | - throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); |
|
1931 | - } |
|
1438 | + } |
|
1439 | + |
|
1440 | + return $this->aInstance; |
|
1441 | + } |
|
1442 | + |
|
1443 | + |
|
1444 | + /** |
|
1445 | + * Initializes a collection based on the name of a relation. |
|
1446 | + * Avoids crafting an 'init[$relationName]s' method name |
|
1447 | + * that wouldn't work when StandardEnglishPluralizer is used. |
|
1448 | + * |
|
1449 | + * @param string $relationName The name of the relation to initialize |
|
1450 | + * @return void |
|
1451 | + */ |
|
1452 | + public function initRelation($relationName) |
|
1453 | + { |
|
1454 | + if ('Subscription' == $relationName) { |
|
1455 | + return $this->initSubscriptions(); |
|
1456 | + } |
|
1457 | + } |
|
1458 | + |
|
1459 | + /** |
|
1460 | + * Clears out the collSubscriptions collection |
|
1461 | + * |
|
1462 | + * This does not modify the database; however, it will remove any associated objects, causing |
|
1463 | + * them to be refetched by subsequent calls to accessor method. |
|
1464 | + * |
|
1465 | + * @return void |
|
1466 | + * @see addSubscriptions() |
|
1467 | + */ |
|
1468 | + public function clearSubscriptions() |
|
1469 | + { |
|
1470 | + $this->collSubscriptions = null; // important to set this to NULL since that means it is uninitialized |
|
1471 | + } |
|
1472 | + |
|
1473 | + /** |
|
1474 | + * Reset is the collSubscriptions collection loaded partially. |
|
1475 | + */ |
|
1476 | + public function resetPartialSubscriptions($v = true) |
|
1477 | + { |
|
1478 | + $this->collSubscriptionsPartial = $v; |
|
1479 | + } |
|
1480 | + |
|
1481 | + /** |
|
1482 | + * Initializes the collSubscriptions collection. |
|
1483 | + * |
|
1484 | + * By default this just sets the collSubscriptions collection to an empty array (like clearcollSubscriptions()); |
|
1485 | + * however, you may wish to override this method in your stub class to provide setting appropriate |
|
1486 | + * to your application -- for example, setting the initial array to the values stored in database. |
|
1487 | + * |
|
1488 | + * @param boolean $overrideExisting If set to true, the method call initializes |
|
1489 | + * the collection even if it is not empty |
|
1490 | + * |
|
1491 | + * @return void |
|
1492 | + */ |
|
1493 | + public function initSubscriptions($overrideExisting = true) |
|
1494 | + { |
|
1495 | + if (null !== $this->collSubscriptions && !$overrideExisting) { |
|
1496 | + return; |
|
1497 | + } |
|
1498 | + |
|
1499 | + $collectionClassName = SubscriptionTableMap::getTableMap()->getCollectionClassName(); |
|
1500 | + |
|
1501 | + $this->collSubscriptions = new $collectionClassName; |
|
1502 | + $this->collSubscriptions->setModel('\Jalle19\StatusManager\Database\Subscription'); |
|
1503 | + } |
|
1504 | + |
|
1505 | + /** |
|
1506 | + * Gets an array of ChildSubscription objects which contain a foreign key that references this object. |
|
1507 | + * |
|
1508 | + * If the $criteria is not null, it is used to always fetch the results from the database. |
|
1509 | + * Otherwise the results are fetched from the database the first time, then cached. |
|
1510 | + * Next time the same method is called without $criteria, the cached collection is returned. |
|
1511 | + * If this ChildInput is new, it will return |
|
1512 | + * an empty collection or the current collection; the criteria is ignored on a new object. |
|
1513 | + * |
|
1514 | + * @param Criteria $criteria optional Criteria object to narrow the query |
|
1515 | + * @param ConnectionInterface $con optional connection object |
|
1516 | + * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects |
|
1517 | + * @throws PropelException |
|
1518 | + */ |
|
1519 | + public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null) |
|
1520 | + { |
|
1521 | + $partial = $this->collSubscriptionsPartial && !$this->isNew(); |
|
1522 | + if (null === $this->collSubscriptions || null !== $criteria || $partial) { |
|
1523 | + if ($this->isNew() && null === $this->collSubscriptions) { |
|
1524 | + // return empty collection |
|
1525 | + $this->initSubscriptions(); |
|
1526 | + } else { |
|
1527 | + $collSubscriptions = ChildSubscriptionQuery::create(null, $criteria) |
|
1528 | + ->filterByInput($this) |
|
1529 | + ->find($con); |
|
1530 | + |
|
1531 | + if (null !== $criteria) { |
|
1532 | + if (false !== $this->collSubscriptionsPartial && count($collSubscriptions)) { |
|
1533 | + $this->initSubscriptions(false); |
|
1534 | + |
|
1535 | + foreach ($collSubscriptions as $obj) { |
|
1536 | + if (false == $this->collSubscriptions->contains($obj)) { |
|
1537 | + $this->collSubscriptions->append($obj); |
|
1538 | + } |
|
1539 | + } |
|
1540 | + |
|
1541 | + $this->collSubscriptionsPartial = true; |
|
1542 | + } |
|
1543 | + |
|
1544 | + return $collSubscriptions; |
|
1545 | + } |
|
1546 | + |
|
1547 | + if ($partial && $this->collSubscriptions) { |
|
1548 | + foreach ($this->collSubscriptions as $obj) { |
|
1549 | + if ($obj->isNew()) { |
|
1550 | + $collSubscriptions[] = $obj; |
|
1551 | + } |
|
1552 | + } |
|
1553 | + } |
|
1554 | + |
|
1555 | + $this->collSubscriptions = $collSubscriptions; |
|
1556 | + $this->collSubscriptionsPartial = false; |
|
1557 | + } |
|
1558 | + } |
|
1559 | + |
|
1560 | + return $this->collSubscriptions; |
|
1561 | + } |
|
1562 | + |
|
1563 | + /** |
|
1564 | + * Sets a collection of ChildSubscription objects related by a one-to-many relationship |
|
1565 | + * to the current object. |
|
1566 | + * It will also schedule objects for deletion based on a diff between old objects (aka persisted) |
|
1567 | + * and new objects from the given Propel collection. |
|
1568 | + * |
|
1569 | + * @param Collection $subscriptions A Propel collection. |
|
1570 | + * @param ConnectionInterface $con Optional connection object |
|
1571 | + * @return $this|ChildInput The current object (for fluent API support) |
|
1572 | + */ |
|
1573 | + public function setSubscriptions(Collection $subscriptions, ConnectionInterface $con = null) |
|
1574 | + { |
|
1575 | + /** @var ChildSubscription[] $subscriptionsToDelete */ |
|
1576 | + $subscriptionsToDelete = $this->getSubscriptions(new Criteria(), $con)->diff($subscriptions); |
|
1577 | + |
|
1578 | + |
|
1579 | + $this->subscriptionsScheduledForDeletion = $subscriptionsToDelete; |
|
1580 | + |
|
1581 | + foreach ($subscriptionsToDelete as $subscriptionRemoved) { |
|
1582 | + $subscriptionRemoved->setInput(null); |
|
1583 | + } |
|
1584 | + |
|
1585 | + $this->collSubscriptions = null; |
|
1586 | + foreach ($subscriptions as $subscription) { |
|
1587 | + $this->addSubscription($subscription); |
|
1588 | + } |
|
1589 | + |
|
1590 | + $this->collSubscriptions = $subscriptions; |
|
1591 | + $this->collSubscriptionsPartial = false; |
|
1592 | + |
|
1593 | + return $this; |
|
1594 | + } |
|
1595 | + |
|
1596 | + /** |
|
1597 | + * Returns the number of related Subscription objects. |
|
1598 | + * |
|
1599 | + * @param Criteria $criteria |
|
1600 | + * @param boolean $distinct |
|
1601 | + * @param ConnectionInterface $con |
|
1602 | + * @return int Count of related Subscription objects. |
|
1603 | + * @throws PropelException |
|
1604 | + */ |
|
1605 | + public function countSubscriptions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) |
|
1606 | + { |
|
1607 | + $partial = $this->collSubscriptionsPartial && !$this->isNew(); |
|
1608 | + if (null === $this->collSubscriptions || null !== $criteria || $partial) { |
|
1609 | + if ($this->isNew() && null === $this->collSubscriptions) { |
|
1610 | + return 0; |
|
1611 | + } |
|
1612 | + |
|
1613 | + if ($partial && !$criteria) { |
|
1614 | + return count($this->getSubscriptions()); |
|
1615 | + } |
|
1616 | + |
|
1617 | + $query = ChildSubscriptionQuery::create(null, $criteria); |
|
1618 | + if ($distinct) { |
|
1619 | + $query->distinct(); |
|
1620 | + } |
|
1621 | + |
|
1622 | + return $query |
|
1623 | + ->filterByInput($this) |
|
1624 | + ->count($con); |
|
1625 | + } |
|
1626 | + |
|
1627 | + return count($this->collSubscriptions); |
|
1628 | + } |
|
1629 | + |
|
1630 | + /** |
|
1631 | + * Method called to associate a ChildSubscription object to this object |
|
1632 | + * through the ChildSubscription foreign key attribute. |
|
1633 | + * |
|
1634 | + * @param ChildSubscription $l ChildSubscription |
|
1635 | + * @return $this|\Jalle19\StatusManager\Database\Input The current object (for fluent API support) |
|
1636 | + */ |
|
1637 | + public function addSubscription(ChildSubscription $l) |
|
1638 | + { |
|
1639 | + if ($this->collSubscriptions === null) { |
|
1640 | + $this->initSubscriptions(); |
|
1641 | + $this->collSubscriptionsPartial = true; |
|
1642 | + } |
|
1643 | + |
|
1644 | + if (!$this->collSubscriptions->contains($l)) { |
|
1645 | + $this->doAddSubscription($l); |
|
1646 | + |
|
1647 | + if ($this->subscriptionsScheduledForDeletion and $this->subscriptionsScheduledForDeletion->contains($l)) { |
|
1648 | + $this->subscriptionsScheduledForDeletion->remove($this->subscriptionsScheduledForDeletion->search($l)); |
|
1649 | + } |
|
1650 | + } |
|
1651 | + |
|
1652 | + return $this; |
|
1653 | + } |
|
1654 | + |
|
1655 | + /** |
|
1656 | + * @param ChildSubscription $subscription The ChildSubscription object to add. |
|
1657 | + */ |
|
1658 | + protected function doAddSubscription(ChildSubscription $subscription) |
|
1659 | + { |
|
1660 | + $this->collSubscriptions[]= $subscription; |
|
1661 | + $subscription->setInput($this); |
|
1662 | + } |
|
1663 | + |
|
1664 | + /** |
|
1665 | + * @param ChildSubscription $subscription The ChildSubscription object to remove. |
|
1666 | + * @return $this|ChildInput The current object (for fluent API support) |
|
1667 | + */ |
|
1668 | + public function removeSubscription(ChildSubscription $subscription) |
|
1669 | + { |
|
1670 | + if ($this->getSubscriptions()->contains($subscription)) { |
|
1671 | + $pos = $this->collSubscriptions->search($subscription); |
|
1672 | + $this->collSubscriptions->remove($pos); |
|
1673 | + if (null === $this->subscriptionsScheduledForDeletion) { |
|
1674 | + $this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions; |
|
1675 | + $this->subscriptionsScheduledForDeletion->clear(); |
|
1676 | + } |
|
1677 | + $this->subscriptionsScheduledForDeletion[]= $subscription; |
|
1678 | + $subscription->setInput(null); |
|
1679 | + } |
|
1680 | + |
|
1681 | + return $this; |
|
1682 | + } |
|
1683 | + |
|
1684 | + |
|
1685 | + /** |
|
1686 | + * If this collection has already been initialized with |
|
1687 | + * an identical criteria, it returns the collection. |
|
1688 | + * Otherwise if this Input is new, it will return |
|
1689 | + * an empty collection; or if this Input has previously |
|
1690 | + * been saved, it will retrieve related Subscriptions from storage. |
|
1691 | + * |
|
1692 | + * This method is protected by default in order to keep the public |
|
1693 | + * api reasonable. You can provide public methods for those you |
|
1694 | + * actually need in Input. |
|
1695 | + * |
|
1696 | + * @param Criteria $criteria optional Criteria object to narrow the query |
|
1697 | + * @param ConnectionInterface $con optional connection object |
|
1698 | + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
|
1699 | + * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects |
|
1700 | + */ |
|
1701 | + public function getSubscriptionsJoinInstance(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
1702 | + { |
|
1703 | + $query = ChildSubscriptionQuery::create(null, $criteria); |
|
1704 | + $query->joinWith('Instance', $joinBehavior); |
|
1705 | + |
|
1706 | + return $this->getSubscriptions($query, $con); |
|
1707 | + } |
|
1708 | + |
|
1709 | + |
|
1710 | + /** |
|
1711 | + * If this collection has already been initialized with |
|
1712 | + * an identical criteria, it returns the collection. |
|
1713 | + * Otherwise if this Input is new, it will return |
|
1714 | + * an empty collection; or if this Input has previously |
|
1715 | + * been saved, it will retrieve related Subscriptions from storage. |
|
1716 | + * |
|
1717 | + * This method is protected by default in order to keep the public |
|
1718 | + * api reasonable. You can provide public methods for those you |
|
1719 | + * actually need in Input. |
|
1720 | + * |
|
1721 | + * @param Criteria $criteria optional Criteria object to narrow the query |
|
1722 | + * @param ConnectionInterface $con optional connection object |
|
1723 | + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
|
1724 | + * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects |
|
1725 | + */ |
|
1726 | + public function getSubscriptionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
1727 | + { |
|
1728 | + $query = ChildSubscriptionQuery::create(null, $criteria); |
|
1729 | + $query->joinWith('User', $joinBehavior); |
|
1730 | + |
|
1731 | + return $this->getSubscriptions($query, $con); |
|
1732 | + } |
|
1733 | + |
|
1734 | + |
|
1735 | + /** |
|
1736 | + * If this collection has already been initialized with |
|
1737 | + * an identical criteria, it returns the collection. |
|
1738 | + * Otherwise if this Input is new, it will return |
|
1739 | + * an empty collection; or if this Input has previously |
|
1740 | + * been saved, it will retrieve related Subscriptions from storage. |
|
1741 | + * |
|
1742 | + * This method is protected by default in order to keep the public |
|
1743 | + * api reasonable. You can provide public methods for those you |
|
1744 | + * actually need in Input. |
|
1745 | + * |
|
1746 | + * @param Criteria $criteria optional Criteria object to narrow the query |
|
1747 | + * @param ConnectionInterface $con optional connection object |
|
1748 | + * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
|
1749 | + * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects |
|
1750 | + */ |
|
1751 | + public function getSubscriptionsJoinChannel(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
1752 | + { |
|
1753 | + $query = ChildSubscriptionQuery::create(null, $criteria); |
|
1754 | + $query->joinWith('Channel', $joinBehavior); |
|
1755 | + |
|
1756 | + return $this->getSubscriptions($query, $con); |
|
1757 | + } |
|
1758 | + |
|
1759 | + /** |
|
1760 | + * Clears the current object, sets all attributes to their default values and removes |
|
1761 | + * outgoing references as well as back-references (from other objects to this one. Results probably in a database |
|
1762 | + * change of those foreign objects when you call `save` there). |
|
1763 | + */ |
|
1764 | + public function clear() |
|
1765 | + { |
|
1766 | + if (null !== $this->aInstance) { |
|
1767 | + $this->aInstance->removeInput($this); |
|
1768 | + } |
|
1769 | + $this->uuid = null; |
|
1770 | + $this->instance_name = null; |
|
1771 | + $this->started = null; |
|
1772 | + $this->input = null; |
|
1773 | + $this->network = null; |
|
1774 | + $this->mux = null; |
|
1775 | + $this->weight = null; |
|
1776 | + $this->alreadyInSave = false; |
|
1777 | + $this->clearAllReferences(); |
|
1778 | + $this->resetModified(); |
|
1779 | + $this->setNew(true); |
|
1780 | + $this->setDeleted(false); |
|
1781 | + } |
|
1782 | + |
|
1783 | + /** |
|
1784 | + * Resets all references and back-references to other model objects or collections of model objects. |
|
1785 | + * |
|
1786 | + * This method is used to reset all php object references (not the actual reference in the database). |
|
1787 | + * Necessary for object serialisation. |
|
1788 | + * |
|
1789 | + * @param boolean $deep Whether to also clear the references on all referrer objects. |
|
1790 | + */ |
|
1791 | + public function clearAllReferences($deep = false) |
|
1792 | + { |
|
1793 | + if ($deep) { |
|
1794 | + if ($this->collSubscriptions) { |
|
1795 | + foreach ($this->collSubscriptions as $o) { |
|
1796 | + $o->clearAllReferences($deep); |
|
1797 | + } |
|
1798 | + } |
|
1799 | + } // if ($deep) |
|
1800 | + |
|
1801 | + $this->collSubscriptions = null; |
|
1802 | + $this->aInstance = null; |
|
1803 | + } |
|
1804 | + |
|
1805 | + /** |
|
1806 | + * Return the string representation of this object |
|
1807 | + * |
|
1808 | + * @return string |
|
1809 | + */ |
|
1810 | + public function __toString() |
|
1811 | + { |
|
1812 | + return (string) $this->exportTo(InputTableMap::DEFAULT_STRING_FORMAT); |
|
1813 | + } |
|
1814 | + |
|
1815 | + /** |
|
1816 | + * Code to be run before persisting the object |
|
1817 | + * @param ConnectionInterface $con |
|
1818 | + * @return boolean |
|
1819 | + */ |
|
1820 | + public function preSave(ConnectionInterface $con = null) |
|
1821 | + { |
|
1822 | + return true; |
|
1823 | + } |
|
1824 | + |
|
1825 | + /** |
|
1826 | + * Code to be run after persisting the object |
|
1827 | + * @param ConnectionInterface $con |
|
1828 | + */ |
|
1829 | + public function postSave(ConnectionInterface $con = null) |
|
1830 | + { |
|
1831 | + |
|
1832 | + } |
|
1833 | + |
|
1834 | + /** |
|
1835 | + * Code to be run before inserting to database |
|
1836 | + * @param ConnectionInterface $con |
|
1837 | + * @return boolean |
|
1838 | + */ |
|
1839 | + public function preInsert(ConnectionInterface $con = null) |
|
1840 | + { |
|
1841 | + return true; |
|
1842 | + } |
|
1843 | + |
|
1844 | + /** |
|
1845 | + * Code to be run after inserting to database |
|
1846 | + * @param ConnectionInterface $con |
|
1847 | + */ |
|
1848 | + public function postInsert(ConnectionInterface $con = null) |
|
1849 | + { |
|
1850 | + |
|
1851 | + } |
|
1852 | + |
|
1853 | + /** |
|
1854 | + * Code to be run before updating the object in database |
|
1855 | + * @param ConnectionInterface $con |
|
1856 | + * @return boolean |
|
1857 | + */ |
|
1858 | + public function preUpdate(ConnectionInterface $con = null) |
|
1859 | + { |
|
1860 | + return true; |
|
1861 | + } |
|
1862 | + |
|
1863 | + /** |
|
1864 | + * Code to be run after updating the object in database |
|
1865 | + * @param ConnectionInterface $con |
|
1866 | + */ |
|
1867 | + public function postUpdate(ConnectionInterface $con = null) |
|
1868 | + { |
|
1869 | + |
|
1870 | + } |
|
1871 | + |
|
1872 | + /** |
|
1873 | + * Code to be run before deleting the object in database |
|
1874 | + * @param ConnectionInterface $con |
|
1875 | + * @return boolean |
|
1876 | + */ |
|
1877 | + public function preDelete(ConnectionInterface $con = null) |
|
1878 | + { |
|
1879 | + return true; |
|
1880 | + } |
|
1881 | + |
|
1882 | + /** |
|
1883 | + * Code to be run after deleting the object in database |
|
1884 | + * @param ConnectionInterface $con |
|
1885 | + */ |
|
1886 | + public function postDelete(ConnectionInterface $con = null) |
|
1887 | + { |
|
1888 | + |
|
1889 | + } |
|
1890 | + |
|
1891 | + |
|
1892 | + /** |
|
1893 | + * Derived method to catches calls to undefined methods. |
|
1894 | + * |
|
1895 | + * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). |
|
1896 | + * Allows to define default __call() behavior if you overwrite __call() |
|
1897 | + * |
|
1898 | + * @param string $name |
|
1899 | + * @param mixed $params |
|
1900 | + * |
|
1901 | + * @return array|string |
|
1902 | + */ |
|
1903 | + public function __call($name, $params) |
|
1904 | + { |
|
1905 | + if (0 === strpos($name, 'get')) { |
|
1906 | + $virtualColumn = substr($name, 3); |
|
1907 | + if ($this->hasVirtualColumn($virtualColumn)) { |
|
1908 | + return $this->getVirtualColumn($virtualColumn); |
|
1909 | + } |
|
1910 | + |
|
1911 | + $virtualColumn = lcfirst($virtualColumn); |
|
1912 | + if ($this->hasVirtualColumn($virtualColumn)) { |
|
1913 | + return $this->getVirtualColumn($virtualColumn); |
|
1914 | + } |
|
1915 | + } |
|
1916 | + |
|
1917 | + if (0 === strpos($name, 'from')) { |
|
1918 | + $format = substr($name, 4); |
|
1919 | + |
|
1920 | + return $this->importFrom($format, reset($params)); |
|
1921 | + } |
|
1922 | + |
|
1923 | + if (0 === strpos($name, 'to')) { |
|
1924 | + $format = substr($name, 2); |
|
1925 | + $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; |
|
1926 | + |
|
1927 | + return $this->exportTo($format, $includeLazyLoadColumns); |
|
1928 | + } |
|
1929 | + |
|
1930 | + throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); |
|
1931 | + } |
|
1932 | 1932 | |
1933 | 1933 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $propertyNames = []; |
361 | 361 | $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC)); |
362 | 362 | |
363 | - foreach($serializableProperties as $property) { |
|
363 | + foreach ($serializableProperties as $property) { |
|
364 | 364 | $propertyNames[] = $property->getName(); |
365 | 365 | } |
366 | 366 | |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
745 | 745 | } |
746 | 746 | |
747 | - $con->transaction(function () use ($con) { |
|
747 | + $con->transaction(function() use ($con) { |
|
748 | 748 | $deleteQuery = ChildInputQuery::create() |
749 | 749 | ->filterByPrimaryKey($this->getPrimaryKey()); |
750 | 750 | $ret = $this->preDelete($con); |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
780 | 780 | } |
781 | 781 | |
782 | - return $con->transaction(function () use ($con) { |
|
782 | + return $con->transaction(function() use ($con) { |
|
783 | 783 | $isInsert = $this->isNew(); |
784 | 784 | $ret = $this->preSave($con); |
785 | 785 | if ($isInsert) { |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | $key = 'Instance'; |
1075 | 1075 | } |
1076 | 1076 | |
1077 | - $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
|
1077 | + $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
|
1078 | 1078 | } |
1079 | 1079 | if (null !== $this->collSubscriptions) { |
1080 | 1080 | |
@@ -1519,7 +1519,7 @@ discard block |
||
1519 | 1519 | public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null) |
1520 | 1520 | { |
1521 | 1521 | $partial = $this->collSubscriptionsPartial && !$this->isNew(); |
1522 | - if (null === $this->collSubscriptions || null !== $criteria || $partial) { |
|
1522 | + if (null === $this->collSubscriptions || null !== $criteria || $partial) { |
|
1523 | 1523 | if ($this->isNew() && null === $this->collSubscriptions) { |
1524 | 1524 | // return empty collection |
1525 | 1525 | $this->initSubscriptions(); |
@@ -1657,7 +1657,7 @@ discard block |
||
1657 | 1657 | */ |
1658 | 1658 | protected function doAddSubscription(ChildSubscription $subscription) |
1659 | 1659 | { |
1660 | - $this->collSubscriptions[]= $subscription; |
|
1660 | + $this->collSubscriptions[] = $subscription; |
|
1661 | 1661 | $subscription->setInput($this); |
1662 | 1662 | } |
1663 | 1663 | |
@@ -1674,7 +1674,7 @@ discard block |
||
1674 | 1674 | $this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions; |
1675 | 1675 | $this->subscriptionsScheduledForDeletion->clear(); |
1676 | 1676 | } |
1677 | - $this->subscriptionsScheduledForDeletion[]= $subscription; |
|
1677 | + $this->subscriptionsScheduledForDeletion[] = $subscription; |
|
1678 | 1678 | $subscription->setInput(null); |
1679 | 1679 | } |
1680 | 1680 |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * $obj = $c->findPk(12, $con); |
149 | 149 | * </code> |
150 | 150 | * |
151 | - * @param mixed $key Primary key to use for the query |
|
151 | + * @param string $key Primary key to use for the query |
|
152 | 152 | * @param ConnectionInterface $con an optional connection object |
153 | 153 | * |
154 | 154 | * @return ChildInput|array|mixed the result, formatted by the current formatter |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | /** |
511 | 511 | * Filter the query by a related \Jalle19\StatusManager\Database\Instance object |
512 | 512 | * |
513 | - * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter |
|
513 | + * @param Instance $instance The related object(s) to use as filter |
|
514 | 514 | * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
515 | 515 | * |
516 | 516 | * @throws \Propel\Runtime\Exception\PropelException |
@@ -76,7 +76,6 @@ discard block |
||
76 | 76 | * @method ChildInput findOneByNetwork(string $network) Return the first ChildInput filtered by the network column |
77 | 77 | * @method ChildInput findOneByMux(string $mux) Return the first ChildInput filtered by the mux column |
78 | 78 | * @method ChildInput findOneByWeight(int $weight) Return the first ChildInput filtered by the weight column * |
79 | - |
|
80 | 79 | * @method ChildInput requirePk($key, ConnectionInterface $con = null) Return the ChildInput by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
81 | 80 | * @method ChildInput requireOne(ConnectionInterface $con = null) Return the first ChildInput matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found |
82 | 81 | * |
@@ -101,637 +100,637 @@ discard block |
||
101 | 100 | */ |
102 | 101 | abstract class InputQuery extends ModelCriteria |
103 | 102 | { |
104 | - protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException'; |
|
105 | - |
|
106 | - /** |
|
107 | - * Initializes internal state of \Jalle19\StatusManager\Database\Base\InputQuery object. |
|
108 | - * |
|
109 | - * @param string $dbName The database name |
|
110 | - * @param string $modelName The phpName of a model, e.g. 'Book' |
|
111 | - * @param string $modelAlias The alias for the model in this query, e.g. 'b' |
|
112 | - */ |
|
113 | - public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Input', $modelAlias = null) |
|
114 | - { |
|
115 | - parent::__construct($dbName, $modelName, $modelAlias); |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * Returns a new ChildInputQuery object. |
|
120 | - * |
|
121 | - * @param string $modelAlias The alias of a model in the query |
|
122 | - * @param Criteria $criteria Optional Criteria to build the query from |
|
123 | - * |
|
124 | - * @return ChildInputQuery |
|
125 | - */ |
|
126 | - public static function create($modelAlias = null, Criteria $criteria = null) |
|
127 | - { |
|
128 | - if ($criteria instanceof ChildInputQuery) { |
|
129 | - return $criteria; |
|
130 | - } |
|
131 | - $query = new ChildInputQuery(); |
|
132 | - if (null !== $modelAlias) { |
|
133 | - $query->setModelAlias($modelAlias); |
|
134 | - } |
|
135 | - if ($criteria instanceof Criteria) { |
|
136 | - $query->mergeWith($criteria); |
|
137 | - } |
|
138 | - |
|
139 | - return $query; |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * Find object by primary key. |
|
144 | - * Propel uses the instance pool to skip the database if the object exists. |
|
145 | - * Go fast if the query is untouched. |
|
146 | - * |
|
147 | - * <code> |
|
148 | - * $obj = $c->findPk(12, $con); |
|
149 | - * </code> |
|
150 | - * |
|
151 | - * @param mixed $key Primary key to use for the query |
|
152 | - * @param ConnectionInterface $con an optional connection object |
|
153 | - * |
|
154 | - * @return ChildInput|array|mixed the result, formatted by the current formatter |
|
155 | - */ |
|
156 | - public function findPk($key, ConnectionInterface $con = null) |
|
157 | - { |
|
158 | - if ($key === null) { |
|
159 | - return null; |
|
160 | - } |
|
161 | - if ((null !== ($obj = InputTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) { |
|
162 | - // the object is already in the instance pool |
|
163 | - return $obj; |
|
164 | - } |
|
165 | - if ($con === null) { |
|
166 | - $con = Propel::getServiceContainer()->getReadConnection(InputTableMap::DATABASE_NAME); |
|
167 | - } |
|
168 | - $this->basePreSelect($con); |
|
169 | - if ($this->formatter || $this->modelAlias || $this->with || $this->select |
|
170 | - || $this->selectColumns || $this->asColumns || $this->selectModifiers |
|
171 | - || $this->map || $this->having || $this->joins) { |
|
172 | - return $this->findPkComplex($key, $con); |
|
173 | - } else { |
|
174 | - return $this->findPkSimple($key, $con); |
|
175 | - } |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * Find object by primary key using raw SQL to go fast. |
|
180 | - * Bypass doSelect() and the object formatter by using generated code. |
|
181 | - * |
|
182 | - * @param mixed $key Primary key to use for the query |
|
183 | - * @param ConnectionInterface $con A connection object |
|
184 | - * |
|
185 | - * @throws \Propel\Runtime\Exception\PropelException |
|
186 | - * |
|
187 | - * @return ChildInput A model object, or null if the key is not found |
|
188 | - */ |
|
189 | - protected function findPkSimple($key, ConnectionInterface $con) |
|
190 | - { |
|
191 | - $sql = 'SELECT uuid, instance_name, started, input, network, mux, weight FROM input WHERE uuid = :p0'; |
|
192 | - try { |
|
193 | - $stmt = $con->prepare($sql); |
|
194 | - $stmt->bindValue(':p0', $key, PDO::PARAM_STR); |
|
195 | - $stmt->execute(); |
|
196 | - } catch (Exception $e) { |
|
197 | - Propel::log($e->getMessage(), Propel::LOG_ERR); |
|
198 | - throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); |
|
199 | - } |
|
200 | - $obj = null; |
|
201 | - if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { |
|
202 | - /** @var ChildInput $obj */ |
|
203 | - $obj = new ChildInput(); |
|
204 | - $obj->hydrate($row); |
|
205 | - InputTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key); |
|
206 | - } |
|
207 | - $stmt->closeCursor(); |
|
208 | - |
|
209 | - return $obj; |
|
210 | - } |
|
211 | - |
|
212 | - /** |
|
213 | - * Find object by primary key. |
|
214 | - * |
|
215 | - * @param mixed $key Primary key to use for the query |
|
216 | - * @param ConnectionInterface $con A connection object |
|
217 | - * |
|
218 | - * @return ChildInput|array|mixed the result, formatted by the current formatter |
|
219 | - */ |
|
220 | - protected function findPkComplex($key, ConnectionInterface $con) |
|
221 | - { |
|
222 | - // As the query uses a PK condition, no limit(1) is necessary. |
|
223 | - $criteria = $this->isKeepQuery() ? clone $this : $this; |
|
224 | - $dataFetcher = $criteria |
|
225 | - ->filterByPrimaryKey($key) |
|
226 | - ->doSelect($con); |
|
227 | - |
|
228 | - return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); |
|
229 | - } |
|
230 | - |
|
231 | - /** |
|
232 | - * Find objects by primary key |
|
233 | - * <code> |
|
234 | - * $objs = $c->findPks(array(12, 56, 832), $con); |
|
235 | - * </code> |
|
236 | - * @param array $keys Primary keys to use for the query |
|
237 | - * @param ConnectionInterface $con an optional connection object |
|
238 | - * |
|
239 | - * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter |
|
240 | - */ |
|
241 | - public function findPks($keys, ConnectionInterface $con = null) |
|
242 | - { |
|
243 | - if (null === $con) { |
|
244 | - $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); |
|
245 | - } |
|
246 | - $this->basePreSelect($con); |
|
247 | - $criteria = $this->isKeepQuery() ? clone $this : $this; |
|
248 | - $dataFetcher = $criteria |
|
249 | - ->filterByPrimaryKeys($keys) |
|
250 | - ->doSelect($con); |
|
251 | - |
|
252 | - return $criteria->getFormatter()->init($criteria)->format($dataFetcher); |
|
253 | - } |
|
254 | - |
|
255 | - /** |
|
256 | - * Filter the query by primary key |
|
257 | - * |
|
258 | - * @param mixed $key Primary key to use for the query |
|
259 | - * |
|
260 | - * @return $this|ChildInputQuery The current query, for fluid interface |
|
261 | - */ |
|
262 | - public function filterByPrimaryKey($key) |
|
263 | - { |
|
264 | - |
|
265 | - return $this->addUsingAlias(InputTableMap::COL_UUID, $key, Criteria::EQUAL); |
|
266 | - } |
|
267 | - |
|
268 | - /** |
|
269 | - * Filter the query by a list of primary keys |
|
270 | - * |
|
271 | - * @param array $keys The list of primary key to use for the query |
|
272 | - * |
|
273 | - * @return $this|ChildInputQuery The current query, for fluid interface |
|
274 | - */ |
|
275 | - public function filterByPrimaryKeys($keys) |
|
276 | - { |
|
277 | - |
|
278 | - return $this->addUsingAlias(InputTableMap::COL_UUID, $keys, Criteria::IN); |
|
279 | - } |
|
280 | - |
|
281 | - /** |
|
282 | - * Filter the query on the uuid column |
|
283 | - * |
|
284 | - * Example usage: |
|
285 | - * <code> |
|
286 | - * $query->filterByUuid('fooValue'); // WHERE uuid = 'fooValue' |
|
287 | - * $query->filterByUuid('%fooValue%'); // WHERE uuid LIKE '%fooValue%' |
|
288 | - * </code> |
|
289 | - * |
|
290 | - * @param string $uuid The value to use as filter. |
|
291 | - * Accepts wildcards (* and % trigger a LIKE) |
|
292 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
293 | - * |
|
294 | - * @return $this|ChildInputQuery The current query, for fluid interface |
|
295 | - */ |
|
296 | - public function filterByUuid($uuid = null, $comparison = null) |
|
297 | - { |
|
298 | - if (null === $comparison) { |
|
299 | - if (is_array($uuid)) { |
|
300 | - $comparison = Criteria::IN; |
|
301 | - } elseif (preg_match('/[\%\*]/', $uuid)) { |
|
302 | - $uuid = str_replace('*', '%', $uuid); |
|
303 | - $comparison = Criteria::LIKE; |
|
304 | - } |
|
305 | - } |
|
306 | - |
|
307 | - return $this->addUsingAlias(InputTableMap::COL_UUID, $uuid, $comparison); |
|
308 | - } |
|
309 | - |
|
310 | - /** |
|
311 | - * Filter the query on the instance_name column |
|
312 | - * |
|
313 | - * Example usage: |
|
314 | - * <code> |
|
315 | - * $query->filterByInstanceName('fooValue'); // WHERE instance_name = 'fooValue' |
|
316 | - * $query->filterByInstanceName('%fooValue%'); // WHERE instance_name LIKE '%fooValue%' |
|
317 | - * </code> |
|
318 | - * |
|
319 | - * @param string $instanceName The value to use as filter. |
|
320 | - * Accepts wildcards (* and % trigger a LIKE) |
|
321 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
322 | - * |
|
323 | - * @return $this|ChildInputQuery The current query, for fluid interface |
|
324 | - */ |
|
325 | - public function filterByInstanceName($instanceName = null, $comparison = null) |
|
326 | - { |
|
327 | - if (null === $comparison) { |
|
328 | - if (is_array($instanceName)) { |
|
329 | - $comparison = Criteria::IN; |
|
330 | - } elseif (preg_match('/[\%\*]/', $instanceName)) { |
|
331 | - $instanceName = str_replace('*', '%', $instanceName); |
|
332 | - $comparison = Criteria::LIKE; |
|
333 | - } |
|
334 | - } |
|
335 | - |
|
336 | - return $this->addUsingAlias(InputTableMap::COL_INSTANCE_NAME, $instanceName, $comparison); |
|
337 | - } |
|
338 | - |
|
339 | - /** |
|
340 | - * Filter the query on the started column |
|
341 | - * |
|
342 | - * Example usage: |
|
343 | - * <code> |
|
344 | - * $query->filterByStarted('2011-03-14'); // WHERE started = '2011-03-14' |
|
345 | - * $query->filterByStarted('now'); // WHERE started = '2011-03-14' |
|
346 | - * $query->filterByStarted(array('max' => 'yesterday')); // WHERE started > '2011-03-13' |
|
347 | - * </code> |
|
348 | - * |
|
349 | - * @param mixed $started The value to use as filter. |
|
350 | - * Values can be integers (unix timestamps), DateTime objects, or strings. |
|
351 | - * Empty strings are treated as NULL. |
|
352 | - * Use scalar values for equality. |
|
353 | - * Use array values for in_array() equivalent. |
|
354 | - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
355 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
356 | - * |
|
357 | - * @return $this|ChildInputQuery The current query, for fluid interface |
|
358 | - */ |
|
359 | - public function filterByStarted($started = null, $comparison = null) |
|
360 | - { |
|
361 | - if (is_array($started)) { |
|
362 | - $useMinMax = false; |
|
363 | - if (isset($started['min'])) { |
|
364 | - $this->addUsingAlias(InputTableMap::COL_STARTED, $started['min'], Criteria::GREATER_EQUAL); |
|
365 | - $useMinMax = true; |
|
366 | - } |
|
367 | - if (isset($started['max'])) { |
|
368 | - $this->addUsingAlias(InputTableMap::COL_STARTED, $started['max'], Criteria::LESS_EQUAL); |
|
369 | - $useMinMax = true; |
|
370 | - } |
|
371 | - if ($useMinMax) { |
|
372 | - return $this; |
|
373 | - } |
|
374 | - if (null === $comparison) { |
|
375 | - $comparison = Criteria::IN; |
|
376 | - } |
|
377 | - } |
|
378 | - |
|
379 | - return $this->addUsingAlias(InputTableMap::COL_STARTED, $started, $comparison); |
|
380 | - } |
|
381 | - |
|
382 | - /** |
|
383 | - * Filter the query on the input column |
|
384 | - * |
|
385 | - * Example usage: |
|
386 | - * <code> |
|
387 | - * $query->filterByInput('fooValue'); // WHERE input = 'fooValue' |
|
388 | - * $query->filterByInput('%fooValue%'); // WHERE input LIKE '%fooValue%' |
|
389 | - * </code> |
|
390 | - * |
|
391 | - * @param string $input The value to use as filter. |
|
392 | - * Accepts wildcards (* and % trigger a LIKE) |
|
393 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
394 | - * |
|
395 | - * @return $this|ChildInputQuery The current query, for fluid interface |
|
396 | - */ |
|
397 | - public function filterByInput($input = null, $comparison = null) |
|
398 | - { |
|
399 | - if (null === $comparison) { |
|
400 | - if (is_array($input)) { |
|
401 | - $comparison = Criteria::IN; |
|
402 | - } elseif (preg_match('/[\%\*]/', $input)) { |
|
403 | - $input = str_replace('*', '%', $input); |
|
404 | - $comparison = Criteria::LIKE; |
|
405 | - } |
|
406 | - } |
|
407 | - |
|
408 | - return $this->addUsingAlias(InputTableMap::COL_INPUT, $input, $comparison); |
|
409 | - } |
|
410 | - |
|
411 | - /** |
|
412 | - * Filter the query on the network column |
|
413 | - * |
|
414 | - * Example usage: |
|
415 | - * <code> |
|
416 | - * $query->filterByNetwork('fooValue'); // WHERE network = 'fooValue' |
|
417 | - * $query->filterByNetwork('%fooValue%'); // WHERE network LIKE '%fooValue%' |
|
418 | - * </code> |
|
419 | - * |
|
420 | - * @param string $network The value to use as filter. |
|
421 | - * Accepts wildcards (* and % trigger a LIKE) |
|
422 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
423 | - * |
|
424 | - * @return $this|ChildInputQuery The current query, for fluid interface |
|
425 | - */ |
|
426 | - public function filterByNetwork($network = null, $comparison = null) |
|
427 | - { |
|
428 | - if (null === $comparison) { |
|
429 | - if (is_array($network)) { |
|
430 | - $comparison = Criteria::IN; |
|
431 | - } elseif (preg_match('/[\%\*]/', $network)) { |
|
432 | - $network = str_replace('*', '%', $network); |
|
433 | - $comparison = Criteria::LIKE; |
|
434 | - } |
|
435 | - } |
|
436 | - |
|
437 | - return $this->addUsingAlias(InputTableMap::COL_NETWORK, $network, $comparison); |
|
438 | - } |
|
439 | - |
|
440 | - /** |
|
441 | - * Filter the query on the mux column |
|
442 | - * |
|
443 | - * Example usage: |
|
444 | - * <code> |
|
445 | - * $query->filterByMux('fooValue'); // WHERE mux = 'fooValue' |
|
446 | - * $query->filterByMux('%fooValue%'); // WHERE mux LIKE '%fooValue%' |
|
447 | - * </code> |
|
448 | - * |
|
449 | - * @param string $mux The value to use as filter. |
|
450 | - * Accepts wildcards (* and % trigger a LIKE) |
|
451 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
452 | - * |
|
453 | - * @return $this|ChildInputQuery The current query, for fluid interface |
|
454 | - */ |
|
455 | - public function filterByMux($mux = null, $comparison = null) |
|
456 | - { |
|
457 | - if (null === $comparison) { |
|
458 | - if (is_array($mux)) { |
|
459 | - $comparison = Criteria::IN; |
|
460 | - } elseif (preg_match('/[\%\*]/', $mux)) { |
|
461 | - $mux = str_replace('*', '%', $mux); |
|
462 | - $comparison = Criteria::LIKE; |
|
463 | - } |
|
464 | - } |
|
465 | - |
|
466 | - return $this->addUsingAlias(InputTableMap::COL_MUX, $mux, $comparison); |
|
467 | - } |
|
468 | - |
|
469 | - /** |
|
470 | - * Filter the query on the weight column |
|
471 | - * |
|
472 | - * Example usage: |
|
473 | - * <code> |
|
474 | - * $query->filterByWeight(1234); // WHERE weight = 1234 |
|
475 | - * $query->filterByWeight(array(12, 34)); // WHERE weight IN (12, 34) |
|
476 | - * $query->filterByWeight(array('min' => 12)); // WHERE weight > 12 |
|
477 | - * </code> |
|
478 | - * |
|
479 | - * @param mixed $weight The value to use as filter. |
|
480 | - * Use scalar values for equality. |
|
481 | - * Use array values for in_array() equivalent. |
|
482 | - * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
483 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
484 | - * |
|
485 | - * @return $this|ChildInputQuery The current query, for fluid interface |
|
486 | - */ |
|
487 | - public function filterByWeight($weight = null, $comparison = null) |
|
488 | - { |
|
489 | - if (is_array($weight)) { |
|
490 | - $useMinMax = false; |
|
491 | - if (isset($weight['min'])) { |
|
492 | - $this->addUsingAlias(InputTableMap::COL_WEIGHT, $weight['min'], Criteria::GREATER_EQUAL); |
|
493 | - $useMinMax = true; |
|
494 | - } |
|
495 | - if (isset($weight['max'])) { |
|
496 | - $this->addUsingAlias(InputTableMap::COL_WEIGHT, $weight['max'], Criteria::LESS_EQUAL); |
|
497 | - $useMinMax = true; |
|
498 | - } |
|
499 | - if ($useMinMax) { |
|
500 | - return $this; |
|
501 | - } |
|
502 | - if (null === $comparison) { |
|
503 | - $comparison = Criteria::IN; |
|
504 | - } |
|
505 | - } |
|
506 | - |
|
507 | - return $this->addUsingAlias(InputTableMap::COL_WEIGHT, $weight, $comparison); |
|
508 | - } |
|
509 | - |
|
510 | - /** |
|
511 | - * Filter the query by a related \Jalle19\StatusManager\Database\Instance object |
|
512 | - * |
|
513 | - * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter |
|
514 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
515 | - * |
|
516 | - * @throws \Propel\Runtime\Exception\PropelException |
|
517 | - * |
|
518 | - * @return ChildInputQuery The current query, for fluid interface |
|
519 | - */ |
|
520 | - public function filterByInstance($instance, $comparison = null) |
|
521 | - { |
|
522 | - if ($instance instanceof \Jalle19\StatusManager\Database\Instance) { |
|
523 | - return $this |
|
524 | - ->addUsingAlias(InputTableMap::COL_INSTANCE_NAME, $instance->getName(), $comparison); |
|
525 | - } elseif ($instance instanceof ObjectCollection) { |
|
526 | - if (null === $comparison) { |
|
527 | - $comparison = Criteria::IN; |
|
528 | - } |
|
529 | - |
|
530 | - return $this |
|
531 | - ->addUsingAlias(InputTableMap::COL_INSTANCE_NAME, $instance->toKeyValue('PrimaryKey', 'Name'), $comparison); |
|
532 | - } else { |
|
533 | - throw new PropelException('filterByInstance() only accepts arguments of type \Jalle19\StatusManager\Database\Instance or Collection'); |
|
534 | - } |
|
535 | - } |
|
536 | - |
|
537 | - /** |
|
538 | - * Adds a JOIN clause to the query using the Instance relation |
|
539 | - * |
|
540 | - * @param string $relationAlias optional alias for the relation |
|
541 | - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
542 | - * |
|
543 | - * @return $this|ChildInputQuery The current query, for fluid interface |
|
544 | - */ |
|
545 | - public function joinInstance($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
546 | - { |
|
547 | - $tableMap = $this->getTableMap(); |
|
548 | - $relationMap = $tableMap->getRelation('Instance'); |
|
549 | - |
|
550 | - // create a ModelJoin object for this join |
|
551 | - $join = new ModelJoin(); |
|
552 | - $join->setJoinType($joinType); |
|
553 | - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
|
554 | - if ($previousJoin = $this->getPreviousJoin()) { |
|
555 | - $join->setPreviousJoin($previousJoin); |
|
556 | - } |
|
557 | - |
|
558 | - // add the ModelJoin to the current object |
|
559 | - if ($relationAlias) { |
|
560 | - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
|
561 | - $this->addJoinObject($join, $relationAlias); |
|
562 | - } else { |
|
563 | - $this->addJoinObject($join, 'Instance'); |
|
564 | - } |
|
565 | - |
|
566 | - return $this; |
|
567 | - } |
|
568 | - |
|
569 | - /** |
|
570 | - * Use the Instance relation Instance object |
|
571 | - * |
|
572 | - * @see useQuery() |
|
573 | - * |
|
574 | - * @param string $relationAlias optional alias for the relation, |
|
575 | - * to be used as main alias in the secondary query |
|
576 | - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
577 | - * |
|
578 | - * @return \Jalle19\StatusManager\Database\InstanceQuery A secondary query class using the current class as primary query |
|
579 | - */ |
|
580 | - public function useInstanceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
581 | - { |
|
582 | - return $this |
|
583 | - ->joinInstance($relationAlias, $joinType) |
|
584 | - ->useQuery($relationAlias ? $relationAlias : 'Instance', '\Jalle19\StatusManager\Database\InstanceQuery'); |
|
585 | - } |
|
586 | - |
|
587 | - /** |
|
588 | - * Filter the query by a related \Jalle19\StatusManager\Database\Subscription object |
|
589 | - * |
|
590 | - * @param \Jalle19\StatusManager\Database\Subscription|ObjectCollection $subscription the related object to use as filter |
|
591 | - * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
592 | - * |
|
593 | - * @return ChildInputQuery The current query, for fluid interface |
|
594 | - */ |
|
595 | - public function filterBySubscription($subscription, $comparison = null) |
|
596 | - { |
|
597 | - if ($subscription instanceof \Jalle19\StatusManager\Database\Subscription) { |
|
598 | - return $this |
|
599 | - ->addUsingAlias(InputTableMap::COL_UUID, $subscription->getInputUuid(), $comparison); |
|
600 | - } elseif ($subscription instanceof ObjectCollection) { |
|
601 | - return $this |
|
602 | - ->useSubscriptionQuery() |
|
603 | - ->filterByPrimaryKeys($subscription->getPrimaryKeys()) |
|
604 | - ->endUse(); |
|
605 | - } else { |
|
606 | - throw new PropelException('filterBySubscription() only accepts arguments of type \Jalle19\StatusManager\Database\Subscription or Collection'); |
|
607 | - } |
|
608 | - } |
|
609 | - |
|
610 | - /** |
|
611 | - * Adds a JOIN clause to the query using the Subscription relation |
|
612 | - * |
|
613 | - * @param string $relationAlias optional alias for the relation |
|
614 | - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
615 | - * |
|
616 | - * @return $this|ChildInputQuery The current query, for fluid interface |
|
617 | - */ |
|
618 | - public function joinSubscription($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
619 | - { |
|
620 | - $tableMap = $this->getTableMap(); |
|
621 | - $relationMap = $tableMap->getRelation('Subscription'); |
|
622 | - |
|
623 | - // create a ModelJoin object for this join |
|
624 | - $join = new ModelJoin(); |
|
625 | - $join->setJoinType($joinType); |
|
626 | - $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
|
627 | - if ($previousJoin = $this->getPreviousJoin()) { |
|
628 | - $join->setPreviousJoin($previousJoin); |
|
629 | - } |
|
630 | - |
|
631 | - // add the ModelJoin to the current object |
|
632 | - if ($relationAlias) { |
|
633 | - $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
|
634 | - $this->addJoinObject($join, $relationAlias); |
|
635 | - } else { |
|
636 | - $this->addJoinObject($join, 'Subscription'); |
|
637 | - } |
|
638 | - |
|
639 | - return $this; |
|
640 | - } |
|
641 | - |
|
642 | - /** |
|
643 | - * Use the Subscription relation Subscription object |
|
644 | - * |
|
645 | - * @see useQuery() |
|
646 | - * |
|
647 | - * @param string $relationAlias optional alias for the relation, |
|
648 | - * to be used as main alias in the secondary query |
|
649 | - * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
650 | - * |
|
651 | - * @return \Jalle19\StatusManager\Database\SubscriptionQuery A secondary query class using the current class as primary query |
|
652 | - */ |
|
653 | - public function useSubscriptionQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
654 | - { |
|
655 | - return $this |
|
656 | - ->joinSubscription($relationAlias, $joinType) |
|
657 | - ->useQuery($relationAlias ? $relationAlias : 'Subscription', '\Jalle19\StatusManager\Database\SubscriptionQuery'); |
|
658 | - } |
|
659 | - |
|
660 | - /** |
|
661 | - * Exclude object from result |
|
662 | - * |
|
663 | - * @param ChildInput $input Object to remove from the list of results |
|
664 | - * |
|
665 | - * @return $this|ChildInputQuery The current query, for fluid interface |
|
666 | - */ |
|
667 | - public function prune($input = null) |
|
668 | - { |
|
669 | - if ($input) { |
|
670 | - $this->addUsingAlias(InputTableMap::COL_UUID, $input->getUuid(), Criteria::NOT_EQUAL); |
|
671 | - } |
|
672 | - |
|
673 | - return $this; |
|
674 | - } |
|
675 | - |
|
676 | - /** |
|
677 | - * Deletes all rows from the input table. |
|
678 | - * |
|
679 | - * @param ConnectionInterface $con the connection to use |
|
680 | - * @return int The number of affected rows (if supported by underlying database driver). |
|
681 | - */ |
|
682 | - public function doDeleteAll(ConnectionInterface $con = null) |
|
683 | - { |
|
684 | - if (null === $con) { |
|
685 | - $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
|
686 | - } |
|
687 | - |
|
688 | - // use transaction because $criteria could contain info |
|
689 | - // for more than one table or we could emulating ON DELETE CASCADE, etc. |
|
690 | - return $con->transaction(function () use ($con) { |
|
691 | - $affectedRows = 0; // initialize var to track total num of affected rows |
|
692 | - $affectedRows += parent::doDeleteAll($con); |
|
693 | - // Because this db requires some delete cascade/set null emulation, we have to |
|
694 | - // clear the cached instance *after* the emulation has happened (since |
|
695 | - // instances get re-added by the select statement contained therein). |
|
696 | - InputTableMap::clearInstancePool(); |
|
697 | - InputTableMap::clearRelatedInstancePool(); |
|
698 | - |
|
699 | - return $affectedRows; |
|
700 | - }); |
|
701 | - } |
|
702 | - |
|
703 | - /** |
|
704 | - * Performs a DELETE on the database based on the current ModelCriteria |
|
705 | - * |
|
706 | - * @param ConnectionInterface $con the connection to use |
|
707 | - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
708 | - * if supported by native driver or if emulated using Propel. |
|
709 | - * @throws PropelException Any exceptions caught during processing will be |
|
710 | - * rethrown wrapped into a PropelException. |
|
711 | - */ |
|
712 | - public function delete(ConnectionInterface $con = null) |
|
713 | - { |
|
714 | - if (null === $con) { |
|
715 | - $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
|
716 | - } |
|
717 | - |
|
718 | - $criteria = $this; |
|
719 | - |
|
720 | - // Set the correct dbName |
|
721 | - $criteria->setDbName(InputTableMap::DATABASE_NAME); |
|
722 | - |
|
723 | - // use transaction because $criteria could contain info |
|
724 | - // for more than one table or we could emulating ON DELETE CASCADE, etc. |
|
725 | - return $con->transaction(function () use ($con, $criteria) { |
|
726 | - $affectedRows = 0; // initialize var to track total num of affected rows |
|
727 | - |
|
728 | - InputTableMap::removeInstanceFromPool($criteria); |
|
729 | - |
|
730 | - $affectedRows += ModelCriteria::delete($con); |
|
731 | - InputTableMap::clearRelatedInstancePool(); |
|
732 | - |
|
733 | - return $affectedRows; |
|
734 | - }); |
|
735 | - } |
|
103 | + protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException'; |
|
104 | + |
|
105 | + /** |
|
106 | + * Initializes internal state of \Jalle19\StatusManager\Database\Base\InputQuery object. |
|
107 | + * |
|
108 | + * @param string $dbName The database name |
|
109 | + * @param string $modelName The phpName of a model, e.g. 'Book' |
|
110 | + * @param string $modelAlias The alias for the model in this query, e.g. 'b' |
|
111 | + */ |
|
112 | + public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Input', $modelAlias = null) |
|
113 | + { |
|
114 | + parent::__construct($dbName, $modelName, $modelAlias); |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * Returns a new ChildInputQuery object. |
|
119 | + * |
|
120 | + * @param string $modelAlias The alias of a model in the query |
|
121 | + * @param Criteria $criteria Optional Criteria to build the query from |
|
122 | + * |
|
123 | + * @return ChildInputQuery |
|
124 | + */ |
|
125 | + public static function create($modelAlias = null, Criteria $criteria = null) |
|
126 | + { |
|
127 | + if ($criteria instanceof ChildInputQuery) { |
|
128 | + return $criteria; |
|
129 | + } |
|
130 | + $query = new ChildInputQuery(); |
|
131 | + if (null !== $modelAlias) { |
|
132 | + $query->setModelAlias($modelAlias); |
|
133 | + } |
|
134 | + if ($criteria instanceof Criteria) { |
|
135 | + $query->mergeWith($criteria); |
|
136 | + } |
|
137 | + |
|
138 | + return $query; |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * Find object by primary key. |
|
143 | + * Propel uses the instance pool to skip the database if the object exists. |
|
144 | + * Go fast if the query is untouched. |
|
145 | + * |
|
146 | + * <code> |
|
147 | + * $obj = $c->findPk(12, $con); |
|
148 | + * </code> |
|
149 | + * |
|
150 | + * @param mixed $key Primary key to use for the query |
|
151 | + * @param ConnectionInterface $con an optional connection object |
|
152 | + * |
|
153 | + * @return ChildInput|array|mixed the result, formatted by the current formatter |
|
154 | + */ |
|
155 | + public function findPk($key, ConnectionInterface $con = null) |
|
156 | + { |
|
157 | + if ($key === null) { |
|
158 | + return null; |
|
159 | + } |
|
160 | + if ((null !== ($obj = InputTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) { |
|
161 | + // the object is already in the instance pool |
|
162 | + return $obj; |
|
163 | + } |
|
164 | + if ($con === null) { |
|
165 | + $con = Propel::getServiceContainer()->getReadConnection(InputTableMap::DATABASE_NAME); |
|
166 | + } |
|
167 | + $this->basePreSelect($con); |
|
168 | + if ($this->formatter || $this->modelAlias || $this->with || $this->select |
|
169 | + || $this->selectColumns || $this->asColumns || $this->selectModifiers |
|
170 | + || $this->map || $this->having || $this->joins) { |
|
171 | + return $this->findPkComplex($key, $con); |
|
172 | + } else { |
|
173 | + return $this->findPkSimple($key, $con); |
|
174 | + } |
|
175 | + } |
|
176 | + |
|
177 | + /** |
|
178 | + * Find object by primary key using raw SQL to go fast. |
|
179 | + * Bypass doSelect() and the object formatter by using generated code. |
|
180 | + * |
|
181 | + * @param mixed $key Primary key to use for the query |
|
182 | + * @param ConnectionInterface $con A connection object |
|
183 | + * |
|
184 | + * @throws \Propel\Runtime\Exception\PropelException |
|
185 | + * |
|
186 | + * @return ChildInput A model object, or null if the key is not found |
|
187 | + */ |
|
188 | + protected function findPkSimple($key, ConnectionInterface $con) |
|
189 | + { |
|
190 | + $sql = 'SELECT uuid, instance_name, started, input, network, mux, weight FROM input WHERE uuid = :p0'; |
|
191 | + try { |
|
192 | + $stmt = $con->prepare($sql); |
|
193 | + $stmt->bindValue(':p0', $key, PDO::PARAM_STR); |
|
194 | + $stmt->execute(); |
|
195 | + } catch (Exception $e) { |
|
196 | + Propel::log($e->getMessage(), Propel::LOG_ERR); |
|
197 | + throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); |
|
198 | + } |
|
199 | + $obj = null; |
|
200 | + if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { |
|
201 | + /** @var ChildInput $obj */ |
|
202 | + $obj = new ChildInput(); |
|
203 | + $obj->hydrate($row); |
|
204 | + InputTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key); |
|
205 | + } |
|
206 | + $stmt->closeCursor(); |
|
207 | + |
|
208 | + return $obj; |
|
209 | + } |
|
210 | + |
|
211 | + /** |
|
212 | + * Find object by primary key. |
|
213 | + * |
|
214 | + * @param mixed $key Primary key to use for the query |
|
215 | + * @param ConnectionInterface $con A connection object |
|
216 | + * |
|
217 | + * @return ChildInput|array|mixed the result, formatted by the current formatter |
|
218 | + */ |
|
219 | + protected function findPkComplex($key, ConnectionInterface $con) |
|
220 | + { |
|
221 | + // As the query uses a PK condition, no limit(1) is necessary. |
|
222 | + $criteria = $this->isKeepQuery() ? clone $this : $this; |
|
223 | + $dataFetcher = $criteria |
|
224 | + ->filterByPrimaryKey($key) |
|
225 | + ->doSelect($con); |
|
226 | + |
|
227 | + return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); |
|
228 | + } |
|
229 | + |
|
230 | + /** |
|
231 | + * Find objects by primary key |
|
232 | + * <code> |
|
233 | + * $objs = $c->findPks(array(12, 56, 832), $con); |
|
234 | + * </code> |
|
235 | + * @param array $keys Primary keys to use for the query |
|
236 | + * @param ConnectionInterface $con an optional connection object |
|
237 | + * |
|
238 | + * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter |
|
239 | + */ |
|
240 | + public function findPks($keys, ConnectionInterface $con = null) |
|
241 | + { |
|
242 | + if (null === $con) { |
|
243 | + $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); |
|
244 | + } |
|
245 | + $this->basePreSelect($con); |
|
246 | + $criteria = $this->isKeepQuery() ? clone $this : $this; |
|
247 | + $dataFetcher = $criteria |
|
248 | + ->filterByPrimaryKeys($keys) |
|
249 | + ->doSelect($con); |
|
250 | + |
|
251 | + return $criteria->getFormatter()->init($criteria)->format($dataFetcher); |
|
252 | + } |
|
253 | + |
|
254 | + /** |
|
255 | + * Filter the query by primary key |
|
256 | + * |
|
257 | + * @param mixed $key Primary key to use for the query |
|
258 | + * |
|
259 | + * @return $this|ChildInputQuery The current query, for fluid interface |
|
260 | + */ |
|
261 | + public function filterByPrimaryKey($key) |
|
262 | + { |
|
263 | + |
|
264 | + return $this->addUsingAlias(InputTableMap::COL_UUID, $key, Criteria::EQUAL); |
|
265 | + } |
|
266 | + |
|
267 | + /** |
|
268 | + * Filter the query by a list of primary keys |
|
269 | + * |
|
270 | + * @param array $keys The list of primary key to use for the query |
|
271 | + * |
|
272 | + * @return $this|ChildInputQuery The current query, for fluid interface |
|
273 | + */ |
|
274 | + public function filterByPrimaryKeys($keys) |
|
275 | + { |
|
276 | + |
|
277 | + return $this->addUsingAlias(InputTableMap::COL_UUID, $keys, Criteria::IN); |
|
278 | + } |
|
279 | + |
|
280 | + /** |
|
281 | + * Filter the query on the uuid column |
|
282 | + * |
|
283 | + * Example usage: |
|
284 | + * <code> |
|
285 | + * $query->filterByUuid('fooValue'); // WHERE uuid = 'fooValue' |
|
286 | + * $query->filterByUuid('%fooValue%'); // WHERE uuid LIKE '%fooValue%' |
|
287 | + * </code> |
|
288 | + * |
|
289 | + * @param string $uuid The value to use as filter. |
|
290 | + * Accepts wildcards (* and % trigger a LIKE) |
|
291 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
292 | + * |
|
293 | + * @return $this|ChildInputQuery The current query, for fluid interface |
|
294 | + */ |
|
295 | + public function filterByUuid($uuid = null, $comparison = null) |
|
296 | + { |
|
297 | + if (null === $comparison) { |
|
298 | + if (is_array($uuid)) { |
|
299 | + $comparison = Criteria::IN; |
|
300 | + } elseif (preg_match('/[\%\*]/', $uuid)) { |
|
301 | + $uuid = str_replace('*', '%', $uuid); |
|
302 | + $comparison = Criteria::LIKE; |
|
303 | + } |
|
304 | + } |
|
305 | + |
|
306 | + return $this->addUsingAlias(InputTableMap::COL_UUID, $uuid, $comparison); |
|
307 | + } |
|
308 | + |
|
309 | + /** |
|
310 | + * Filter the query on the instance_name column |
|
311 | + * |
|
312 | + * Example usage: |
|
313 | + * <code> |
|
314 | + * $query->filterByInstanceName('fooValue'); // WHERE instance_name = 'fooValue' |
|
315 | + * $query->filterByInstanceName('%fooValue%'); // WHERE instance_name LIKE '%fooValue%' |
|
316 | + * </code> |
|
317 | + * |
|
318 | + * @param string $instanceName The value to use as filter. |
|
319 | + * Accepts wildcards (* and % trigger a LIKE) |
|
320 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
321 | + * |
|
322 | + * @return $this|ChildInputQuery The current query, for fluid interface |
|
323 | + */ |
|
324 | + public function filterByInstanceName($instanceName = null, $comparison = null) |
|
325 | + { |
|
326 | + if (null === $comparison) { |
|
327 | + if (is_array($instanceName)) { |
|
328 | + $comparison = Criteria::IN; |
|
329 | + } elseif (preg_match('/[\%\*]/', $instanceName)) { |
|
330 | + $instanceName = str_replace('*', '%', $instanceName); |
|
331 | + $comparison = Criteria::LIKE; |
|
332 | + } |
|
333 | + } |
|
334 | + |
|
335 | + return $this->addUsingAlias(InputTableMap::COL_INSTANCE_NAME, $instanceName, $comparison); |
|
336 | + } |
|
337 | + |
|
338 | + /** |
|
339 | + * Filter the query on the started column |
|
340 | + * |
|
341 | + * Example usage: |
|
342 | + * <code> |
|
343 | + * $query->filterByStarted('2011-03-14'); // WHERE started = '2011-03-14' |
|
344 | + * $query->filterByStarted('now'); // WHERE started = '2011-03-14' |
|
345 | + * $query->filterByStarted(array('max' => 'yesterday')); // WHERE started > '2011-03-13' |
|
346 | + * </code> |
|
347 | + * |
|
348 | + * @param mixed $started The value to use as filter. |
|
349 | + * Values can be integers (unix timestamps), DateTime objects, or strings. |
|
350 | + * Empty strings are treated as NULL. |
|
351 | + * Use scalar values for equality. |
|
352 | + * Use array values for in_array() equivalent. |
|
353 | + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
354 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
355 | + * |
|
356 | + * @return $this|ChildInputQuery The current query, for fluid interface |
|
357 | + */ |
|
358 | + public function filterByStarted($started = null, $comparison = null) |
|
359 | + { |
|
360 | + if (is_array($started)) { |
|
361 | + $useMinMax = false; |
|
362 | + if (isset($started['min'])) { |
|
363 | + $this->addUsingAlias(InputTableMap::COL_STARTED, $started['min'], Criteria::GREATER_EQUAL); |
|
364 | + $useMinMax = true; |
|
365 | + } |
|
366 | + if (isset($started['max'])) { |
|
367 | + $this->addUsingAlias(InputTableMap::COL_STARTED, $started['max'], Criteria::LESS_EQUAL); |
|
368 | + $useMinMax = true; |
|
369 | + } |
|
370 | + if ($useMinMax) { |
|
371 | + return $this; |
|
372 | + } |
|
373 | + if (null === $comparison) { |
|
374 | + $comparison = Criteria::IN; |
|
375 | + } |
|
376 | + } |
|
377 | + |
|
378 | + return $this->addUsingAlias(InputTableMap::COL_STARTED, $started, $comparison); |
|
379 | + } |
|
380 | + |
|
381 | + /** |
|
382 | + * Filter the query on the input column |
|
383 | + * |
|
384 | + * Example usage: |
|
385 | + * <code> |
|
386 | + * $query->filterByInput('fooValue'); // WHERE input = 'fooValue' |
|
387 | + * $query->filterByInput('%fooValue%'); // WHERE input LIKE '%fooValue%' |
|
388 | + * </code> |
|
389 | + * |
|
390 | + * @param string $input The value to use as filter. |
|
391 | + * Accepts wildcards (* and % trigger a LIKE) |
|
392 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
393 | + * |
|
394 | + * @return $this|ChildInputQuery The current query, for fluid interface |
|
395 | + */ |
|
396 | + public function filterByInput($input = null, $comparison = null) |
|
397 | + { |
|
398 | + if (null === $comparison) { |
|
399 | + if (is_array($input)) { |
|
400 | + $comparison = Criteria::IN; |
|
401 | + } elseif (preg_match('/[\%\*]/', $input)) { |
|
402 | + $input = str_replace('*', '%', $input); |
|
403 | + $comparison = Criteria::LIKE; |
|
404 | + } |
|
405 | + } |
|
406 | + |
|
407 | + return $this->addUsingAlias(InputTableMap::COL_INPUT, $input, $comparison); |
|
408 | + } |
|
409 | + |
|
410 | + /** |
|
411 | + * Filter the query on the network column |
|
412 | + * |
|
413 | + * Example usage: |
|
414 | + * <code> |
|
415 | + * $query->filterByNetwork('fooValue'); // WHERE network = 'fooValue' |
|
416 | + * $query->filterByNetwork('%fooValue%'); // WHERE network LIKE '%fooValue%' |
|
417 | + * </code> |
|
418 | + * |
|
419 | + * @param string $network The value to use as filter. |
|
420 | + * Accepts wildcards (* and % trigger a LIKE) |
|
421 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
422 | + * |
|
423 | + * @return $this|ChildInputQuery The current query, for fluid interface |
|
424 | + */ |
|
425 | + public function filterByNetwork($network = null, $comparison = null) |
|
426 | + { |
|
427 | + if (null === $comparison) { |
|
428 | + if (is_array($network)) { |
|
429 | + $comparison = Criteria::IN; |
|
430 | + } elseif (preg_match('/[\%\*]/', $network)) { |
|
431 | + $network = str_replace('*', '%', $network); |
|
432 | + $comparison = Criteria::LIKE; |
|
433 | + } |
|
434 | + } |
|
435 | + |
|
436 | + return $this->addUsingAlias(InputTableMap::COL_NETWORK, $network, $comparison); |
|
437 | + } |
|
438 | + |
|
439 | + /** |
|
440 | + * Filter the query on the mux column |
|
441 | + * |
|
442 | + * Example usage: |
|
443 | + * <code> |
|
444 | + * $query->filterByMux('fooValue'); // WHERE mux = 'fooValue' |
|
445 | + * $query->filterByMux('%fooValue%'); // WHERE mux LIKE '%fooValue%' |
|
446 | + * </code> |
|
447 | + * |
|
448 | + * @param string $mux The value to use as filter. |
|
449 | + * Accepts wildcards (* and % trigger a LIKE) |
|
450 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
451 | + * |
|
452 | + * @return $this|ChildInputQuery The current query, for fluid interface |
|
453 | + */ |
|
454 | + public function filterByMux($mux = null, $comparison = null) |
|
455 | + { |
|
456 | + if (null === $comparison) { |
|
457 | + if (is_array($mux)) { |
|
458 | + $comparison = Criteria::IN; |
|
459 | + } elseif (preg_match('/[\%\*]/', $mux)) { |
|
460 | + $mux = str_replace('*', '%', $mux); |
|
461 | + $comparison = Criteria::LIKE; |
|
462 | + } |
|
463 | + } |
|
464 | + |
|
465 | + return $this->addUsingAlias(InputTableMap::COL_MUX, $mux, $comparison); |
|
466 | + } |
|
467 | + |
|
468 | + /** |
|
469 | + * Filter the query on the weight column |
|
470 | + * |
|
471 | + * Example usage: |
|
472 | + * <code> |
|
473 | + * $query->filterByWeight(1234); // WHERE weight = 1234 |
|
474 | + * $query->filterByWeight(array(12, 34)); // WHERE weight IN (12, 34) |
|
475 | + * $query->filterByWeight(array('min' => 12)); // WHERE weight > 12 |
|
476 | + * </code> |
|
477 | + * |
|
478 | + * @param mixed $weight The value to use as filter. |
|
479 | + * Use scalar values for equality. |
|
480 | + * Use array values for in_array() equivalent. |
|
481 | + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. |
|
482 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
483 | + * |
|
484 | + * @return $this|ChildInputQuery The current query, for fluid interface |
|
485 | + */ |
|
486 | + public function filterByWeight($weight = null, $comparison = null) |
|
487 | + { |
|
488 | + if (is_array($weight)) { |
|
489 | + $useMinMax = false; |
|
490 | + if (isset($weight['min'])) { |
|
491 | + $this->addUsingAlias(InputTableMap::COL_WEIGHT, $weight['min'], Criteria::GREATER_EQUAL); |
|
492 | + $useMinMax = true; |
|
493 | + } |
|
494 | + if (isset($weight['max'])) { |
|
495 | + $this->addUsingAlias(InputTableMap::COL_WEIGHT, $weight['max'], Criteria::LESS_EQUAL); |
|
496 | + $useMinMax = true; |
|
497 | + } |
|
498 | + if ($useMinMax) { |
|
499 | + return $this; |
|
500 | + } |
|
501 | + if (null === $comparison) { |
|
502 | + $comparison = Criteria::IN; |
|
503 | + } |
|
504 | + } |
|
505 | + |
|
506 | + return $this->addUsingAlias(InputTableMap::COL_WEIGHT, $weight, $comparison); |
|
507 | + } |
|
508 | + |
|
509 | + /** |
|
510 | + * Filter the query by a related \Jalle19\StatusManager\Database\Instance object |
|
511 | + * |
|
512 | + * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter |
|
513 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
514 | + * |
|
515 | + * @throws \Propel\Runtime\Exception\PropelException |
|
516 | + * |
|
517 | + * @return ChildInputQuery The current query, for fluid interface |
|
518 | + */ |
|
519 | + public function filterByInstance($instance, $comparison = null) |
|
520 | + { |
|
521 | + if ($instance instanceof \Jalle19\StatusManager\Database\Instance) { |
|
522 | + return $this |
|
523 | + ->addUsingAlias(InputTableMap::COL_INSTANCE_NAME, $instance->getName(), $comparison); |
|
524 | + } elseif ($instance instanceof ObjectCollection) { |
|
525 | + if (null === $comparison) { |
|
526 | + $comparison = Criteria::IN; |
|
527 | + } |
|
528 | + |
|
529 | + return $this |
|
530 | + ->addUsingAlias(InputTableMap::COL_INSTANCE_NAME, $instance->toKeyValue('PrimaryKey', 'Name'), $comparison); |
|
531 | + } else { |
|
532 | + throw new PropelException('filterByInstance() only accepts arguments of type \Jalle19\StatusManager\Database\Instance or Collection'); |
|
533 | + } |
|
534 | + } |
|
535 | + |
|
536 | + /** |
|
537 | + * Adds a JOIN clause to the query using the Instance relation |
|
538 | + * |
|
539 | + * @param string $relationAlias optional alias for the relation |
|
540 | + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
541 | + * |
|
542 | + * @return $this|ChildInputQuery The current query, for fluid interface |
|
543 | + */ |
|
544 | + public function joinInstance($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
545 | + { |
|
546 | + $tableMap = $this->getTableMap(); |
|
547 | + $relationMap = $tableMap->getRelation('Instance'); |
|
548 | + |
|
549 | + // create a ModelJoin object for this join |
|
550 | + $join = new ModelJoin(); |
|
551 | + $join->setJoinType($joinType); |
|
552 | + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
|
553 | + if ($previousJoin = $this->getPreviousJoin()) { |
|
554 | + $join->setPreviousJoin($previousJoin); |
|
555 | + } |
|
556 | + |
|
557 | + // add the ModelJoin to the current object |
|
558 | + if ($relationAlias) { |
|
559 | + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
|
560 | + $this->addJoinObject($join, $relationAlias); |
|
561 | + } else { |
|
562 | + $this->addJoinObject($join, 'Instance'); |
|
563 | + } |
|
564 | + |
|
565 | + return $this; |
|
566 | + } |
|
567 | + |
|
568 | + /** |
|
569 | + * Use the Instance relation Instance object |
|
570 | + * |
|
571 | + * @see useQuery() |
|
572 | + * |
|
573 | + * @param string $relationAlias optional alias for the relation, |
|
574 | + * to be used as main alias in the secondary query |
|
575 | + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
576 | + * |
|
577 | + * @return \Jalle19\StatusManager\Database\InstanceQuery A secondary query class using the current class as primary query |
|
578 | + */ |
|
579 | + public function useInstanceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) |
|
580 | + { |
|
581 | + return $this |
|
582 | + ->joinInstance($relationAlias, $joinType) |
|
583 | + ->useQuery($relationAlias ? $relationAlias : 'Instance', '\Jalle19\StatusManager\Database\InstanceQuery'); |
|
584 | + } |
|
585 | + |
|
586 | + /** |
|
587 | + * Filter the query by a related \Jalle19\StatusManager\Database\Subscription object |
|
588 | + * |
|
589 | + * @param \Jalle19\StatusManager\Database\Subscription|ObjectCollection $subscription the related object to use as filter |
|
590 | + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL |
|
591 | + * |
|
592 | + * @return ChildInputQuery The current query, for fluid interface |
|
593 | + */ |
|
594 | + public function filterBySubscription($subscription, $comparison = null) |
|
595 | + { |
|
596 | + if ($subscription instanceof \Jalle19\StatusManager\Database\Subscription) { |
|
597 | + return $this |
|
598 | + ->addUsingAlias(InputTableMap::COL_UUID, $subscription->getInputUuid(), $comparison); |
|
599 | + } elseif ($subscription instanceof ObjectCollection) { |
|
600 | + return $this |
|
601 | + ->useSubscriptionQuery() |
|
602 | + ->filterByPrimaryKeys($subscription->getPrimaryKeys()) |
|
603 | + ->endUse(); |
|
604 | + } else { |
|
605 | + throw new PropelException('filterBySubscription() only accepts arguments of type \Jalle19\StatusManager\Database\Subscription or Collection'); |
|
606 | + } |
|
607 | + } |
|
608 | + |
|
609 | + /** |
|
610 | + * Adds a JOIN clause to the query using the Subscription relation |
|
611 | + * |
|
612 | + * @param string $relationAlias optional alias for the relation |
|
613 | + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
614 | + * |
|
615 | + * @return $this|ChildInputQuery The current query, for fluid interface |
|
616 | + */ |
|
617 | + public function joinSubscription($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
618 | + { |
|
619 | + $tableMap = $this->getTableMap(); |
|
620 | + $relationMap = $tableMap->getRelation('Subscription'); |
|
621 | + |
|
622 | + // create a ModelJoin object for this join |
|
623 | + $join = new ModelJoin(); |
|
624 | + $join->setJoinType($joinType); |
|
625 | + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); |
|
626 | + if ($previousJoin = $this->getPreviousJoin()) { |
|
627 | + $join->setPreviousJoin($previousJoin); |
|
628 | + } |
|
629 | + |
|
630 | + // add the ModelJoin to the current object |
|
631 | + if ($relationAlias) { |
|
632 | + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); |
|
633 | + $this->addJoinObject($join, $relationAlias); |
|
634 | + } else { |
|
635 | + $this->addJoinObject($join, 'Subscription'); |
|
636 | + } |
|
637 | + |
|
638 | + return $this; |
|
639 | + } |
|
640 | + |
|
641 | + /** |
|
642 | + * Use the Subscription relation Subscription object |
|
643 | + * |
|
644 | + * @see useQuery() |
|
645 | + * |
|
646 | + * @param string $relationAlias optional alias for the relation, |
|
647 | + * to be used as main alias in the secondary query |
|
648 | + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' |
|
649 | + * |
|
650 | + * @return \Jalle19\StatusManager\Database\SubscriptionQuery A secondary query class using the current class as primary query |
|
651 | + */ |
|
652 | + public function useSubscriptionQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN) |
|
653 | + { |
|
654 | + return $this |
|
655 | + ->joinSubscription($relationAlias, $joinType) |
|
656 | + ->useQuery($relationAlias ? $relationAlias : 'Subscription', '\Jalle19\StatusManager\Database\SubscriptionQuery'); |
|
657 | + } |
|
658 | + |
|
659 | + /** |
|
660 | + * Exclude object from result |
|
661 | + * |
|
662 | + * @param ChildInput $input Object to remove from the list of results |
|
663 | + * |
|
664 | + * @return $this|ChildInputQuery The current query, for fluid interface |
|
665 | + */ |
|
666 | + public function prune($input = null) |
|
667 | + { |
|
668 | + if ($input) { |
|
669 | + $this->addUsingAlias(InputTableMap::COL_UUID, $input->getUuid(), Criteria::NOT_EQUAL); |
|
670 | + } |
|
671 | + |
|
672 | + return $this; |
|
673 | + } |
|
674 | + |
|
675 | + /** |
|
676 | + * Deletes all rows from the input table. |
|
677 | + * |
|
678 | + * @param ConnectionInterface $con the connection to use |
|
679 | + * @return int The number of affected rows (if supported by underlying database driver). |
|
680 | + */ |
|
681 | + public function doDeleteAll(ConnectionInterface $con = null) |
|
682 | + { |
|
683 | + if (null === $con) { |
|
684 | + $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
|
685 | + } |
|
686 | + |
|
687 | + // use transaction because $criteria could contain info |
|
688 | + // for more than one table or we could emulating ON DELETE CASCADE, etc. |
|
689 | + return $con->transaction(function () use ($con) { |
|
690 | + $affectedRows = 0; // initialize var to track total num of affected rows |
|
691 | + $affectedRows += parent::doDeleteAll($con); |
|
692 | + // Because this db requires some delete cascade/set null emulation, we have to |
|
693 | + // clear the cached instance *after* the emulation has happened (since |
|
694 | + // instances get re-added by the select statement contained therein). |
|
695 | + InputTableMap::clearInstancePool(); |
|
696 | + InputTableMap::clearRelatedInstancePool(); |
|
697 | + |
|
698 | + return $affectedRows; |
|
699 | + }); |
|
700 | + } |
|
701 | + |
|
702 | + /** |
|
703 | + * Performs a DELETE on the database based on the current ModelCriteria |
|
704 | + * |
|
705 | + * @param ConnectionInterface $con the connection to use |
|
706 | + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
707 | + * if supported by native driver or if emulated using Propel. |
|
708 | + * @throws PropelException Any exceptions caught during processing will be |
|
709 | + * rethrown wrapped into a PropelException. |
|
710 | + */ |
|
711 | + public function delete(ConnectionInterface $con = null) |
|
712 | + { |
|
713 | + if (null === $con) { |
|
714 | + $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
|
715 | + } |
|
716 | + |
|
717 | + $criteria = $this; |
|
718 | + |
|
719 | + // Set the correct dbName |
|
720 | + $criteria->setDbName(InputTableMap::DATABASE_NAME); |
|
721 | + |
|
722 | + // use transaction because $criteria could contain info |
|
723 | + // for more than one table or we could emulating ON DELETE CASCADE, etc. |
|
724 | + return $con->transaction(function () use ($con, $criteria) { |
|
725 | + $affectedRows = 0; // initialize var to track total num of affected rows |
|
726 | + |
|
727 | + InputTableMap::removeInstanceFromPool($criteria); |
|
728 | + |
|
729 | + $affectedRows += ModelCriteria::delete($con); |
|
730 | + InputTableMap::clearRelatedInstancePool(); |
|
731 | + |
|
732 | + return $affectedRows; |
|
733 | + }); |
|
734 | + } |
|
736 | 735 | |
737 | 736 | } // InputQuery |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | |
621 | 621 | // use transaction because $criteria could contain info |
622 | 622 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
623 | - return $con->transaction(function () use ($con) { |
|
623 | + return $con->transaction(function() use ($con) { |
|
624 | 624 | $affectedRows = 0; // initialize var to track total num of affected rows |
625 | 625 | $affectedRows += parent::doDeleteAll($con); |
626 | 626 | // Because this db requires some delete cascade/set null emulation, we have to |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | // use transaction because $criteria could contain info |
657 | 657 | // for more than one table or we could emulating ON DELETE CASCADE, etc. |
658 | - return $con->transaction(function () use ($con, $criteria) { |
|
658 | + return $con->transaction(function() use ($con, $criteria) { |
|
659 | 659 | $affectedRows = 0; // initialize var to track total num of affected rows |
660 | 660 | |
661 | 661 | UserTableMap::removeInstanceFromPool($criteria); |