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