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