Completed
Push — master ( 33443d...de9a4e )
by Sam
03:47
created
src/cli/Database/Base/InputQuery.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Indentation   +632 added lines, -633 removed lines patch added patch discarded remove patch
@@ -76,7 +76,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/cli/Database/Base/SubscriptionQuery.php 2 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Indentation   +931 added lines, -932 removed lines patch added patch discarded remove patch
@@ -105,7 +105,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/cli/PersistenceManager.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
migrations/PropelMigration_1455268734.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -7,37 +7,37 @@  discard block
 block discarded – undo
7 7
  */
8 8
 class PropelMigration_1455268734
9 9
 {
10
-    public $comment = '';
10
+	public $comment = '';
11 11
 
12
-    public function preUp($manager)
13
-    {
14
-        // add the pre-migration code here
15
-    }
12
+	public function preUp($manager)
13
+	{
14
+		// add the pre-migration code here
15
+	}
16 16
 
17
-    public function postUp($manager)
18
-    {
19
-        // add the post-migration code here
20
-    }
17
+	public function postUp($manager)
18
+	{
19
+		// add the post-migration code here
20
+	}
21 21
 
22
-    public function preDown($manager)
23
-    {
24
-        // add the pre-migration code here
25
-    }
22
+	public function preDown($manager)
23
+	{
24
+		// add the pre-migration code here
25
+	}
26 26
 
27
-    public function postDown($manager)
28
-    {
29
-        // add the post-migration code here
30
-    }
27
+	public function postDown($manager)
28
+	{
29
+		// add the post-migration code here
30
+	}
31 31
 
32
-    /**
33
-     * Get the SQL statements for the Up migration
34
-     *
35
-     * @return array list of the SQL strings to execute for the Up migration
36
-     *               the keys being the datasources
37
-     */
38
-    public function getUpSQL()
39
-    {
40
-        return array (
32
+	/**
33
+	 * Get the SQL statements for the Up migration
34
+	 *
35
+	 * @return array list of the SQL strings to execute for the Up migration
36
+	 *               the keys being the datasources
37
+	 */
38
+	public function getUpSQL()
39
+	{
40
+		return array (
41 41
   'tvheadend_status_manager' => '
42 42
 PRAGMA foreign_keys = OFF;
43 43
 
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
 PRAGMA foreign_keys = ON;
61 61
 ',
62 62
 );
63
-    }
63
+	}
64 64
 
65
-    /**
66
-     * Get the SQL statements for the Down migration
67
-     *
68
-     * @return array list of the SQL strings to execute for the Down migration
69
-     *               the keys being the datasources
70
-     */
71
-    public function getDownSQL()
72
-    {
73
-        return array (
65
+	/**
66
+	 * Get the SQL statements for the Down migration
67
+	 *
68
+	 * @return array list of the SQL strings to execute for the Down migration
69
+	 *               the keys being the datasources
70
+	 */
71
+	public function getDownSQL()
72
+	{
73
+		return array (
74 74
   'tvheadend_status_manager' => '
75 75
 PRAGMA foreign_keys = OFF;
76 76
 
@@ -79,6 +79,6 @@  discard block
 block discarded – undo
79 79
 PRAGMA foreign_keys = ON;
80 80
 ',
81 81
 );
82
-    }
82
+	}
83 83
 
84 84
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function getUpSQL()
39 39
     {
40
-        return array (
40
+        return array(
41 41
   'tvheadend_status_manager' => '
42 42
 PRAGMA foreign_keys = OFF;
43 43
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function getDownSQL()
72 72
     {
73
-        return array (
73
+        return array(
74 74
   'tvheadend_status_manager' => '
75 75
 PRAGMA foreign_keys = OFF;
76 76
 
Please login to merge, or discard this patch.
migrations/PropelMigration_1455269307.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -7,37 +7,37 @@  discard block
 block discarded – undo
7 7
  */
8 8
 class PropelMigration_1455269307
9 9
 {
10
-    public $comment = '';
10
+	public $comment = '';
11 11
 
12
-    public function preUp($manager)
13
-    {
14
-        // add the pre-migration code here
15
-    }
12
+	public function preUp($manager)
13
+	{
14
+		// add the pre-migration code here
15
+	}
16 16
 
17
-    public function postUp($manager)
18
-    {
19
-        // add the post-migration code here
20
-    }
17
+	public function postUp($manager)
18
+	{
19
+		// add the post-migration code here
20
+	}
21 21
 
22
-    public function preDown($manager)
23
-    {
24
-        // add the pre-migration code here
25
-    }
22
+	public function preDown($manager)
23
+	{
24
+		// add the pre-migration code here
25
+	}
26 26
 
27
-    public function postDown($manager)
28
-    {
29
-        // add the post-migration code here
30
-    }
27
+	public function postDown($manager)
28
+	{
29
+		// add the post-migration code here
30
+	}
31 31
 
32
-    /**
33
-     * Get the SQL statements for the Up migration
34
-     *
35
-     * @return array list of the SQL strings to execute for the Up migration
36
-     *               the keys being the datasources
37
-     */
38
-    public function getUpSQL()
39
-    {
40
-        return array (
32
+	/**
33
+	 * Get the SQL statements for the Up migration
34
+	 *
35
+	 * @return array list of the SQL strings to execute for the Up migration
36
+	 *               the keys being the datasources
37
+	 */
38
+	public function getUpSQL()
39
+	{
40
+		return array (
41 41
   'tvheadend_status_manager' => '
42 42
 PRAGMA foreign_keys = OFF;
43 43
 
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
 PRAGMA foreign_keys = ON;
47 47
 ',
48 48
 );
49
-    }
49
+	}
50 50
 
51
-    /**
52
-     * Get the SQL statements for the Down migration
53
-     *
54
-     * @return array list of the SQL strings to execute for the Down migration
55
-     *               the keys being the datasources
56
-     */
57
-    public function getDownSQL()
58
-    {
59
-        return array (
51
+	/**
52
+	 * Get the SQL statements for the Down migration
53
+	 *
54
+	 * @return array list of the SQL strings to execute for the Down migration
55
+	 *               the keys being the datasources
56
+	 */
57
+	public function getDownSQL()
58
+	{
59
+		return array (
60 60
   'tvheadend_status_manager' => '
61 61
 PRAGMA foreign_keys = OFF;
62 62
 
@@ -86,6 +86,6 @@  discard block
 block discarded – undo
86 86
 PRAGMA foreign_keys = ON;
87 87
 ',
88 88
 );
89
-    }
89
+	}
90 90
 
91 91
 }
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function getUpSQL()
39 39
     {
40
-        return array (
40
+        return array(
41 41
   'tvheadend_status_manager' => '
42 42
 PRAGMA foreign_keys = OFF;
43 43
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function getDownSQL()
58 58
     {
59
-        return array (
59
+        return array(
60 60
   'tvheadend_status_manager' => '
61 61
 PRAGMA foreign_keys = OFF;
62 62
 
Please login to merge, or discard this patch.
migrations/PropelMigration_1455269455.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -7,37 +7,37 @@  discard block
 block discarded – undo
7 7
  */
8 8
 class PropelMigration_1455269455
9 9
 {
10
-    public $comment = '';
11
-
12
-    public function preUp($manager)
13
-    {
14
-        // add the pre-migration code here
15
-    }
16
-
17
-    public function postUp($manager)
18
-    {
19
-        // add the post-migration code here
20
-    }
21
-
22
-    public function preDown($manager)
23
-    {
24
-        // add the pre-migration code here
25
-    }
26
-
27
-    public function postDown($manager)
28
-    {
29
-        // add the post-migration code here
30
-    }
31
-
32
-    /**
33
-     * Get the SQL statements for the Up migration
34
-     *
35
-     * @return array list of the SQL strings to execute for the Up migration
36
-     *               the keys being the datasources
37
-     */
38
-    public function getUpSQL()
39
-    {
40
-        return array (
10
+	public $comment = '';
11
+
12
+	public function preUp($manager)
13
+	{
14
+		// add the pre-migration code here
15
+	}
16
+
17
+	public function postUp($manager)
18
+	{
19
+		// add the post-migration code here
20
+	}
21
+
22
+	public function preDown($manager)
23
+	{
24
+		// add the pre-migration code here
25
+	}
26
+
27
+	public function postDown($manager)
28
+	{
29
+		// add the post-migration code here
30
+	}
31
+
32
+	/**
33
+	 * Get the SQL statements for the Up migration
34
+	 *
35
+	 * @return array list of the SQL strings to execute for the Up migration
36
+	 *               the keys being the datasources
37
+	 */
38
+	public function getUpSQL()
39
+	{
40
+		return array (
41 41
   'tvheadend_status_manager' => '
42 42
 PRAGMA foreign_keys = OFF;
43 43
 
@@ -69,17 +69,17 @@  discard block
 block discarded – undo
69 69
 PRAGMA foreign_keys = ON;
70 70
 ',
71 71
 );
72
-    }
73
-
74
-    /**
75
-     * Get the SQL statements for the Down migration
76
-     *
77
-     * @return array list of the SQL strings to execute for the Down migration
78
-     *               the keys being the datasources
79
-     */
80
-    public function getDownSQL()
81
-    {
82
-        return array (
72
+	}
73
+
74
+	/**
75
+	 * Get the SQL statements for the Down migration
76
+	 *
77
+	 * @return array list of the SQL strings to execute for the Down migration
78
+	 *               the keys being the datasources
79
+	 */
80
+	public function getDownSQL()
81
+	{
82
+		return array (
83 83
   'tvheadend_status_manager' => '
84 84
 PRAGMA foreign_keys = OFF;
85 85
 
@@ -110,6 +110,6 @@  discard block
 block discarded – undo
110 110
 PRAGMA foreign_keys = ON;
111 111
 ',
112 112
 );
113
-    }
113
+	}
114 114
 
115 115
 }
116 116
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function getUpSQL()
39 39
     {
40
-        return array (
40
+        return array(
41 41
   'tvheadend_status_manager' => '
42 42
 PRAGMA foreign_keys = OFF;
43 43
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function getDownSQL()
81 81
     {
82
-        return array (
82
+        return array(
83 83
   'tvheadend_status_manager' => '
84 84
 PRAGMA foreign_keys = OFF;
85 85
 
Please login to merge, or discard this patch.
migrations/PropelMigration_1455269809.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -7,37 +7,37 @@  discard block
 block discarded – undo
7 7
  */
8 8
 class PropelMigration_1455269809
9 9
 {
10
-    public $comment = '';
11
-
12
-    public function preUp($manager)
13
-    {
14
-        // add the pre-migration code here
15
-    }
16
-
17
-    public function postUp($manager)
18
-    {
19
-        // add the post-migration code here
20
-    }
21
-
22
-    public function preDown($manager)
23
-    {
24
-        // add the pre-migration code here
25
-    }
26
-
27
-    public function postDown($manager)
28
-    {
29
-        // add the post-migration code here
30
-    }
31
-
32
-    /**
33
-     * Get the SQL statements for the Up migration
34
-     *
35
-     * @return array list of the SQL strings to execute for the Up migration
36
-     *               the keys being the datasources
37
-     */
38
-    public function getUpSQL()
39
-    {
40
-        return array (
10
+	public $comment = '';
11
+
12
+	public function preUp($manager)
13
+	{
14
+		// add the pre-migration code here
15
+	}
16
+
17
+	public function postUp($manager)
18
+	{
19
+		// add the post-migration code here
20
+	}
21
+
22
+	public function preDown($manager)
23
+	{
24
+		// add the pre-migration code here
25
+	}
26
+
27
+	public function postDown($manager)
28
+	{
29
+		// add the post-migration code here
30
+	}
31
+
32
+	/**
33
+	 * Get the SQL statements for the Up migration
34
+	 *
35
+	 * @return array list of the SQL strings to execute for the Up migration
36
+	 *               the keys being the datasources
37
+	 */
38
+	public function getUpSQL()
39
+	{
40
+		return array (
41 41
   'tvheadend_status_manager' => '
42 42
 PRAGMA foreign_keys = OFF;
43 43
 
@@ -69,17 +69,17 @@  discard block
 block discarded – undo
69 69
 PRAGMA foreign_keys = ON;
70 70
 ',
71 71
 );
72
-    }
73
-
74
-    /**
75
-     * Get the SQL statements for the Down migration
76
-     *
77
-     * @return array list of the SQL strings to execute for the Down migration
78
-     *               the keys being the datasources
79
-     */
80
-    public function getDownSQL()
81
-    {
82
-        return array (
72
+	}
73
+
74
+	/**
75
+	 * Get the SQL statements for the Down migration
76
+	 *
77
+	 * @return array list of the SQL strings to execute for the Down migration
78
+	 *               the keys being the datasources
79
+	 */
80
+	public function getDownSQL()
81
+	{
82
+		return array (
83 83
   'tvheadend_status_manager' => '
84 84
 PRAGMA foreign_keys = OFF;
85 85
 
@@ -111,6 +111,6 @@  discard block
 block discarded – undo
111 111
 PRAGMA foreign_keys = ON;
112 112
 ',
113 113
 );
114
-    }
114
+	}
115 115
 
116 116
 }
117 117
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function getUpSQL()
39 39
     {
40
-        return array (
40
+        return array(
41 41
   'tvheadend_status_manager' => '
42 42
 PRAGMA foreign_keys = OFF;
43 43
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function getDownSQL()
81 81
     {
82
-        return array (
82
+        return array(
83 83
   'tvheadend_status_manager' => '
84 84
 PRAGMA foreign_keys = OFF;
85 85
 
Please login to merge, or discard this patch.
src/cli/Database/Base/Channel.php 1 patch
Indentation   +1638 added lines, -1638 removed lines patch added patch discarded remove patch
@@ -34,1650 +34,1650 @@
 block discarded – undo
34 34
 */
35 35
 abstract class Channel implements ActiveRecordInterface
36 36
 {
37
-    /**
38
-     * TableMap class name
39
-     */
40
-    const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\ChannelTableMap';
41
-
42
-
43
-    /**
44
-     * attribute to determine if this object has previously been saved.
45
-     * @var boolean
46
-     */
47
-    protected $new = true;
48
-
49
-    /**
50
-     * attribute to determine whether this object has been deleted.
51
-     * @var boolean
52
-     */
53
-    protected $deleted = false;
54
-
55
-    /**
56
-     * The columns that have been modified in current object.
57
-     * Tracking modified columns allows us to only update modified columns.
58
-     * @var array
59
-     */
60
-    protected $modifiedColumns = array();
61
-
62
-    /**
63
-     * The (virtual) columns that are added at runtime
64
-     * The formatters can add supplementary columns based on a resultset
65
-     * @var array
66
-     */
67
-    protected $virtualColumns = array();
68
-
69
-    /**
70
-     * The value for the id field.
71
-     *
72
-     * @var        int
73
-     */
74
-    protected $id;
75
-
76
-    /**
77
-     * The value for the instance_name field.
78
-     *
79
-     * @var        string
80
-     */
81
-    protected $instance_name;
82
-
83
-    /**
84
-     * The value for the name field.
85
-     *
86
-     * @var        string
87
-     */
88
-    protected $name;
89
-
90
-    /**
91
-     * @var        ChildInstance
92
-     */
93
-    protected $aInstance;
94
-
95
-    /**
96
-     * @var        ObjectCollection|ChildSubscription[] Collection to store aggregation of ChildSubscription objects.
97
-     */
98
-    protected $collSubscriptions;
99
-    protected $collSubscriptionsPartial;
100
-
101
-    /**
102
-     * Flag to prevent endless save loop, if this object is referenced
103
-     * by another object which falls in this transaction.
104
-     *
105
-     * @var boolean
106
-     */
107
-    protected $alreadyInSave = false;
108
-
109
-    /**
110
-     * An array of objects scheduled for deletion.
111
-     * @var ObjectCollection|ChildSubscription[]
112
-     */
113
-    protected $subscriptionsScheduledForDeletion = null;
114
-
115
-    /**
116
-     * Initializes internal state of Jalle19\StatusManager\Database\Base\Channel object.
117
-     */
118
-    public function __construct()
119
-    {
120
-    }
121
-
122
-    /**
123
-     * Returns whether the object has been modified.
124
-     *
125
-     * @return boolean True if the object has been modified.
126
-     */
127
-    public function isModified()
128
-    {
129
-        return !!$this->modifiedColumns;
130
-    }
131
-
132
-    /**
133
-     * Has specified column been modified?
134
-     *
135
-     * @param  string  $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
136
-     * @return boolean True if $col has been modified.
137
-     */
138
-    public function isColumnModified($col)
139
-    {
140
-        return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
141
-    }
142
-
143
-    /**
144
-     * Get the columns that have been modified in this object.
145
-     * @return array A unique list of the modified column names for this object.
146
-     */
147
-    public function getModifiedColumns()
148
-    {
149
-        return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
150
-    }
151
-
152
-    /**
153
-     * Returns whether the object has ever been saved.  This will
154
-     * be false, if the object was retrieved from storage or was created
155
-     * and then saved.
156
-     *
157
-     * @return boolean true, if the object has never been persisted.
158
-     */
159
-    public function isNew()
160
-    {
161
-        return $this->new;
162
-    }
163
-
164
-    /**
165
-     * Setter for the isNew attribute.  This method will be called
166
-     * by Propel-generated children and objects.
167
-     *
168
-     * @param boolean $b the state of the object.
169
-     */
170
-    public function setNew($b)
171
-    {
172
-        $this->new = (boolean) $b;
173
-    }
174
-
175
-    /**
176
-     * Whether this object has been deleted.
177
-     * @return boolean The deleted state of this object.
178
-     */
179
-    public function isDeleted()
180
-    {
181
-        return $this->deleted;
182
-    }
183
-
184
-    /**
185
-     * Specify whether this object has been deleted.
186
-     * @param  boolean $b The deleted state of this object.
187
-     * @return void
188
-     */
189
-    public function setDeleted($b)
190
-    {
191
-        $this->deleted = (boolean) $b;
192
-    }
193
-
194
-    /**
195
-     * Sets the modified state for the object to be false.
196
-     * @param  string $col If supplied, only the specified column is reset.
197
-     * @return void
198
-     */
199
-    public function resetModified($col = null)
200
-    {
201
-        if (null !== $col) {
202
-            if (isset($this->modifiedColumns[$col])) {
203
-                unset($this->modifiedColumns[$col]);
204
-            }
205
-        } else {
206
-            $this->modifiedColumns = array();
207
-        }
208
-    }
209
-
210
-    /**
211
-     * Compares this with another <code>Channel</code> instance.  If
212
-     * <code>obj</code> is an instance of <code>Channel</code>, delegates to
213
-     * <code>equals(Channel)</code>.  Otherwise, returns <code>false</code>.
214
-     *
215
-     * @param  mixed   $obj The object to compare to.
216
-     * @return boolean Whether equal to the object specified.
217
-     */
218
-    public function equals($obj)
219
-    {
220
-        if (!$obj instanceof static) {
221
-            return false;
222
-        }
223
-
224
-        if ($this === $obj) {
225
-            return true;
226
-        }
227
-
228
-        if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) {
229
-            return false;
230
-        }
231
-
232
-        return $this->getPrimaryKey() === $obj->getPrimaryKey();
233
-    }
234
-
235
-    /**
236
-     * Get the associative array of the virtual columns in this object
237
-     *
238
-     * @return array
239
-     */
240
-    public function getVirtualColumns()
241
-    {
242
-        return $this->virtualColumns;
243
-    }
244
-
245
-    /**
246
-     * Checks the existence of a virtual column in this object
247
-     *
248
-     * @param  string  $name The virtual column name
249
-     * @return boolean
250
-     */
251
-    public function hasVirtualColumn($name)
252
-    {
253
-        return array_key_exists($name, $this->virtualColumns);
254
-    }
255
-
256
-    /**
257
-     * Get the value of a virtual column in this object
258
-     *
259
-     * @param  string $name The virtual column name
260
-     * @return mixed
261
-     *
262
-     * @throws PropelException
263
-     */
264
-    public function getVirtualColumn($name)
265
-    {
266
-        if (!$this->hasVirtualColumn($name)) {
267
-            throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
268
-        }
269
-
270
-        return $this->virtualColumns[$name];
271
-    }
272
-
273
-    /**
274
-     * Set the value of a virtual column in this object
275
-     *
276
-     * @param string $name  The virtual column name
277
-     * @param mixed  $value The value to give to the virtual column
278
-     *
279
-     * @return $this|Channel The current object, for fluid interface
280
-     */
281
-    public function setVirtualColumn($name, $value)
282
-    {
283
-        $this->virtualColumns[$name] = $value;
284
-
285
-        return $this;
286
-    }
287
-
288
-    /**
289
-     * Logs a message using Propel::log().
290
-     *
291
-     * @param  string  $msg
292
-     * @param  int     $priority One of the Propel::LOG_* logging levels
293
-     * @return boolean
294
-     */
295
-    protected function log($msg, $priority = Propel::LOG_INFO)
296
-    {
297
-        return Propel::log(get_class($this) . ': ' . $msg, $priority);
298
-    }
299
-
300
-    /**
301
-     * Export the current object properties to a string, using a given parser format
302
-     * <code>
303
-     * $book = BookQuery::create()->findPk(9012);
304
-     * echo $book->exportTo('JSON');
305
-     *  => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
306
-     * </code>
307
-     *
308
-     * @param  mixed   $parser                 A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
309
-     * @param  boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
310
-     * @return string  The exported data
311
-     */
312
-    public function exportTo($parser, $includeLazyLoadColumns = true)
313
-    {
314
-        if (!$parser instanceof AbstractParser) {
315
-            $parser = AbstractParser::getParser($parser);
316
-        }
317
-
318
-        return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
319
-    }
320
-
321
-    /**
322
-     * Clean up internal collections prior to serializing
323
-     * Avoids recursive loops that turn into segmentation faults when serializing
324
-     */
325
-    public function __sleep()
326
-    {
327
-        $this->clearAllReferences();
328
-
329
-        $cls = new \ReflectionClass($this);
330
-        $propertyNames = [];
331
-        $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
332
-
333
-        foreach($serializableProperties as $property) {
334
-            $propertyNames[] = $property->getName();
335
-        }
336
-
337
-        return $propertyNames;
338
-    }
339
-
340
-    /**
341
-     * Get the [id] column value.
342
-     *
343
-     * @return int
344
-     */
345
-    public function getId()
346
-    {
347
-        return $this->id;
348
-    }
349
-
350
-    /**
351
-     * Get the [instance_name] column value.
352
-     *
353
-     * @return string
354
-     */
355
-    public function getInstanceName()
356
-    {
357
-        return $this->instance_name;
358
-    }
359
-
360
-    /**
361
-     * Get the [name] column value.
362
-     *
363
-     * @return string
364
-     */
365
-    public function getName()
366
-    {
367
-        return $this->name;
368
-    }
369
-
370
-    /**
371
-     * Set the value of [id] column.
372
-     *
373
-     * @param int $v new value
374
-     * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
375
-     */
376
-    public function setId($v)
377
-    {
378
-        if ($v !== null) {
379
-            $v = (int) $v;
380
-        }
381
-
382
-        if ($this->id !== $v) {
383
-            $this->id = $v;
384
-            $this->modifiedColumns[ChannelTableMap::COL_ID] = true;
385
-        }
386
-
387
-        return $this;
388
-    } // setId()
389
-
390
-    /**
391
-     * Set the value of [instance_name] column.
392
-     *
393
-     * @param string $v new value
394
-     * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
395
-     */
396
-    public function setInstanceName($v)
397
-    {
398
-        if ($v !== null) {
399
-            $v = (string) $v;
400
-        }
401
-
402
-        if ($this->instance_name !== $v) {
403
-            $this->instance_name = $v;
404
-            $this->modifiedColumns[ChannelTableMap::COL_INSTANCE_NAME] = true;
405
-        }
406
-
407
-        if ($this->aInstance !== null && $this->aInstance->getName() !== $v) {
408
-            $this->aInstance = null;
409
-        }
410
-
411
-        return $this;
412
-    } // setInstanceName()
413
-
414
-    /**
415
-     * Set the value of [name] column.
416
-     *
417
-     * @param string $v new value
418
-     * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
419
-     */
420
-    public function setName($v)
421
-    {
422
-        if ($v !== null) {
423
-            $v = (string) $v;
424
-        }
425
-
426
-        if ($this->name !== $v) {
427
-            $this->name = $v;
428
-            $this->modifiedColumns[ChannelTableMap::COL_NAME] = true;
429
-        }
430
-
431
-        return $this;
432
-    } // setName()
433
-
434
-    /**
435
-     * Indicates whether the columns in this object are only set to default values.
436
-     *
437
-     * This method can be used in conjunction with isModified() to indicate whether an object is both
438
-     * modified _and_ has some values set which are non-default.
439
-     *
440
-     * @return boolean Whether the columns in this object are only been set with default values.
441
-     */
442
-    public function hasOnlyDefaultValues()
443
-    {
444
-        // otherwise, everything was equal, so return TRUE
445
-        return true;
446
-    } // hasOnlyDefaultValues()
447
-
448
-    /**
449
-     * Hydrates (populates) the object variables with values from the database resultset.
450
-     *
451
-     * An offset (0-based "start column") is specified so that objects can be hydrated
452
-     * with a subset of the columns in the resultset rows.  This is needed, for example,
453
-     * for results of JOIN queries where the resultset row includes columns from two or
454
-     * more tables.
455
-     *
456
-     * @param array   $row       The row returned by DataFetcher->fetch().
457
-     * @param int     $startcol  0-based offset column which indicates which restultset column to start with.
458
-     * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
459
-     * @param string  $indexType The index type of $row. Mostly DataFetcher->getIndexType().
37
+	/**
38
+	 * TableMap class name
39
+	 */
40
+	const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\ChannelTableMap';
41
+
42
+
43
+	/**
44
+	 * attribute to determine if this object has previously been saved.
45
+	 * @var boolean
46
+	 */
47
+	protected $new = true;
48
+
49
+	/**
50
+	 * attribute to determine whether this object has been deleted.
51
+	 * @var boolean
52
+	 */
53
+	protected $deleted = false;
54
+
55
+	/**
56
+	 * The columns that have been modified in current object.
57
+	 * Tracking modified columns allows us to only update modified columns.
58
+	 * @var array
59
+	 */
60
+	protected $modifiedColumns = array();
61
+
62
+	/**
63
+	 * The (virtual) columns that are added at runtime
64
+	 * The formatters can add supplementary columns based on a resultset
65
+	 * @var array
66
+	 */
67
+	protected $virtualColumns = array();
68
+
69
+	/**
70
+	 * The value for the id field.
71
+	 *
72
+	 * @var        int
73
+	 */
74
+	protected $id;
75
+
76
+	/**
77
+	 * The value for the instance_name field.
78
+	 *
79
+	 * @var        string
80
+	 */
81
+	protected $instance_name;
82
+
83
+	/**
84
+	 * The value for the name field.
85
+	 *
86
+	 * @var        string
87
+	 */
88
+	protected $name;
89
+
90
+	/**
91
+	 * @var        ChildInstance
92
+	 */
93
+	protected $aInstance;
94
+
95
+	/**
96
+	 * @var        ObjectCollection|ChildSubscription[] Collection to store aggregation of ChildSubscription objects.
97
+	 */
98
+	protected $collSubscriptions;
99
+	protected $collSubscriptionsPartial;
100
+
101
+	/**
102
+	 * Flag to prevent endless save loop, if this object is referenced
103
+	 * by another object which falls in this transaction.
104
+	 *
105
+	 * @var boolean
106
+	 */
107
+	protected $alreadyInSave = false;
108
+
109
+	/**
110
+	 * An array of objects scheduled for deletion.
111
+	 * @var ObjectCollection|ChildSubscription[]
112
+	 */
113
+	protected $subscriptionsScheduledForDeletion = null;
114
+
115
+	/**
116
+	 * Initializes internal state of Jalle19\StatusManager\Database\Base\Channel object.
117
+	 */
118
+	public function __construct()
119
+	{
120
+	}
121
+
122
+	/**
123
+	 * Returns whether the object has been modified.
124
+	 *
125
+	 * @return boolean True if the object has been modified.
126
+	 */
127
+	public function isModified()
128
+	{
129
+		return !!$this->modifiedColumns;
130
+	}
131
+
132
+	/**
133
+	 * Has specified column been modified?
134
+	 *
135
+	 * @param  string  $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
136
+	 * @return boolean True if $col has been modified.
137
+	 */
138
+	public function isColumnModified($col)
139
+	{
140
+		return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
141
+	}
142
+
143
+	/**
144
+	 * Get the columns that have been modified in this object.
145
+	 * @return array A unique list of the modified column names for this object.
146
+	 */
147
+	public function getModifiedColumns()
148
+	{
149
+		return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
150
+	}
151
+
152
+	/**
153
+	 * Returns whether the object has ever been saved.  This will
154
+	 * be false, if the object was retrieved from storage or was created
155
+	 * and then saved.
156
+	 *
157
+	 * @return boolean true, if the object has never been persisted.
158
+	 */
159
+	public function isNew()
160
+	{
161
+		return $this->new;
162
+	}
163
+
164
+	/**
165
+	 * Setter for the isNew attribute.  This method will be called
166
+	 * by Propel-generated children and objects.
167
+	 *
168
+	 * @param boolean $b the state of the object.
169
+	 */
170
+	public function setNew($b)
171
+	{
172
+		$this->new = (boolean) $b;
173
+	}
174
+
175
+	/**
176
+	 * Whether this object has been deleted.
177
+	 * @return boolean The deleted state of this object.
178
+	 */
179
+	public function isDeleted()
180
+	{
181
+		return $this->deleted;
182
+	}
183
+
184
+	/**
185
+	 * Specify whether this object has been deleted.
186
+	 * @param  boolean $b The deleted state of this object.
187
+	 * @return void
188
+	 */
189
+	public function setDeleted($b)
190
+	{
191
+		$this->deleted = (boolean) $b;
192
+	}
193
+
194
+	/**
195
+	 * Sets the modified state for the object to be false.
196
+	 * @param  string $col If supplied, only the specified column is reset.
197
+	 * @return void
198
+	 */
199
+	public function resetModified($col = null)
200
+	{
201
+		if (null !== $col) {
202
+			if (isset($this->modifiedColumns[$col])) {
203
+				unset($this->modifiedColumns[$col]);
204
+			}
205
+		} else {
206
+			$this->modifiedColumns = array();
207
+		}
208
+	}
209
+
210
+	/**
211
+	 * Compares this with another <code>Channel</code> instance.  If
212
+	 * <code>obj</code> is an instance of <code>Channel</code>, delegates to
213
+	 * <code>equals(Channel)</code>.  Otherwise, returns <code>false</code>.
214
+	 *
215
+	 * @param  mixed   $obj The object to compare to.
216
+	 * @return boolean Whether equal to the object specified.
217
+	 */
218
+	public function equals($obj)
219
+	{
220
+		if (!$obj instanceof static) {
221
+			return false;
222
+		}
223
+
224
+		if ($this === $obj) {
225
+			return true;
226
+		}
227
+
228
+		if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) {
229
+			return false;
230
+		}
231
+
232
+		return $this->getPrimaryKey() === $obj->getPrimaryKey();
233
+	}
234
+
235
+	/**
236
+	 * Get the associative array of the virtual columns in this object
237
+	 *
238
+	 * @return array
239
+	 */
240
+	public function getVirtualColumns()
241
+	{
242
+		return $this->virtualColumns;
243
+	}
244
+
245
+	/**
246
+	 * Checks the existence of a virtual column in this object
247
+	 *
248
+	 * @param  string  $name The virtual column name
249
+	 * @return boolean
250
+	 */
251
+	public function hasVirtualColumn($name)
252
+	{
253
+		return array_key_exists($name, $this->virtualColumns);
254
+	}
255
+
256
+	/**
257
+	 * Get the value of a virtual column in this object
258
+	 *
259
+	 * @param  string $name The virtual column name
260
+	 * @return mixed
261
+	 *
262
+	 * @throws PropelException
263
+	 */
264
+	public function getVirtualColumn($name)
265
+	{
266
+		if (!$this->hasVirtualColumn($name)) {
267
+			throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
268
+		}
269
+
270
+		return $this->virtualColumns[$name];
271
+	}
272
+
273
+	/**
274
+	 * Set the value of a virtual column in this object
275
+	 *
276
+	 * @param string $name  The virtual column name
277
+	 * @param mixed  $value The value to give to the virtual column
278
+	 *
279
+	 * @return $this|Channel The current object, for fluid interface
280
+	 */
281
+	public function setVirtualColumn($name, $value)
282
+	{
283
+		$this->virtualColumns[$name] = $value;
284
+
285
+		return $this;
286
+	}
287
+
288
+	/**
289
+	 * Logs a message using Propel::log().
290
+	 *
291
+	 * @param  string  $msg
292
+	 * @param  int     $priority One of the Propel::LOG_* logging levels
293
+	 * @return boolean
294
+	 */
295
+	protected function log($msg, $priority = Propel::LOG_INFO)
296
+	{
297
+		return Propel::log(get_class($this) . ': ' . $msg, $priority);
298
+	}
299
+
300
+	/**
301
+	 * Export the current object properties to a string, using a given parser format
302
+	 * <code>
303
+	 * $book = BookQuery::create()->findPk(9012);
304
+	 * echo $book->exportTo('JSON');
305
+	 *  => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
306
+	 * </code>
307
+	 *
308
+	 * @param  mixed   $parser                 A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
309
+	 * @param  boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
310
+	 * @return string  The exported data
311
+	 */
312
+	public function exportTo($parser, $includeLazyLoadColumns = true)
313
+	{
314
+		if (!$parser instanceof AbstractParser) {
315
+			$parser = AbstractParser::getParser($parser);
316
+		}
317
+
318
+		return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
319
+	}
320
+
321
+	/**
322
+	 * Clean up internal collections prior to serializing
323
+	 * Avoids recursive loops that turn into segmentation faults when serializing
324
+	 */
325
+	public function __sleep()
326
+	{
327
+		$this->clearAllReferences();
328
+
329
+		$cls = new \ReflectionClass($this);
330
+		$propertyNames = [];
331
+		$serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
332
+
333
+		foreach($serializableProperties as $property) {
334
+			$propertyNames[] = $property->getName();
335
+		}
336
+
337
+		return $propertyNames;
338
+	}
339
+
340
+	/**
341
+	 * Get the [id] column value.
342
+	 *
343
+	 * @return int
344
+	 */
345
+	public function getId()
346
+	{
347
+		return $this->id;
348
+	}
349
+
350
+	/**
351
+	 * Get the [instance_name] column value.
352
+	 *
353
+	 * @return string
354
+	 */
355
+	public function getInstanceName()
356
+	{
357
+		return $this->instance_name;
358
+	}
359
+
360
+	/**
361
+	 * Get the [name] column value.
362
+	 *
363
+	 * @return string
364
+	 */
365
+	public function getName()
366
+	{
367
+		return $this->name;
368
+	}
369
+
370
+	/**
371
+	 * Set the value of [id] column.
372
+	 *
373
+	 * @param int $v new value
374
+	 * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
375
+	 */
376
+	public function setId($v)
377
+	{
378
+		if ($v !== null) {
379
+			$v = (int) $v;
380
+		}
381
+
382
+		if ($this->id !== $v) {
383
+			$this->id = $v;
384
+			$this->modifiedColumns[ChannelTableMap::COL_ID] = true;
385
+		}
386
+
387
+		return $this;
388
+	} // setId()
389
+
390
+	/**
391
+	 * Set the value of [instance_name] column.
392
+	 *
393
+	 * @param string $v new value
394
+	 * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
395
+	 */
396
+	public function setInstanceName($v)
397
+	{
398
+		if ($v !== null) {
399
+			$v = (string) $v;
400
+		}
401
+
402
+		if ($this->instance_name !== $v) {
403
+			$this->instance_name = $v;
404
+			$this->modifiedColumns[ChannelTableMap::COL_INSTANCE_NAME] = true;
405
+		}
406
+
407
+		if ($this->aInstance !== null && $this->aInstance->getName() !== $v) {
408
+			$this->aInstance = null;
409
+		}
410
+
411
+		return $this;
412
+	} // setInstanceName()
413
+
414
+	/**
415
+	 * Set the value of [name] column.
416
+	 *
417
+	 * @param string $v new value
418
+	 * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
419
+	 */
420
+	public function setName($v)
421
+	{
422
+		if ($v !== null) {
423
+			$v = (string) $v;
424
+		}
425
+
426
+		if ($this->name !== $v) {
427
+			$this->name = $v;
428
+			$this->modifiedColumns[ChannelTableMap::COL_NAME] = true;
429
+		}
430
+
431
+		return $this;
432
+	} // setName()
433
+
434
+	/**
435
+	 * Indicates whether the columns in this object are only set to default values.
436
+	 *
437
+	 * This method can be used in conjunction with isModified() to indicate whether an object is both
438
+	 * modified _and_ has some values set which are non-default.
439
+	 *
440
+	 * @return boolean Whether the columns in this object are only been set with default values.
441
+	 */
442
+	public function hasOnlyDefaultValues()
443
+	{
444
+		// otherwise, everything was equal, so return TRUE
445
+		return true;
446
+	} // hasOnlyDefaultValues()
447
+
448
+	/**
449
+	 * Hydrates (populates) the object variables with values from the database resultset.
450
+	 *
451
+	 * An offset (0-based "start column") is specified so that objects can be hydrated
452
+	 * with a subset of the columns in the resultset rows.  This is needed, for example,
453
+	 * for results of JOIN queries where the resultset row includes columns from two or
454
+	 * more tables.
455
+	 *
456
+	 * @param array   $row       The row returned by DataFetcher->fetch().
457
+	 * @param int     $startcol  0-based offset column which indicates which restultset column to start with.
458
+	 * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
459
+	 * @param string  $indexType The index type of $row. Mostly DataFetcher->getIndexType().
460 460
                                   One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
461
-     *                            TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
462
-     *
463
-     * @return int             next starting column
464
-     * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
465
-     */
466
-    public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
467
-    {
468
-        try {
469
-
470
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ChannelTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
471
-            $this->id = (null !== $col) ? (int) $col : null;
472
-
473
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ChannelTableMap::translateFieldName('InstanceName', TableMap::TYPE_PHPNAME, $indexType)];
474
-            $this->instance_name = (null !== $col) ? (string) $col : null;
475
-
476
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ChannelTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
477
-            $this->name = (null !== $col) ? (string) $col : null;
478
-            $this->resetModified();
479
-
480
-            $this->setNew(false);
481
-
482
-            if ($rehydrate) {
483
-                $this->ensureConsistency();
484
-            }
485
-
486
-            return $startcol + 3; // 3 = ChannelTableMap::NUM_HYDRATE_COLUMNS.
487
-
488
-        } catch (Exception $e) {
489
-            throw new PropelException(sprintf('Error populating %s object', '\\Jalle19\\StatusManager\\Database\\Channel'), 0, $e);
490
-        }
491
-    }
492
-
493
-    /**
494
-     * Checks and repairs the internal consistency of the object.
495
-     *
496
-     * This method is executed after an already-instantiated object is re-hydrated
497
-     * from the database.  It exists to check any foreign keys to make sure that
498
-     * the objects related to the current object are correct based on foreign key.
499
-     *
500
-     * You can override this method in the stub class, but you should always invoke
501
-     * the base method from the overridden method (i.e. parent::ensureConsistency()),
502
-     * in case your model changes.
503
-     *
504
-     * @throws PropelException
505
-     */
506
-    public function ensureConsistency()
507
-    {
508
-        if ($this->aInstance !== null && $this->instance_name !== $this->aInstance->getName()) {
509
-            $this->aInstance = null;
510
-        }
511
-    } // ensureConsistency
512
-
513
-    /**
514
-     * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
515
-     *
516
-     * This will only work if the object has been saved and has a valid primary key set.
517
-     *
518
-     * @param      boolean $deep (optional) Whether to also de-associated any related objects.
519
-     * @param      ConnectionInterface $con (optional) The ConnectionInterface connection to use.
520
-     * @return void
521
-     * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
522
-     */
523
-    public function reload($deep = false, ConnectionInterface $con = null)
524
-    {
525
-        if ($this->isDeleted()) {
526
-            throw new PropelException("Cannot reload a deleted object.");
527
-        }
528
-
529
-        if ($this->isNew()) {
530
-            throw new PropelException("Cannot reload an unsaved object.");
531
-        }
532
-
533
-        if ($con === null) {
534
-            $con = Propel::getServiceContainer()->getReadConnection(ChannelTableMap::DATABASE_NAME);
535
-        }
536
-
537
-        // We don't need to alter the object instance pool; we're just modifying this instance
538
-        // already in the pool.
539
-
540
-        $dataFetcher = ChildChannelQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
541
-        $row = $dataFetcher->fetch();
542
-        $dataFetcher->close();
543
-        if (!$row) {
544
-            throw new PropelException('Cannot find matching row in the database to reload object values.');
545
-        }
546
-        $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
547
-
548
-        if ($deep) {  // also de-associate any related objects?
549
-
550
-            $this->aInstance = null;
551
-            $this->collSubscriptions = null;
552
-
553
-        } // if (deep)
554
-    }
555
-
556
-    /**
557
-     * Removes this object from datastore and sets delete attribute.
558
-     *
559
-     * @param      ConnectionInterface $con
560
-     * @return void
561
-     * @throws PropelException
562
-     * @see Channel::setDeleted()
563
-     * @see Channel::isDeleted()
564
-     */
565
-    public function delete(ConnectionInterface $con = null)
566
-    {
567
-        if ($this->isDeleted()) {
568
-            throw new PropelException("This object has already been deleted.");
569
-        }
570
-
571
-        if ($con === null) {
572
-            $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
573
-        }
574
-
575
-        $con->transaction(function () use ($con) {
576
-            $deleteQuery = ChildChannelQuery::create()
577
-                ->filterByPrimaryKey($this->getPrimaryKey());
578
-            $ret = $this->preDelete($con);
579
-            if ($ret) {
580
-                $deleteQuery->delete($con);
581
-                $this->postDelete($con);
582
-                $this->setDeleted(true);
583
-            }
584
-        });
585
-    }
586
-
587
-    /**
588
-     * Persists this object to the database.
589
-     *
590
-     * If the object is new, it inserts it; otherwise an update is performed.
591
-     * All modified related objects will also be persisted in the doSave()
592
-     * method.  This method wraps all precipitate database operations in a
593
-     * single transaction.
594
-     *
595
-     * @param      ConnectionInterface $con
596
-     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
597
-     * @throws PropelException
598
-     * @see doSave()
599
-     */
600
-    public function save(ConnectionInterface $con = null)
601
-    {
602
-        if ($this->isDeleted()) {
603
-            throw new PropelException("You cannot save an object that has been deleted.");
604
-        }
605
-
606
-        if ($con === null) {
607
-            $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
608
-        }
609
-
610
-        return $con->transaction(function () use ($con) {
611
-            $isInsert = $this->isNew();
612
-            $ret = $this->preSave($con);
613
-            if ($isInsert) {
614
-                $ret = $ret && $this->preInsert($con);
615
-            } else {
616
-                $ret = $ret && $this->preUpdate($con);
617
-            }
618
-            if ($ret) {
619
-                $affectedRows = $this->doSave($con);
620
-                if ($isInsert) {
621
-                    $this->postInsert($con);
622
-                } else {
623
-                    $this->postUpdate($con);
624
-                }
625
-                $this->postSave($con);
626
-                ChannelTableMap::addInstanceToPool($this);
627
-            } else {
628
-                $affectedRows = 0;
629
-            }
630
-
631
-            return $affectedRows;
632
-        });
633
-    }
634
-
635
-    /**
636
-     * Performs the work of inserting or updating the row in the database.
637
-     *
638
-     * If the object is new, it inserts it; otherwise an update is performed.
639
-     * All related objects are also updated in this method.
640
-     *
641
-     * @param      ConnectionInterface $con
642
-     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
643
-     * @throws PropelException
644
-     * @see save()
645
-     */
646
-    protected function doSave(ConnectionInterface $con)
647
-    {
648
-        $affectedRows = 0; // initialize var to track total num of affected rows
649
-        if (!$this->alreadyInSave) {
650
-            $this->alreadyInSave = true;
651
-
652
-            // We call the save method on the following object(s) if they
653
-            // were passed to this object by their corresponding set
654
-            // method.  This object relates to these object(s) by a
655
-            // foreign key reference.
656
-
657
-            if ($this->aInstance !== null) {
658
-                if ($this->aInstance->isModified() || $this->aInstance->isNew()) {
659
-                    $affectedRows += $this->aInstance->save($con);
660
-                }
661
-                $this->setInstance($this->aInstance);
662
-            }
663
-
664
-            if ($this->isNew() || $this->isModified()) {
665
-                // persist changes
666
-                if ($this->isNew()) {
667
-                    $this->doInsert($con);
668
-                    $affectedRows += 1;
669
-                } else {
670
-                    $affectedRows += $this->doUpdate($con);
671
-                }
672
-                $this->resetModified();
673
-            }
674
-
675
-            if ($this->subscriptionsScheduledForDeletion !== null) {
676
-                if (!$this->subscriptionsScheduledForDeletion->isEmpty()) {
677
-                    \Jalle19\StatusManager\Database\SubscriptionQuery::create()
678
-                        ->filterByPrimaryKeys($this->subscriptionsScheduledForDeletion->getPrimaryKeys(false))
679
-                        ->delete($con);
680
-                    $this->subscriptionsScheduledForDeletion = null;
681
-                }
682
-            }
683
-
684
-            if ($this->collSubscriptions !== null) {
685
-                foreach ($this->collSubscriptions as $referrerFK) {
686
-                    if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
687
-                        $affectedRows += $referrerFK->save($con);
688
-                    }
689
-                }
690
-            }
691
-
692
-            $this->alreadyInSave = false;
693
-
694
-        }
695
-
696
-        return $affectedRows;
697
-    } // doSave()
698
-
699
-    /**
700
-     * Insert the row in the database.
701
-     *
702
-     * @param      ConnectionInterface $con
703
-     *
704
-     * @throws PropelException
705
-     * @see doSave()
706
-     */
707
-    protected function doInsert(ConnectionInterface $con)
708
-    {
709
-        $modifiedColumns = array();
710
-        $index = 0;
711
-
712
-        $this->modifiedColumns[ChannelTableMap::COL_ID] = true;
713
-        if (null !== $this->id) {
714
-            throw new PropelException('Cannot insert a value for auto-increment primary key (' . ChannelTableMap::COL_ID . ')');
715
-        }
716
-
717
-         // check the columns in natural order for more readable SQL queries
718
-        if ($this->isColumnModified(ChannelTableMap::COL_ID)) {
719
-            $modifiedColumns[':p' . $index++]  = 'id';
720
-        }
721
-        if ($this->isColumnModified(ChannelTableMap::COL_INSTANCE_NAME)) {
722
-            $modifiedColumns[':p' . $index++]  = 'instance_name';
723
-        }
724
-        if ($this->isColumnModified(ChannelTableMap::COL_NAME)) {
725
-            $modifiedColumns[':p' . $index++]  = 'name';
726
-        }
727
-
728
-        $sql = sprintf(
729
-            'INSERT INTO channel (%s) VALUES (%s)',
730
-            implode(', ', $modifiedColumns),
731
-            implode(', ', array_keys($modifiedColumns))
732
-        );
733
-
734
-        try {
735
-            $stmt = $con->prepare($sql);
736
-            foreach ($modifiedColumns as $identifier => $columnName) {
737
-                switch ($columnName) {
738
-                    case 'id':
739
-                        $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
740
-                        break;
741
-                    case 'instance_name':
742
-                        $stmt->bindValue($identifier, $this->instance_name, PDO::PARAM_STR);
743
-                        break;
744
-                    case 'name':
745
-                        $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
746
-                        break;
747
-                }
748
-            }
749
-            $stmt->execute();
750
-        } catch (Exception $e) {
751
-            Propel::log($e->getMessage(), Propel::LOG_ERR);
752
-            throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
753
-        }
754
-
755
-        try {
756
-            $pk = $con->lastInsertId();
757
-        } catch (Exception $e) {
758
-            throw new PropelException('Unable to get autoincrement id.', 0, $e);
759
-        }
760
-        $this->setId($pk);
761
-
762
-        $this->setNew(false);
763
-    }
764
-
765
-    /**
766
-     * Update the row in the database.
767
-     *
768
-     * @param      ConnectionInterface $con
769
-     *
770
-     * @return Integer Number of updated rows
771
-     * @see doSave()
772
-     */
773
-    protected function doUpdate(ConnectionInterface $con)
774
-    {
775
-        $selectCriteria = $this->buildPkeyCriteria();
776
-        $valuesCriteria = $this->buildCriteria();
777
-
778
-        return $selectCriteria->doUpdate($valuesCriteria, $con);
779
-    }
780
-
781
-    /**
782
-     * Retrieves a field from the object by name passed in as a string.
783
-     *
784
-     * @param      string $name name
785
-     * @param      string $type The type of fieldname the $name is of:
786
-     *                     one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
787
-     *                     TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
788
-     *                     Defaults to TableMap::TYPE_PHPNAME.
789
-     * @return mixed Value of field.
790
-     */
791
-    public function getByName($name, $type = TableMap::TYPE_PHPNAME)
792
-    {
793
-        $pos = ChannelTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
794
-        $field = $this->getByPosition($pos);
795
-
796
-        return $field;
797
-    }
798
-
799
-    /**
800
-     * Retrieves a field from the object by Position as specified in the xml schema.
801
-     * Zero-based.
802
-     *
803
-     * @param      int $pos position in xml schema
804
-     * @return mixed Value of field at $pos
805
-     */
806
-    public function getByPosition($pos)
807
-    {
808
-        switch ($pos) {
809
-            case 0:
810
-                return $this->getId();
811
-                break;
812
-            case 1:
813
-                return $this->getInstanceName();
814
-                break;
815
-            case 2:
816
-                return $this->getName();
817
-                break;
818
-            default:
819
-                return null;
820
-                break;
821
-        } // switch()
822
-    }
823
-
824
-    /**
825
-     * Exports the object as an array.
826
-     *
827
-     * You can specify the key type of the array by passing one of the class
828
-     * type constants.
829
-     *
830
-     * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
831
-     *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
832
-     *                    Defaults to TableMap::TYPE_PHPNAME.
833
-     * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
834
-     * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
835
-     * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
836
-     *
837
-     * @return array an associative array containing the field names (as keys) and field values
838
-     */
839
-    public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
840
-    {
841
-
842
-        if (isset($alreadyDumpedObjects['Channel'][$this->hashCode()])) {
843
-            return '*RECURSION*';
844
-        }
845
-        $alreadyDumpedObjects['Channel'][$this->hashCode()] = true;
846
-        $keys = ChannelTableMap::getFieldNames($keyType);
847
-        $result = array(
848
-            $keys[0] => $this->getId(),
849
-            $keys[1] => $this->getInstanceName(),
850
-            $keys[2] => $this->getName(),
851
-        );
852
-        $virtualColumns = $this->virtualColumns;
853
-        foreach ($virtualColumns as $key => $virtualColumn) {
854
-            $result[$key] = $virtualColumn;
855
-        }
856
-
857
-        if ($includeForeignObjects) {
858
-            if (null !== $this->aInstance) {
859
-
860
-                switch ($keyType) {
861
-                    case TableMap::TYPE_CAMELNAME:
862
-                        $key = 'instance';
863
-                        break;
864
-                    case TableMap::TYPE_FIELDNAME:
865
-                        $key = 'instance';
866
-                        break;
867
-                    default:
868
-                        $key = 'Instance';
869
-                }
870
-
871
-                $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
872
-            }
873
-            if (null !== $this->collSubscriptions) {
874
-
875
-                switch ($keyType) {
876
-                    case TableMap::TYPE_CAMELNAME:
877
-                        $key = 'subscriptions';
878
-                        break;
879
-                    case TableMap::TYPE_FIELDNAME:
880
-                        $key = 'subscriptions';
881
-                        break;
882
-                    default:
883
-                        $key = 'Subscriptions';
884
-                }
885
-
886
-                $result[$key] = $this->collSubscriptions->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
887
-            }
888
-        }
889
-
890
-        return $result;
891
-    }
892
-
893
-    /**
894
-     * Sets a field from the object by name passed in as a string.
895
-     *
896
-     * @param  string $name
897
-     * @param  mixed  $value field value
898
-     * @param  string $type The type of fieldname the $name is of:
899
-     *                one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
900
-     *                TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
901
-     *                Defaults to TableMap::TYPE_PHPNAME.
902
-     * @return $this|\Jalle19\StatusManager\Database\Channel
903
-     */
904
-    public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
905
-    {
906
-        $pos = ChannelTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
907
-
908
-        return $this->setByPosition($pos, $value);
909
-    }
910
-
911
-    /**
912
-     * Sets a field from the object by Position as specified in the xml schema.
913
-     * Zero-based.
914
-     *
915
-     * @param  int $pos position in xml schema
916
-     * @param  mixed $value field value
917
-     * @return $this|\Jalle19\StatusManager\Database\Channel
918
-     */
919
-    public function setByPosition($pos, $value)
920
-    {
921
-        switch ($pos) {
922
-            case 0:
923
-                $this->setId($value);
924
-                break;
925
-            case 1:
926
-                $this->setInstanceName($value);
927
-                break;
928
-            case 2:
929
-                $this->setName($value);
930
-                break;
931
-        } // switch()
932
-
933
-        return $this;
934
-    }
935
-
936
-    /**
937
-     * Populates the object using an array.
938
-     *
939
-     * This is particularly useful when populating an object from one of the
940
-     * request arrays (e.g. $_POST).  This method goes through the column
941
-     * names, checking to see whether a matching key exists in populated
942
-     * array. If so the setByName() method is called for that column.
943
-     *
944
-     * You can specify the key type of the array by additionally passing one
945
-     * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
946
-     * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
947
-     * The default key type is the column's TableMap::TYPE_PHPNAME.
948
-     *
949
-     * @param      array  $arr     An array to populate the object from.
950
-     * @param      string $keyType The type of keys the array uses.
951
-     * @return void
952
-     */
953
-    public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
954
-    {
955
-        $keys = ChannelTableMap::getFieldNames($keyType);
956
-
957
-        if (array_key_exists($keys[0], $arr)) {
958
-            $this->setId($arr[$keys[0]]);
959
-        }
960
-        if (array_key_exists($keys[1], $arr)) {
961
-            $this->setInstanceName($arr[$keys[1]]);
962
-        }
963
-        if (array_key_exists($keys[2], $arr)) {
964
-            $this->setName($arr[$keys[2]]);
965
-        }
966
-    }
967
-
968
-     /**
969
-     * Populate the current object from a string, using a given parser format
970
-     * <code>
971
-     * $book = new Book();
972
-     * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
973
-     * </code>
974
-     *
975
-     * You can specify the key type of the array by additionally passing one
976
-     * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
977
-     * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
978
-     * The default key type is the column's TableMap::TYPE_PHPNAME.
979
-     *
980
-     * @param mixed $parser A AbstractParser instance,
981
-     *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
982
-     * @param string $data The source data to import from
983
-     * @param string $keyType The type of keys the array uses.
984
-     *
985
-     * @return $this|\Jalle19\StatusManager\Database\Channel The current object, for fluid interface
986
-     */
987
-    public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME)
988
-    {
989
-        if (!$parser instanceof AbstractParser) {
990
-            $parser = AbstractParser::getParser($parser);
991
-        }
992
-
993
-        $this->fromArray($parser->toArray($data), $keyType);
994
-
995
-        return $this;
996
-    }
997
-
998
-    /**
999
-     * Build a Criteria object containing the values of all modified columns in this object.
1000
-     *
1001
-     * @return Criteria The Criteria object containing all modified values.
1002
-     */
1003
-    public function buildCriteria()
1004
-    {
1005
-        $criteria = new Criteria(ChannelTableMap::DATABASE_NAME);
1006
-
1007
-        if ($this->isColumnModified(ChannelTableMap::COL_ID)) {
1008
-            $criteria->add(ChannelTableMap::COL_ID, $this->id);
1009
-        }
1010
-        if ($this->isColumnModified(ChannelTableMap::COL_INSTANCE_NAME)) {
1011
-            $criteria->add(ChannelTableMap::COL_INSTANCE_NAME, $this->instance_name);
1012
-        }
1013
-        if ($this->isColumnModified(ChannelTableMap::COL_NAME)) {
1014
-            $criteria->add(ChannelTableMap::COL_NAME, $this->name);
1015
-        }
1016
-
1017
-        return $criteria;
1018
-    }
1019
-
1020
-    /**
1021
-     * Builds a Criteria object containing the primary key for this object.
1022
-     *
1023
-     * Unlike buildCriteria() this method includes the primary key values regardless
1024
-     * of whether or not they have been modified.
1025
-     *
1026
-     * @throws LogicException if no primary key is defined
1027
-     *
1028
-     * @return Criteria The Criteria object containing value(s) for primary key(s).
1029
-     */
1030
-    public function buildPkeyCriteria()
1031
-    {
1032
-        $criteria = ChildChannelQuery::create();
1033
-        $criteria->add(ChannelTableMap::COL_ID, $this->id);
1034
-
1035
-        return $criteria;
1036
-    }
1037
-
1038
-    /**
1039
-     * If the primary key is not null, return the hashcode of the
1040
-     * primary key. Otherwise, return the hash code of the object.
1041
-     *
1042
-     * @return int Hashcode
1043
-     */
1044
-    public function hashCode()
1045
-    {
1046
-        $validPk = null !== $this->getId();
1047
-
1048
-        $validPrimaryKeyFKs = 0;
1049
-        $primaryKeyFKs = [];
1050
-
1051
-        if ($validPk) {
1052
-            return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
1053
-        } elseif ($validPrimaryKeyFKs) {
1054
-            return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
1055
-        }
1056
-
1057
-        return spl_object_hash($this);
1058
-    }
1059
-
1060
-    /**
1061
-     * Returns the primary key for this object (row).
1062
-     * @return int
1063
-     */
1064
-    public function getPrimaryKey()
1065
-    {
1066
-        return $this->getId();
1067
-    }
1068
-
1069
-    /**
1070
-     * Generic method to set the primary key (id column).
1071
-     *
1072
-     * @param       int $key Primary key.
1073
-     * @return void
1074
-     */
1075
-    public function setPrimaryKey($key)
1076
-    {
1077
-        $this->setId($key);
1078
-    }
1079
-
1080
-    /**
1081
-     * Returns true if the primary key for this object is null.
1082
-     * @return boolean
1083
-     */
1084
-    public function isPrimaryKeyNull()
1085
-    {
1086
-        return null === $this->getId();
1087
-    }
1088
-
1089
-    /**
1090
-     * Sets contents of passed object to values from current object.
1091
-     *
1092
-     * If desired, this method can also make copies of all associated (fkey referrers)
1093
-     * objects.
1094
-     *
1095
-     * @param      object $copyObj An object of \Jalle19\StatusManager\Database\Channel (or compatible) type.
1096
-     * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1097
-     * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1098
-     * @throws PropelException
1099
-     */
1100
-    public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1101
-    {
1102
-        $copyObj->setInstanceName($this->getInstanceName());
1103
-        $copyObj->setName($this->getName());
1104
-
1105
-        if ($deepCopy) {
1106
-            // important: temporarily setNew(false) because this affects the behavior of
1107
-            // the getter/setter methods for fkey referrer objects.
1108
-            $copyObj->setNew(false);
1109
-
1110
-            foreach ($this->getSubscriptions() as $relObj) {
1111
-                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1112
-                    $copyObj->addSubscription($relObj->copy($deepCopy));
1113
-                }
1114
-            }
1115
-
1116
-        } // if ($deepCopy)
1117
-
1118
-        if ($makeNew) {
1119
-            $copyObj->setNew(true);
1120
-            $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
1121
-        }
1122
-    }
1123
-
1124
-    /**
1125
-     * Makes a copy of this object that will be inserted as a new row in table when saved.
1126
-     * It creates a new object filling in the simple attributes, but skipping any primary
1127
-     * keys that are defined for the table.
1128
-     *
1129
-     * If desired, this method can also make copies of all associated (fkey referrers)
1130
-     * objects.
1131
-     *
1132
-     * @param  boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1133
-     * @return \Jalle19\StatusManager\Database\Channel Clone of current object.
1134
-     * @throws PropelException
1135
-     */
1136
-    public function copy($deepCopy = false)
1137
-    {
1138
-        // we use get_class(), because this might be a subclass
1139
-        $clazz = get_class($this);
1140
-        $copyObj = new $clazz();
1141
-        $this->copyInto($copyObj, $deepCopy);
1142
-
1143
-        return $copyObj;
1144
-    }
1145
-
1146
-    /**
1147
-     * Declares an association between this object and a ChildInstance object.
1148
-     *
1149
-     * @param  ChildInstance $v
1150
-     * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
1151
-     * @throws PropelException
1152
-     */
1153
-    public function setInstance(ChildInstance $v = null)
1154
-    {
1155
-        if ($v === null) {
1156
-            $this->setInstanceName(NULL);
1157
-        } else {
1158
-            $this->setInstanceName($v->getName());
1159
-        }
1160
-
1161
-        $this->aInstance = $v;
1162
-
1163
-        // Add binding for other direction of this n:n relationship.
1164
-        // If this object has already been added to the ChildInstance object, it will not be re-added.
1165
-        if ($v !== null) {
1166
-            $v->addChannel($this);
1167
-        }
1168
-
1169
-
1170
-        return $this;
1171
-    }
1172
-
1173
-
1174
-    /**
1175
-     * Get the associated ChildInstance object
1176
-     *
1177
-     * @param  ConnectionInterface $con Optional Connection object.
1178
-     * @return ChildInstance The associated ChildInstance object.
1179
-     * @throws PropelException
1180
-     */
1181
-    public function getInstance(ConnectionInterface $con = null)
1182
-    {
1183
-        if ($this->aInstance === null && (($this->instance_name !== "" && $this->instance_name !== null))) {
1184
-            $this->aInstance = ChildInstanceQuery::create()->findPk($this->instance_name, $con);
1185
-            /* The following can be used additionally to
461
+	 *                            TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
462
+	 *
463
+	 * @return int             next starting column
464
+	 * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
465
+	 */
466
+	public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
467
+	{
468
+		try {
469
+
470
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ChannelTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
471
+			$this->id = (null !== $col) ? (int) $col : null;
472
+
473
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ChannelTableMap::translateFieldName('InstanceName', TableMap::TYPE_PHPNAME, $indexType)];
474
+			$this->instance_name = (null !== $col) ? (string) $col : null;
475
+
476
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ChannelTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
477
+			$this->name = (null !== $col) ? (string) $col : null;
478
+			$this->resetModified();
479
+
480
+			$this->setNew(false);
481
+
482
+			if ($rehydrate) {
483
+				$this->ensureConsistency();
484
+			}
485
+
486
+			return $startcol + 3; // 3 = ChannelTableMap::NUM_HYDRATE_COLUMNS.
487
+
488
+		} catch (Exception $e) {
489
+			throw new PropelException(sprintf('Error populating %s object', '\\Jalle19\\StatusManager\\Database\\Channel'), 0, $e);
490
+		}
491
+	}
492
+
493
+	/**
494
+	 * Checks and repairs the internal consistency of the object.
495
+	 *
496
+	 * This method is executed after an already-instantiated object is re-hydrated
497
+	 * from the database.  It exists to check any foreign keys to make sure that
498
+	 * the objects related to the current object are correct based on foreign key.
499
+	 *
500
+	 * You can override this method in the stub class, but you should always invoke
501
+	 * the base method from the overridden method (i.e. parent::ensureConsistency()),
502
+	 * in case your model changes.
503
+	 *
504
+	 * @throws PropelException
505
+	 */
506
+	public function ensureConsistency()
507
+	{
508
+		if ($this->aInstance !== null && $this->instance_name !== $this->aInstance->getName()) {
509
+			$this->aInstance = null;
510
+		}
511
+	} // ensureConsistency
512
+
513
+	/**
514
+	 * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
515
+	 *
516
+	 * This will only work if the object has been saved and has a valid primary key set.
517
+	 *
518
+	 * @param      boolean $deep (optional) Whether to also de-associated any related objects.
519
+	 * @param      ConnectionInterface $con (optional) The ConnectionInterface connection to use.
520
+	 * @return void
521
+	 * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
522
+	 */
523
+	public function reload($deep = false, ConnectionInterface $con = null)
524
+	{
525
+		if ($this->isDeleted()) {
526
+			throw new PropelException("Cannot reload a deleted object.");
527
+		}
528
+
529
+		if ($this->isNew()) {
530
+			throw new PropelException("Cannot reload an unsaved object.");
531
+		}
532
+
533
+		if ($con === null) {
534
+			$con = Propel::getServiceContainer()->getReadConnection(ChannelTableMap::DATABASE_NAME);
535
+		}
536
+
537
+		// We don't need to alter the object instance pool; we're just modifying this instance
538
+		// already in the pool.
539
+
540
+		$dataFetcher = ChildChannelQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
541
+		$row = $dataFetcher->fetch();
542
+		$dataFetcher->close();
543
+		if (!$row) {
544
+			throw new PropelException('Cannot find matching row in the database to reload object values.');
545
+		}
546
+		$this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
547
+
548
+		if ($deep) {  // also de-associate any related objects?
549
+
550
+			$this->aInstance = null;
551
+			$this->collSubscriptions = null;
552
+
553
+		} // if (deep)
554
+	}
555
+
556
+	/**
557
+	 * Removes this object from datastore and sets delete attribute.
558
+	 *
559
+	 * @param      ConnectionInterface $con
560
+	 * @return void
561
+	 * @throws PropelException
562
+	 * @see Channel::setDeleted()
563
+	 * @see Channel::isDeleted()
564
+	 */
565
+	public function delete(ConnectionInterface $con = null)
566
+	{
567
+		if ($this->isDeleted()) {
568
+			throw new PropelException("This object has already been deleted.");
569
+		}
570
+
571
+		if ($con === null) {
572
+			$con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
573
+		}
574
+
575
+		$con->transaction(function () use ($con) {
576
+			$deleteQuery = ChildChannelQuery::create()
577
+				->filterByPrimaryKey($this->getPrimaryKey());
578
+			$ret = $this->preDelete($con);
579
+			if ($ret) {
580
+				$deleteQuery->delete($con);
581
+				$this->postDelete($con);
582
+				$this->setDeleted(true);
583
+			}
584
+		});
585
+	}
586
+
587
+	/**
588
+	 * Persists this object to the database.
589
+	 *
590
+	 * If the object is new, it inserts it; otherwise an update is performed.
591
+	 * All modified related objects will also be persisted in the doSave()
592
+	 * method.  This method wraps all precipitate database operations in a
593
+	 * single transaction.
594
+	 *
595
+	 * @param      ConnectionInterface $con
596
+	 * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
597
+	 * @throws PropelException
598
+	 * @see doSave()
599
+	 */
600
+	public function save(ConnectionInterface $con = null)
601
+	{
602
+		if ($this->isDeleted()) {
603
+			throw new PropelException("You cannot save an object that has been deleted.");
604
+		}
605
+
606
+		if ($con === null) {
607
+			$con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
608
+		}
609
+
610
+		return $con->transaction(function () use ($con) {
611
+			$isInsert = $this->isNew();
612
+			$ret = $this->preSave($con);
613
+			if ($isInsert) {
614
+				$ret = $ret && $this->preInsert($con);
615
+			} else {
616
+				$ret = $ret && $this->preUpdate($con);
617
+			}
618
+			if ($ret) {
619
+				$affectedRows = $this->doSave($con);
620
+				if ($isInsert) {
621
+					$this->postInsert($con);
622
+				} else {
623
+					$this->postUpdate($con);
624
+				}
625
+				$this->postSave($con);
626
+				ChannelTableMap::addInstanceToPool($this);
627
+			} else {
628
+				$affectedRows = 0;
629
+			}
630
+
631
+			return $affectedRows;
632
+		});
633
+	}
634
+
635
+	/**
636
+	 * Performs the work of inserting or updating the row in the database.
637
+	 *
638
+	 * If the object is new, it inserts it; otherwise an update is performed.
639
+	 * All related objects are also updated in this method.
640
+	 *
641
+	 * @param      ConnectionInterface $con
642
+	 * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
643
+	 * @throws PropelException
644
+	 * @see save()
645
+	 */
646
+	protected function doSave(ConnectionInterface $con)
647
+	{
648
+		$affectedRows = 0; // initialize var to track total num of affected rows
649
+		if (!$this->alreadyInSave) {
650
+			$this->alreadyInSave = true;
651
+
652
+			// We call the save method on the following object(s) if they
653
+			// were passed to this object by their corresponding set
654
+			// method.  This object relates to these object(s) by a
655
+			// foreign key reference.
656
+
657
+			if ($this->aInstance !== null) {
658
+				if ($this->aInstance->isModified() || $this->aInstance->isNew()) {
659
+					$affectedRows += $this->aInstance->save($con);
660
+				}
661
+				$this->setInstance($this->aInstance);
662
+			}
663
+
664
+			if ($this->isNew() || $this->isModified()) {
665
+				// persist changes
666
+				if ($this->isNew()) {
667
+					$this->doInsert($con);
668
+					$affectedRows += 1;
669
+				} else {
670
+					$affectedRows += $this->doUpdate($con);
671
+				}
672
+				$this->resetModified();
673
+			}
674
+
675
+			if ($this->subscriptionsScheduledForDeletion !== null) {
676
+				if (!$this->subscriptionsScheduledForDeletion->isEmpty()) {
677
+					\Jalle19\StatusManager\Database\SubscriptionQuery::create()
678
+						->filterByPrimaryKeys($this->subscriptionsScheduledForDeletion->getPrimaryKeys(false))
679
+						->delete($con);
680
+					$this->subscriptionsScheduledForDeletion = null;
681
+				}
682
+			}
683
+
684
+			if ($this->collSubscriptions !== null) {
685
+				foreach ($this->collSubscriptions as $referrerFK) {
686
+					if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
687
+						$affectedRows += $referrerFK->save($con);
688
+					}
689
+				}
690
+			}
691
+
692
+			$this->alreadyInSave = false;
693
+
694
+		}
695
+
696
+		return $affectedRows;
697
+	} // doSave()
698
+
699
+	/**
700
+	 * Insert the row in the database.
701
+	 *
702
+	 * @param      ConnectionInterface $con
703
+	 *
704
+	 * @throws PropelException
705
+	 * @see doSave()
706
+	 */
707
+	protected function doInsert(ConnectionInterface $con)
708
+	{
709
+		$modifiedColumns = array();
710
+		$index = 0;
711
+
712
+		$this->modifiedColumns[ChannelTableMap::COL_ID] = true;
713
+		if (null !== $this->id) {
714
+			throw new PropelException('Cannot insert a value for auto-increment primary key (' . ChannelTableMap::COL_ID . ')');
715
+		}
716
+
717
+		 // check the columns in natural order for more readable SQL queries
718
+		if ($this->isColumnModified(ChannelTableMap::COL_ID)) {
719
+			$modifiedColumns[':p' . $index++]  = 'id';
720
+		}
721
+		if ($this->isColumnModified(ChannelTableMap::COL_INSTANCE_NAME)) {
722
+			$modifiedColumns[':p' . $index++]  = 'instance_name';
723
+		}
724
+		if ($this->isColumnModified(ChannelTableMap::COL_NAME)) {
725
+			$modifiedColumns[':p' . $index++]  = 'name';
726
+		}
727
+
728
+		$sql = sprintf(
729
+			'INSERT INTO channel (%s) VALUES (%s)',
730
+			implode(', ', $modifiedColumns),
731
+			implode(', ', array_keys($modifiedColumns))
732
+		);
733
+
734
+		try {
735
+			$stmt = $con->prepare($sql);
736
+			foreach ($modifiedColumns as $identifier => $columnName) {
737
+				switch ($columnName) {
738
+					case 'id':
739
+						$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
740
+						break;
741
+					case 'instance_name':
742
+						$stmt->bindValue($identifier, $this->instance_name, PDO::PARAM_STR);
743
+						break;
744
+					case 'name':
745
+						$stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
746
+						break;
747
+				}
748
+			}
749
+			$stmt->execute();
750
+		} catch (Exception $e) {
751
+			Propel::log($e->getMessage(), Propel::LOG_ERR);
752
+			throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
753
+		}
754
+
755
+		try {
756
+			$pk = $con->lastInsertId();
757
+		} catch (Exception $e) {
758
+			throw new PropelException('Unable to get autoincrement id.', 0, $e);
759
+		}
760
+		$this->setId($pk);
761
+
762
+		$this->setNew(false);
763
+	}
764
+
765
+	/**
766
+	 * Update the row in the database.
767
+	 *
768
+	 * @param      ConnectionInterface $con
769
+	 *
770
+	 * @return Integer Number of updated rows
771
+	 * @see doSave()
772
+	 */
773
+	protected function doUpdate(ConnectionInterface $con)
774
+	{
775
+		$selectCriteria = $this->buildPkeyCriteria();
776
+		$valuesCriteria = $this->buildCriteria();
777
+
778
+		return $selectCriteria->doUpdate($valuesCriteria, $con);
779
+	}
780
+
781
+	/**
782
+	 * Retrieves a field from the object by name passed in as a string.
783
+	 *
784
+	 * @param      string $name name
785
+	 * @param      string $type The type of fieldname the $name is of:
786
+	 *                     one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
787
+	 *                     TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
788
+	 *                     Defaults to TableMap::TYPE_PHPNAME.
789
+	 * @return mixed Value of field.
790
+	 */
791
+	public function getByName($name, $type = TableMap::TYPE_PHPNAME)
792
+	{
793
+		$pos = ChannelTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
794
+		$field = $this->getByPosition($pos);
795
+
796
+		return $field;
797
+	}
798
+
799
+	/**
800
+	 * Retrieves a field from the object by Position as specified in the xml schema.
801
+	 * Zero-based.
802
+	 *
803
+	 * @param      int $pos position in xml schema
804
+	 * @return mixed Value of field at $pos
805
+	 */
806
+	public function getByPosition($pos)
807
+	{
808
+		switch ($pos) {
809
+			case 0:
810
+				return $this->getId();
811
+				break;
812
+			case 1:
813
+				return $this->getInstanceName();
814
+				break;
815
+			case 2:
816
+				return $this->getName();
817
+				break;
818
+			default:
819
+				return null;
820
+				break;
821
+		} // switch()
822
+	}
823
+
824
+	/**
825
+	 * Exports the object as an array.
826
+	 *
827
+	 * You can specify the key type of the array by passing one of the class
828
+	 * type constants.
829
+	 *
830
+	 * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
831
+	 *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
832
+	 *                    Defaults to TableMap::TYPE_PHPNAME.
833
+	 * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
834
+	 * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
835
+	 * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
836
+	 *
837
+	 * @return array an associative array containing the field names (as keys) and field values
838
+	 */
839
+	public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
840
+	{
841
+
842
+		if (isset($alreadyDumpedObjects['Channel'][$this->hashCode()])) {
843
+			return '*RECURSION*';
844
+		}
845
+		$alreadyDumpedObjects['Channel'][$this->hashCode()] = true;
846
+		$keys = ChannelTableMap::getFieldNames($keyType);
847
+		$result = array(
848
+			$keys[0] => $this->getId(),
849
+			$keys[1] => $this->getInstanceName(),
850
+			$keys[2] => $this->getName(),
851
+		);
852
+		$virtualColumns = $this->virtualColumns;
853
+		foreach ($virtualColumns as $key => $virtualColumn) {
854
+			$result[$key] = $virtualColumn;
855
+		}
856
+
857
+		if ($includeForeignObjects) {
858
+			if (null !== $this->aInstance) {
859
+
860
+				switch ($keyType) {
861
+					case TableMap::TYPE_CAMELNAME:
862
+						$key = 'instance';
863
+						break;
864
+					case TableMap::TYPE_FIELDNAME:
865
+						$key = 'instance';
866
+						break;
867
+					default:
868
+						$key = 'Instance';
869
+				}
870
+
871
+				$result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
872
+			}
873
+			if (null !== $this->collSubscriptions) {
874
+
875
+				switch ($keyType) {
876
+					case TableMap::TYPE_CAMELNAME:
877
+						$key = 'subscriptions';
878
+						break;
879
+					case TableMap::TYPE_FIELDNAME:
880
+						$key = 'subscriptions';
881
+						break;
882
+					default:
883
+						$key = 'Subscriptions';
884
+				}
885
+
886
+				$result[$key] = $this->collSubscriptions->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
887
+			}
888
+		}
889
+
890
+		return $result;
891
+	}
892
+
893
+	/**
894
+	 * Sets a field from the object by name passed in as a string.
895
+	 *
896
+	 * @param  string $name
897
+	 * @param  mixed  $value field value
898
+	 * @param  string $type The type of fieldname the $name is of:
899
+	 *                one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
900
+	 *                TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
901
+	 *                Defaults to TableMap::TYPE_PHPNAME.
902
+	 * @return $this|\Jalle19\StatusManager\Database\Channel
903
+	 */
904
+	public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
905
+	{
906
+		$pos = ChannelTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
907
+
908
+		return $this->setByPosition($pos, $value);
909
+	}
910
+
911
+	/**
912
+	 * Sets a field from the object by Position as specified in the xml schema.
913
+	 * Zero-based.
914
+	 *
915
+	 * @param  int $pos position in xml schema
916
+	 * @param  mixed $value field value
917
+	 * @return $this|\Jalle19\StatusManager\Database\Channel
918
+	 */
919
+	public function setByPosition($pos, $value)
920
+	{
921
+		switch ($pos) {
922
+			case 0:
923
+				$this->setId($value);
924
+				break;
925
+			case 1:
926
+				$this->setInstanceName($value);
927
+				break;
928
+			case 2:
929
+				$this->setName($value);
930
+				break;
931
+		} // switch()
932
+
933
+		return $this;
934
+	}
935
+
936
+	/**
937
+	 * Populates the object using an array.
938
+	 *
939
+	 * This is particularly useful when populating an object from one of the
940
+	 * request arrays (e.g. $_POST).  This method goes through the column
941
+	 * names, checking to see whether a matching key exists in populated
942
+	 * array. If so the setByName() method is called for that column.
943
+	 *
944
+	 * You can specify the key type of the array by additionally passing one
945
+	 * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
946
+	 * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
947
+	 * The default key type is the column's TableMap::TYPE_PHPNAME.
948
+	 *
949
+	 * @param      array  $arr     An array to populate the object from.
950
+	 * @param      string $keyType The type of keys the array uses.
951
+	 * @return void
952
+	 */
953
+	public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
954
+	{
955
+		$keys = ChannelTableMap::getFieldNames($keyType);
956
+
957
+		if (array_key_exists($keys[0], $arr)) {
958
+			$this->setId($arr[$keys[0]]);
959
+		}
960
+		if (array_key_exists($keys[1], $arr)) {
961
+			$this->setInstanceName($arr[$keys[1]]);
962
+		}
963
+		if (array_key_exists($keys[2], $arr)) {
964
+			$this->setName($arr[$keys[2]]);
965
+		}
966
+	}
967
+
968
+	 /**
969
+	  * Populate the current object from a string, using a given parser format
970
+	  * <code>
971
+	  * $book = new Book();
972
+	  * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
973
+	  * </code>
974
+	  *
975
+	  * You can specify the key type of the array by additionally passing one
976
+	  * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
977
+	  * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
978
+	  * The default key type is the column's TableMap::TYPE_PHPNAME.
979
+	  *
980
+	  * @param mixed $parser A AbstractParser instance,
981
+	  *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
982
+	  * @param string $data The source data to import from
983
+	  * @param string $keyType The type of keys the array uses.
984
+	  *
985
+	  * @return $this|\Jalle19\StatusManager\Database\Channel The current object, for fluid interface
986
+	  */
987
+	public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME)
988
+	{
989
+		if (!$parser instanceof AbstractParser) {
990
+			$parser = AbstractParser::getParser($parser);
991
+		}
992
+
993
+		$this->fromArray($parser->toArray($data), $keyType);
994
+
995
+		return $this;
996
+	}
997
+
998
+	/**
999
+	 * Build a Criteria object containing the values of all modified columns in this object.
1000
+	 *
1001
+	 * @return Criteria The Criteria object containing all modified values.
1002
+	 */
1003
+	public function buildCriteria()
1004
+	{
1005
+		$criteria = new Criteria(ChannelTableMap::DATABASE_NAME);
1006
+
1007
+		if ($this->isColumnModified(ChannelTableMap::COL_ID)) {
1008
+			$criteria->add(ChannelTableMap::COL_ID, $this->id);
1009
+		}
1010
+		if ($this->isColumnModified(ChannelTableMap::COL_INSTANCE_NAME)) {
1011
+			$criteria->add(ChannelTableMap::COL_INSTANCE_NAME, $this->instance_name);
1012
+		}
1013
+		if ($this->isColumnModified(ChannelTableMap::COL_NAME)) {
1014
+			$criteria->add(ChannelTableMap::COL_NAME, $this->name);
1015
+		}
1016
+
1017
+		return $criteria;
1018
+	}
1019
+
1020
+	/**
1021
+	 * Builds a Criteria object containing the primary key for this object.
1022
+	 *
1023
+	 * Unlike buildCriteria() this method includes the primary key values regardless
1024
+	 * of whether or not they have been modified.
1025
+	 *
1026
+	 * @throws LogicException if no primary key is defined
1027
+	 *
1028
+	 * @return Criteria The Criteria object containing value(s) for primary key(s).
1029
+	 */
1030
+	public function buildPkeyCriteria()
1031
+	{
1032
+		$criteria = ChildChannelQuery::create();
1033
+		$criteria->add(ChannelTableMap::COL_ID, $this->id);
1034
+
1035
+		return $criteria;
1036
+	}
1037
+
1038
+	/**
1039
+	 * If the primary key is not null, return the hashcode of the
1040
+	 * primary key. Otherwise, return the hash code of the object.
1041
+	 *
1042
+	 * @return int Hashcode
1043
+	 */
1044
+	public function hashCode()
1045
+	{
1046
+		$validPk = null !== $this->getId();
1047
+
1048
+		$validPrimaryKeyFKs = 0;
1049
+		$primaryKeyFKs = [];
1050
+
1051
+		if ($validPk) {
1052
+			return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
1053
+		} elseif ($validPrimaryKeyFKs) {
1054
+			return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
1055
+		}
1056
+
1057
+		return spl_object_hash($this);
1058
+	}
1059
+
1060
+	/**
1061
+	 * Returns the primary key for this object (row).
1062
+	 * @return int
1063
+	 */
1064
+	public function getPrimaryKey()
1065
+	{
1066
+		return $this->getId();
1067
+	}
1068
+
1069
+	/**
1070
+	 * Generic method to set the primary key (id column).
1071
+	 *
1072
+	 * @param       int $key Primary key.
1073
+	 * @return void
1074
+	 */
1075
+	public function setPrimaryKey($key)
1076
+	{
1077
+		$this->setId($key);
1078
+	}
1079
+
1080
+	/**
1081
+	 * Returns true if the primary key for this object is null.
1082
+	 * @return boolean
1083
+	 */
1084
+	public function isPrimaryKeyNull()
1085
+	{
1086
+		return null === $this->getId();
1087
+	}
1088
+
1089
+	/**
1090
+	 * Sets contents of passed object to values from current object.
1091
+	 *
1092
+	 * If desired, this method can also make copies of all associated (fkey referrers)
1093
+	 * objects.
1094
+	 *
1095
+	 * @param      object $copyObj An object of \Jalle19\StatusManager\Database\Channel (or compatible) type.
1096
+	 * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1097
+	 * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1098
+	 * @throws PropelException
1099
+	 */
1100
+	public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1101
+	{
1102
+		$copyObj->setInstanceName($this->getInstanceName());
1103
+		$copyObj->setName($this->getName());
1104
+
1105
+		if ($deepCopy) {
1106
+			// important: temporarily setNew(false) because this affects the behavior of
1107
+			// the getter/setter methods for fkey referrer objects.
1108
+			$copyObj->setNew(false);
1109
+
1110
+			foreach ($this->getSubscriptions() as $relObj) {
1111
+				if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1112
+					$copyObj->addSubscription($relObj->copy($deepCopy));
1113
+				}
1114
+			}
1115
+
1116
+		} // if ($deepCopy)
1117
+
1118
+		if ($makeNew) {
1119
+			$copyObj->setNew(true);
1120
+			$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
1121
+		}
1122
+	}
1123
+
1124
+	/**
1125
+	 * Makes a copy of this object that will be inserted as a new row in table when saved.
1126
+	 * It creates a new object filling in the simple attributes, but skipping any primary
1127
+	 * keys that are defined for the table.
1128
+	 *
1129
+	 * If desired, this method can also make copies of all associated (fkey referrers)
1130
+	 * objects.
1131
+	 *
1132
+	 * @param  boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1133
+	 * @return \Jalle19\StatusManager\Database\Channel Clone of current object.
1134
+	 * @throws PropelException
1135
+	 */
1136
+	public function copy($deepCopy = false)
1137
+	{
1138
+		// we use get_class(), because this might be a subclass
1139
+		$clazz = get_class($this);
1140
+		$copyObj = new $clazz();
1141
+		$this->copyInto($copyObj, $deepCopy);
1142
+
1143
+		return $copyObj;
1144
+	}
1145
+
1146
+	/**
1147
+	 * Declares an association between this object and a ChildInstance object.
1148
+	 *
1149
+	 * @param  ChildInstance $v
1150
+	 * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
1151
+	 * @throws PropelException
1152
+	 */
1153
+	public function setInstance(ChildInstance $v = null)
1154
+	{
1155
+		if ($v === null) {
1156
+			$this->setInstanceName(NULL);
1157
+		} else {
1158
+			$this->setInstanceName($v->getName());
1159
+		}
1160
+
1161
+		$this->aInstance = $v;
1162
+
1163
+		// Add binding for other direction of this n:n relationship.
1164
+		// If this object has already been added to the ChildInstance object, it will not be re-added.
1165
+		if ($v !== null) {
1166
+			$v->addChannel($this);
1167
+		}
1168
+
1169
+
1170
+		return $this;
1171
+	}
1172
+
1173
+
1174
+	/**
1175
+	 * Get the associated ChildInstance object
1176
+	 *
1177
+	 * @param  ConnectionInterface $con Optional Connection object.
1178
+	 * @return ChildInstance The associated ChildInstance object.
1179
+	 * @throws PropelException
1180
+	 */
1181
+	public function getInstance(ConnectionInterface $con = null)
1182
+	{
1183
+		if ($this->aInstance === null && (($this->instance_name !== "" && $this->instance_name !== null))) {
1184
+			$this->aInstance = ChildInstanceQuery::create()->findPk($this->instance_name, $con);
1185
+			/* The following can be used additionally to
1186 1186
                 guarantee the related object contains a reference
1187 1187
                 to this object.  This level of coupling may, however, be
1188 1188
                 undesirable since it could result in an only partially populated collection
1189 1189
                 in the referenced object.
1190 1190
                 $this->aInstance->addChannels($this);
1191 1191
              */
1192
-        }
1193
-
1194
-        return $this->aInstance;
1195
-    }
1196
-
1197
-
1198
-    /**
1199
-     * Initializes a collection based on the name of a relation.
1200
-     * Avoids crafting an 'init[$relationName]s' method name
1201
-     * that wouldn't work when StandardEnglishPluralizer is used.
1202
-     *
1203
-     * @param      string $relationName The name of the relation to initialize
1204
-     * @return void
1205
-     */
1206
-    public function initRelation($relationName)
1207
-    {
1208
-        if ('Subscription' == $relationName) {
1209
-            return $this->initSubscriptions();
1210
-        }
1211
-    }
1212
-
1213
-    /**
1214
-     * Clears out the collSubscriptions collection
1215
-     *
1216
-     * This does not modify the database; however, it will remove any associated objects, causing
1217
-     * them to be refetched by subsequent calls to accessor method.
1218
-     *
1219
-     * @return void
1220
-     * @see        addSubscriptions()
1221
-     */
1222
-    public function clearSubscriptions()
1223
-    {
1224
-        $this->collSubscriptions = null; // important to set this to NULL since that means it is uninitialized
1225
-    }
1226
-
1227
-    /**
1228
-     * Reset is the collSubscriptions collection loaded partially.
1229
-     */
1230
-    public function resetPartialSubscriptions($v = true)
1231
-    {
1232
-        $this->collSubscriptionsPartial = $v;
1233
-    }
1234
-
1235
-    /**
1236
-     * Initializes the collSubscriptions collection.
1237
-     *
1238
-     * By default this just sets the collSubscriptions collection to an empty array (like clearcollSubscriptions());
1239
-     * however, you may wish to override this method in your stub class to provide setting appropriate
1240
-     * to your application -- for example, setting the initial array to the values stored in database.
1241
-     *
1242
-     * @param      boolean $overrideExisting If set to true, the method call initializes
1243
-     *                                        the collection even if it is not empty
1244
-     *
1245
-     * @return void
1246
-     */
1247
-    public function initSubscriptions($overrideExisting = true)
1248
-    {
1249
-        if (null !== $this->collSubscriptions && !$overrideExisting) {
1250
-            return;
1251
-        }
1252
-
1253
-        $collectionClassName = SubscriptionTableMap::getTableMap()->getCollectionClassName();
1254
-
1255
-        $this->collSubscriptions = new $collectionClassName;
1256
-        $this->collSubscriptions->setModel('\Jalle19\StatusManager\Database\Subscription');
1257
-    }
1258
-
1259
-    /**
1260
-     * Gets an array of ChildSubscription objects which contain a foreign key that references this object.
1261
-     *
1262
-     * If the $criteria is not null, it is used to always fetch the results from the database.
1263
-     * Otherwise the results are fetched from the database the first time, then cached.
1264
-     * Next time the same method is called without $criteria, the cached collection is returned.
1265
-     * If this ChildChannel is new, it will return
1266
-     * an empty collection or the current collection; the criteria is ignored on a new object.
1267
-     *
1268
-     * @param      Criteria $criteria optional Criteria object to narrow the query
1269
-     * @param      ConnectionInterface $con optional connection object
1270
-     * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1271
-     * @throws PropelException
1272
-     */
1273
-    public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null)
1274
-    {
1275
-        $partial = $this->collSubscriptionsPartial && !$this->isNew();
1276
-        if (null === $this->collSubscriptions || null !== $criteria  || $partial) {
1277
-            if ($this->isNew() && null === $this->collSubscriptions) {
1278
-                // return empty collection
1279
-                $this->initSubscriptions();
1280
-            } else {
1281
-                $collSubscriptions = ChildSubscriptionQuery::create(null, $criteria)
1282
-                    ->filterByChannel($this)
1283
-                    ->find($con);
1284
-
1285
-                if (null !== $criteria) {
1286
-                    if (false !== $this->collSubscriptionsPartial && count($collSubscriptions)) {
1287
-                        $this->initSubscriptions(false);
1288
-
1289
-                        foreach ($collSubscriptions as $obj) {
1290
-                            if (false == $this->collSubscriptions->contains($obj)) {
1291
-                                $this->collSubscriptions->append($obj);
1292
-                            }
1293
-                        }
1294
-
1295
-                        $this->collSubscriptionsPartial = true;
1296
-                    }
1297
-
1298
-                    return $collSubscriptions;
1299
-                }
1300
-
1301
-                if ($partial && $this->collSubscriptions) {
1302
-                    foreach ($this->collSubscriptions as $obj) {
1303
-                        if ($obj->isNew()) {
1304
-                            $collSubscriptions[] = $obj;
1305
-                        }
1306
-                    }
1307
-                }
1308
-
1309
-                $this->collSubscriptions = $collSubscriptions;
1310
-                $this->collSubscriptionsPartial = false;
1311
-            }
1312
-        }
1313
-
1314
-        return $this->collSubscriptions;
1315
-    }
1316
-
1317
-    /**
1318
-     * Sets a collection of ChildSubscription objects related by a one-to-many relationship
1319
-     * to the current object.
1320
-     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1321
-     * and new objects from the given Propel collection.
1322
-     *
1323
-     * @param      Collection $subscriptions A Propel collection.
1324
-     * @param      ConnectionInterface $con Optional connection object
1325
-     * @return $this|ChildChannel The current object (for fluent API support)
1326
-     */
1327
-    public function setSubscriptions(Collection $subscriptions, ConnectionInterface $con = null)
1328
-    {
1329
-        /** @var ChildSubscription[] $subscriptionsToDelete */
1330
-        $subscriptionsToDelete = $this->getSubscriptions(new Criteria(), $con)->diff($subscriptions);
1331
-
1332
-
1333
-        $this->subscriptionsScheduledForDeletion = $subscriptionsToDelete;
1334
-
1335
-        foreach ($subscriptionsToDelete as $subscriptionRemoved) {
1336
-            $subscriptionRemoved->setChannel(null);
1337
-        }
1338
-
1339
-        $this->collSubscriptions = null;
1340
-        foreach ($subscriptions as $subscription) {
1341
-            $this->addSubscription($subscription);
1342
-        }
1343
-
1344
-        $this->collSubscriptions = $subscriptions;
1345
-        $this->collSubscriptionsPartial = false;
1346
-
1347
-        return $this;
1348
-    }
1349
-
1350
-    /**
1351
-     * Returns the number of related Subscription objects.
1352
-     *
1353
-     * @param      Criteria $criteria
1354
-     * @param      boolean $distinct
1355
-     * @param      ConnectionInterface $con
1356
-     * @return int             Count of related Subscription objects.
1357
-     * @throws PropelException
1358
-     */
1359
-    public function countSubscriptions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
1360
-    {
1361
-        $partial = $this->collSubscriptionsPartial && !$this->isNew();
1362
-        if (null === $this->collSubscriptions || null !== $criteria || $partial) {
1363
-            if ($this->isNew() && null === $this->collSubscriptions) {
1364
-                return 0;
1365
-            }
1366
-
1367
-            if ($partial && !$criteria) {
1368
-                return count($this->getSubscriptions());
1369
-            }
1370
-
1371
-            $query = ChildSubscriptionQuery::create(null, $criteria);
1372
-            if ($distinct) {
1373
-                $query->distinct();
1374
-            }
1375
-
1376
-            return $query
1377
-                ->filterByChannel($this)
1378
-                ->count($con);
1379
-        }
1380
-
1381
-        return count($this->collSubscriptions);
1382
-    }
1383
-
1384
-    /**
1385
-     * Method called to associate a ChildSubscription object to this object
1386
-     * through the ChildSubscription foreign key attribute.
1387
-     *
1388
-     * @param  ChildSubscription $l ChildSubscription
1389
-     * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
1390
-     */
1391
-    public function addSubscription(ChildSubscription $l)
1392
-    {
1393
-        if ($this->collSubscriptions === null) {
1394
-            $this->initSubscriptions();
1395
-            $this->collSubscriptionsPartial = true;
1396
-        }
1397
-
1398
-        if (!$this->collSubscriptions->contains($l)) {
1399
-            $this->doAddSubscription($l);
1400
-
1401
-            if ($this->subscriptionsScheduledForDeletion and $this->subscriptionsScheduledForDeletion->contains($l)) {
1402
-                $this->subscriptionsScheduledForDeletion->remove($this->subscriptionsScheduledForDeletion->search($l));
1403
-            }
1404
-        }
1405
-
1406
-        return $this;
1407
-    }
1408
-
1409
-    /**
1410
-     * @param ChildSubscription $subscription The ChildSubscription object to add.
1411
-     */
1412
-    protected function doAddSubscription(ChildSubscription $subscription)
1413
-    {
1414
-        $this->collSubscriptions[]= $subscription;
1415
-        $subscription->setChannel($this);
1416
-    }
1417
-
1418
-    /**
1419
-     * @param  ChildSubscription $subscription The ChildSubscription object to remove.
1420
-     * @return $this|ChildChannel The current object (for fluent API support)
1421
-     */
1422
-    public function removeSubscription(ChildSubscription $subscription)
1423
-    {
1424
-        if ($this->getSubscriptions()->contains($subscription)) {
1425
-            $pos = $this->collSubscriptions->search($subscription);
1426
-            $this->collSubscriptions->remove($pos);
1427
-            if (null === $this->subscriptionsScheduledForDeletion) {
1428
-                $this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions;
1429
-                $this->subscriptionsScheduledForDeletion->clear();
1430
-            }
1431
-            $this->subscriptionsScheduledForDeletion[]= clone $subscription;
1432
-            $subscription->setChannel(null);
1433
-        }
1434
-
1435
-        return $this;
1436
-    }
1437
-
1438
-
1439
-    /**
1440
-     * If this collection has already been initialized with
1441
-     * an identical criteria, it returns the collection.
1442
-     * Otherwise if this Channel is new, it will return
1443
-     * an empty collection; or if this Channel has previously
1444
-     * been saved, it will retrieve related Subscriptions from storage.
1445
-     *
1446
-     * This method is protected by default in order to keep the public
1447
-     * api reasonable.  You can provide public methods for those you
1448
-     * actually need in Channel.
1449
-     *
1450
-     * @param      Criteria $criteria optional Criteria object to narrow the query
1451
-     * @param      ConnectionInterface $con optional connection object
1452
-     * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1453
-     * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1454
-     */
1455
-    public function getSubscriptionsJoinInstance(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1456
-    {
1457
-        $query = ChildSubscriptionQuery::create(null, $criteria);
1458
-        $query->joinWith('Instance', $joinBehavior);
1459
-
1460
-        return $this->getSubscriptions($query, $con);
1461
-    }
1462
-
1463
-
1464
-    /**
1465
-     * If this collection has already been initialized with
1466
-     * an identical criteria, it returns the collection.
1467
-     * Otherwise if this Channel is new, it will return
1468
-     * an empty collection; or if this Channel has previously
1469
-     * been saved, it will retrieve related Subscriptions from storage.
1470
-     *
1471
-     * This method is protected by default in order to keep the public
1472
-     * api reasonable.  You can provide public methods for those you
1473
-     * actually need in Channel.
1474
-     *
1475
-     * @param      Criteria $criteria optional Criteria object to narrow the query
1476
-     * @param      ConnectionInterface $con optional connection object
1477
-     * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1478
-     * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1479
-     */
1480
-    public function getSubscriptionsJoinInput(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1481
-    {
1482
-        $query = ChildSubscriptionQuery::create(null, $criteria);
1483
-        $query->joinWith('Input', $joinBehavior);
1484
-
1485
-        return $this->getSubscriptions($query, $con);
1486
-    }
1487
-
1488
-
1489
-    /**
1490
-     * If this collection has already been initialized with
1491
-     * an identical criteria, it returns the collection.
1492
-     * Otherwise if this Channel is new, it will return
1493
-     * an empty collection; or if this Channel has previously
1494
-     * been saved, it will retrieve related Subscriptions from storage.
1495
-     *
1496
-     * This method is protected by default in order to keep the public
1497
-     * api reasonable.  You can provide public methods for those you
1498
-     * actually need in Channel.
1499
-     *
1500
-     * @param      Criteria $criteria optional Criteria object to narrow the query
1501
-     * @param      ConnectionInterface $con optional connection object
1502
-     * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1503
-     * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1504
-     */
1505
-    public function getSubscriptionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1506
-    {
1507
-        $query = ChildSubscriptionQuery::create(null, $criteria);
1508
-        $query->joinWith('User', $joinBehavior);
1509
-
1510
-        return $this->getSubscriptions($query, $con);
1511
-    }
1512
-
1513
-    /**
1514
-     * Clears the current object, sets all attributes to their default values and removes
1515
-     * outgoing references as well as back-references (from other objects to this one. Results probably in a database
1516
-     * change of those foreign objects when you call `save` there).
1517
-     */
1518
-    public function clear()
1519
-    {
1520
-        if (null !== $this->aInstance) {
1521
-            $this->aInstance->removeChannel($this);
1522
-        }
1523
-        $this->id = null;
1524
-        $this->instance_name = null;
1525
-        $this->name = null;
1526
-        $this->alreadyInSave = false;
1527
-        $this->clearAllReferences();
1528
-        $this->resetModified();
1529
-        $this->setNew(true);
1530
-        $this->setDeleted(false);
1531
-    }
1532
-
1533
-    /**
1534
-     * Resets all references and back-references to other model objects or collections of model objects.
1535
-     *
1536
-     * This method is used to reset all php object references (not the actual reference in the database).
1537
-     * Necessary for object serialisation.
1538
-     *
1539
-     * @param      boolean $deep Whether to also clear the references on all referrer objects.
1540
-     */
1541
-    public function clearAllReferences($deep = false)
1542
-    {
1543
-        if ($deep) {
1544
-            if ($this->collSubscriptions) {
1545
-                foreach ($this->collSubscriptions as $o) {
1546
-                    $o->clearAllReferences($deep);
1547
-                }
1548
-            }
1549
-        } // if ($deep)
1550
-
1551
-        $this->collSubscriptions = null;
1552
-        $this->aInstance = null;
1553
-    }
1554
-
1555
-    /**
1556
-     * Return the string representation of this object
1557
-     *
1558
-     * @return string
1559
-     */
1560
-    public function __toString()
1561
-    {
1562
-        return (string) $this->exportTo(ChannelTableMap::DEFAULT_STRING_FORMAT);
1563
-    }
1564
-
1565
-    /**
1566
-     * Code to be run before persisting the object
1567
-     * @param  ConnectionInterface $con
1568
-     * @return boolean
1569
-     */
1570
-    public function preSave(ConnectionInterface $con = null)
1571
-    {
1572
-        return true;
1573
-    }
1574
-
1575
-    /**
1576
-     * Code to be run after persisting the object
1577
-     * @param ConnectionInterface $con
1578
-     */
1579
-    public function postSave(ConnectionInterface $con = null)
1580
-    {
1581
-
1582
-    }
1583
-
1584
-    /**
1585
-     * Code to be run before inserting to database
1586
-     * @param  ConnectionInterface $con
1587
-     * @return boolean
1588
-     */
1589
-    public function preInsert(ConnectionInterface $con = null)
1590
-    {
1591
-        return true;
1592
-    }
1593
-
1594
-    /**
1595
-     * Code to be run after inserting to database
1596
-     * @param ConnectionInterface $con
1597
-     */
1598
-    public function postInsert(ConnectionInterface $con = null)
1599
-    {
1600
-
1601
-    }
1602
-
1603
-    /**
1604
-     * Code to be run before updating the object in database
1605
-     * @param  ConnectionInterface $con
1606
-     * @return boolean
1607
-     */
1608
-    public function preUpdate(ConnectionInterface $con = null)
1609
-    {
1610
-        return true;
1611
-    }
1612
-
1613
-    /**
1614
-     * Code to be run after updating the object in database
1615
-     * @param ConnectionInterface $con
1616
-     */
1617
-    public function postUpdate(ConnectionInterface $con = null)
1618
-    {
1619
-
1620
-    }
1621
-
1622
-    /**
1623
-     * Code to be run before deleting the object in database
1624
-     * @param  ConnectionInterface $con
1625
-     * @return boolean
1626
-     */
1627
-    public function preDelete(ConnectionInterface $con = null)
1628
-    {
1629
-        return true;
1630
-    }
1631
-
1632
-    /**
1633
-     * Code to be run after deleting the object in database
1634
-     * @param ConnectionInterface $con
1635
-     */
1636
-    public function postDelete(ConnectionInterface $con = null)
1637
-    {
1638
-
1639
-    }
1640
-
1641
-
1642
-    /**
1643
-     * Derived method to catches calls to undefined methods.
1644
-     *
1645
-     * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
1646
-     * Allows to define default __call() behavior if you overwrite __call()
1647
-     *
1648
-     * @param string $name
1649
-     * @param mixed  $params
1650
-     *
1651
-     * @return array|string
1652
-     */
1653
-    public function __call($name, $params)
1654
-    {
1655
-        if (0 === strpos($name, 'get')) {
1656
-            $virtualColumn = substr($name, 3);
1657
-            if ($this->hasVirtualColumn($virtualColumn)) {
1658
-                return $this->getVirtualColumn($virtualColumn);
1659
-            }
1660
-
1661
-            $virtualColumn = lcfirst($virtualColumn);
1662
-            if ($this->hasVirtualColumn($virtualColumn)) {
1663
-                return $this->getVirtualColumn($virtualColumn);
1664
-            }
1665
-        }
1666
-
1667
-        if (0 === strpos($name, 'from')) {
1668
-            $format = substr($name, 4);
1669
-
1670
-            return $this->importFrom($format, reset($params));
1671
-        }
1672
-
1673
-        if (0 === strpos($name, 'to')) {
1674
-            $format = substr($name, 2);
1675
-            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1676
-
1677
-            return $this->exportTo($format, $includeLazyLoadColumns);
1678
-        }
1679
-
1680
-        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1681
-    }
1192
+		}
1193
+
1194
+		return $this->aInstance;
1195
+	}
1196
+
1197
+
1198
+	/**
1199
+	 * Initializes a collection based on the name of a relation.
1200
+	 * Avoids crafting an 'init[$relationName]s' method name
1201
+	 * that wouldn't work when StandardEnglishPluralizer is used.
1202
+	 *
1203
+	 * @param      string $relationName The name of the relation to initialize
1204
+	 * @return void
1205
+	 */
1206
+	public function initRelation($relationName)
1207
+	{
1208
+		if ('Subscription' == $relationName) {
1209
+			return $this->initSubscriptions();
1210
+		}
1211
+	}
1212
+
1213
+	/**
1214
+	 * Clears out the collSubscriptions collection
1215
+	 *
1216
+	 * This does not modify the database; however, it will remove any associated objects, causing
1217
+	 * them to be refetched by subsequent calls to accessor method.
1218
+	 *
1219
+	 * @return void
1220
+	 * @see        addSubscriptions()
1221
+	 */
1222
+	public function clearSubscriptions()
1223
+	{
1224
+		$this->collSubscriptions = null; // important to set this to NULL since that means it is uninitialized
1225
+	}
1226
+
1227
+	/**
1228
+	 * Reset is the collSubscriptions collection loaded partially.
1229
+	 */
1230
+	public function resetPartialSubscriptions($v = true)
1231
+	{
1232
+		$this->collSubscriptionsPartial = $v;
1233
+	}
1234
+
1235
+	/**
1236
+	 * Initializes the collSubscriptions collection.
1237
+	 *
1238
+	 * By default this just sets the collSubscriptions collection to an empty array (like clearcollSubscriptions());
1239
+	 * however, you may wish to override this method in your stub class to provide setting appropriate
1240
+	 * to your application -- for example, setting the initial array to the values stored in database.
1241
+	 *
1242
+	 * @param      boolean $overrideExisting If set to true, the method call initializes
1243
+	 *                                        the collection even if it is not empty
1244
+	 *
1245
+	 * @return void
1246
+	 */
1247
+	public function initSubscriptions($overrideExisting = true)
1248
+	{
1249
+		if (null !== $this->collSubscriptions && !$overrideExisting) {
1250
+			return;
1251
+		}
1252
+
1253
+		$collectionClassName = SubscriptionTableMap::getTableMap()->getCollectionClassName();
1254
+
1255
+		$this->collSubscriptions = new $collectionClassName;
1256
+		$this->collSubscriptions->setModel('\Jalle19\StatusManager\Database\Subscription');
1257
+	}
1258
+
1259
+	/**
1260
+	 * Gets an array of ChildSubscription objects which contain a foreign key that references this object.
1261
+	 *
1262
+	 * If the $criteria is not null, it is used to always fetch the results from the database.
1263
+	 * Otherwise the results are fetched from the database the first time, then cached.
1264
+	 * Next time the same method is called without $criteria, the cached collection is returned.
1265
+	 * If this ChildChannel is new, it will return
1266
+	 * an empty collection or the current collection; the criteria is ignored on a new object.
1267
+	 *
1268
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
1269
+	 * @param      ConnectionInterface $con optional connection object
1270
+	 * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1271
+	 * @throws PropelException
1272
+	 */
1273
+	public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null)
1274
+	{
1275
+		$partial = $this->collSubscriptionsPartial && !$this->isNew();
1276
+		if (null === $this->collSubscriptions || null !== $criteria  || $partial) {
1277
+			if ($this->isNew() && null === $this->collSubscriptions) {
1278
+				// return empty collection
1279
+				$this->initSubscriptions();
1280
+			} else {
1281
+				$collSubscriptions = ChildSubscriptionQuery::create(null, $criteria)
1282
+					->filterByChannel($this)
1283
+					->find($con);
1284
+
1285
+				if (null !== $criteria) {
1286
+					if (false !== $this->collSubscriptionsPartial && count($collSubscriptions)) {
1287
+						$this->initSubscriptions(false);
1288
+
1289
+						foreach ($collSubscriptions as $obj) {
1290
+							if (false == $this->collSubscriptions->contains($obj)) {
1291
+								$this->collSubscriptions->append($obj);
1292
+							}
1293
+						}
1294
+
1295
+						$this->collSubscriptionsPartial = true;
1296
+					}
1297
+
1298
+					return $collSubscriptions;
1299
+				}
1300
+
1301
+				if ($partial && $this->collSubscriptions) {
1302
+					foreach ($this->collSubscriptions as $obj) {
1303
+						if ($obj->isNew()) {
1304
+							$collSubscriptions[] = $obj;
1305
+						}
1306
+					}
1307
+				}
1308
+
1309
+				$this->collSubscriptions = $collSubscriptions;
1310
+				$this->collSubscriptionsPartial = false;
1311
+			}
1312
+		}
1313
+
1314
+		return $this->collSubscriptions;
1315
+	}
1316
+
1317
+	/**
1318
+	 * Sets a collection of ChildSubscription objects related by a one-to-many relationship
1319
+	 * to the current object.
1320
+	 * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1321
+	 * and new objects from the given Propel collection.
1322
+	 *
1323
+	 * @param      Collection $subscriptions A Propel collection.
1324
+	 * @param      ConnectionInterface $con Optional connection object
1325
+	 * @return $this|ChildChannel The current object (for fluent API support)
1326
+	 */
1327
+	public function setSubscriptions(Collection $subscriptions, ConnectionInterface $con = null)
1328
+	{
1329
+		/** @var ChildSubscription[] $subscriptionsToDelete */
1330
+		$subscriptionsToDelete = $this->getSubscriptions(new Criteria(), $con)->diff($subscriptions);
1331
+
1332
+
1333
+		$this->subscriptionsScheduledForDeletion = $subscriptionsToDelete;
1334
+
1335
+		foreach ($subscriptionsToDelete as $subscriptionRemoved) {
1336
+			$subscriptionRemoved->setChannel(null);
1337
+		}
1338
+
1339
+		$this->collSubscriptions = null;
1340
+		foreach ($subscriptions as $subscription) {
1341
+			$this->addSubscription($subscription);
1342
+		}
1343
+
1344
+		$this->collSubscriptions = $subscriptions;
1345
+		$this->collSubscriptionsPartial = false;
1346
+
1347
+		return $this;
1348
+	}
1349
+
1350
+	/**
1351
+	 * Returns the number of related Subscription objects.
1352
+	 *
1353
+	 * @param      Criteria $criteria
1354
+	 * @param      boolean $distinct
1355
+	 * @param      ConnectionInterface $con
1356
+	 * @return int             Count of related Subscription objects.
1357
+	 * @throws PropelException
1358
+	 */
1359
+	public function countSubscriptions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
1360
+	{
1361
+		$partial = $this->collSubscriptionsPartial && !$this->isNew();
1362
+		if (null === $this->collSubscriptions || null !== $criteria || $partial) {
1363
+			if ($this->isNew() && null === $this->collSubscriptions) {
1364
+				return 0;
1365
+			}
1366
+
1367
+			if ($partial && !$criteria) {
1368
+				return count($this->getSubscriptions());
1369
+			}
1370
+
1371
+			$query = ChildSubscriptionQuery::create(null, $criteria);
1372
+			if ($distinct) {
1373
+				$query->distinct();
1374
+			}
1375
+
1376
+			return $query
1377
+				->filterByChannel($this)
1378
+				->count($con);
1379
+		}
1380
+
1381
+		return count($this->collSubscriptions);
1382
+	}
1383
+
1384
+	/**
1385
+	 * Method called to associate a ChildSubscription object to this object
1386
+	 * through the ChildSubscription foreign key attribute.
1387
+	 *
1388
+	 * @param  ChildSubscription $l ChildSubscription
1389
+	 * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
1390
+	 */
1391
+	public function addSubscription(ChildSubscription $l)
1392
+	{
1393
+		if ($this->collSubscriptions === null) {
1394
+			$this->initSubscriptions();
1395
+			$this->collSubscriptionsPartial = true;
1396
+		}
1397
+
1398
+		if (!$this->collSubscriptions->contains($l)) {
1399
+			$this->doAddSubscription($l);
1400
+
1401
+			if ($this->subscriptionsScheduledForDeletion and $this->subscriptionsScheduledForDeletion->contains($l)) {
1402
+				$this->subscriptionsScheduledForDeletion->remove($this->subscriptionsScheduledForDeletion->search($l));
1403
+			}
1404
+		}
1405
+
1406
+		return $this;
1407
+	}
1408
+
1409
+	/**
1410
+	 * @param ChildSubscription $subscription The ChildSubscription object to add.
1411
+	 */
1412
+	protected function doAddSubscription(ChildSubscription $subscription)
1413
+	{
1414
+		$this->collSubscriptions[]= $subscription;
1415
+		$subscription->setChannel($this);
1416
+	}
1417
+
1418
+	/**
1419
+	 * @param  ChildSubscription $subscription The ChildSubscription object to remove.
1420
+	 * @return $this|ChildChannel The current object (for fluent API support)
1421
+	 */
1422
+	public function removeSubscription(ChildSubscription $subscription)
1423
+	{
1424
+		if ($this->getSubscriptions()->contains($subscription)) {
1425
+			$pos = $this->collSubscriptions->search($subscription);
1426
+			$this->collSubscriptions->remove($pos);
1427
+			if (null === $this->subscriptionsScheduledForDeletion) {
1428
+				$this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions;
1429
+				$this->subscriptionsScheduledForDeletion->clear();
1430
+			}
1431
+			$this->subscriptionsScheduledForDeletion[]= clone $subscription;
1432
+			$subscription->setChannel(null);
1433
+		}
1434
+
1435
+		return $this;
1436
+	}
1437
+
1438
+
1439
+	/**
1440
+	 * If this collection has already been initialized with
1441
+	 * an identical criteria, it returns the collection.
1442
+	 * Otherwise if this Channel is new, it will return
1443
+	 * an empty collection; or if this Channel has previously
1444
+	 * been saved, it will retrieve related Subscriptions from storage.
1445
+	 *
1446
+	 * This method is protected by default in order to keep the public
1447
+	 * api reasonable.  You can provide public methods for those you
1448
+	 * actually need in Channel.
1449
+	 *
1450
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
1451
+	 * @param      ConnectionInterface $con optional connection object
1452
+	 * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1453
+	 * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1454
+	 */
1455
+	public function getSubscriptionsJoinInstance(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1456
+	{
1457
+		$query = ChildSubscriptionQuery::create(null, $criteria);
1458
+		$query->joinWith('Instance', $joinBehavior);
1459
+
1460
+		return $this->getSubscriptions($query, $con);
1461
+	}
1462
+
1463
+
1464
+	/**
1465
+	 * If this collection has already been initialized with
1466
+	 * an identical criteria, it returns the collection.
1467
+	 * Otherwise if this Channel is new, it will return
1468
+	 * an empty collection; or if this Channel has previously
1469
+	 * been saved, it will retrieve related Subscriptions from storage.
1470
+	 *
1471
+	 * This method is protected by default in order to keep the public
1472
+	 * api reasonable.  You can provide public methods for those you
1473
+	 * actually need in Channel.
1474
+	 *
1475
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
1476
+	 * @param      ConnectionInterface $con optional connection object
1477
+	 * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1478
+	 * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1479
+	 */
1480
+	public function getSubscriptionsJoinInput(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1481
+	{
1482
+		$query = ChildSubscriptionQuery::create(null, $criteria);
1483
+		$query->joinWith('Input', $joinBehavior);
1484
+
1485
+		return $this->getSubscriptions($query, $con);
1486
+	}
1487
+
1488
+
1489
+	/**
1490
+	 * If this collection has already been initialized with
1491
+	 * an identical criteria, it returns the collection.
1492
+	 * Otherwise if this Channel is new, it will return
1493
+	 * an empty collection; or if this Channel has previously
1494
+	 * been saved, it will retrieve related Subscriptions from storage.
1495
+	 *
1496
+	 * This method is protected by default in order to keep the public
1497
+	 * api reasonable.  You can provide public methods for those you
1498
+	 * actually need in Channel.
1499
+	 *
1500
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
1501
+	 * @param      ConnectionInterface $con optional connection object
1502
+	 * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1503
+	 * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1504
+	 */
1505
+	public function getSubscriptionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1506
+	{
1507
+		$query = ChildSubscriptionQuery::create(null, $criteria);
1508
+		$query->joinWith('User', $joinBehavior);
1509
+
1510
+		return $this->getSubscriptions($query, $con);
1511
+	}
1512
+
1513
+	/**
1514
+	 * Clears the current object, sets all attributes to their default values and removes
1515
+	 * outgoing references as well as back-references (from other objects to this one. Results probably in a database
1516
+	 * change of those foreign objects when you call `save` there).
1517
+	 */
1518
+	public function clear()
1519
+	{
1520
+		if (null !== $this->aInstance) {
1521
+			$this->aInstance->removeChannel($this);
1522
+		}
1523
+		$this->id = null;
1524
+		$this->instance_name = null;
1525
+		$this->name = null;
1526
+		$this->alreadyInSave = false;
1527
+		$this->clearAllReferences();
1528
+		$this->resetModified();
1529
+		$this->setNew(true);
1530
+		$this->setDeleted(false);
1531
+	}
1532
+
1533
+	/**
1534
+	 * Resets all references and back-references to other model objects or collections of model objects.
1535
+	 *
1536
+	 * This method is used to reset all php object references (not the actual reference in the database).
1537
+	 * Necessary for object serialisation.
1538
+	 *
1539
+	 * @param      boolean $deep Whether to also clear the references on all referrer objects.
1540
+	 */
1541
+	public function clearAllReferences($deep = false)
1542
+	{
1543
+		if ($deep) {
1544
+			if ($this->collSubscriptions) {
1545
+				foreach ($this->collSubscriptions as $o) {
1546
+					$o->clearAllReferences($deep);
1547
+				}
1548
+			}
1549
+		} // if ($deep)
1550
+
1551
+		$this->collSubscriptions = null;
1552
+		$this->aInstance = null;
1553
+	}
1554
+
1555
+	/**
1556
+	 * Return the string representation of this object
1557
+	 *
1558
+	 * @return string
1559
+	 */
1560
+	public function __toString()
1561
+	{
1562
+		return (string) $this->exportTo(ChannelTableMap::DEFAULT_STRING_FORMAT);
1563
+	}
1564
+
1565
+	/**
1566
+	 * Code to be run before persisting the object
1567
+	 * @param  ConnectionInterface $con
1568
+	 * @return boolean
1569
+	 */
1570
+	public function preSave(ConnectionInterface $con = null)
1571
+	{
1572
+		return true;
1573
+	}
1574
+
1575
+	/**
1576
+	 * Code to be run after persisting the object
1577
+	 * @param ConnectionInterface $con
1578
+	 */
1579
+	public function postSave(ConnectionInterface $con = null)
1580
+	{
1581
+
1582
+	}
1583
+
1584
+	/**
1585
+	 * Code to be run before inserting to database
1586
+	 * @param  ConnectionInterface $con
1587
+	 * @return boolean
1588
+	 */
1589
+	public function preInsert(ConnectionInterface $con = null)
1590
+	{
1591
+		return true;
1592
+	}
1593
+
1594
+	/**
1595
+	 * Code to be run after inserting to database
1596
+	 * @param ConnectionInterface $con
1597
+	 */
1598
+	public function postInsert(ConnectionInterface $con = null)
1599
+	{
1600
+
1601
+	}
1602
+
1603
+	/**
1604
+	 * Code to be run before updating the object in database
1605
+	 * @param  ConnectionInterface $con
1606
+	 * @return boolean
1607
+	 */
1608
+	public function preUpdate(ConnectionInterface $con = null)
1609
+	{
1610
+		return true;
1611
+	}
1612
+
1613
+	/**
1614
+	 * Code to be run after updating the object in database
1615
+	 * @param ConnectionInterface $con
1616
+	 */
1617
+	public function postUpdate(ConnectionInterface $con = null)
1618
+	{
1619
+
1620
+	}
1621
+
1622
+	/**
1623
+	 * Code to be run before deleting the object in database
1624
+	 * @param  ConnectionInterface $con
1625
+	 * @return boolean
1626
+	 */
1627
+	public function preDelete(ConnectionInterface $con = null)
1628
+	{
1629
+		return true;
1630
+	}
1631
+
1632
+	/**
1633
+	 * Code to be run after deleting the object in database
1634
+	 * @param ConnectionInterface $con
1635
+	 */
1636
+	public function postDelete(ConnectionInterface $con = null)
1637
+	{
1638
+
1639
+	}
1640
+
1641
+
1642
+	/**
1643
+	 * Derived method to catches calls to undefined methods.
1644
+	 *
1645
+	 * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
1646
+	 * Allows to define default __call() behavior if you overwrite __call()
1647
+	 *
1648
+	 * @param string $name
1649
+	 * @param mixed  $params
1650
+	 *
1651
+	 * @return array|string
1652
+	 */
1653
+	public function __call($name, $params)
1654
+	{
1655
+		if (0 === strpos($name, 'get')) {
1656
+			$virtualColumn = substr($name, 3);
1657
+			if ($this->hasVirtualColumn($virtualColumn)) {
1658
+				return $this->getVirtualColumn($virtualColumn);
1659
+			}
1660
+
1661
+			$virtualColumn = lcfirst($virtualColumn);
1662
+			if ($this->hasVirtualColumn($virtualColumn)) {
1663
+				return $this->getVirtualColumn($virtualColumn);
1664
+			}
1665
+		}
1666
+
1667
+		if (0 === strpos($name, 'from')) {
1668
+			$format = substr($name, 4);
1669
+
1670
+			return $this->importFrom($format, reset($params));
1671
+		}
1672
+
1673
+		if (0 === strpos($name, 'to')) {
1674
+			$format = substr($name, 2);
1675
+			$includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1676
+
1677
+			return $this->exportTo($format, $includeLazyLoadColumns);
1678
+		}
1679
+
1680
+		throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1681
+	}
1682 1682
 
1683 1683
 }
Please login to merge, or discard this patch.
src/cli/Database/Base/Input.php 2 patches
Indentation   +1886 added lines, -1886 removed lines patch added patch discarded remove patch
@@ -36,1898 +36,1898 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.