Completed
Push — master ( 8d6c09...33443d )
by Sam
05:30 queued 40s
created
src/cli/Database/Base/Channel.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      *
306 306
      * @param  string  $msg
307 307
      * @param  int     $priority One of the Propel::LOG_* logging levels
308
-     * @return boolean
308
+     * @return boolean|null
309 309
      */
310 310
     protected function log($msg, $priority = Propel::LOG_INFO)
311 311
     {
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
      * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1029 1029
      * The default key type is the column's TableMap::TYPE_PHPNAME.
1030 1030
      *
1031
-     * @param mixed $parser A AbstractParser instance,
1031
+     * @param string $parser A AbstractParser instance,
1032 1032
      *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
1033 1033
      * @param string $data The source data to import from
1034 1034
      * @param string $keyType The type of keys the array uses.
Please login to merge, or discard this patch.
Indentation   +1613 added lines, -1613 removed lines patch added patch discarded remove patch
@@ -34,1625 +34,1625 @@
 block discarded – undo
34 34
 */
35 35
 abstract class Channel implements ActiveRecordInterface
36 36
 {
37
-    /**
38
-     * TableMap class name
39
-     */
40
-    const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\ChannelTableMap';
41
-
42
-
43
-    /**
44
-     * attribute to determine if this object has previously been saved.
45
-     * @var boolean
46
-     */
47
-    protected $new = true;
48
-
49
-    /**
50
-     * attribute to determine whether this object has been deleted.
51
-     * @var boolean
52
-     */
53
-    protected $deleted = false;
54
-
55
-    /**
56
-     * The columns that have been modified in current object.
57
-     * Tracking modified columns allows us to only update modified columns.
58
-     * @var array
59
-     */
60
-    protected $modifiedColumns = array();
61
-
62
-    /**
63
-     * The (virtual) columns that are added at runtime
64
-     * The formatters can add supplementary columns based on a resultset
65
-     * @var array
66
-     */
67
-    protected $virtualColumns = array();
68
-
69
-    /**
70
-     * The value for the id field.
71
-     *
72
-     * @var        int
73
-     */
74
-    protected $id;
75
-
76
-    /**
77
-     * The value for the instance_name field.
78
-     *
79
-     * @var        string
80
-     */
81
-    protected $instance_name;
82
-
83
-    /**
84
-     * The value for the name field.
85
-     *
86
-     * @var        string
87
-     */
88
-    protected $name;
89
-
90
-    /**
91
-     * @var        ChildInstance
92
-     */
93
-    protected $aInstance;
94
-
95
-    /**
96
-     * @var        ObjectCollection|ChildSubscription[] Collection to store aggregation of ChildSubscription objects.
97
-     */
98
-    protected $collSubscriptions;
99
-    protected $collSubscriptionsPartial;
100
-
101
-    /**
102
-     * Flag to prevent endless save loop, if this object is referenced
103
-     * by another object which falls in this transaction.
104
-     *
105
-     * @var boolean
106
-     */
107
-    protected $alreadyInSave = false;
108
-
109
-    /**
110
-     * An array of objects scheduled for deletion.
111
-     * @var ObjectCollection|ChildSubscription[]
112
-     */
113
-    protected $subscriptionsScheduledForDeletion = null;
114
-
115
-    /**
116
-     * Initializes internal state of Jalle19\StatusManager\Database\Base\Channel object.
117
-     */
118
-    public function __construct()
119
-    {
120
-    }
121
-
122
-    /**
123
-     * Returns whether the object has been modified.
124
-     *
125
-     * @return boolean True if the object has been modified.
126
-     */
127
-    public function isModified()
128
-    {
129
-        return !!$this->modifiedColumns;
130
-    }
131
-
132
-    /**
133
-     * Has specified column been modified?
134
-     *
135
-     * @param  string  $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
136
-     * @return boolean True if $col has been modified.
137
-     */
138
-    public function isColumnModified($col)
139
-    {
140
-        return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
141
-    }
142
-
143
-    /**
144
-     * Get the columns that have been modified in this object.
145
-     * @return array A unique list of the modified column names for this object.
146
-     */
147
-    public function getModifiedColumns()
148
-    {
149
-        return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
150
-    }
151
-
152
-    /**
153
-     * Returns whether the object has ever been saved.  This will
154
-     * be false, if the object was retrieved from storage or was created
155
-     * and then saved.
156
-     *
157
-     * @return boolean true, if the object has never been persisted.
158
-     */
159
-    public function isNew()
160
-    {
161
-        return $this->new;
162
-    }
163
-
164
-    /**
165
-     * Setter for the isNew attribute.  This method will be called
166
-     * by Propel-generated children and objects.
167
-     *
168
-     * @param boolean $b the state of the object.
169
-     */
170
-    public function setNew($b)
171
-    {
172
-        $this->new = (boolean) $b;
173
-    }
174
-
175
-    /**
176
-     * Whether this object has been deleted.
177
-     * @return boolean The deleted state of this object.
178
-     */
179
-    public function isDeleted()
180
-    {
181
-        return $this->deleted;
182
-    }
183
-
184
-    /**
185
-     * Specify whether this object has been deleted.
186
-     * @param  boolean $b The deleted state of this object.
187
-     * @return void
188
-     */
189
-    public function setDeleted($b)
190
-    {
191
-        $this->deleted = (boolean) $b;
192
-    }
193
-
194
-    /**
195
-     * Sets the modified state for the object to be false.
196
-     * @param  string $col If supplied, only the specified column is reset.
197
-     * @return void
198
-     */
199
-    public function resetModified($col = null)
200
-    {
201
-        if (null !== $col) {
202
-            if (isset($this->modifiedColumns[$col])) {
203
-                unset($this->modifiedColumns[$col]);
204
-            }
205
-        } else {
206
-            $this->modifiedColumns = array();
207
-        }
208
-    }
209
-
210
-    /**
211
-     * Compares this with another <code>Channel</code> instance.  If
212
-     * <code>obj</code> is an instance of <code>Channel</code>, delegates to
213
-     * <code>equals(Channel)</code>.  Otherwise, returns <code>false</code>.
214
-     *
215
-     * @param  mixed   $obj The object to compare to.
216
-     * @return boolean Whether equal to the object specified.
217
-     */
218
-    public function equals($obj)
219
-    {
220
-        if (!$obj instanceof static) {
221
-            return false;
222
-        }
223
-
224
-        if ($this === $obj) {
225
-            return true;
226
-        }
227
-
228
-        if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) {
229
-            return false;
230
-        }
231
-
232
-        return $this->getPrimaryKey() === $obj->getPrimaryKey();
233
-    }
234
-
235
-    /**
236
-     * Get the associative array of the virtual columns in this object
237
-     *
238
-     * @return array
239
-     */
240
-    public function getVirtualColumns()
241
-    {
242
-        return $this->virtualColumns;
243
-    }
244
-
245
-    /**
246
-     * Checks the existence of a virtual column in this object
247
-     *
248
-     * @param  string  $name The virtual column name
249
-     * @return boolean
250
-     */
251
-    public function hasVirtualColumn($name)
252
-    {
253
-        return array_key_exists($name, $this->virtualColumns);
254
-    }
255
-
256
-    /**
257
-     * Get the value of a virtual column in this object
258
-     *
259
-     * @param  string $name The virtual column name
260
-     * @return mixed
261
-     *
262
-     * @throws PropelException
263
-     */
264
-    public function getVirtualColumn($name)
265
-    {
266
-        if (!$this->hasVirtualColumn($name)) {
267
-            throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
268
-        }
269
-
270
-        return $this->virtualColumns[$name];
271
-    }
272
-
273
-    /**
274
-     * Set the value of a virtual column in this object
275
-     *
276
-     * @param string $name  The virtual column name
277
-     * @param mixed  $value The value to give to the virtual column
278
-     *
279
-     * @return $this|Channel The current object, for fluid interface
280
-     */
281
-    public function setVirtualColumn($name, $value)
282
-    {
283
-        $this->virtualColumns[$name] = $value;
284
-
285
-        return $this;
286
-    }
287
-
288
-    /**
289
-     * Logs a message using Propel::log().
290
-     *
291
-     * @param  string  $msg
292
-     * @param  int     $priority One of the Propel::LOG_* logging levels
293
-     * @return boolean
294
-     */
295
-    protected function log($msg, $priority = Propel::LOG_INFO)
296
-    {
297
-        return Propel::log(get_class($this) . ': ' . $msg, $priority);
298
-    }
299
-
300
-    /**
301
-     * Export the current object properties to a string, using a given parser format
302
-     * <code>
303
-     * $book = BookQuery::create()->findPk(9012);
304
-     * echo $book->exportTo('JSON');
305
-     *  => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
306
-     * </code>
307
-     *
308
-     * @param  mixed   $parser                 A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
309
-     * @param  boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
310
-     * @return string  The exported data
311
-     */
312
-    public function exportTo($parser, $includeLazyLoadColumns = true)
313
-    {
314
-        if (!$parser instanceof AbstractParser) {
315
-            $parser = AbstractParser::getParser($parser);
316
-        }
317
-
318
-        return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
319
-    }
320
-
321
-    /**
322
-     * Clean up internal collections prior to serializing
323
-     * Avoids recursive loops that turn into segmentation faults when serializing
324
-     */
325
-    public function __sleep()
326
-    {
327
-        $this->clearAllReferences();
328
-
329
-        $cls = new \ReflectionClass($this);
330
-        $propertyNames = [];
331
-        $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
332
-
333
-        foreach($serializableProperties as $property) {
334
-            $propertyNames[] = $property->getName();
335
-        }
336
-
337
-        return $propertyNames;
338
-    }
339
-
340
-    /**
341
-     * Get the [id] column value.
342
-     *
343
-     * @return int
344
-     */
345
-    public function getId()
346
-    {
347
-        return $this->id;
348
-    }
349
-
350
-    /**
351
-     * Get the [instance_name] column value.
352
-     *
353
-     * @return string
354
-     */
355
-    public function getInstanceName()
356
-    {
357
-        return $this->instance_name;
358
-    }
359
-
360
-    /**
361
-     * Get the [name] column value.
362
-     *
363
-     * @return string
364
-     */
365
-    public function getName()
366
-    {
367
-        return $this->name;
368
-    }
369
-
370
-    /**
371
-     * Set the value of [id] column.
372
-     *
373
-     * @param int $v new value
374
-     * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
375
-     */
376
-    public function setId($v)
377
-    {
378
-        if ($v !== null) {
379
-            $v = (int) $v;
380
-        }
381
-
382
-        if ($this->id !== $v) {
383
-            $this->id = $v;
384
-            $this->modifiedColumns[ChannelTableMap::COL_ID] = true;
385
-        }
386
-
387
-        return $this;
388
-    } // setId()
389
-
390
-    /**
391
-     * Set the value of [instance_name] column.
392
-     *
393
-     * @param string $v new value
394
-     * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
395
-     */
396
-    public function setInstanceName($v)
397
-    {
398
-        if ($v !== null) {
399
-            $v = (string) $v;
400
-        }
401
-
402
-        if ($this->instance_name !== $v) {
403
-            $this->instance_name = $v;
404
-            $this->modifiedColumns[ChannelTableMap::COL_INSTANCE_NAME] = true;
405
-        }
406
-
407
-        if ($this->aInstance !== null && $this->aInstance->getName() !== $v) {
408
-            $this->aInstance = null;
409
-        }
410
-
411
-        return $this;
412
-    } // setInstanceName()
413
-
414
-    /**
415
-     * Set the value of [name] column.
416
-     *
417
-     * @param string $v new value
418
-     * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
419
-     */
420
-    public function setName($v)
421
-    {
422
-        if ($v !== null) {
423
-            $v = (string) $v;
424
-        }
425
-
426
-        if ($this->name !== $v) {
427
-            $this->name = $v;
428
-            $this->modifiedColumns[ChannelTableMap::COL_NAME] = true;
429
-        }
430
-
431
-        return $this;
432
-    } // setName()
433
-
434
-    /**
435
-     * Indicates whether the columns in this object are only set to default values.
436
-     *
437
-     * This method can be used in conjunction with isModified() to indicate whether an object is both
438
-     * modified _and_ has some values set which are non-default.
439
-     *
440
-     * @return boolean Whether the columns in this object are only been set with default values.
441
-     */
442
-    public function hasOnlyDefaultValues()
443
-    {
444
-        // otherwise, everything was equal, so return TRUE
445
-        return true;
446
-    } // hasOnlyDefaultValues()
447
-
448
-    /**
449
-     * Hydrates (populates) the object variables with values from the database resultset.
450
-     *
451
-     * An offset (0-based "start column") is specified so that objects can be hydrated
452
-     * with a subset of the columns in the resultset rows.  This is needed, for example,
453
-     * for results of JOIN queries where the resultset row includes columns from two or
454
-     * more tables.
455
-     *
456
-     * @param array   $row       The row returned by DataFetcher->fetch().
457
-     * @param int     $startcol  0-based offset column which indicates which restultset column to start with.
458
-     * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
459
-     * @param string  $indexType The index type of $row. Mostly DataFetcher->getIndexType().
37
+	/**
38
+	 * TableMap class name
39
+	 */
40
+	const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\ChannelTableMap';
41
+
42
+
43
+	/**
44
+	 * attribute to determine if this object has previously been saved.
45
+	 * @var boolean
46
+	 */
47
+	protected $new = true;
48
+
49
+	/**
50
+	 * attribute to determine whether this object has been deleted.
51
+	 * @var boolean
52
+	 */
53
+	protected $deleted = false;
54
+
55
+	/**
56
+	 * The columns that have been modified in current object.
57
+	 * Tracking modified columns allows us to only update modified columns.
58
+	 * @var array
59
+	 */
60
+	protected $modifiedColumns = array();
61
+
62
+	/**
63
+	 * The (virtual) columns that are added at runtime
64
+	 * The formatters can add supplementary columns based on a resultset
65
+	 * @var array
66
+	 */
67
+	protected $virtualColumns = array();
68
+
69
+	/**
70
+	 * The value for the id field.
71
+	 *
72
+	 * @var        int
73
+	 */
74
+	protected $id;
75
+
76
+	/**
77
+	 * The value for the instance_name field.
78
+	 *
79
+	 * @var        string
80
+	 */
81
+	protected $instance_name;
82
+
83
+	/**
84
+	 * The value for the name field.
85
+	 *
86
+	 * @var        string
87
+	 */
88
+	protected $name;
89
+
90
+	/**
91
+	 * @var        ChildInstance
92
+	 */
93
+	protected $aInstance;
94
+
95
+	/**
96
+	 * @var        ObjectCollection|ChildSubscription[] Collection to store aggregation of ChildSubscription objects.
97
+	 */
98
+	protected $collSubscriptions;
99
+	protected $collSubscriptionsPartial;
100
+
101
+	/**
102
+	 * Flag to prevent endless save loop, if this object is referenced
103
+	 * by another object which falls in this transaction.
104
+	 *
105
+	 * @var boolean
106
+	 */
107
+	protected $alreadyInSave = false;
108
+
109
+	/**
110
+	 * An array of objects scheduled for deletion.
111
+	 * @var ObjectCollection|ChildSubscription[]
112
+	 */
113
+	protected $subscriptionsScheduledForDeletion = null;
114
+
115
+	/**
116
+	 * Initializes internal state of Jalle19\StatusManager\Database\Base\Channel object.
117
+	 */
118
+	public function __construct()
119
+	{
120
+	}
121
+
122
+	/**
123
+	 * Returns whether the object has been modified.
124
+	 *
125
+	 * @return boolean True if the object has been modified.
126
+	 */
127
+	public function isModified()
128
+	{
129
+		return !!$this->modifiedColumns;
130
+	}
131
+
132
+	/**
133
+	 * Has specified column been modified?
134
+	 *
135
+	 * @param  string  $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
136
+	 * @return boolean True if $col has been modified.
137
+	 */
138
+	public function isColumnModified($col)
139
+	{
140
+		return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
141
+	}
142
+
143
+	/**
144
+	 * Get the columns that have been modified in this object.
145
+	 * @return array A unique list of the modified column names for this object.
146
+	 */
147
+	public function getModifiedColumns()
148
+	{
149
+		return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
150
+	}
151
+
152
+	/**
153
+	 * Returns whether the object has ever been saved.  This will
154
+	 * be false, if the object was retrieved from storage or was created
155
+	 * and then saved.
156
+	 *
157
+	 * @return boolean true, if the object has never been persisted.
158
+	 */
159
+	public function isNew()
160
+	{
161
+		return $this->new;
162
+	}
163
+
164
+	/**
165
+	 * Setter for the isNew attribute.  This method will be called
166
+	 * by Propel-generated children and objects.
167
+	 *
168
+	 * @param boolean $b the state of the object.
169
+	 */
170
+	public function setNew($b)
171
+	{
172
+		$this->new = (boolean) $b;
173
+	}
174
+
175
+	/**
176
+	 * Whether this object has been deleted.
177
+	 * @return boolean The deleted state of this object.
178
+	 */
179
+	public function isDeleted()
180
+	{
181
+		return $this->deleted;
182
+	}
183
+
184
+	/**
185
+	 * Specify whether this object has been deleted.
186
+	 * @param  boolean $b The deleted state of this object.
187
+	 * @return void
188
+	 */
189
+	public function setDeleted($b)
190
+	{
191
+		$this->deleted = (boolean) $b;
192
+	}
193
+
194
+	/**
195
+	 * Sets the modified state for the object to be false.
196
+	 * @param  string $col If supplied, only the specified column is reset.
197
+	 * @return void
198
+	 */
199
+	public function resetModified($col = null)
200
+	{
201
+		if (null !== $col) {
202
+			if (isset($this->modifiedColumns[$col])) {
203
+				unset($this->modifiedColumns[$col]);
204
+			}
205
+		} else {
206
+			$this->modifiedColumns = array();
207
+		}
208
+	}
209
+
210
+	/**
211
+	 * Compares this with another <code>Channel</code> instance.  If
212
+	 * <code>obj</code> is an instance of <code>Channel</code>, delegates to
213
+	 * <code>equals(Channel)</code>.  Otherwise, returns <code>false</code>.
214
+	 *
215
+	 * @param  mixed   $obj The object to compare to.
216
+	 * @return boolean Whether equal to the object specified.
217
+	 */
218
+	public function equals($obj)
219
+	{
220
+		if (!$obj instanceof static) {
221
+			return false;
222
+		}
223
+
224
+		if ($this === $obj) {
225
+			return true;
226
+		}
227
+
228
+		if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) {
229
+			return false;
230
+		}
231
+
232
+		return $this->getPrimaryKey() === $obj->getPrimaryKey();
233
+	}
234
+
235
+	/**
236
+	 * Get the associative array of the virtual columns in this object
237
+	 *
238
+	 * @return array
239
+	 */
240
+	public function getVirtualColumns()
241
+	{
242
+		return $this->virtualColumns;
243
+	}
244
+
245
+	/**
246
+	 * Checks the existence of a virtual column in this object
247
+	 *
248
+	 * @param  string  $name The virtual column name
249
+	 * @return boolean
250
+	 */
251
+	public function hasVirtualColumn($name)
252
+	{
253
+		return array_key_exists($name, $this->virtualColumns);
254
+	}
255
+
256
+	/**
257
+	 * Get the value of a virtual column in this object
258
+	 *
259
+	 * @param  string $name The virtual column name
260
+	 * @return mixed
261
+	 *
262
+	 * @throws PropelException
263
+	 */
264
+	public function getVirtualColumn($name)
265
+	{
266
+		if (!$this->hasVirtualColumn($name)) {
267
+			throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
268
+		}
269
+
270
+		return $this->virtualColumns[$name];
271
+	}
272
+
273
+	/**
274
+	 * Set the value of a virtual column in this object
275
+	 *
276
+	 * @param string $name  The virtual column name
277
+	 * @param mixed  $value The value to give to the virtual column
278
+	 *
279
+	 * @return $this|Channel The current object, for fluid interface
280
+	 */
281
+	public function setVirtualColumn($name, $value)
282
+	{
283
+		$this->virtualColumns[$name] = $value;
284
+
285
+		return $this;
286
+	}
287
+
288
+	/**
289
+	 * Logs a message using Propel::log().
290
+	 *
291
+	 * @param  string  $msg
292
+	 * @param  int     $priority One of the Propel::LOG_* logging levels
293
+	 * @return boolean
294
+	 */
295
+	protected function log($msg, $priority = Propel::LOG_INFO)
296
+	{
297
+		return Propel::log(get_class($this) . ': ' . $msg, $priority);
298
+	}
299
+
300
+	/**
301
+	 * Export the current object properties to a string, using a given parser format
302
+	 * <code>
303
+	 * $book = BookQuery::create()->findPk(9012);
304
+	 * echo $book->exportTo('JSON');
305
+	 *  => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
306
+	 * </code>
307
+	 *
308
+	 * @param  mixed   $parser                 A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
309
+	 * @param  boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
310
+	 * @return string  The exported data
311
+	 */
312
+	public function exportTo($parser, $includeLazyLoadColumns = true)
313
+	{
314
+		if (!$parser instanceof AbstractParser) {
315
+			$parser = AbstractParser::getParser($parser);
316
+		}
317
+
318
+		return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
319
+	}
320
+
321
+	/**
322
+	 * Clean up internal collections prior to serializing
323
+	 * Avoids recursive loops that turn into segmentation faults when serializing
324
+	 */
325
+	public function __sleep()
326
+	{
327
+		$this->clearAllReferences();
328
+
329
+		$cls = new \ReflectionClass($this);
330
+		$propertyNames = [];
331
+		$serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
332
+
333
+		foreach($serializableProperties as $property) {
334
+			$propertyNames[] = $property->getName();
335
+		}
336
+
337
+		return $propertyNames;
338
+	}
339
+
340
+	/**
341
+	 * Get the [id] column value.
342
+	 *
343
+	 * @return int
344
+	 */
345
+	public function getId()
346
+	{
347
+		return $this->id;
348
+	}
349
+
350
+	/**
351
+	 * Get the [instance_name] column value.
352
+	 *
353
+	 * @return string
354
+	 */
355
+	public function getInstanceName()
356
+	{
357
+		return $this->instance_name;
358
+	}
359
+
360
+	/**
361
+	 * Get the [name] column value.
362
+	 *
363
+	 * @return string
364
+	 */
365
+	public function getName()
366
+	{
367
+		return $this->name;
368
+	}
369
+
370
+	/**
371
+	 * Set the value of [id] column.
372
+	 *
373
+	 * @param int $v new value
374
+	 * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
375
+	 */
376
+	public function setId($v)
377
+	{
378
+		if ($v !== null) {
379
+			$v = (int) $v;
380
+		}
381
+
382
+		if ($this->id !== $v) {
383
+			$this->id = $v;
384
+			$this->modifiedColumns[ChannelTableMap::COL_ID] = true;
385
+		}
386
+
387
+		return $this;
388
+	} // setId()
389
+
390
+	/**
391
+	 * Set the value of [instance_name] column.
392
+	 *
393
+	 * @param string $v new value
394
+	 * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
395
+	 */
396
+	public function setInstanceName($v)
397
+	{
398
+		if ($v !== null) {
399
+			$v = (string) $v;
400
+		}
401
+
402
+		if ($this->instance_name !== $v) {
403
+			$this->instance_name = $v;
404
+			$this->modifiedColumns[ChannelTableMap::COL_INSTANCE_NAME] = true;
405
+		}
406
+
407
+		if ($this->aInstance !== null && $this->aInstance->getName() !== $v) {
408
+			$this->aInstance = null;
409
+		}
410
+
411
+		return $this;
412
+	} // setInstanceName()
413
+
414
+	/**
415
+	 * Set the value of [name] column.
416
+	 *
417
+	 * @param string $v new value
418
+	 * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
419
+	 */
420
+	public function setName($v)
421
+	{
422
+		if ($v !== null) {
423
+			$v = (string) $v;
424
+		}
425
+
426
+		if ($this->name !== $v) {
427
+			$this->name = $v;
428
+			$this->modifiedColumns[ChannelTableMap::COL_NAME] = true;
429
+		}
430
+
431
+		return $this;
432
+	} // setName()
433
+
434
+	/**
435
+	 * Indicates whether the columns in this object are only set to default values.
436
+	 *
437
+	 * This method can be used in conjunction with isModified() to indicate whether an object is both
438
+	 * modified _and_ has some values set which are non-default.
439
+	 *
440
+	 * @return boolean Whether the columns in this object are only been set with default values.
441
+	 */
442
+	public function hasOnlyDefaultValues()
443
+	{
444
+		// otherwise, everything was equal, so return TRUE
445
+		return true;
446
+	} // hasOnlyDefaultValues()
447
+
448
+	/**
449
+	 * Hydrates (populates) the object variables with values from the database resultset.
450
+	 *
451
+	 * An offset (0-based "start column") is specified so that objects can be hydrated
452
+	 * with a subset of the columns in the resultset rows.  This is needed, for example,
453
+	 * for results of JOIN queries where the resultset row includes columns from two or
454
+	 * more tables.
455
+	 *
456
+	 * @param array   $row       The row returned by DataFetcher->fetch().
457
+	 * @param int     $startcol  0-based offset column which indicates which restultset column to start with.
458
+	 * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
459
+	 * @param string  $indexType The index type of $row. Mostly DataFetcher->getIndexType().
460 460
                                   One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
461
-     *                            TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
462
-     *
463
-     * @return int             next starting column
464
-     * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
465
-     */
466
-    public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
467
-    {
468
-        try {
469
-
470
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ChannelTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
471
-            $this->id = (null !== $col) ? (int) $col : null;
472
-
473
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ChannelTableMap::translateFieldName('InstanceName', TableMap::TYPE_PHPNAME, $indexType)];
474
-            $this->instance_name = (null !== $col) ? (string) $col : null;
475
-
476
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ChannelTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
477
-            $this->name = (null !== $col) ? (string) $col : null;
478
-            $this->resetModified();
479
-
480
-            $this->setNew(false);
481
-
482
-            if ($rehydrate) {
483
-                $this->ensureConsistency();
484
-            }
485
-
486
-            return $startcol + 3; // 3 = ChannelTableMap::NUM_HYDRATE_COLUMNS.
487
-
488
-        } catch (Exception $e) {
489
-            throw new PropelException(sprintf('Error populating %s object', '\\Jalle19\\StatusManager\\Database\\Channel'), 0, $e);
490
-        }
491
-    }
492
-
493
-    /**
494
-     * Checks and repairs the internal consistency of the object.
495
-     *
496
-     * This method is executed after an already-instantiated object is re-hydrated
497
-     * from the database.  It exists to check any foreign keys to make sure that
498
-     * the objects related to the current object are correct based on foreign key.
499
-     *
500
-     * You can override this method in the stub class, but you should always invoke
501
-     * the base method from the overridden method (i.e. parent::ensureConsistency()),
502
-     * in case your model changes.
503
-     *
504
-     * @throws PropelException
505
-     */
506
-    public function ensureConsistency()
507
-    {
508
-        if ($this->aInstance !== null && $this->instance_name !== $this->aInstance->getName()) {
509
-            $this->aInstance = null;
510
-        }
511
-    } // ensureConsistency
512
-
513
-    /**
514
-     * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
515
-     *
516
-     * This will only work if the object has been saved and has a valid primary key set.
517
-     *
518
-     * @param      boolean $deep (optional) Whether to also de-associated any related objects.
519
-     * @param      ConnectionInterface $con (optional) The ConnectionInterface connection to use.
520
-     * @return void
521
-     * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
522
-     */
523
-    public function reload($deep = false, ConnectionInterface $con = null)
524
-    {
525
-        if ($this->isDeleted()) {
526
-            throw new PropelException("Cannot reload a deleted object.");
527
-        }
528
-
529
-        if ($this->isNew()) {
530
-            throw new PropelException("Cannot reload an unsaved object.");
531
-        }
532
-
533
-        if ($con === null) {
534
-            $con = Propel::getServiceContainer()->getReadConnection(ChannelTableMap::DATABASE_NAME);
535
-        }
536
-
537
-        // We don't need to alter the object instance pool; we're just modifying this instance
538
-        // already in the pool.
539
-
540
-        $dataFetcher = ChildChannelQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
541
-        $row = $dataFetcher->fetch();
542
-        $dataFetcher->close();
543
-        if (!$row) {
544
-            throw new PropelException('Cannot find matching row in the database to reload object values.');
545
-        }
546
-        $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
547
-
548
-        if ($deep) {  // also de-associate any related objects?
549
-
550
-            $this->aInstance = null;
551
-            $this->collSubscriptions = null;
552
-
553
-        } // if (deep)
554
-    }
555
-
556
-    /**
557
-     * Removes this object from datastore and sets delete attribute.
558
-     *
559
-     * @param      ConnectionInterface $con
560
-     * @return void
561
-     * @throws PropelException
562
-     * @see Channel::setDeleted()
563
-     * @see Channel::isDeleted()
564
-     */
565
-    public function delete(ConnectionInterface $con = null)
566
-    {
567
-        if ($this->isDeleted()) {
568
-            throw new PropelException("This object has already been deleted.");
569
-        }
570
-
571
-        if ($con === null) {
572
-            $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
573
-        }
574
-
575
-        $con->transaction(function () use ($con) {
576
-            $deleteQuery = ChildChannelQuery::create()
577
-                ->filterByPrimaryKey($this->getPrimaryKey());
578
-            $ret = $this->preDelete($con);
579
-            if ($ret) {
580
-                $deleteQuery->delete($con);
581
-                $this->postDelete($con);
582
-                $this->setDeleted(true);
583
-            }
584
-        });
585
-    }
586
-
587
-    /**
588
-     * Persists this object to the database.
589
-     *
590
-     * If the object is new, it inserts it; otherwise an update is performed.
591
-     * All modified related objects will also be persisted in the doSave()
592
-     * method.  This method wraps all precipitate database operations in a
593
-     * single transaction.
594
-     *
595
-     * @param      ConnectionInterface $con
596
-     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
597
-     * @throws PropelException
598
-     * @see doSave()
599
-     */
600
-    public function save(ConnectionInterface $con = null)
601
-    {
602
-        if ($this->isDeleted()) {
603
-            throw new PropelException("You cannot save an object that has been deleted.");
604
-        }
605
-
606
-        if ($con === null) {
607
-            $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
608
-        }
609
-
610
-        return $con->transaction(function () use ($con) {
611
-            $isInsert = $this->isNew();
612
-            $ret = $this->preSave($con);
613
-            if ($isInsert) {
614
-                $ret = $ret && $this->preInsert($con);
615
-            } else {
616
-                $ret = $ret && $this->preUpdate($con);
617
-            }
618
-            if ($ret) {
619
-                $affectedRows = $this->doSave($con);
620
-                if ($isInsert) {
621
-                    $this->postInsert($con);
622
-                } else {
623
-                    $this->postUpdate($con);
624
-                }
625
-                $this->postSave($con);
626
-                ChannelTableMap::addInstanceToPool($this);
627
-            } else {
628
-                $affectedRows = 0;
629
-            }
630
-
631
-            return $affectedRows;
632
-        });
633
-    }
634
-
635
-    /**
636
-     * Performs the work of inserting or updating the row in the database.
637
-     *
638
-     * If the object is new, it inserts it; otherwise an update is performed.
639
-     * All related objects are also updated in this method.
640
-     *
641
-     * @param      ConnectionInterface $con
642
-     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
643
-     * @throws PropelException
644
-     * @see save()
645
-     */
646
-    protected function doSave(ConnectionInterface $con)
647
-    {
648
-        $affectedRows = 0; // initialize var to track total num of affected rows
649
-        if (!$this->alreadyInSave) {
650
-            $this->alreadyInSave = true;
651
-
652
-            // We call the save method on the following object(s) if they
653
-            // were passed to this object by their corresponding set
654
-            // method.  This object relates to these object(s) by a
655
-            // foreign key reference.
656
-
657
-            if ($this->aInstance !== null) {
658
-                if ($this->aInstance->isModified() || $this->aInstance->isNew()) {
659
-                    $affectedRows += $this->aInstance->save($con);
660
-                }
661
-                $this->setInstance($this->aInstance);
662
-            }
663
-
664
-            if ($this->isNew() || $this->isModified()) {
665
-                // persist changes
666
-                if ($this->isNew()) {
667
-                    $this->doInsert($con);
668
-                    $affectedRows += 1;
669
-                } else {
670
-                    $affectedRows += $this->doUpdate($con);
671
-                }
672
-                $this->resetModified();
673
-            }
674
-
675
-            if ($this->subscriptionsScheduledForDeletion !== null) {
676
-                if (!$this->subscriptionsScheduledForDeletion->isEmpty()) {
677
-                    \Jalle19\StatusManager\Database\SubscriptionQuery::create()
678
-                        ->filterByPrimaryKeys($this->subscriptionsScheduledForDeletion->getPrimaryKeys(false))
679
-                        ->delete($con);
680
-                    $this->subscriptionsScheduledForDeletion = null;
681
-                }
682
-            }
683
-
684
-            if ($this->collSubscriptions !== null) {
685
-                foreach ($this->collSubscriptions as $referrerFK) {
686
-                    if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
687
-                        $affectedRows += $referrerFK->save($con);
688
-                    }
689
-                }
690
-            }
691
-
692
-            $this->alreadyInSave = false;
693
-
694
-        }
695
-
696
-        return $affectedRows;
697
-    } // doSave()
698
-
699
-    /**
700
-     * Insert the row in the database.
701
-     *
702
-     * @param      ConnectionInterface $con
703
-     *
704
-     * @throws PropelException
705
-     * @see doSave()
706
-     */
707
-    protected function doInsert(ConnectionInterface $con)
708
-    {
709
-        $modifiedColumns = array();
710
-        $index = 0;
711
-
712
-        $this->modifiedColumns[ChannelTableMap::COL_ID] = true;
713
-        if (null !== $this->id) {
714
-            throw new PropelException('Cannot insert a value for auto-increment primary key (' . ChannelTableMap::COL_ID . ')');
715
-        }
716
-
717
-         // check the columns in natural order for more readable SQL queries
718
-        if ($this->isColumnModified(ChannelTableMap::COL_ID)) {
719
-            $modifiedColumns[':p' . $index++]  = 'id';
720
-        }
721
-        if ($this->isColumnModified(ChannelTableMap::COL_INSTANCE_NAME)) {
722
-            $modifiedColumns[':p' . $index++]  = 'instance_name';
723
-        }
724
-        if ($this->isColumnModified(ChannelTableMap::COL_NAME)) {
725
-            $modifiedColumns[':p' . $index++]  = 'name';
726
-        }
727
-
728
-        $sql = sprintf(
729
-            'INSERT INTO channel (%s) VALUES (%s)',
730
-            implode(', ', $modifiedColumns),
731
-            implode(', ', array_keys($modifiedColumns))
732
-        );
733
-
734
-        try {
735
-            $stmt = $con->prepare($sql);
736
-            foreach ($modifiedColumns as $identifier => $columnName) {
737
-                switch ($columnName) {
738
-                    case 'id':
739
-                        $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
740
-                        break;
741
-                    case 'instance_name':
742
-                        $stmt->bindValue($identifier, $this->instance_name, PDO::PARAM_STR);
743
-                        break;
744
-                    case 'name':
745
-                        $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
746
-                        break;
747
-                }
748
-            }
749
-            $stmt->execute();
750
-        } catch (Exception $e) {
751
-            Propel::log($e->getMessage(), Propel::LOG_ERR);
752
-            throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
753
-        }
754
-
755
-        try {
756
-            $pk = $con->lastInsertId();
757
-        } catch (Exception $e) {
758
-            throw new PropelException('Unable to get autoincrement id.', 0, $e);
759
-        }
760
-        $this->setId($pk);
761
-
762
-        $this->setNew(false);
763
-    }
764
-
765
-    /**
766
-     * Update the row in the database.
767
-     *
768
-     * @param      ConnectionInterface $con
769
-     *
770
-     * @return Integer Number of updated rows
771
-     * @see doSave()
772
-     */
773
-    protected function doUpdate(ConnectionInterface $con)
774
-    {
775
-        $selectCriteria = $this->buildPkeyCriteria();
776
-        $valuesCriteria = $this->buildCriteria();
777
-
778
-        return $selectCriteria->doUpdate($valuesCriteria, $con);
779
-    }
780
-
781
-    /**
782
-     * Retrieves a field from the object by name passed in as a string.
783
-     *
784
-     * @param      string $name name
785
-     * @param      string $type The type of fieldname the $name is of:
786
-     *                     one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
787
-     *                     TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
788
-     *                     Defaults to TableMap::TYPE_PHPNAME.
789
-     * @return mixed Value of field.
790
-     */
791
-    public function getByName($name, $type = TableMap::TYPE_PHPNAME)
792
-    {
793
-        $pos = ChannelTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
794
-        $field = $this->getByPosition($pos);
795
-
796
-        return $field;
797
-    }
798
-
799
-    /**
800
-     * Retrieves a field from the object by Position as specified in the xml schema.
801
-     * Zero-based.
802
-     *
803
-     * @param      int $pos position in xml schema
804
-     * @return mixed Value of field at $pos
805
-     */
806
-    public function getByPosition($pos)
807
-    {
808
-        switch ($pos) {
809
-            case 0:
810
-                return $this->getId();
811
-                break;
812
-            case 1:
813
-                return $this->getInstanceName();
814
-                break;
815
-            case 2:
816
-                return $this->getName();
817
-                break;
818
-            default:
819
-                return null;
820
-                break;
821
-        } // switch()
822
-    }
823
-
824
-    /**
825
-     * Exports the object as an array.
826
-     *
827
-     * You can specify the key type of the array by passing one of the class
828
-     * type constants.
829
-     *
830
-     * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
831
-     *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
832
-     *                    Defaults to TableMap::TYPE_PHPNAME.
833
-     * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
834
-     * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
835
-     * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
836
-     *
837
-     * @return array an associative array containing the field names (as keys) and field values
838
-     */
839
-    public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
840
-    {
841
-
842
-        if (isset($alreadyDumpedObjects['Channel'][$this->hashCode()])) {
843
-            return '*RECURSION*';
844
-        }
845
-        $alreadyDumpedObjects['Channel'][$this->hashCode()] = true;
846
-        $keys = ChannelTableMap::getFieldNames($keyType);
847
-        $result = array(
848
-            $keys[0] => $this->getId(),
849
-            $keys[1] => $this->getInstanceName(),
850
-            $keys[2] => $this->getName(),
851
-        );
852
-        $virtualColumns = $this->virtualColumns;
853
-        foreach ($virtualColumns as $key => $virtualColumn) {
854
-            $result[$key] = $virtualColumn;
855
-        }
856
-
857
-        if ($includeForeignObjects) {
858
-            if (null !== $this->aInstance) {
859
-
860
-                switch ($keyType) {
861
-                    case TableMap::TYPE_CAMELNAME:
862
-                        $key = 'instance';
863
-                        break;
864
-                    case TableMap::TYPE_FIELDNAME:
865
-                        $key = 'instance';
866
-                        break;
867
-                    default:
868
-                        $key = 'Instance';
869
-                }
870
-
871
-                $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
872
-            }
873
-            if (null !== $this->collSubscriptions) {
874
-
875
-                switch ($keyType) {
876
-                    case TableMap::TYPE_CAMELNAME:
877
-                        $key = 'subscriptions';
878
-                        break;
879
-                    case TableMap::TYPE_FIELDNAME:
880
-                        $key = 'subscriptions';
881
-                        break;
882
-                    default:
883
-                        $key = 'Subscriptions';
884
-                }
885
-
886
-                $result[$key] = $this->collSubscriptions->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
887
-            }
888
-        }
889
-
890
-        return $result;
891
-    }
892
-
893
-    /**
894
-     * Sets a field from the object by name passed in as a string.
895
-     *
896
-     * @param  string $name
897
-     * @param  mixed  $value field value
898
-     * @param  string $type The type of fieldname the $name is of:
899
-     *                one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
900
-     *                TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
901
-     *                Defaults to TableMap::TYPE_PHPNAME.
902
-     * @return $this|\Jalle19\StatusManager\Database\Channel
903
-     */
904
-    public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
905
-    {
906
-        $pos = ChannelTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
907
-
908
-        return $this->setByPosition($pos, $value);
909
-    }
910
-
911
-    /**
912
-     * Sets a field from the object by Position as specified in the xml schema.
913
-     * Zero-based.
914
-     *
915
-     * @param  int $pos position in xml schema
916
-     * @param  mixed $value field value
917
-     * @return $this|\Jalle19\StatusManager\Database\Channel
918
-     */
919
-    public function setByPosition($pos, $value)
920
-    {
921
-        switch ($pos) {
922
-            case 0:
923
-                $this->setId($value);
924
-                break;
925
-            case 1:
926
-                $this->setInstanceName($value);
927
-                break;
928
-            case 2:
929
-                $this->setName($value);
930
-                break;
931
-        } // switch()
932
-
933
-        return $this;
934
-    }
935
-
936
-    /**
937
-     * Populates the object using an array.
938
-     *
939
-     * This is particularly useful when populating an object from one of the
940
-     * request arrays (e.g. $_POST).  This method goes through the column
941
-     * names, checking to see whether a matching key exists in populated
942
-     * array. If so the setByName() method is called for that column.
943
-     *
944
-     * You can specify the key type of the array by additionally passing one
945
-     * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
946
-     * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
947
-     * The default key type is the column's TableMap::TYPE_PHPNAME.
948
-     *
949
-     * @param      array  $arr     An array to populate the object from.
950
-     * @param      string $keyType The type of keys the array uses.
951
-     * @return void
952
-     */
953
-    public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
954
-    {
955
-        $keys = ChannelTableMap::getFieldNames($keyType);
956
-
957
-        if (array_key_exists($keys[0], $arr)) {
958
-            $this->setId($arr[$keys[0]]);
959
-        }
960
-        if (array_key_exists($keys[1], $arr)) {
961
-            $this->setInstanceName($arr[$keys[1]]);
962
-        }
963
-        if (array_key_exists($keys[2], $arr)) {
964
-            $this->setName($arr[$keys[2]]);
965
-        }
966
-    }
967
-
968
-     /**
969
-     * Populate the current object from a string, using a given parser format
970
-     * <code>
971
-     * $book = new Book();
972
-     * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
973
-     * </code>
974
-     *
975
-     * You can specify the key type of the array by additionally passing one
976
-     * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
977
-     * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
978
-     * The default key type is the column's TableMap::TYPE_PHPNAME.
979
-     *
980
-     * @param mixed $parser A AbstractParser instance,
981
-     *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
982
-     * @param string $data The source data to import from
983
-     * @param string $keyType The type of keys the array uses.
984
-     *
985
-     * @return $this|\Jalle19\StatusManager\Database\Channel The current object, for fluid interface
986
-     */
987
-    public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME)
988
-    {
989
-        if (!$parser instanceof AbstractParser) {
990
-            $parser = AbstractParser::getParser($parser);
991
-        }
992
-
993
-        $this->fromArray($parser->toArray($data), $keyType);
994
-
995
-        return $this;
996
-    }
997
-
998
-    /**
999
-     * Build a Criteria object containing the values of all modified columns in this object.
1000
-     *
1001
-     * @return Criteria The Criteria object containing all modified values.
1002
-     */
1003
-    public function buildCriteria()
1004
-    {
1005
-        $criteria = new Criteria(ChannelTableMap::DATABASE_NAME);
1006
-
1007
-        if ($this->isColumnModified(ChannelTableMap::COL_ID)) {
1008
-            $criteria->add(ChannelTableMap::COL_ID, $this->id);
1009
-        }
1010
-        if ($this->isColumnModified(ChannelTableMap::COL_INSTANCE_NAME)) {
1011
-            $criteria->add(ChannelTableMap::COL_INSTANCE_NAME, $this->instance_name);
1012
-        }
1013
-        if ($this->isColumnModified(ChannelTableMap::COL_NAME)) {
1014
-            $criteria->add(ChannelTableMap::COL_NAME, $this->name);
1015
-        }
1016
-
1017
-        return $criteria;
1018
-    }
1019
-
1020
-    /**
1021
-     * Builds a Criteria object containing the primary key for this object.
1022
-     *
1023
-     * Unlike buildCriteria() this method includes the primary key values regardless
1024
-     * of whether or not they have been modified.
1025
-     *
1026
-     * @throws LogicException if no primary key is defined
1027
-     *
1028
-     * @return Criteria The Criteria object containing value(s) for primary key(s).
1029
-     */
1030
-    public function buildPkeyCriteria()
1031
-    {
1032
-        $criteria = ChildChannelQuery::create();
1033
-        $criteria->add(ChannelTableMap::COL_ID, $this->id);
1034
-
1035
-        return $criteria;
1036
-    }
1037
-
1038
-    /**
1039
-     * If the primary key is not null, return the hashcode of the
1040
-     * primary key. Otherwise, return the hash code of the object.
1041
-     *
1042
-     * @return int Hashcode
1043
-     */
1044
-    public function hashCode()
1045
-    {
1046
-        $validPk = null !== $this->getId();
1047
-
1048
-        $validPrimaryKeyFKs = 0;
1049
-        $primaryKeyFKs = [];
1050
-
1051
-        if ($validPk) {
1052
-            return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
1053
-        } elseif ($validPrimaryKeyFKs) {
1054
-            return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
1055
-        }
1056
-
1057
-        return spl_object_hash($this);
1058
-    }
1059
-
1060
-    /**
1061
-     * Returns the primary key for this object (row).
1062
-     * @return int
1063
-     */
1064
-    public function getPrimaryKey()
1065
-    {
1066
-        return $this->getId();
1067
-    }
1068
-
1069
-    /**
1070
-     * Generic method to set the primary key (id column).
1071
-     *
1072
-     * @param       int $key Primary key.
1073
-     * @return void
1074
-     */
1075
-    public function setPrimaryKey($key)
1076
-    {
1077
-        $this->setId($key);
1078
-    }
1079
-
1080
-    /**
1081
-     * Returns true if the primary key for this object is null.
1082
-     * @return boolean
1083
-     */
1084
-    public function isPrimaryKeyNull()
1085
-    {
1086
-        return null === $this->getId();
1087
-    }
1088
-
1089
-    /**
1090
-     * Sets contents of passed object to values from current object.
1091
-     *
1092
-     * If desired, this method can also make copies of all associated (fkey referrers)
1093
-     * objects.
1094
-     *
1095
-     * @param      object $copyObj An object of \Jalle19\StatusManager\Database\Channel (or compatible) type.
1096
-     * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1097
-     * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1098
-     * @throws PropelException
1099
-     */
1100
-    public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1101
-    {
1102
-        $copyObj->setInstanceName($this->getInstanceName());
1103
-        $copyObj->setName($this->getName());
1104
-
1105
-        if ($deepCopy) {
1106
-            // important: temporarily setNew(false) because this affects the behavior of
1107
-            // the getter/setter methods for fkey referrer objects.
1108
-            $copyObj->setNew(false);
1109
-
1110
-            foreach ($this->getSubscriptions() as $relObj) {
1111
-                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1112
-                    $copyObj->addSubscription($relObj->copy($deepCopy));
1113
-                }
1114
-            }
1115
-
1116
-        } // if ($deepCopy)
1117
-
1118
-        if ($makeNew) {
1119
-            $copyObj->setNew(true);
1120
-            $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
1121
-        }
1122
-    }
1123
-
1124
-    /**
1125
-     * Makes a copy of this object that will be inserted as a new row in table when saved.
1126
-     * It creates a new object filling in the simple attributes, but skipping any primary
1127
-     * keys that are defined for the table.
1128
-     *
1129
-     * If desired, this method can also make copies of all associated (fkey referrers)
1130
-     * objects.
1131
-     *
1132
-     * @param  boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1133
-     * @return \Jalle19\StatusManager\Database\Channel Clone of current object.
1134
-     * @throws PropelException
1135
-     */
1136
-    public function copy($deepCopy = false)
1137
-    {
1138
-        // we use get_class(), because this might be a subclass
1139
-        $clazz = get_class($this);
1140
-        $copyObj = new $clazz();
1141
-        $this->copyInto($copyObj, $deepCopy);
1142
-
1143
-        return $copyObj;
1144
-    }
1145
-
1146
-    /**
1147
-     * Declares an association between this object and a ChildInstance object.
1148
-     *
1149
-     * @param  ChildInstance $v
1150
-     * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
1151
-     * @throws PropelException
1152
-     */
1153
-    public function setInstance(ChildInstance $v = null)
1154
-    {
1155
-        if ($v === null) {
1156
-            $this->setInstanceName(NULL);
1157
-        } else {
1158
-            $this->setInstanceName($v->getName());
1159
-        }
1160
-
1161
-        $this->aInstance = $v;
1162
-
1163
-        // Add binding for other direction of this n:n relationship.
1164
-        // If this object has already been added to the ChildInstance object, it will not be re-added.
1165
-        if ($v !== null) {
1166
-            $v->addChannel($this);
1167
-        }
1168
-
1169
-
1170
-        return $this;
1171
-    }
1172
-
1173
-
1174
-    /**
1175
-     * Get the associated ChildInstance object
1176
-     *
1177
-     * @param  ConnectionInterface $con Optional Connection object.
1178
-     * @return ChildInstance The associated ChildInstance object.
1179
-     * @throws PropelException
1180
-     */
1181
-    public function getInstance(ConnectionInterface $con = null)
1182
-    {
1183
-        if ($this->aInstance === null && (($this->instance_name !== "" && $this->instance_name !== null))) {
1184
-            $this->aInstance = ChildInstanceQuery::create()->findPk($this->instance_name, $con);
1185
-            /* The following can be used additionally to
461
+	 *                            TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
462
+	 *
463
+	 * @return int             next starting column
464
+	 * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
465
+	 */
466
+	public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
467
+	{
468
+		try {
469
+
470
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ChannelTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
471
+			$this->id = (null !== $col) ? (int) $col : null;
472
+
473
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ChannelTableMap::translateFieldName('InstanceName', TableMap::TYPE_PHPNAME, $indexType)];
474
+			$this->instance_name = (null !== $col) ? (string) $col : null;
475
+
476
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ChannelTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
477
+			$this->name = (null !== $col) ? (string) $col : null;
478
+			$this->resetModified();
479
+
480
+			$this->setNew(false);
481
+
482
+			if ($rehydrate) {
483
+				$this->ensureConsistency();
484
+			}
485
+
486
+			return $startcol + 3; // 3 = ChannelTableMap::NUM_HYDRATE_COLUMNS.
487
+
488
+		} catch (Exception $e) {
489
+			throw new PropelException(sprintf('Error populating %s object', '\\Jalle19\\StatusManager\\Database\\Channel'), 0, $e);
490
+		}
491
+	}
492
+
493
+	/**
494
+	 * Checks and repairs the internal consistency of the object.
495
+	 *
496
+	 * This method is executed after an already-instantiated object is re-hydrated
497
+	 * from the database.  It exists to check any foreign keys to make sure that
498
+	 * the objects related to the current object are correct based on foreign key.
499
+	 *
500
+	 * You can override this method in the stub class, but you should always invoke
501
+	 * the base method from the overridden method (i.e. parent::ensureConsistency()),
502
+	 * in case your model changes.
503
+	 *
504
+	 * @throws PropelException
505
+	 */
506
+	public function ensureConsistency()
507
+	{
508
+		if ($this->aInstance !== null && $this->instance_name !== $this->aInstance->getName()) {
509
+			$this->aInstance = null;
510
+		}
511
+	} // ensureConsistency
512
+
513
+	/**
514
+	 * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
515
+	 *
516
+	 * This will only work if the object has been saved and has a valid primary key set.
517
+	 *
518
+	 * @param      boolean $deep (optional) Whether to also de-associated any related objects.
519
+	 * @param      ConnectionInterface $con (optional) The ConnectionInterface connection to use.
520
+	 * @return void
521
+	 * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
522
+	 */
523
+	public function reload($deep = false, ConnectionInterface $con = null)
524
+	{
525
+		if ($this->isDeleted()) {
526
+			throw new PropelException("Cannot reload a deleted object.");
527
+		}
528
+
529
+		if ($this->isNew()) {
530
+			throw new PropelException("Cannot reload an unsaved object.");
531
+		}
532
+
533
+		if ($con === null) {
534
+			$con = Propel::getServiceContainer()->getReadConnection(ChannelTableMap::DATABASE_NAME);
535
+		}
536
+
537
+		// We don't need to alter the object instance pool; we're just modifying this instance
538
+		// already in the pool.
539
+
540
+		$dataFetcher = ChildChannelQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
541
+		$row = $dataFetcher->fetch();
542
+		$dataFetcher->close();
543
+		if (!$row) {
544
+			throw new PropelException('Cannot find matching row in the database to reload object values.');
545
+		}
546
+		$this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
547
+
548
+		if ($deep) {  // also de-associate any related objects?
549
+
550
+			$this->aInstance = null;
551
+			$this->collSubscriptions = null;
552
+
553
+		} // if (deep)
554
+	}
555
+
556
+	/**
557
+	 * Removes this object from datastore and sets delete attribute.
558
+	 *
559
+	 * @param      ConnectionInterface $con
560
+	 * @return void
561
+	 * @throws PropelException
562
+	 * @see Channel::setDeleted()
563
+	 * @see Channel::isDeleted()
564
+	 */
565
+	public function delete(ConnectionInterface $con = null)
566
+	{
567
+		if ($this->isDeleted()) {
568
+			throw new PropelException("This object has already been deleted.");
569
+		}
570
+
571
+		if ($con === null) {
572
+			$con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
573
+		}
574
+
575
+		$con->transaction(function () use ($con) {
576
+			$deleteQuery = ChildChannelQuery::create()
577
+				->filterByPrimaryKey($this->getPrimaryKey());
578
+			$ret = $this->preDelete($con);
579
+			if ($ret) {
580
+				$deleteQuery->delete($con);
581
+				$this->postDelete($con);
582
+				$this->setDeleted(true);
583
+			}
584
+		});
585
+	}
586
+
587
+	/**
588
+	 * Persists this object to the database.
589
+	 *
590
+	 * If the object is new, it inserts it; otherwise an update is performed.
591
+	 * All modified related objects will also be persisted in the doSave()
592
+	 * method.  This method wraps all precipitate database operations in a
593
+	 * single transaction.
594
+	 *
595
+	 * @param      ConnectionInterface $con
596
+	 * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
597
+	 * @throws PropelException
598
+	 * @see doSave()
599
+	 */
600
+	public function save(ConnectionInterface $con = null)
601
+	{
602
+		if ($this->isDeleted()) {
603
+			throw new PropelException("You cannot save an object that has been deleted.");
604
+		}
605
+
606
+		if ($con === null) {
607
+			$con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
608
+		}
609
+
610
+		return $con->transaction(function () use ($con) {
611
+			$isInsert = $this->isNew();
612
+			$ret = $this->preSave($con);
613
+			if ($isInsert) {
614
+				$ret = $ret && $this->preInsert($con);
615
+			} else {
616
+				$ret = $ret && $this->preUpdate($con);
617
+			}
618
+			if ($ret) {
619
+				$affectedRows = $this->doSave($con);
620
+				if ($isInsert) {
621
+					$this->postInsert($con);
622
+				} else {
623
+					$this->postUpdate($con);
624
+				}
625
+				$this->postSave($con);
626
+				ChannelTableMap::addInstanceToPool($this);
627
+			} else {
628
+				$affectedRows = 0;
629
+			}
630
+
631
+			return $affectedRows;
632
+		});
633
+	}
634
+
635
+	/**
636
+	 * Performs the work of inserting or updating the row in the database.
637
+	 *
638
+	 * If the object is new, it inserts it; otherwise an update is performed.
639
+	 * All related objects are also updated in this method.
640
+	 *
641
+	 * @param      ConnectionInterface $con
642
+	 * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
643
+	 * @throws PropelException
644
+	 * @see save()
645
+	 */
646
+	protected function doSave(ConnectionInterface $con)
647
+	{
648
+		$affectedRows = 0; // initialize var to track total num of affected rows
649
+		if (!$this->alreadyInSave) {
650
+			$this->alreadyInSave = true;
651
+
652
+			// We call the save method on the following object(s) if they
653
+			// were passed to this object by their corresponding set
654
+			// method.  This object relates to these object(s) by a
655
+			// foreign key reference.
656
+
657
+			if ($this->aInstance !== null) {
658
+				if ($this->aInstance->isModified() || $this->aInstance->isNew()) {
659
+					$affectedRows += $this->aInstance->save($con);
660
+				}
661
+				$this->setInstance($this->aInstance);
662
+			}
663
+
664
+			if ($this->isNew() || $this->isModified()) {
665
+				// persist changes
666
+				if ($this->isNew()) {
667
+					$this->doInsert($con);
668
+					$affectedRows += 1;
669
+				} else {
670
+					$affectedRows += $this->doUpdate($con);
671
+				}
672
+				$this->resetModified();
673
+			}
674
+
675
+			if ($this->subscriptionsScheduledForDeletion !== null) {
676
+				if (!$this->subscriptionsScheduledForDeletion->isEmpty()) {
677
+					\Jalle19\StatusManager\Database\SubscriptionQuery::create()
678
+						->filterByPrimaryKeys($this->subscriptionsScheduledForDeletion->getPrimaryKeys(false))
679
+						->delete($con);
680
+					$this->subscriptionsScheduledForDeletion = null;
681
+				}
682
+			}
683
+
684
+			if ($this->collSubscriptions !== null) {
685
+				foreach ($this->collSubscriptions as $referrerFK) {
686
+					if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
687
+						$affectedRows += $referrerFK->save($con);
688
+					}
689
+				}
690
+			}
691
+
692
+			$this->alreadyInSave = false;
693
+
694
+		}
695
+
696
+		return $affectedRows;
697
+	} // doSave()
698
+
699
+	/**
700
+	 * Insert the row in the database.
701
+	 *
702
+	 * @param      ConnectionInterface $con
703
+	 *
704
+	 * @throws PropelException
705
+	 * @see doSave()
706
+	 */
707
+	protected function doInsert(ConnectionInterface $con)
708
+	{
709
+		$modifiedColumns = array();
710
+		$index = 0;
711
+
712
+		$this->modifiedColumns[ChannelTableMap::COL_ID] = true;
713
+		if (null !== $this->id) {
714
+			throw new PropelException('Cannot insert a value for auto-increment primary key (' . ChannelTableMap::COL_ID . ')');
715
+		}
716
+
717
+		 // check the columns in natural order for more readable SQL queries
718
+		if ($this->isColumnModified(ChannelTableMap::COL_ID)) {
719
+			$modifiedColumns[':p' . $index++]  = 'id';
720
+		}
721
+		if ($this->isColumnModified(ChannelTableMap::COL_INSTANCE_NAME)) {
722
+			$modifiedColumns[':p' . $index++]  = 'instance_name';
723
+		}
724
+		if ($this->isColumnModified(ChannelTableMap::COL_NAME)) {
725
+			$modifiedColumns[':p' . $index++]  = 'name';
726
+		}
727
+
728
+		$sql = sprintf(
729
+			'INSERT INTO channel (%s) VALUES (%s)',
730
+			implode(', ', $modifiedColumns),
731
+			implode(', ', array_keys($modifiedColumns))
732
+		);
733
+
734
+		try {
735
+			$stmt = $con->prepare($sql);
736
+			foreach ($modifiedColumns as $identifier => $columnName) {
737
+				switch ($columnName) {
738
+					case 'id':
739
+						$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
740
+						break;
741
+					case 'instance_name':
742
+						$stmt->bindValue($identifier, $this->instance_name, PDO::PARAM_STR);
743
+						break;
744
+					case 'name':
745
+						$stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
746
+						break;
747
+				}
748
+			}
749
+			$stmt->execute();
750
+		} catch (Exception $e) {
751
+			Propel::log($e->getMessage(), Propel::LOG_ERR);
752
+			throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
753
+		}
754
+
755
+		try {
756
+			$pk = $con->lastInsertId();
757
+		} catch (Exception $e) {
758
+			throw new PropelException('Unable to get autoincrement id.', 0, $e);
759
+		}
760
+		$this->setId($pk);
761
+
762
+		$this->setNew(false);
763
+	}
764
+
765
+	/**
766
+	 * Update the row in the database.
767
+	 *
768
+	 * @param      ConnectionInterface $con
769
+	 *
770
+	 * @return Integer Number of updated rows
771
+	 * @see doSave()
772
+	 */
773
+	protected function doUpdate(ConnectionInterface $con)
774
+	{
775
+		$selectCriteria = $this->buildPkeyCriteria();
776
+		$valuesCriteria = $this->buildCriteria();
777
+
778
+		return $selectCriteria->doUpdate($valuesCriteria, $con);
779
+	}
780
+
781
+	/**
782
+	 * Retrieves a field from the object by name passed in as a string.
783
+	 *
784
+	 * @param      string $name name
785
+	 * @param      string $type The type of fieldname the $name is of:
786
+	 *                     one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
787
+	 *                     TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
788
+	 *                     Defaults to TableMap::TYPE_PHPNAME.
789
+	 * @return mixed Value of field.
790
+	 */
791
+	public function getByName($name, $type = TableMap::TYPE_PHPNAME)
792
+	{
793
+		$pos = ChannelTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
794
+		$field = $this->getByPosition($pos);
795
+
796
+		return $field;
797
+	}
798
+
799
+	/**
800
+	 * Retrieves a field from the object by Position as specified in the xml schema.
801
+	 * Zero-based.
802
+	 *
803
+	 * @param      int $pos position in xml schema
804
+	 * @return mixed Value of field at $pos
805
+	 */
806
+	public function getByPosition($pos)
807
+	{
808
+		switch ($pos) {
809
+			case 0:
810
+				return $this->getId();
811
+				break;
812
+			case 1:
813
+				return $this->getInstanceName();
814
+				break;
815
+			case 2:
816
+				return $this->getName();
817
+				break;
818
+			default:
819
+				return null;
820
+				break;
821
+		} // switch()
822
+	}
823
+
824
+	/**
825
+	 * Exports the object as an array.
826
+	 *
827
+	 * You can specify the key type of the array by passing one of the class
828
+	 * type constants.
829
+	 *
830
+	 * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
831
+	 *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
832
+	 *                    Defaults to TableMap::TYPE_PHPNAME.
833
+	 * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
834
+	 * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
835
+	 * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
836
+	 *
837
+	 * @return array an associative array containing the field names (as keys) and field values
838
+	 */
839
+	public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
840
+	{
841
+
842
+		if (isset($alreadyDumpedObjects['Channel'][$this->hashCode()])) {
843
+			return '*RECURSION*';
844
+		}
845
+		$alreadyDumpedObjects['Channel'][$this->hashCode()] = true;
846
+		$keys = ChannelTableMap::getFieldNames($keyType);
847
+		$result = array(
848
+			$keys[0] => $this->getId(),
849
+			$keys[1] => $this->getInstanceName(),
850
+			$keys[2] => $this->getName(),
851
+		);
852
+		$virtualColumns = $this->virtualColumns;
853
+		foreach ($virtualColumns as $key => $virtualColumn) {
854
+			$result[$key] = $virtualColumn;
855
+		}
856
+
857
+		if ($includeForeignObjects) {
858
+			if (null !== $this->aInstance) {
859
+
860
+				switch ($keyType) {
861
+					case TableMap::TYPE_CAMELNAME:
862
+						$key = 'instance';
863
+						break;
864
+					case TableMap::TYPE_FIELDNAME:
865
+						$key = 'instance';
866
+						break;
867
+					default:
868
+						$key = 'Instance';
869
+				}
870
+
871
+				$result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
872
+			}
873
+			if (null !== $this->collSubscriptions) {
874
+
875
+				switch ($keyType) {
876
+					case TableMap::TYPE_CAMELNAME:
877
+						$key = 'subscriptions';
878
+						break;
879
+					case TableMap::TYPE_FIELDNAME:
880
+						$key = 'subscriptions';
881
+						break;
882
+					default:
883
+						$key = 'Subscriptions';
884
+				}
885
+
886
+				$result[$key] = $this->collSubscriptions->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
887
+			}
888
+		}
889
+
890
+		return $result;
891
+	}
892
+
893
+	/**
894
+	 * Sets a field from the object by name passed in as a string.
895
+	 *
896
+	 * @param  string $name
897
+	 * @param  mixed  $value field value
898
+	 * @param  string $type The type of fieldname the $name is of:
899
+	 *                one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
900
+	 *                TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
901
+	 *                Defaults to TableMap::TYPE_PHPNAME.
902
+	 * @return $this|\Jalle19\StatusManager\Database\Channel
903
+	 */
904
+	public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
905
+	{
906
+		$pos = ChannelTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
907
+
908
+		return $this->setByPosition($pos, $value);
909
+	}
910
+
911
+	/**
912
+	 * Sets a field from the object by Position as specified in the xml schema.
913
+	 * Zero-based.
914
+	 *
915
+	 * @param  int $pos position in xml schema
916
+	 * @param  mixed $value field value
917
+	 * @return $this|\Jalle19\StatusManager\Database\Channel
918
+	 */
919
+	public function setByPosition($pos, $value)
920
+	{
921
+		switch ($pos) {
922
+			case 0:
923
+				$this->setId($value);
924
+				break;
925
+			case 1:
926
+				$this->setInstanceName($value);
927
+				break;
928
+			case 2:
929
+				$this->setName($value);
930
+				break;
931
+		} // switch()
932
+
933
+		return $this;
934
+	}
935
+
936
+	/**
937
+	 * Populates the object using an array.
938
+	 *
939
+	 * This is particularly useful when populating an object from one of the
940
+	 * request arrays (e.g. $_POST).  This method goes through the column
941
+	 * names, checking to see whether a matching key exists in populated
942
+	 * array. If so the setByName() method is called for that column.
943
+	 *
944
+	 * You can specify the key type of the array by additionally passing one
945
+	 * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
946
+	 * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
947
+	 * The default key type is the column's TableMap::TYPE_PHPNAME.
948
+	 *
949
+	 * @param      array  $arr     An array to populate the object from.
950
+	 * @param      string $keyType The type of keys the array uses.
951
+	 * @return void
952
+	 */
953
+	public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
954
+	{
955
+		$keys = ChannelTableMap::getFieldNames($keyType);
956
+
957
+		if (array_key_exists($keys[0], $arr)) {
958
+			$this->setId($arr[$keys[0]]);
959
+		}
960
+		if (array_key_exists($keys[1], $arr)) {
961
+			$this->setInstanceName($arr[$keys[1]]);
962
+		}
963
+		if (array_key_exists($keys[2], $arr)) {
964
+			$this->setName($arr[$keys[2]]);
965
+		}
966
+	}
967
+
968
+	 /**
969
+	  * Populate the current object from a string, using a given parser format
970
+	  * <code>
971
+	  * $book = new Book();
972
+	  * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
973
+	  * </code>
974
+	  *
975
+	  * You can specify the key type of the array by additionally passing one
976
+	  * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
977
+	  * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
978
+	  * The default key type is the column's TableMap::TYPE_PHPNAME.
979
+	  *
980
+	  * @param mixed $parser A AbstractParser instance,
981
+	  *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
982
+	  * @param string $data The source data to import from
983
+	  * @param string $keyType The type of keys the array uses.
984
+	  *
985
+	  * @return $this|\Jalle19\StatusManager\Database\Channel The current object, for fluid interface
986
+	  */
987
+	public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME)
988
+	{
989
+		if (!$parser instanceof AbstractParser) {
990
+			$parser = AbstractParser::getParser($parser);
991
+		}
992
+
993
+		$this->fromArray($parser->toArray($data), $keyType);
994
+
995
+		return $this;
996
+	}
997
+
998
+	/**
999
+	 * Build a Criteria object containing the values of all modified columns in this object.
1000
+	 *
1001
+	 * @return Criteria The Criteria object containing all modified values.
1002
+	 */
1003
+	public function buildCriteria()
1004
+	{
1005
+		$criteria = new Criteria(ChannelTableMap::DATABASE_NAME);
1006
+
1007
+		if ($this->isColumnModified(ChannelTableMap::COL_ID)) {
1008
+			$criteria->add(ChannelTableMap::COL_ID, $this->id);
1009
+		}
1010
+		if ($this->isColumnModified(ChannelTableMap::COL_INSTANCE_NAME)) {
1011
+			$criteria->add(ChannelTableMap::COL_INSTANCE_NAME, $this->instance_name);
1012
+		}
1013
+		if ($this->isColumnModified(ChannelTableMap::COL_NAME)) {
1014
+			$criteria->add(ChannelTableMap::COL_NAME, $this->name);
1015
+		}
1016
+
1017
+		return $criteria;
1018
+	}
1019
+
1020
+	/**
1021
+	 * Builds a Criteria object containing the primary key for this object.
1022
+	 *
1023
+	 * Unlike buildCriteria() this method includes the primary key values regardless
1024
+	 * of whether or not they have been modified.
1025
+	 *
1026
+	 * @throws LogicException if no primary key is defined
1027
+	 *
1028
+	 * @return Criteria The Criteria object containing value(s) for primary key(s).
1029
+	 */
1030
+	public function buildPkeyCriteria()
1031
+	{
1032
+		$criteria = ChildChannelQuery::create();
1033
+		$criteria->add(ChannelTableMap::COL_ID, $this->id);
1034
+
1035
+		return $criteria;
1036
+	}
1037
+
1038
+	/**
1039
+	 * If the primary key is not null, return the hashcode of the
1040
+	 * primary key. Otherwise, return the hash code of the object.
1041
+	 *
1042
+	 * @return int Hashcode
1043
+	 */
1044
+	public function hashCode()
1045
+	{
1046
+		$validPk = null !== $this->getId();
1047
+
1048
+		$validPrimaryKeyFKs = 0;
1049
+		$primaryKeyFKs = [];
1050
+
1051
+		if ($validPk) {
1052
+			return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
1053
+		} elseif ($validPrimaryKeyFKs) {
1054
+			return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
1055
+		}
1056
+
1057
+		return spl_object_hash($this);
1058
+	}
1059
+
1060
+	/**
1061
+	 * Returns the primary key for this object (row).
1062
+	 * @return int
1063
+	 */
1064
+	public function getPrimaryKey()
1065
+	{
1066
+		return $this->getId();
1067
+	}
1068
+
1069
+	/**
1070
+	 * Generic method to set the primary key (id column).
1071
+	 *
1072
+	 * @param       int $key Primary key.
1073
+	 * @return void
1074
+	 */
1075
+	public function setPrimaryKey($key)
1076
+	{
1077
+		$this->setId($key);
1078
+	}
1079
+
1080
+	/**
1081
+	 * Returns true if the primary key for this object is null.
1082
+	 * @return boolean
1083
+	 */
1084
+	public function isPrimaryKeyNull()
1085
+	{
1086
+		return null === $this->getId();
1087
+	}
1088
+
1089
+	/**
1090
+	 * Sets contents of passed object to values from current object.
1091
+	 *
1092
+	 * If desired, this method can also make copies of all associated (fkey referrers)
1093
+	 * objects.
1094
+	 *
1095
+	 * @param      object $copyObj An object of \Jalle19\StatusManager\Database\Channel (or compatible) type.
1096
+	 * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1097
+	 * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1098
+	 * @throws PropelException
1099
+	 */
1100
+	public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1101
+	{
1102
+		$copyObj->setInstanceName($this->getInstanceName());
1103
+		$copyObj->setName($this->getName());
1104
+
1105
+		if ($deepCopy) {
1106
+			// important: temporarily setNew(false) because this affects the behavior of
1107
+			// the getter/setter methods for fkey referrer objects.
1108
+			$copyObj->setNew(false);
1109
+
1110
+			foreach ($this->getSubscriptions() as $relObj) {
1111
+				if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1112
+					$copyObj->addSubscription($relObj->copy($deepCopy));
1113
+				}
1114
+			}
1115
+
1116
+		} // if ($deepCopy)
1117
+
1118
+		if ($makeNew) {
1119
+			$copyObj->setNew(true);
1120
+			$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
1121
+		}
1122
+	}
1123
+
1124
+	/**
1125
+	 * Makes a copy of this object that will be inserted as a new row in table when saved.
1126
+	 * It creates a new object filling in the simple attributes, but skipping any primary
1127
+	 * keys that are defined for the table.
1128
+	 *
1129
+	 * If desired, this method can also make copies of all associated (fkey referrers)
1130
+	 * objects.
1131
+	 *
1132
+	 * @param  boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1133
+	 * @return \Jalle19\StatusManager\Database\Channel Clone of current object.
1134
+	 * @throws PropelException
1135
+	 */
1136
+	public function copy($deepCopy = false)
1137
+	{
1138
+		// we use get_class(), because this might be a subclass
1139
+		$clazz = get_class($this);
1140
+		$copyObj = new $clazz();
1141
+		$this->copyInto($copyObj, $deepCopy);
1142
+
1143
+		return $copyObj;
1144
+	}
1145
+
1146
+	/**
1147
+	 * Declares an association between this object and a ChildInstance object.
1148
+	 *
1149
+	 * @param  ChildInstance $v
1150
+	 * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
1151
+	 * @throws PropelException
1152
+	 */
1153
+	public function setInstance(ChildInstance $v = null)
1154
+	{
1155
+		if ($v === null) {
1156
+			$this->setInstanceName(NULL);
1157
+		} else {
1158
+			$this->setInstanceName($v->getName());
1159
+		}
1160
+
1161
+		$this->aInstance = $v;
1162
+
1163
+		// Add binding for other direction of this n:n relationship.
1164
+		// If this object has already been added to the ChildInstance object, it will not be re-added.
1165
+		if ($v !== null) {
1166
+			$v->addChannel($this);
1167
+		}
1168
+
1169
+
1170
+		return $this;
1171
+	}
1172
+
1173
+
1174
+	/**
1175
+	 * Get the associated ChildInstance object
1176
+	 *
1177
+	 * @param  ConnectionInterface $con Optional Connection object.
1178
+	 * @return ChildInstance The associated ChildInstance object.
1179
+	 * @throws PropelException
1180
+	 */
1181
+	public function getInstance(ConnectionInterface $con = null)
1182
+	{
1183
+		if ($this->aInstance === null && (($this->instance_name !== "" && $this->instance_name !== null))) {
1184
+			$this->aInstance = ChildInstanceQuery::create()->findPk($this->instance_name, $con);
1185
+			/* The following can be used additionally to
1186 1186
                 guarantee the related object contains a reference
1187 1187
                 to this object.  This level of coupling may, however, be
1188 1188
                 undesirable since it could result in an only partially populated collection
1189 1189
                 in the referenced object.
1190 1190
                 $this->aInstance->addChannels($this);
1191 1191
              */
1192
-        }
1193
-
1194
-        return $this->aInstance;
1195
-    }
1196
-
1197
-
1198
-    /**
1199
-     * Initializes a collection based on the name of a relation.
1200
-     * Avoids crafting an 'init[$relationName]s' method name
1201
-     * that wouldn't work when StandardEnglishPluralizer is used.
1202
-     *
1203
-     * @param      string $relationName The name of the relation to initialize
1204
-     * @return void
1205
-     */
1206
-    public function initRelation($relationName)
1207
-    {
1208
-        if ('Subscription' == $relationName) {
1209
-            return $this->initSubscriptions();
1210
-        }
1211
-    }
1212
-
1213
-    /**
1214
-     * Clears out the collSubscriptions collection
1215
-     *
1216
-     * This does not modify the database; however, it will remove any associated objects, causing
1217
-     * them to be refetched by subsequent calls to accessor method.
1218
-     *
1219
-     * @return void
1220
-     * @see        addSubscriptions()
1221
-     */
1222
-    public function clearSubscriptions()
1223
-    {
1224
-        $this->collSubscriptions = null; // important to set this to NULL since that means it is uninitialized
1225
-    }
1226
-
1227
-    /**
1228
-     * Reset is the collSubscriptions collection loaded partially.
1229
-     */
1230
-    public function resetPartialSubscriptions($v = true)
1231
-    {
1232
-        $this->collSubscriptionsPartial = $v;
1233
-    }
1234
-
1235
-    /**
1236
-     * Initializes the collSubscriptions collection.
1237
-     *
1238
-     * By default this just sets the collSubscriptions collection to an empty array (like clearcollSubscriptions());
1239
-     * however, you may wish to override this method in your stub class to provide setting appropriate
1240
-     * to your application -- for example, setting the initial array to the values stored in database.
1241
-     *
1242
-     * @param      boolean $overrideExisting If set to true, the method call initializes
1243
-     *                                        the collection even if it is not empty
1244
-     *
1245
-     * @return void
1246
-     */
1247
-    public function initSubscriptions($overrideExisting = true)
1248
-    {
1249
-        if (null !== $this->collSubscriptions && !$overrideExisting) {
1250
-            return;
1251
-        }
1252
-
1253
-        $collectionClassName = SubscriptionTableMap::getTableMap()->getCollectionClassName();
1254
-
1255
-        $this->collSubscriptions = new $collectionClassName;
1256
-        $this->collSubscriptions->setModel('\Jalle19\StatusManager\Database\Subscription');
1257
-    }
1258
-
1259
-    /**
1260
-     * Gets an array of ChildSubscription objects which contain a foreign key that references this object.
1261
-     *
1262
-     * If the $criteria is not null, it is used to always fetch the results from the database.
1263
-     * Otherwise the results are fetched from the database the first time, then cached.
1264
-     * Next time the same method is called without $criteria, the cached collection is returned.
1265
-     * If this ChildChannel is new, it will return
1266
-     * an empty collection or the current collection; the criteria is ignored on a new object.
1267
-     *
1268
-     * @param      Criteria $criteria optional Criteria object to narrow the query
1269
-     * @param      ConnectionInterface $con optional connection object
1270
-     * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1271
-     * @throws PropelException
1272
-     */
1273
-    public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null)
1274
-    {
1275
-        $partial = $this->collSubscriptionsPartial && !$this->isNew();
1276
-        if (null === $this->collSubscriptions || null !== $criteria  || $partial) {
1277
-            if ($this->isNew() && null === $this->collSubscriptions) {
1278
-                // return empty collection
1279
-                $this->initSubscriptions();
1280
-            } else {
1281
-                $collSubscriptions = ChildSubscriptionQuery::create(null, $criteria)
1282
-                    ->filterByChannel($this)
1283
-                    ->find($con);
1284
-
1285
-                if (null !== $criteria) {
1286
-                    if (false !== $this->collSubscriptionsPartial && count($collSubscriptions)) {
1287
-                        $this->initSubscriptions(false);
1288
-
1289
-                        foreach ($collSubscriptions as $obj) {
1290
-                            if (false == $this->collSubscriptions->contains($obj)) {
1291
-                                $this->collSubscriptions->append($obj);
1292
-                            }
1293
-                        }
1294
-
1295
-                        $this->collSubscriptionsPartial = true;
1296
-                    }
1297
-
1298
-                    return $collSubscriptions;
1299
-                }
1300
-
1301
-                if ($partial && $this->collSubscriptions) {
1302
-                    foreach ($this->collSubscriptions as $obj) {
1303
-                        if ($obj->isNew()) {
1304
-                            $collSubscriptions[] = $obj;
1305
-                        }
1306
-                    }
1307
-                }
1308
-
1309
-                $this->collSubscriptions = $collSubscriptions;
1310
-                $this->collSubscriptionsPartial = false;
1311
-            }
1312
-        }
1313
-
1314
-        return $this->collSubscriptions;
1315
-    }
1316
-
1317
-    /**
1318
-     * Sets a collection of ChildSubscription objects related by a one-to-many relationship
1319
-     * to the current object.
1320
-     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1321
-     * and new objects from the given Propel collection.
1322
-     *
1323
-     * @param      Collection $subscriptions A Propel collection.
1324
-     * @param      ConnectionInterface $con Optional connection object
1325
-     * @return $this|ChildChannel The current object (for fluent API support)
1326
-     */
1327
-    public function setSubscriptions(Collection $subscriptions, ConnectionInterface $con = null)
1328
-    {
1329
-        /** @var ChildSubscription[] $subscriptionsToDelete */
1330
-        $subscriptionsToDelete = $this->getSubscriptions(new Criteria(), $con)->diff($subscriptions);
1331
-
1332
-
1333
-        $this->subscriptionsScheduledForDeletion = $subscriptionsToDelete;
1334
-
1335
-        foreach ($subscriptionsToDelete as $subscriptionRemoved) {
1336
-            $subscriptionRemoved->setChannel(null);
1337
-        }
1338
-
1339
-        $this->collSubscriptions = null;
1340
-        foreach ($subscriptions as $subscription) {
1341
-            $this->addSubscription($subscription);
1342
-        }
1343
-
1344
-        $this->collSubscriptions = $subscriptions;
1345
-        $this->collSubscriptionsPartial = false;
1346
-
1347
-        return $this;
1348
-    }
1349
-
1350
-    /**
1351
-     * Returns the number of related Subscription objects.
1352
-     *
1353
-     * @param      Criteria $criteria
1354
-     * @param      boolean $distinct
1355
-     * @param      ConnectionInterface $con
1356
-     * @return int             Count of related Subscription objects.
1357
-     * @throws PropelException
1358
-     */
1359
-    public function countSubscriptions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
1360
-    {
1361
-        $partial = $this->collSubscriptionsPartial && !$this->isNew();
1362
-        if (null === $this->collSubscriptions || null !== $criteria || $partial) {
1363
-            if ($this->isNew() && null === $this->collSubscriptions) {
1364
-                return 0;
1365
-            }
1366
-
1367
-            if ($partial && !$criteria) {
1368
-                return count($this->getSubscriptions());
1369
-            }
1370
-
1371
-            $query = ChildSubscriptionQuery::create(null, $criteria);
1372
-            if ($distinct) {
1373
-                $query->distinct();
1374
-            }
1375
-
1376
-            return $query
1377
-                ->filterByChannel($this)
1378
-                ->count($con);
1379
-        }
1380
-
1381
-        return count($this->collSubscriptions);
1382
-    }
1383
-
1384
-    /**
1385
-     * Method called to associate a ChildSubscription object to this object
1386
-     * through the ChildSubscription foreign key attribute.
1387
-     *
1388
-     * @param  ChildSubscription $l ChildSubscription
1389
-     * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
1390
-     */
1391
-    public function addSubscription(ChildSubscription $l)
1392
-    {
1393
-        if ($this->collSubscriptions === null) {
1394
-            $this->initSubscriptions();
1395
-            $this->collSubscriptionsPartial = true;
1396
-        }
1397
-
1398
-        if (!$this->collSubscriptions->contains($l)) {
1399
-            $this->doAddSubscription($l);
1400
-
1401
-            if ($this->subscriptionsScheduledForDeletion and $this->subscriptionsScheduledForDeletion->contains($l)) {
1402
-                $this->subscriptionsScheduledForDeletion->remove($this->subscriptionsScheduledForDeletion->search($l));
1403
-            }
1404
-        }
1405
-
1406
-        return $this;
1407
-    }
1408
-
1409
-    /**
1410
-     * @param ChildSubscription $subscription The ChildSubscription object to add.
1411
-     */
1412
-    protected function doAddSubscription(ChildSubscription $subscription)
1413
-    {
1414
-        $this->collSubscriptions[]= $subscription;
1415
-        $subscription->setChannel($this);
1416
-    }
1417
-
1418
-    /**
1419
-     * @param  ChildSubscription $subscription The ChildSubscription object to remove.
1420
-     * @return $this|ChildChannel The current object (for fluent API support)
1421
-     */
1422
-    public function removeSubscription(ChildSubscription $subscription)
1423
-    {
1424
-        if ($this->getSubscriptions()->contains($subscription)) {
1425
-            $pos = $this->collSubscriptions->search($subscription);
1426
-            $this->collSubscriptions->remove($pos);
1427
-            if (null === $this->subscriptionsScheduledForDeletion) {
1428
-                $this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions;
1429
-                $this->subscriptionsScheduledForDeletion->clear();
1430
-            }
1431
-            $this->subscriptionsScheduledForDeletion[]= clone $subscription;
1432
-            $subscription->setChannel(null);
1433
-        }
1434
-
1435
-        return $this;
1436
-    }
1437
-
1438
-
1439
-    /**
1440
-     * If this collection has already been initialized with
1441
-     * an identical criteria, it returns the collection.
1442
-     * Otherwise if this Channel is new, it will return
1443
-     * an empty collection; or if this Channel has previously
1444
-     * been saved, it will retrieve related Subscriptions from storage.
1445
-     *
1446
-     * This method is protected by default in order to keep the public
1447
-     * api reasonable.  You can provide public methods for those you
1448
-     * actually need in Channel.
1449
-     *
1450
-     * @param      Criteria $criteria optional Criteria object to narrow the query
1451
-     * @param      ConnectionInterface $con optional connection object
1452
-     * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1453
-     * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1454
-     */
1455
-    public function getSubscriptionsJoinInstance(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1456
-    {
1457
-        $query = ChildSubscriptionQuery::create(null, $criteria);
1458
-        $query->joinWith('Instance', $joinBehavior);
1459
-
1460
-        return $this->getSubscriptions($query, $con);
1461
-    }
1462
-
1463
-
1464
-    /**
1465
-     * If this collection has already been initialized with
1466
-     * an identical criteria, it returns the collection.
1467
-     * Otherwise if this Channel is new, it will return
1468
-     * an empty collection; or if this Channel has previously
1469
-     * been saved, it will retrieve related Subscriptions from storage.
1470
-     *
1471
-     * This method is protected by default in order to keep the public
1472
-     * api reasonable.  You can provide public methods for those you
1473
-     * actually need in Channel.
1474
-     *
1475
-     * @param      Criteria $criteria optional Criteria object to narrow the query
1476
-     * @param      ConnectionInterface $con optional connection object
1477
-     * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1478
-     * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1479
-     */
1480
-    public function getSubscriptionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1481
-    {
1482
-        $query = ChildSubscriptionQuery::create(null, $criteria);
1483
-        $query->joinWith('User', $joinBehavior);
1484
-
1485
-        return $this->getSubscriptions($query, $con);
1486
-    }
1487
-
1488
-    /**
1489
-     * Clears the current object, sets all attributes to their default values and removes
1490
-     * outgoing references as well as back-references (from other objects to this one. Results probably in a database
1491
-     * change of those foreign objects when you call `save` there).
1492
-     */
1493
-    public function clear()
1494
-    {
1495
-        if (null !== $this->aInstance) {
1496
-            $this->aInstance->removeChannel($this);
1497
-        }
1498
-        $this->id = null;
1499
-        $this->instance_name = null;
1500
-        $this->name = null;
1501
-        $this->alreadyInSave = false;
1502
-        $this->clearAllReferences();
1503
-        $this->resetModified();
1504
-        $this->setNew(true);
1505
-        $this->setDeleted(false);
1506
-    }
1507
-
1508
-    /**
1509
-     * Resets all references and back-references to other model objects or collections of model objects.
1510
-     *
1511
-     * This method is used to reset all php object references (not the actual reference in the database).
1512
-     * Necessary for object serialisation.
1513
-     *
1514
-     * @param      boolean $deep Whether to also clear the references on all referrer objects.
1515
-     */
1516
-    public function clearAllReferences($deep = false)
1517
-    {
1518
-        if ($deep) {
1519
-            if ($this->collSubscriptions) {
1520
-                foreach ($this->collSubscriptions as $o) {
1521
-                    $o->clearAllReferences($deep);
1522
-                }
1523
-            }
1524
-        } // if ($deep)
1525
-
1526
-        $this->collSubscriptions = null;
1527
-        $this->aInstance = null;
1528
-    }
1529
-
1530
-    /**
1531
-     * Return the string representation of this object
1532
-     *
1533
-     * @return string
1534
-     */
1535
-    public function __toString()
1536
-    {
1537
-        return (string) $this->exportTo(ChannelTableMap::DEFAULT_STRING_FORMAT);
1538
-    }
1539
-
1540
-    /**
1541
-     * Code to be run before persisting the object
1542
-     * @param  ConnectionInterface $con
1543
-     * @return boolean
1544
-     */
1545
-    public function preSave(ConnectionInterface $con = null)
1546
-    {
1547
-        return true;
1548
-    }
1549
-
1550
-    /**
1551
-     * Code to be run after persisting the object
1552
-     * @param ConnectionInterface $con
1553
-     */
1554
-    public function postSave(ConnectionInterface $con = null)
1555
-    {
1556
-
1557
-    }
1558
-
1559
-    /**
1560
-     * Code to be run before inserting to database
1561
-     * @param  ConnectionInterface $con
1562
-     * @return boolean
1563
-     */
1564
-    public function preInsert(ConnectionInterface $con = null)
1565
-    {
1566
-        return true;
1567
-    }
1568
-
1569
-    /**
1570
-     * Code to be run after inserting to database
1571
-     * @param ConnectionInterface $con
1572
-     */
1573
-    public function postInsert(ConnectionInterface $con = null)
1574
-    {
1575
-
1576
-    }
1577
-
1578
-    /**
1579
-     * Code to be run before updating the object in database
1580
-     * @param  ConnectionInterface $con
1581
-     * @return boolean
1582
-     */
1583
-    public function preUpdate(ConnectionInterface $con = null)
1584
-    {
1585
-        return true;
1586
-    }
1587
-
1588
-    /**
1589
-     * Code to be run after updating the object in database
1590
-     * @param ConnectionInterface $con
1591
-     */
1592
-    public function postUpdate(ConnectionInterface $con = null)
1593
-    {
1594
-
1595
-    }
1596
-
1597
-    /**
1598
-     * Code to be run before deleting the object in database
1599
-     * @param  ConnectionInterface $con
1600
-     * @return boolean
1601
-     */
1602
-    public function preDelete(ConnectionInterface $con = null)
1603
-    {
1604
-        return true;
1605
-    }
1606
-
1607
-    /**
1608
-     * Code to be run after deleting the object in database
1609
-     * @param ConnectionInterface $con
1610
-     */
1611
-    public function postDelete(ConnectionInterface $con = null)
1612
-    {
1613
-
1614
-    }
1615
-
1616
-
1617
-    /**
1618
-     * Derived method to catches calls to undefined methods.
1619
-     *
1620
-     * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
1621
-     * Allows to define default __call() behavior if you overwrite __call()
1622
-     *
1623
-     * @param string $name
1624
-     * @param mixed  $params
1625
-     *
1626
-     * @return array|string
1627
-     */
1628
-    public function __call($name, $params)
1629
-    {
1630
-        if (0 === strpos($name, 'get')) {
1631
-            $virtualColumn = substr($name, 3);
1632
-            if ($this->hasVirtualColumn($virtualColumn)) {
1633
-                return $this->getVirtualColumn($virtualColumn);
1634
-            }
1635
-
1636
-            $virtualColumn = lcfirst($virtualColumn);
1637
-            if ($this->hasVirtualColumn($virtualColumn)) {
1638
-                return $this->getVirtualColumn($virtualColumn);
1639
-            }
1640
-        }
1641
-
1642
-        if (0 === strpos($name, 'from')) {
1643
-            $format = substr($name, 4);
1644
-
1645
-            return $this->importFrom($format, reset($params));
1646
-        }
1647
-
1648
-        if (0 === strpos($name, 'to')) {
1649
-            $format = substr($name, 2);
1650
-            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1651
-
1652
-            return $this->exportTo($format, $includeLazyLoadColumns);
1653
-        }
1654
-
1655
-        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1656
-    }
1192
+		}
1193
+
1194
+		return $this->aInstance;
1195
+	}
1196
+
1197
+
1198
+	/**
1199
+	 * Initializes a collection based on the name of a relation.
1200
+	 * Avoids crafting an 'init[$relationName]s' method name
1201
+	 * that wouldn't work when StandardEnglishPluralizer is used.
1202
+	 *
1203
+	 * @param      string $relationName The name of the relation to initialize
1204
+	 * @return void
1205
+	 */
1206
+	public function initRelation($relationName)
1207
+	{
1208
+		if ('Subscription' == $relationName) {
1209
+			return $this->initSubscriptions();
1210
+		}
1211
+	}
1212
+
1213
+	/**
1214
+	 * Clears out the collSubscriptions collection
1215
+	 *
1216
+	 * This does not modify the database; however, it will remove any associated objects, causing
1217
+	 * them to be refetched by subsequent calls to accessor method.
1218
+	 *
1219
+	 * @return void
1220
+	 * @see        addSubscriptions()
1221
+	 */
1222
+	public function clearSubscriptions()
1223
+	{
1224
+		$this->collSubscriptions = null; // important to set this to NULL since that means it is uninitialized
1225
+	}
1226
+
1227
+	/**
1228
+	 * Reset is the collSubscriptions collection loaded partially.
1229
+	 */
1230
+	public function resetPartialSubscriptions($v = true)
1231
+	{
1232
+		$this->collSubscriptionsPartial = $v;
1233
+	}
1234
+
1235
+	/**
1236
+	 * Initializes the collSubscriptions collection.
1237
+	 *
1238
+	 * By default this just sets the collSubscriptions collection to an empty array (like clearcollSubscriptions());
1239
+	 * however, you may wish to override this method in your stub class to provide setting appropriate
1240
+	 * to your application -- for example, setting the initial array to the values stored in database.
1241
+	 *
1242
+	 * @param      boolean $overrideExisting If set to true, the method call initializes
1243
+	 *                                        the collection even if it is not empty
1244
+	 *
1245
+	 * @return void
1246
+	 */
1247
+	public function initSubscriptions($overrideExisting = true)
1248
+	{
1249
+		if (null !== $this->collSubscriptions && !$overrideExisting) {
1250
+			return;
1251
+		}
1252
+
1253
+		$collectionClassName = SubscriptionTableMap::getTableMap()->getCollectionClassName();
1254
+
1255
+		$this->collSubscriptions = new $collectionClassName;
1256
+		$this->collSubscriptions->setModel('\Jalle19\StatusManager\Database\Subscription');
1257
+	}
1258
+
1259
+	/**
1260
+	 * Gets an array of ChildSubscription objects which contain a foreign key that references this object.
1261
+	 *
1262
+	 * If the $criteria is not null, it is used to always fetch the results from the database.
1263
+	 * Otherwise the results are fetched from the database the first time, then cached.
1264
+	 * Next time the same method is called without $criteria, the cached collection is returned.
1265
+	 * If this ChildChannel is new, it will return
1266
+	 * an empty collection or the current collection; the criteria is ignored on a new object.
1267
+	 *
1268
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
1269
+	 * @param      ConnectionInterface $con optional connection object
1270
+	 * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1271
+	 * @throws PropelException
1272
+	 */
1273
+	public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null)
1274
+	{
1275
+		$partial = $this->collSubscriptionsPartial && !$this->isNew();
1276
+		if (null === $this->collSubscriptions || null !== $criteria  || $partial) {
1277
+			if ($this->isNew() && null === $this->collSubscriptions) {
1278
+				// return empty collection
1279
+				$this->initSubscriptions();
1280
+			} else {
1281
+				$collSubscriptions = ChildSubscriptionQuery::create(null, $criteria)
1282
+					->filterByChannel($this)
1283
+					->find($con);
1284
+
1285
+				if (null !== $criteria) {
1286
+					if (false !== $this->collSubscriptionsPartial && count($collSubscriptions)) {
1287
+						$this->initSubscriptions(false);
1288
+
1289
+						foreach ($collSubscriptions as $obj) {
1290
+							if (false == $this->collSubscriptions->contains($obj)) {
1291
+								$this->collSubscriptions->append($obj);
1292
+							}
1293
+						}
1294
+
1295
+						$this->collSubscriptionsPartial = true;
1296
+					}
1297
+
1298
+					return $collSubscriptions;
1299
+				}
1300
+
1301
+				if ($partial && $this->collSubscriptions) {
1302
+					foreach ($this->collSubscriptions as $obj) {
1303
+						if ($obj->isNew()) {
1304
+							$collSubscriptions[] = $obj;
1305
+						}
1306
+					}
1307
+				}
1308
+
1309
+				$this->collSubscriptions = $collSubscriptions;
1310
+				$this->collSubscriptionsPartial = false;
1311
+			}
1312
+		}
1313
+
1314
+		return $this->collSubscriptions;
1315
+	}
1316
+
1317
+	/**
1318
+	 * Sets a collection of ChildSubscription objects related by a one-to-many relationship
1319
+	 * to the current object.
1320
+	 * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1321
+	 * and new objects from the given Propel collection.
1322
+	 *
1323
+	 * @param      Collection $subscriptions A Propel collection.
1324
+	 * @param      ConnectionInterface $con Optional connection object
1325
+	 * @return $this|ChildChannel The current object (for fluent API support)
1326
+	 */
1327
+	public function setSubscriptions(Collection $subscriptions, ConnectionInterface $con = null)
1328
+	{
1329
+		/** @var ChildSubscription[] $subscriptionsToDelete */
1330
+		$subscriptionsToDelete = $this->getSubscriptions(new Criteria(), $con)->diff($subscriptions);
1331
+
1332
+
1333
+		$this->subscriptionsScheduledForDeletion = $subscriptionsToDelete;
1334
+
1335
+		foreach ($subscriptionsToDelete as $subscriptionRemoved) {
1336
+			$subscriptionRemoved->setChannel(null);
1337
+		}
1338
+
1339
+		$this->collSubscriptions = null;
1340
+		foreach ($subscriptions as $subscription) {
1341
+			$this->addSubscription($subscription);
1342
+		}
1343
+
1344
+		$this->collSubscriptions = $subscriptions;
1345
+		$this->collSubscriptionsPartial = false;
1346
+
1347
+		return $this;
1348
+	}
1349
+
1350
+	/**
1351
+	 * Returns the number of related Subscription objects.
1352
+	 *
1353
+	 * @param      Criteria $criteria
1354
+	 * @param      boolean $distinct
1355
+	 * @param      ConnectionInterface $con
1356
+	 * @return int             Count of related Subscription objects.
1357
+	 * @throws PropelException
1358
+	 */
1359
+	public function countSubscriptions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
1360
+	{
1361
+		$partial = $this->collSubscriptionsPartial && !$this->isNew();
1362
+		if (null === $this->collSubscriptions || null !== $criteria || $partial) {
1363
+			if ($this->isNew() && null === $this->collSubscriptions) {
1364
+				return 0;
1365
+			}
1366
+
1367
+			if ($partial && !$criteria) {
1368
+				return count($this->getSubscriptions());
1369
+			}
1370
+
1371
+			$query = ChildSubscriptionQuery::create(null, $criteria);
1372
+			if ($distinct) {
1373
+				$query->distinct();
1374
+			}
1375
+
1376
+			return $query
1377
+				->filterByChannel($this)
1378
+				->count($con);
1379
+		}
1380
+
1381
+		return count($this->collSubscriptions);
1382
+	}
1383
+
1384
+	/**
1385
+	 * Method called to associate a ChildSubscription object to this object
1386
+	 * through the ChildSubscription foreign key attribute.
1387
+	 *
1388
+	 * @param  ChildSubscription $l ChildSubscription
1389
+	 * @return $this|\Jalle19\StatusManager\Database\Channel The current object (for fluent API support)
1390
+	 */
1391
+	public function addSubscription(ChildSubscription $l)
1392
+	{
1393
+		if ($this->collSubscriptions === null) {
1394
+			$this->initSubscriptions();
1395
+			$this->collSubscriptionsPartial = true;
1396
+		}
1397
+
1398
+		if (!$this->collSubscriptions->contains($l)) {
1399
+			$this->doAddSubscription($l);
1400
+
1401
+			if ($this->subscriptionsScheduledForDeletion and $this->subscriptionsScheduledForDeletion->contains($l)) {
1402
+				$this->subscriptionsScheduledForDeletion->remove($this->subscriptionsScheduledForDeletion->search($l));
1403
+			}
1404
+		}
1405
+
1406
+		return $this;
1407
+	}
1408
+
1409
+	/**
1410
+	 * @param ChildSubscription $subscription The ChildSubscription object to add.
1411
+	 */
1412
+	protected function doAddSubscription(ChildSubscription $subscription)
1413
+	{
1414
+		$this->collSubscriptions[]= $subscription;
1415
+		$subscription->setChannel($this);
1416
+	}
1417
+
1418
+	/**
1419
+	 * @param  ChildSubscription $subscription The ChildSubscription object to remove.
1420
+	 * @return $this|ChildChannel The current object (for fluent API support)
1421
+	 */
1422
+	public function removeSubscription(ChildSubscription $subscription)
1423
+	{
1424
+		if ($this->getSubscriptions()->contains($subscription)) {
1425
+			$pos = $this->collSubscriptions->search($subscription);
1426
+			$this->collSubscriptions->remove($pos);
1427
+			if (null === $this->subscriptionsScheduledForDeletion) {
1428
+				$this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions;
1429
+				$this->subscriptionsScheduledForDeletion->clear();
1430
+			}
1431
+			$this->subscriptionsScheduledForDeletion[]= clone $subscription;
1432
+			$subscription->setChannel(null);
1433
+		}
1434
+
1435
+		return $this;
1436
+	}
1437
+
1438
+
1439
+	/**
1440
+	 * If this collection has already been initialized with
1441
+	 * an identical criteria, it returns the collection.
1442
+	 * Otherwise if this Channel is new, it will return
1443
+	 * an empty collection; or if this Channel has previously
1444
+	 * been saved, it will retrieve related Subscriptions from storage.
1445
+	 *
1446
+	 * This method is protected by default in order to keep the public
1447
+	 * api reasonable.  You can provide public methods for those you
1448
+	 * actually need in Channel.
1449
+	 *
1450
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
1451
+	 * @param      ConnectionInterface $con optional connection object
1452
+	 * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1453
+	 * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1454
+	 */
1455
+	public function getSubscriptionsJoinInstance(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1456
+	{
1457
+		$query = ChildSubscriptionQuery::create(null, $criteria);
1458
+		$query->joinWith('Instance', $joinBehavior);
1459
+
1460
+		return $this->getSubscriptions($query, $con);
1461
+	}
1462
+
1463
+
1464
+	/**
1465
+	 * If this collection has already been initialized with
1466
+	 * an identical criteria, it returns the collection.
1467
+	 * Otherwise if this Channel is new, it will return
1468
+	 * an empty collection; or if this Channel has previously
1469
+	 * been saved, it will retrieve related Subscriptions from storage.
1470
+	 *
1471
+	 * This method is protected by default in order to keep the public
1472
+	 * api reasonable.  You can provide public methods for those you
1473
+	 * actually need in Channel.
1474
+	 *
1475
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
1476
+	 * @param      ConnectionInterface $con optional connection object
1477
+	 * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1478
+	 * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1479
+	 */
1480
+	public function getSubscriptionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1481
+	{
1482
+		$query = ChildSubscriptionQuery::create(null, $criteria);
1483
+		$query->joinWith('User', $joinBehavior);
1484
+
1485
+		return $this->getSubscriptions($query, $con);
1486
+	}
1487
+
1488
+	/**
1489
+	 * Clears the current object, sets all attributes to their default values and removes
1490
+	 * outgoing references as well as back-references (from other objects to this one. Results probably in a database
1491
+	 * change of those foreign objects when you call `save` there).
1492
+	 */
1493
+	public function clear()
1494
+	{
1495
+		if (null !== $this->aInstance) {
1496
+			$this->aInstance->removeChannel($this);
1497
+		}
1498
+		$this->id = null;
1499
+		$this->instance_name = null;
1500
+		$this->name = null;
1501
+		$this->alreadyInSave = false;
1502
+		$this->clearAllReferences();
1503
+		$this->resetModified();
1504
+		$this->setNew(true);
1505
+		$this->setDeleted(false);
1506
+	}
1507
+
1508
+	/**
1509
+	 * Resets all references and back-references to other model objects or collections of model objects.
1510
+	 *
1511
+	 * This method is used to reset all php object references (not the actual reference in the database).
1512
+	 * Necessary for object serialisation.
1513
+	 *
1514
+	 * @param      boolean $deep Whether to also clear the references on all referrer objects.
1515
+	 */
1516
+	public function clearAllReferences($deep = false)
1517
+	{
1518
+		if ($deep) {
1519
+			if ($this->collSubscriptions) {
1520
+				foreach ($this->collSubscriptions as $o) {
1521
+					$o->clearAllReferences($deep);
1522
+				}
1523
+			}
1524
+		} // if ($deep)
1525
+
1526
+		$this->collSubscriptions = null;
1527
+		$this->aInstance = null;
1528
+	}
1529
+
1530
+	/**
1531
+	 * Return the string representation of this object
1532
+	 *
1533
+	 * @return string
1534
+	 */
1535
+	public function __toString()
1536
+	{
1537
+		return (string) $this->exportTo(ChannelTableMap::DEFAULT_STRING_FORMAT);
1538
+	}
1539
+
1540
+	/**
1541
+	 * Code to be run before persisting the object
1542
+	 * @param  ConnectionInterface $con
1543
+	 * @return boolean
1544
+	 */
1545
+	public function preSave(ConnectionInterface $con = null)
1546
+	{
1547
+		return true;
1548
+	}
1549
+
1550
+	/**
1551
+	 * Code to be run after persisting the object
1552
+	 * @param ConnectionInterface $con
1553
+	 */
1554
+	public function postSave(ConnectionInterface $con = null)
1555
+	{
1556
+
1557
+	}
1558
+
1559
+	/**
1560
+	 * Code to be run before inserting to database
1561
+	 * @param  ConnectionInterface $con
1562
+	 * @return boolean
1563
+	 */
1564
+	public function preInsert(ConnectionInterface $con = null)
1565
+	{
1566
+		return true;
1567
+	}
1568
+
1569
+	/**
1570
+	 * Code to be run after inserting to database
1571
+	 * @param ConnectionInterface $con
1572
+	 */
1573
+	public function postInsert(ConnectionInterface $con = null)
1574
+	{
1575
+
1576
+	}
1577
+
1578
+	/**
1579
+	 * Code to be run before updating the object in database
1580
+	 * @param  ConnectionInterface $con
1581
+	 * @return boolean
1582
+	 */
1583
+	public function preUpdate(ConnectionInterface $con = null)
1584
+	{
1585
+		return true;
1586
+	}
1587
+
1588
+	/**
1589
+	 * Code to be run after updating the object in database
1590
+	 * @param ConnectionInterface $con
1591
+	 */
1592
+	public function postUpdate(ConnectionInterface $con = null)
1593
+	{
1594
+
1595
+	}
1596
+
1597
+	/**
1598
+	 * Code to be run before deleting the object in database
1599
+	 * @param  ConnectionInterface $con
1600
+	 * @return boolean
1601
+	 */
1602
+	public function preDelete(ConnectionInterface $con = null)
1603
+	{
1604
+		return true;
1605
+	}
1606
+
1607
+	/**
1608
+	 * Code to be run after deleting the object in database
1609
+	 * @param ConnectionInterface $con
1610
+	 */
1611
+	public function postDelete(ConnectionInterface $con = null)
1612
+	{
1613
+
1614
+	}
1615
+
1616
+
1617
+	/**
1618
+	 * Derived method to catches calls to undefined methods.
1619
+	 *
1620
+	 * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
1621
+	 * Allows to define default __call() behavior if you overwrite __call()
1622
+	 *
1623
+	 * @param string $name
1624
+	 * @param mixed  $params
1625
+	 *
1626
+	 * @return array|string
1627
+	 */
1628
+	public function __call($name, $params)
1629
+	{
1630
+		if (0 === strpos($name, 'get')) {
1631
+			$virtualColumn = substr($name, 3);
1632
+			if ($this->hasVirtualColumn($virtualColumn)) {
1633
+				return $this->getVirtualColumn($virtualColumn);
1634
+			}
1635
+
1636
+			$virtualColumn = lcfirst($virtualColumn);
1637
+			if ($this->hasVirtualColumn($virtualColumn)) {
1638
+				return $this->getVirtualColumn($virtualColumn);
1639
+			}
1640
+		}
1641
+
1642
+		if (0 === strpos($name, 'from')) {
1643
+			$format = substr($name, 4);
1644
+
1645
+			return $this->importFrom($format, reset($params));
1646
+		}
1647
+
1648
+		if (0 === strpos($name, 'to')) {
1649
+			$format = substr($name, 2);
1650
+			$includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1651
+
1652
+			return $this->exportTo($format, $includeLazyLoadColumns);
1653
+		}
1654
+
1655
+		throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1656
+	}
1657 1657
 
1658 1658
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
         $propertyNames = [];
331 331
         $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
332 332
 
333
-        foreach($serializableProperties as $property) {
333
+        foreach ($serializableProperties as $property) {
334 334
             $propertyNames[] = $property->getName();
335 335
         }
336 336
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
             $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
573 573
         }
574 574
 
575
-        $con->transaction(function () use ($con) {
575
+        $con->transaction(function() use ($con) {
576 576
             $deleteQuery = ChildChannelQuery::create()
577 577
                 ->filterByPrimaryKey($this->getPrimaryKey());
578 578
             $ret = $this->preDelete($con);
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
             $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
608 608
         }
609 609
 
610
-        return $con->transaction(function () use ($con) {
610
+        return $con->transaction(function() use ($con) {
611 611
             $isInsert = $this->isNew();
612 612
             $ret = $this->preSave($con);
613 613
             if ($isInsert) {
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
                         $key = 'Instance';
869 869
                 }
870 870
 
871
-                $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
871
+                $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
872 872
             }
873 873
             if (null !== $this->collSubscriptions) {
874 874
 
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
     public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null)
1274 1274
     {
1275 1275
         $partial = $this->collSubscriptionsPartial && !$this->isNew();
1276
-        if (null === $this->collSubscriptions || null !== $criteria  || $partial) {
1276
+        if (null === $this->collSubscriptions || null !== $criteria || $partial) {
1277 1277
             if ($this->isNew() && null === $this->collSubscriptions) {
1278 1278
                 // return empty collection
1279 1279
                 $this->initSubscriptions();
@@ -1411,7 +1411,7 @@  discard block
 block discarded – undo
1411 1411
      */
1412 1412
     protected function doAddSubscription(ChildSubscription $subscription)
1413 1413
     {
1414
-        $this->collSubscriptions[]= $subscription;
1414
+        $this->collSubscriptions[] = $subscription;
1415 1415
         $subscription->setChannel($this);
1416 1416
     }
1417 1417
 
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
                 $this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions;
1429 1429
                 $this->subscriptionsScheduledForDeletion->clear();
1430 1430
             }
1431
-            $this->subscriptionsScheduledForDeletion[]= clone $subscription;
1431
+            $this->subscriptionsScheduledForDeletion[] = clone $subscription;
1432 1432
             $subscription->setChannel(null);
1433 1433
         }
1434 1434
 
Please login to merge, or discard this patch.
src/cli/Database/Base/ChannelQuery.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
      * $obj  = $c->findPk(12, $con);
139 139
      * </code>
140 140
      *
141
-     * @param mixed $key Primary key to use for the query
141
+     * @param integer $key Primary key to use for the query
142 142
      * @param ConnectionInterface $con an optional connection object
143 143
      *
144 144
      * @return ChildUser|array|mixed the result, formatted by the current formatter
Please login to merge, or discard this patch.
Indentation   +502 added lines, -503 removed lines patch added patch discarded remove patch
@@ -64,7 +64,6 @@  discard block
 block discarded – undo
64 64
  * @method     ChildChannel findOneById(int $id) Return the first ChildChannel filtered by the id column
65 65
  * @method     ChildChannel findOneByInstanceName(string $instance_name) Return the first ChildChannel filtered by the instance_name column
66 66
  * @method     ChildChannel findOneByName(string $name) Return the first ChildChannel filtered by the name column *
67
-
68 67
  * @method     ChildChannel requirePk($key, ConnectionInterface $con = null) Return the ChildChannel by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
69 68
  * @method     ChildChannel requireOne(ConnectionInterface $con = null) Return the first ChildChannel matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
70 69
  *
@@ -81,507 +80,507 @@  discard block
 block discarded – undo
81 80
  */
82 81
 abstract class ChannelQuery extends ModelCriteria
83 82
 {
84
-    protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException';
85
-
86
-    /**
87
-     * Initializes internal state of \Jalle19\StatusManager\Database\Base\ChannelQuery object.
88
-     *
89
-     * @param     string $dbName The database name
90
-     * @param     string $modelName The phpName of a model, e.g. 'Book'
91
-     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
92
-     */
93
-    public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Channel', $modelAlias = null)
94
-    {
95
-        parent::__construct($dbName, $modelName, $modelAlias);
96
-    }
97
-
98
-    /**
99
-     * Returns a new ChildChannelQuery object.
100
-     *
101
-     * @param     string $modelAlias The alias of a model in the query
102
-     * @param     Criteria $criteria Optional Criteria to build the query from
103
-     *
104
-     * @return ChildChannelQuery
105
-     */
106
-    public static function create($modelAlias = null, Criteria $criteria = null)
107
-    {
108
-        if ($criteria instanceof ChildChannelQuery) {
109
-            return $criteria;
110
-        }
111
-        $query = new ChildChannelQuery();
112
-        if (null !== $modelAlias) {
113
-            $query->setModelAlias($modelAlias);
114
-        }
115
-        if ($criteria instanceof Criteria) {
116
-            $query->mergeWith($criteria);
117
-        }
118
-
119
-        return $query;
120
-    }
121
-
122
-    /**
123
-     * Find object by primary key.
124
-     * Propel uses the instance pool to skip the database if the object exists.
125
-     * Go fast if the query is untouched.
126
-     *
127
-     * <code>
128
-     * $obj  = $c->findPk(12, $con);
129
-     * </code>
130
-     *
131
-     * @param mixed $key Primary key to use for the query
132
-     * @param ConnectionInterface $con an optional connection object
133
-     *
134
-     * @return ChildChannel|array|mixed the result, formatted by the current formatter
135
-     */
136
-    public function findPk($key, ConnectionInterface $con = null)
137
-    {
138
-        if ($key === null) {
139
-            return null;
140
-        }
141
-        if ((null !== ($obj = ChannelTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) {
142
-            // the object is already in the instance pool
143
-            return $obj;
144
-        }
145
-        if ($con === null) {
146
-            $con = Propel::getServiceContainer()->getReadConnection(ChannelTableMap::DATABASE_NAME);
147
-        }
148
-        $this->basePreSelect($con);
149
-        if ($this->formatter || $this->modelAlias || $this->with || $this->select
150
-         || $this->selectColumns || $this->asColumns || $this->selectModifiers
151
-         || $this->map || $this->having || $this->joins) {
152
-            return $this->findPkComplex($key, $con);
153
-        } else {
154
-            return $this->findPkSimple($key, $con);
155
-        }
156
-    }
157
-
158
-    /**
159
-     * Find object by primary key using raw SQL to go fast.
160
-     * Bypass doSelect() and the object formatter by using generated code.
161
-     *
162
-     * @param     mixed $key Primary key to use for the query
163
-     * @param     ConnectionInterface $con A connection object
164
-     *
165
-     * @throws \Propel\Runtime\Exception\PropelException
166
-     *
167
-     * @return ChildChannel A model object, or null if the key is not found
168
-     */
169
-    protected function findPkSimple($key, ConnectionInterface $con)
170
-    {
171
-        $sql = 'SELECT id, instance_name, name FROM channel WHERE id = :p0';
172
-        try {
173
-            $stmt = $con->prepare($sql);
174
-            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
175
-            $stmt->execute();
176
-        } catch (Exception $e) {
177
-            Propel::log($e->getMessage(), Propel::LOG_ERR);
178
-            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
179
-        }
180
-        $obj = null;
181
-        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
182
-            /** @var ChildChannel $obj */
183
-            $obj = new ChildChannel();
184
-            $obj->hydrate($row);
185
-            ChannelTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
186
-        }
187
-        $stmt->closeCursor();
188
-
189
-        return $obj;
190
-    }
191
-
192
-    /**
193
-     * Find object by primary key.
194
-     *
195
-     * @param     mixed $key Primary key to use for the query
196
-     * @param     ConnectionInterface $con A connection object
197
-     *
198
-     * @return ChildChannel|array|mixed the result, formatted by the current formatter
199
-     */
200
-    protected function findPkComplex($key, ConnectionInterface $con)
201
-    {
202
-        // As the query uses a PK condition, no limit(1) is necessary.
203
-        $criteria = $this->isKeepQuery() ? clone $this : $this;
204
-        $dataFetcher = $criteria
205
-            ->filterByPrimaryKey($key)
206
-            ->doSelect($con);
207
-
208
-        return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
209
-    }
210
-
211
-    /**
212
-     * Find objects by primary key
213
-     * <code>
214
-     * $objs = $c->findPks(array(12, 56, 832), $con);
215
-     * </code>
216
-     * @param     array $keys Primary keys to use for the query
217
-     * @param     ConnectionInterface $con an optional connection object
218
-     *
219
-     * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
220
-     */
221
-    public function findPks($keys, ConnectionInterface $con = null)
222
-    {
223
-        if (null === $con) {
224
-            $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
225
-        }
226
-        $this->basePreSelect($con);
227
-        $criteria = $this->isKeepQuery() ? clone $this : $this;
228
-        $dataFetcher = $criteria
229
-            ->filterByPrimaryKeys($keys)
230
-            ->doSelect($con);
231
-
232
-        return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
233
-    }
234
-
235
-    /**
236
-     * Filter the query by primary key
237
-     *
238
-     * @param     mixed $key Primary key to use for the query
239
-     *
240
-     * @return $this|ChildChannelQuery The current query, for fluid interface
241
-     */
242
-    public function filterByPrimaryKey($key)
243
-    {
244
-
245
-        return $this->addUsingAlias(ChannelTableMap::COL_ID, $key, Criteria::EQUAL);
246
-    }
247
-
248
-    /**
249
-     * Filter the query by a list of primary keys
250
-     *
251
-     * @param     array $keys The list of primary key to use for the query
252
-     *
253
-     * @return $this|ChildChannelQuery The current query, for fluid interface
254
-     */
255
-    public function filterByPrimaryKeys($keys)
256
-    {
257
-
258
-        return $this->addUsingAlias(ChannelTableMap::COL_ID, $keys, Criteria::IN);
259
-    }
260
-
261
-    /**
262
-     * Filter the query on the id column
263
-     *
264
-     * Example usage:
265
-     * <code>
266
-     * $query->filterById(1234); // WHERE id = 1234
267
-     * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
268
-     * $query->filterById(array('min' => 12)); // WHERE id > 12
269
-     * </code>
270
-     *
271
-     * @param     mixed $id The value to use as filter.
272
-     *              Use scalar values for equality.
273
-     *              Use array values for in_array() equivalent.
274
-     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
275
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
276
-     *
277
-     * @return $this|ChildChannelQuery The current query, for fluid interface
278
-     */
279
-    public function filterById($id = null, $comparison = null)
280
-    {
281
-        if (is_array($id)) {
282
-            $useMinMax = false;
283
-            if (isset($id['min'])) {
284
-                $this->addUsingAlias(ChannelTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL);
285
-                $useMinMax = true;
286
-            }
287
-            if (isset($id['max'])) {
288
-                $this->addUsingAlias(ChannelTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL);
289
-                $useMinMax = true;
290
-            }
291
-            if ($useMinMax) {
292
-                return $this;
293
-            }
294
-            if (null === $comparison) {
295
-                $comparison = Criteria::IN;
296
-            }
297
-        }
298
-
299
-        return $this->addUsingAlias(ChannelTableMap::COL_ID, $id, $comparison);
300
-    }
301
-
302
-    /**
303
-     * Filter the query on the instance_name column
304
-     *
305
-     * Example usage:
306
-     * <code>
307
-     * $query->filterByInstanceName('fooValue');   // WHERE instance_name = 'fooValue'
308
-     * $query->filterByInstanceName('%fooValue%'); // WHERE instance_name LIKE '%fooValue%'
309
-     * </code>
310
-     *
311
-     * @param     string $instanceName The value to use as filter.
312
-     *              Accepts wildcards (* and % trigger a LIKE)
313
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
314
-     *
315
-     * @return $this|ChildChannelQuery The current query, for fluid interface
316
-     */
317
-    public function filterByInstanceName($instanceName = null, $comparison = null)
318
-    {
319
-        if (null === $comparison) {
320
-            if (is_array($instanceName)) {
321
-                $comparison = Criteria::IN;
322
-            } elseif (preg_match('/[\%\*]/', $instanceName)) {
323
-                $instanceName = str_replace('*', '%', $instanceName);
324
-                $comparison = Criteria::LIKE;
325
-            }
326
-        }
327
-
328
-        return $this->addUsingAlias(ChannelTableMap::COL_INSTANCE_NAME, $instanceName, $comparison);
329
-    }
330
-
331
-    /**
332
-     * Filter the query on the name column
333
-     *
334
-     * Example usage:
335
-     * <code>
336
-     * $query->filterByName('fooValue');   // WHERE name = 'fooValue'
337
-     * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
338
-     * </code>
339
-     *
340
-     * @param     string $name The value to use as filter.
341
-     *              Accepts wildcards (* and % trigger a LIKE)
342
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
343
-     *
344
-     * @return $this|ChildChannelQuery The current query, for fluid interface
345
-     */
346
-    public function filterByName($name = null, $comparison = null)
347
-    {
348
-        if (null === $comparison) {
349
-            if (is_array($name)) {
350
-                $comparison = Criteria::IN;
351
-            } elseif (preg_match('/[\%\*]/', $name)) {
352
-                $name = str_replace('*', '%', $name);
353
-                $comparison = Criteria::LIKE;
354
-            }
355
-        }
356
-
357
-        return $this->addUsingAlias(ChannelTableMap::COL_NAME, $name, $comparison);
358
-    }
359
-
360
-    /**
361
-     * Filter the query by a related \Jalle19\StatusManager\Database\Instance object
362
-     *
363
-     * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter
364
-     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
365
-     *
366
-     * @throws \Propel\Runtime\Exception\PropelException
367
-     *
368
-     * @return ChildChannelQuery The current query, for fluid interface
369
-     */
370
-    public function filterByInstance($instance, $comparison = null)
371
-    {
372
-        if ($instance instanceof \Jalle19\StatusManager\Database\Instance) {
373
-            return $this
374
-                ->addUsingAlias(ChannelTableMap::COL_INSTANCE_NAME, $instance->getName(), $comparison);
375
-        } elseif ($instance instanceof ObjectCollection) {
376
-            if (null === $comparison) {
377
-                $comparison = Criteria::IN;
378
-            }
379
-
380
-            return $this
381
-                ->addUsingAlias(ChannelTableMap::COL_INSTANCE_NAME, $instance->toKeyValue('PrimaryKey', 'Name'), $comparison);
382
-        } else {
383
-            throw new PropelException('filterByInstance() only accepts arguments of type \Jalle19\StatusManager\Database\Instance or Collection');
384
-        }
385
-    }
386
-
387
-    /**
388
-     * Adds a JOIN clause to the query using the Instance relation
389
-     *
390
-     * @param     string $relationAlias optional alias for the relation
391
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
392
-     *
393
-     * @return $this|ChildChannelQuery The current query, for fluid interface
394
-     */
395
-    public function joinInstance($relationAlias = null, $joinType = Criteria::INNER_JOIN)
396
-    {
397
-        $tableMap = $this->getTableMap();
398
-        $relationMap = $tableMap->getRelation('Instance');
399
-
400
-        // create a ModelJoin object for this join
401
-        $join = new ModelJoin();
402
-        $join->setJoinType($joinType);
403
-        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
404
-        if ($previousJoin = $this->getPreviousJoin()) {
405
-            $join->setPreviousJoin($previousJoin);
406
-        }
407
-
408
-        // add the ModelJoin to the current object
409
-        if ($relationAlias) {
410
-            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
411
-            $this->addJoinObject($join, $relationAlias);
412
-        } else {
413
-            $this->addJoinObject($join, 'Instance');
414
-        }
415
-
416
-        return $this;
417
-    }
418
-
419
-    /**
420
-     * Use the Instance relation Instance object
421
-     *
422
-     * @see useQuery()
423
-     *
424
-     * @param     string $relationAlias optional alias for the relation,
425
-     *                                   to be used as main alias in the secondary query
426
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
427
-     *
428
-     * @return \Jalle19\StatusManager\Database\InstanceQuery A secondary query class using the current class as primary query
429
-     */
430
-    public function useInstanceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
431
-    {
432
-        return $this
433
-            ->joinInstance($relationAlias, $joinType)
434
-            ->useQuery($relationAlias ? $relationAlias : 'Instance', '\Jalle19\StatusManager\Database\InstanceQuery');
435
-    }
436
-
437
-    /**
438
-     * Filter the query by a related \Jalle19\StatusManager\Database\Subscription object
439
-     *
440
-     * @param \Jalle19\StatusManager\Database\Subscription|ObjectCollection $subscription the related object to use as filter
441
-     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
442
-     *
443
-     * @return ChildChannelQuery The current query, for fluid interface
444
-     */
445
-    public function filterBySubscription($subscription, $comparison = null)
446
-    {
447
-        if ($subscription instanceof \Jalle19\StatusManager\Database\Subscription) {
448
-            return $this
449
-                ->addUsingAlias(ChannelTableMap::COL_ID, $subscription->getChannelId(), $comparison);
450
-        } elseif ($subscription instanceof ObjectCollection) {
451
-            return $this
452
-                ->useSubscriptionQuery()
453
-                ->filterByPrimaryKeys($subscription->getPrimaryKeys())
454
-                ->endUse();
455
-        } else {
456
-            throw new PropelException('filterBySubscription() only accepts arguments of type \Jalle19\StatusManager\Database\Subscription or Collection');
457
-        }
458
-    }
459
-
460
-    /**
461
-     * Adds a JOIN clause to the query using the Subscription relation
462
-     *
463
-     * @param     string $relationAlias optional alias for the relation
464
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
465
-     *
466
-     * @return $this|ChildChannelQuery The current query, for fluid interface
467
-     */
468
-    public function joinSubscription($relationAlias = null, $joinType = Criteria::INNER_JOIN)
469
-    {
470
-        $tableMap = $this->getTableMap();
471
-        $relationMap = $tableMap->getRelation('Subscription');
472
-
473
-        // create a ModelJoin object for this join
474
-        $join = new ModelJoin();
475
-        $join->setJoinType($joinType);
476
-        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
477
-        if ($previousJoin = $this->getPreviousJoin()) {
478
-            $join->setPreviousJoin($previousJoin);
479
-        }
480
-
481
-        // add the ModelJoin to the current object
482
-        if ($relationAlias) {
483
-            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
484
-            $this->addJoinObject($join, $relationAlias);
485
-        } else {
486
-            $this->addJoinObject($join, 'Subscription');
487
-        }
488
-
489
-        return $this;
490
-    }
491
-
492
-    /**
493
-     * Use the Subscription relation Subscription object
494
-     *
495
-     * @see useQuery()
496
-     *
497
-     * @param     string $relationAlias optional alias for the relation,
498
-     *                                   to be used as main alias in the secondary query
499
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
500
-     *
501
-     * @return \Jalle19\StatusManager\Database\SubscriptionQuery A secondary query class using the current class as primary query
502
-     */
503
-    public function useSubscriptionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
504
-    {
505
-        return $this
506
-            ->joinSubscription($relationAlias, $joinType)
507
-            ->useQuery($relationAlias ? $relationAlias : 'Subscription', '\Jalle19\StatusManager\Database\SubscriptionQuery');
508
-    }
509
-
510
-    /**
511
-     * Exclude object from result
512
-     *
513
-     * @param   ChildChannel $channel Object to remove from the list of results
514
-     *
515
-     * @return $this|ChildChannelQuery The current query, for fluid interface
516
-     */
517
-    public function prune($channel = null)
518
-    {
519
-        if ($channel) {
520
-            $this->addUsingAlias(ChannelTableMap::COL_ID, $channel->getId(), Criteria::NOT_EQUAL);
521
-        }
522
-
523
-        return $this;
524
-    }
525
-
526
-    /**
527
-     * Deletes all rows from the channel table.
528
-     *
529
-     * @param ConnectionInterface $con the connection to use
530
-     * @return int The number of affected rows (if supported by underlying database driver).
531
-     */
532
-    public function doDeleteAll(ConnectionInterface $con = null)
533
-    {
534
-        if (null === $con) {
535
-            $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
536
-        }
537
-
538
-        // use transaction because $criteria could contain info
539
-        // for more than one table or we could emulating ON DELETE CASCADE, etc.
540
-        return $con->transaction(function () use ($con) {
541
-            $affectedRows = 0; // initialize var to track total num of affected rows
542
-            $affectedRows += parent::doDeleteAll($con);
543
-            // Because this db requires some delete cascade/set null emulation, we have to
544
-            // clear the cached instance *after* the emulation has happened (since
545
-            // instances get re-added by the select statement contained therein).
546
-            ChannelTableMap::clearInstancePool();
547
-            ChannelTableMap::clearRelatedInstancePool();
548
-
549
-            return $affectedRows;
550
-        });
551
-    }
552
-
553
-    /**
554
-     * Performs a DELETE on the database based on the current ModelCriteria
555
-     *
556
-     * @param ConnectionInterface $con the connection to use
557
-     * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
558
-     *                         if supported by native driver or if emulated using Propel.
559
-     * @throws PropelException Any exceptions caught during processing will be
560
-     *                         rethrown wrapped into a PropelException.
561
-     */
562
-    public function delete(ConnectionInterface $con = null)
563
-    {
564
-        if (null === $con) {
565
-            $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
566
-        }
567
-
568
-        $criteria = $this;
569
-
570
-        // Set the correct dbName
571
-        $criteria->setDbName(ChannelTableMap::DATABASE_NAME);
572
-
573
-        // use transaction because $criteria could contain info
574
-        // for more than one table or we could emulating ON DELETE CASCADE, etc.
575
-        return $con->transaction(function () use ($con, $criteria) {
576
-            $affectedRows = 0; // initialize var to track total num of affected rows
577
-
578
-            ChannelTableMap::removeInstanceFromPool($criteria);
579
-
580
-            $affectedRows += ModelCriteria::delete($con);
581
-            ChannelTableMap::clearRelatedInstancePool();
582
-
583
-            return $affectedRows;
584
-        });
585
-    }
83
+	protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException';
84
+
85
+	/**
86
+	 * Initializes internal state of \Jalle19\StatusManager\Database\Base\ChannelQuery object.
87
+	 *
88
+	 * @param     string $dbName The database name
89
+	 * @param     string $modelName The phpName of a model, e.g. 'Book'
90
+	 * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
91
+	 */
92
+	public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Channel', $modelAlias = null)
93
+	{
94
+		parent::__construct($dbName, $modelName, $modelAlias);
95
+	}
96
+
97
+	/**
98
+	 * Returns a new ChildChannelQuery object.
99
+	 *
100
+	 * @param     string $modelAlias The alias of a model in the query
101
+	 * @param     Criteria $criteria Optional Criteria to build the query from
102
+	 *
103
+	 * @return ChildChannelQuery
104
+	 */
105
+	public static function create($modelAlias = null, Criteria $criteria = null)
106
+	{
107
+		if ($criteria instanceof ChildChannelQuery) {
108
+			return $criteria;
109
+		}
110
+		$query = new ChildChannelQuery();
111
+		if (null !== $modelAlias) {
112
+			$query->setModelAlias($modelAlias);
113
+		}
114
+		if ($criteria instanceof Criteria) {
115
+			$query->mergeWith($criteria);
116
+		}
117
+
118
+		return $query;
119
+	}
120
+
121
+	/**
122
+	 * Find object by primary key.
123
+	 * Propel uses the instance pool to skip the database if the object exists.
124
+	 * Go fast if the query is untouched.
125
+	 *
126
+	 * <code>
127
+	 * $obj  = $c->findPk(12, $con);
128
+	 * </code>
129
+	 *
130
+	 * @param mixed $key Primary key to use for the query
131
+	 * @param ConnectionInterface $con an optional connection object
132
+	 *
133
+	 * @return ChildChannel|array|mixed the result, formatted by the current formatter
134
+	 */
135
+	public function findPk($key, ConnectionInterface $con = null)
136
+	{
137
+		if ($key === null) {
138
+			return null;
139
+		}
140
+		if ((null !== ($obj = ChannelTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) {
141
+			// the object is already in the instance pool
142
+			return $obj;
143
+		}
144
+		if ($con === null) {
145
+			$con = Propel::getServiceContainer()->getReadConnection(ChannelTableMap::DATABASE_NAME);
146
+		}
147
+		$this->basePreSelect($con);
148
+		if ($this->formatter || $this->modelAlias || $this->with || $this->select
149
+		 || $this->selectColumns || $this->asColumns || $this->selectModifiers
150
+		 || $this->map || $this->having || $this->joins) {
151
+			return $this->findPkComplex($key, $con);
152
+		} else {
153
+			return $this->findPkSimple($key, $con);
154
+		}
155
+	}
156
+
157
+	/**
158
+	 * Find object by primary key using raw SQL to go fast.
159
+	 * Bypass doSelect() and the object formatter by using generated code.
160
+	 *
161
+	 * @param     mixed $key Primary key to use for the query
162
+	 * @param     ConnectionInterface $con A connection object
163
+	 *
164
+	 * @throws \Propel\Runtime\Exception\PropelException
165
+	 *
166
+	 * @return ChildChannel A model object, or null if the key is not found
167
+	 */
168
+	protected function findPkSimple($key, ConnectionInterface $con)
169
+	{
170
+		$sql = 'SELECT id, instance_name, name FROM channel WHERE id = :p0';
171
+		try {
172
+			$stmt = $con->prepare($sql);
173
+			$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
174
+			$stmt->execute();
175
+		} catch (Exception $e) {
176
+			Propel::log($e->getMessage(), Propel::LOG_ERR);
177
+			throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
178
+		}
179
+		$obj = null;
180
+		if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
181
+			/** @var ChildChannel $obj */
182
+			$obj = new ChildChannel();
183
+			$obj->hydrate($row);
184
+			ChannelTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
185
+		}
186
+		$stmt->closeCursor();
187
+
188
+		return $obj;
189
+	}
190
+
191
+	/**
192
+	 * Find object by primary key.
193
+	 *
194
+	 * @param     mixed $key Primary key to use for the query
195
+	 * @param     ConnectionInterface $con A connection object
196
+	 *
197
+	 * @return ChildChannel|array|mixed the result, formatted by the current formatter
198
+	 */
199
+	protected function findPkComplex($key, ConnectionInterface $con)
200
+	{
201
+		// As the query uses a PK condition, no limit(1) is necessary.
202
+		$criteria = $this->isKeepQuery() ? clone $this : $this;
203
+		$dataFetcher = $criteria
204
+			->filterByPrimaryKey($key)
205
+			->doSelect($con);
206
+
207
+		return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
208
+	}
209
+
210
+	/**
211
+	 * Find objects by primary key
212
+	 * <code>
213
+	 * $objs = $c->findPks(array(12, 56, 832), $con);
214
+	 * </code>
215
+	 * @param     array $keys Primary keys to use for the query
216
+	 * @param     ConnectionInterface $con an optional connection object
217
+	 *
218
+	 * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
219
+	 */
220
+	public function findPks($keys, ConnectionInterface $con = null)
221
+	{
222
+		if (null === $con) {
223
+			$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
224
+		}
225
+		$this->basePreSelect($con);
226
+		$criteria = $this->isKeepQuery() ? clone $this : $this;
227
+		$dataFetcher = $criteria
228
+			->filterByPrimaryKeys($keys)
229
+			->doSelect($con);
230
+
231
+		return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
232
+	}
233
+
234
+	/**
235
+	 * Filter the query by primary key
236
+	 *
237
+	 * @param     mixed $key Primary key to use for the query
238
+	 *
239
+	 * @return $this|ChildChannelQuery The current query, for fluid interface
240
+	 */
241
+	public function filterByPrimaryKey($key)
242
+	{
243
+
244
+		return $this->addUsingAlias(ChannelTableMap::COL_ID, $key, Criteria::EQUAL);
245
+	}
246
+
247
+	/**
248
+	 * Filter the query by a list of primary keys
249
+	 *
250
+	 * @param     array $keys The list of primary key to use for the query
251
+	 *
252
+	 * @return $this|ChildChannelQuery The current query, for fluid interface
253
+	 */
254
+	public function filterByPrimaryKeys($keys)
255
+	{
256
+
257
+		return $this->addUsingAlias(ChannelTableMap::COL_ID, $keys, Criteria::IN);
258
+	}
259
+
260
+	/**
261
+	 * Filter the query on the id column
262
+	 *
263
+	 * Example usage:
264
+	 * <code>
265
+	 * $query->filterById(1234); // WHERE id = 1234
266
+	 * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
267
+	 * $query->filterById(array('min' => 12)); // WHERE id > 12
268
+	 * </code>
269
+	 *
270
+	 * @param     mixed $id The value to use as filter.
271
+	 *              Use scalar values for equality.
272
+	 *              Use array values for in_array() equivalent.
273
+	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
274
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
275
+	 *
276
+	 * @return $this|ChildChannelQuery The current query, for fluid interface
277
+	 */
278
+	public function filterById($id = null, $comparison = null)
279
+	{
280
+		if (is_array($id)) {
281
+			$useMinMax = false;
282
+			if (isset($id['min'])) {
283
+				$this->addUsingAlias(ChannelTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL);
284
+				$useMinMax = true;
285
+			}
286
+			if (isset($id['max'])) {
287
+				$this->addUsingAlias(ChannelTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL);
288
+				$useMinMax = true;
289
+			}
290
+			if ($useMinMax) {
291
+				return $this;
292
+			}
293
+			if (null === $comparison) {
294
+				$comparison = Criteria::IN;
295
+			}
296
+		}
297
+
298
+		return $this->addUsingAlias(ChannelTableMap::COL_ID, $id, $comparison);
299
+	}
300
+
301
+	/**
302
+	 * Filter the query on the instance_name column
303
+	 *
304
+	 * Example usage:
305
+	 * <code>
306
+	 * $query->filterByInstanceName('fooValue');   // WHERE instance_name = 'fooValue'
307
+	 * $query->filterByInstanceName('%fooValue%'); // WHERE instance_name LIKE '%fooValue%'
308
+	 * </code>
309
+	 *
310
+	 * @param     string $instanceName The value to use as filter.
311
+	 *              Accepts wildcards (* and % trigger a LIKE)
312
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
313
+	 *
314
+	 * @return $this|ChildChannelQuery The current query, for fluid interface
315
+	 */
316
+	public function filterByInstanceName($instanceName = null, $comparison = null)
317
+	{
318
+		if (null === $comparison) {
319
+			if (is_array($instanceName)) {
320
+				$comparison = Criteria::IN;
321
+			} elseif (preg_match('/[\%\*]/', $instanceName)) {
322
+				$instanceName = str_replace('*', '%', $instanceName);
323
+				$comparison = Criteria::LIKE;
324
+			}
325
+		}
326
+
327
+		return $this->addUsingAlias(ChannelTableMap::COL_INSTANCE_NAME, $instanceName, $comparison);
328
+	}
329
+
330
+	/**
331
+	 * Filter the query on the name column
332
+	 *
333
+	 * Example usage:
334
+	 * <code>
335
+	 * $query->filterByName('fooValue');   // WHERE name = 'fooValue'
336
+	 * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
337
+	 * </code>
338
+	 *
339
+	 * @param     string $name The value to use as filter.
340
+	 *              Accepts wildcards (* and % trigger a LIKE)
341
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
342
+	 *
343
+	 * @return $this|ChildChannelQuery The current query, for fluid interface
344
+	 */
345
+	public function filterByName($name = null, $comparison = null)
346
+	{
347
+		if (null === $comparison) {
348
+			if (is_array($name)) {
349
+				$comparison = Criteria::IN;
350
+			} elseif (preg_match('/[\%\*]/', $name)) {
351
+				$name = str_replace('*', '%', $name);
352
+				$comparison = Criteria::LIKE;
353
+			}
354
+		}
355
+
356
+		return $this->addUsingAlias(ChannelTableMap::COL_NAME, $name, $comparison);
357
+	}
358
+
359
+	/**
360
+	 * Filter the query by a related \Jalle19\StatusManager\Database\Instance object
361
+	 *
362
+	 * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter
363
+	 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
364
+	 *
365
+	 * @throws \Propel\Runtime\Exception\PropelException
366
+	 *
367
+	 * @return ChildChannelQuery The current query, for fluid interface
368
+	 */
369
+	public function filterByInstance($instance, $comparison = null)
370
+	{
371
+		if ($instance instanceof \Jalle19\StatusManager\Database\Instance) {
372
+			return $this
373
+				->addUsingAlias(ChannelTableMap::COL_INSTANCE_NAME, $instance->getName(), $comparison);
374
+		} elseif ($instance instanceof ObjectCollection) {
375
+			if (null === $comparison) {
376
+				$comparison = Criteria::IN;
377
+			}
378
+
379
+			return $this
380
+				->addUsingAlias(ChannelTableMap::COL_INSTANCE_NAME, $instance->toKeyValue('PrimaryKey', 'Name'), $comparison);
381
+		} else {
382
+			throw new PropelException('filterByInstance() only accepts arguments of type \Jalle19\StatusManager\Database\Instance or Collection');
383
+		}
384
+	}
385
+
386
+	/**
387
+	 * Adds a JOIN clause to the query using the Instance relation
388
+	 *
389
+	 * @param     string $relationAlias optional alias for the relation
390
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
391
+	 *
392
+	 * @return $this|ChildChannelQuery The current query, for fluid interface
393
+	 */
394
+	public function joinInstance($relationAlias = null, $joinType = Criteria::INNER_JOIN)
395
+	{
396
+		$tableMap = $this->getTableMap();
397
+		$relationMap = $tableMap->getRelation('Instance');
398
+
399
+		// create a ModelJoin object for this join
400
+		$join = new ModelJoin();
401
+		$join->setJoinType($joinType);
402
+		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
403
+		if ($previousJoin = $this->getPreviousJoin()) {
404
+			$join->setPreviousJoin($previousJoin);
405
+		}
406
+
407
+		// add the ModelJoin to the current object
408
+		if ($relationAlias) {
409
+			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
410
+			$this->addJoinObject($join, $relationAlias);
411
+		} else {
412
+			$this->addJoinObject($join, 'Instance');
413
+		}
414
+
415
+		return $this;
416
+	}
417
+
418
+	/**
419
+	 * Use the Instance relation Instance object
420
+	 *
421
+	 * @see useQuery()
422
+	 *
423
+	 * @param     string $relationAlias optional alias for the relation,
424
+	 *                                   to be used as main alias in the secondary query
425
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
426
+	 *
427
+	 * @return \Jalle19\StatusManager\Database\InstanceQuery A secondary query class using the current class as primary query
428
+	 */
429
+	public function useInstanceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
430
+	{
431
+		return $this
432
+			->joinInstance($relationAlias, $joinType)
433
+			->useQuery($relationAlias ? $relationAlias : 'Instance', '\Jalle19\StatusManager\Database\InstanceQuery');
434
+	}
435
+
436
+	/**
437
+	 * Filter the query by a related \Jalle19\StatusManager\Database\Subscription object
438
+	 *
439
+	 * @param \Jalle19\StatusManager\Database\Subscription|ObjectCollection $subscription the related object to use as filter
440
+	 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
441
+	 *
442
+	 * @return ChildChannelQuery The current query, for fluid interface
443
+	 */
444
+	public function filterBySubscription($subscription, $comparison = null)
445
+	{
446
+		if ($subscription instanceof \Jalle19\StatusManager\Database\Subscription) {
447
+			return $this
448
+				->addUsingAlias(ChannelTableMap::COL_ID, $subscription->getChannelId(), $comparison);
449
+		} elseif ($subscription instanceof ObjectCollection) {
450
+			return $this
451
+				->useSubscriptionQuery()
452
+				->filterByPrimaryKeys($subscription->getPrimaryKeys())
453
+				->endUse();
454
+		} else {
455
+			throw new PropelException('filterBySubscription() only accepts arguments of type \Jalle19\StatusManager\Database\Subscription or Collection');
456
+		}
457
+	}
458
+
459
+	/**
460
+	 * Adds a JOIN clause to the query using the Subscription relation
461
+	 *
462
+	 * @param     string $relationAlias optional alias for the relation
463
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
464
+	 *
465
+	 * @return $this|ChildChannelQuery The current query, for fluid interface
466
+	 */
467
+	public function joinSubscription($relationAlias = null, $joinType = Criteria::INNER_JOIN)
468
+	{
469
+		$tableMap = $this->getTableMap();
470
+		$relationMap = $tableMap->getRelation('Subscription');
471
+
472
+		// create a ModelJoin object for this join
473
+		$join = new ModelJoin();
474
+		$join->setJoinType($joinType);
475
+		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
476
+		if ($previousJoin = $this->getPreviousJoin()) {
477
+			$join->setPreviousJoin($previousJoin);
478
+		}
479
+
480
+		// add the ModelJoin to the current object
481
+		if ($relationAlias) {
482
+			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
483
+			$this->addJoinObject($join, $relationAlias);
484
+		} else {
485
+			$this->addJoinObject($join, 'Subscription');
486
+		}
487
+
488
+		return $this;
489
+	}
490
+
491
+	/**
492
+	 * Use the Subscription relation Subscription object
493
+	 *
494
+	 * @see useQuery()
495
+	 *
496
+	 * @param     string $relationAlias optional alias for the relation,
497
+	 *                                   to be used as main alias in the secondary query
498
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
499
+	 *
500
+	 * @return \Jalle19\StatusManager\Database\SubscriptionQuery A secondary query class using the current class as primary query
501
+	 */
502
+	public function useSubscriptionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
503
+	{
504
+		return $this
505
+			->joinSubscription($relationAlias, $joinType)
506
+			->useQuery($relationAlias ? $relationAlias : 'Subscription', '\Jalle19\StatusManager\Database\SubscriptionQuery');
507
+	}
508
+
509
+	/**
510
+	 * Exclude object from result
511
+	 *
512
+	 * @param   ChildChannel $channel Object to remove from the list of results
513
+	 *
514
+	 * @return $this|ChildChannelQuery The current query, for fluid interface
515
+	 */
516
+	public function prune($channel = null)
517
+	{
518
+		if ($channel) {
519
+			$this->addUsingAlias(ChannelTableMap::COL_ID, $channel->getId(), Criteria::NOT_EQUAL);
520
+		}
521
+
522
+		return $this;
523
+	}
524
+
525
+	/**
526
+	 * Deletes all rows from the channel table.
527
+	 *
528
+	 * @param ConnectionInterface $con the connection to use
529
+	 * @return int The number of affected rows (if supported by underlying database driver).
530
+	 */
531
+	public function doDeleteAll(ConnectionInterface $con = null)
532
+	{
533
+		if (null === $con) {
534
+			$con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
535
+		}
536
+
537
+		// use transaction because $criteria could contain info
538
+		// for more than one table or we could emulating ON DELETE CASCADE, etc.
539
+		return $con->transaction(function () use ($con) {
540
+			$affectedRows = 0; // initialize var to track total num of affected rows
541
+			$affectedRows += parent::doDeleteAll($con);
542
+			// Because this db requires some delete cascade/set null emulation, we have to
543
+			// clear the cached instance *after* the emulation has happened (since
544
+			// instances get re-added by the select statement contained therein).
545
+			ChannelTableMap::clearInstancePool();
546
+			ChannelTableMap::clearRelatedInstancePool();
547
+
548
+			return $affectedRows;
549
+		});
550
+	}
551
+
552
+	/**
553
+	 * Performs a DELETE on the database based on the current ModelCriteria
554
+	 *
555
+	 * @param ConnectionInterface $con the connection to use
556
+	 * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
557
+	 *                         if supported by native driver or if emulated using Propel.
558
+	 * @throws PropelException Any exceptions caught during processing will be
559
+	 *                         rethrown wrapped into a PropelException.
560
+	 */
561
+	public function delete(ConnectionInterface $con = null)
562
+	{
563
+		if (null === $con) {
564
+			$con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
565
+		}
566
+
567
+		$criteria = $this;
568
+
569
+		// Set the correct dbName
570
+		$criteria->setDbName(ChannelTableMap::DATABASE_NAME);
571
+
572
+		// use transaction because $criteria could contain info
573
+		// for more than one table or we could emulating ON DELETE CASCADE, etc.
574
+		return $con->transaction(function () use ($con, $criteria) {
575
+			$affectedRows = 0; // initialize var to track total num of affected rows
576
+
577
+			ChannelTableMap::removeInstanceFromPool($criteria);
578
+
579
+			$affectedRows += ModelCriteria::delete($con);
580
+			ChannelTableMap::clearRelatedInstancePool();
581
+
582
+			return $affectedRows;
583
+		});
584
+	}
586 585
 
587 586
 } // ChannelQuery
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 
621 621
         // use transaction because $criteria could contain info
622 622
         // for more than one table or we could emulating ON DELETE CASCADE, etc.
623
-        return $con->transaction(function () use ($con) {
623
+        return $con->transaction(function() use ($con) {
624 624
             $affectedRows = 0; // initialize var to track total num of affected rows
625 625
             $affectedRows += parent::doDeleteAll($con);
626 626
             // Because this db requires some delete cascade/set null emulation, we have to
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 
656 656
         // use transaction because $criteria could contain info
657 657
         // for more than one table or we could emulating ON DELETE CASCADE, etc.
658
-        return $con->transaction(function () use ($con, $criteria) {
658
+        return $con->transaction(function() use ($con, $criteria) {
659 659
             $affectedRows = 0; // initialize var to track total num of affected rows
660 660
 
661 661
             UserTableMap::removeInstanceFromPool($criteria);
Please login to merge, or discard this patch.
src/cli/Database/Base/Connection.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      *
306 306
      * @param  string  $msg
307 307
      * @param  int     $priority One of the Propel::LOG_* logging levels
308
-     * @return boolean
308
+     * @return boolean|null
309 309
      */
310 310
     protected function log($msg, $priority = Propel::LOG_INFO)
311 311
     {
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
      * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1029 1029
      * The default key type is the column's TableMap::TYPE_PHPNAME.
1030 1030
      *
1031
-     * @param mixed $parser A AbstractParser instance,
1031
+     * @param string $parser A AbstractParser instance,
1032 1032
      *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
1033 1033
      * @param string $data The source data to import from
1034 1034
      * @param string $keyType The type of keys the array uses.
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,6 @@
 block discarded – undo
17 17
 use Propel\Runtime\ActiveQuery\Criteria;
18 18
 use Propel\Runtime\ActiveQuery\ModelCriteria;
19 19
 use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
20
-use Propel\Runtime\Collection\Collection;
21 20
 use Propel\Runtime\Connection\ConnectionInterface;
22 21
 use Propel\Runtime\Exception\BadMethodCallException;
23 22
 use Propel\Runtime\Exception\LogicException;
Please login to merge, or discard this patch.
Indentation   +1537 added lines, -1537 removed lines patch added patch discarded remove patch
@@ -33,1555 +33,1555 @@
 block discarded – undo
33 33
 */
34 34
 abstract class Connection implements ActiveRecordInterface
35 35
 {
36
-    /**
37
-     * TableMap class name
38
-     */
39
-    const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\ConnectionTableMap';
40
-
41
-
42
-    /**
43
-     * attribute to determine if this object has previously been saved.
44
-     * @var boolean
45
-     */
46
-    protected $new = true;
47
-
48
-    /**
49
-     * attribute to determine whether this object has been deleted.
50
-     * @var boolean
51
-     */
52
-    protected $deleted = false;
53
-
54
-    /**
55
-     * The columns that have been modified in current object.
56
-     * Tracking modified columns allows us to only update modified columns.
57
-     * @var array
58
-     */
59
-    protected $modifiedColumns = array();
60
-
61
-    /**
62
-     * The (virtual) columns that are added at runtime
63
-     * The formatters can add supplementary columns based on a resultset
64
-     * @var array
65
-     */
66
-    protected $virtualColumns = array();
67
-
68
-    /**
69
-     * The value for the id field.
70
-     *
71
-     * @var        int
72
-     */
73
-    protected $id;
74
-
75
-    /**
76
-     * The value for the instance_name field.
77
-     *
78
-     * @var        string
79
-     */
80
-    protected $instance_name;
81
-
82
-    /**
83
-     * The value for the user_id field.
84
-     *
85
-     * @var        int
86
-     */
87
-    protected $user_id;
88
-
89
-    /**
90
-     * The value for the peer field.
91
-     *
92
-     * @var        string
93
-     */
94
-    protected $peer;
95
-
96
-    /**
97
-     * The value for the started field.
98
-     *
99
-     * @var        \DateTime
100
-     */
101
-    protected $started;
102
-
103
-    /**
104
-     * The value for the type field.
105
-     *
106
-     * @var        string
107
-     */
108
-    protected $type;
109
-
110
-    /**
111
-     * @var        ChildInstance
112
-     */
113
-    protected $aInstance;
114
-
115
-    /**
116
-     * @var        ChildUser
117
-     */
118
-    protected $aUser;
119
-
120
-    /**
121
-     * Flag to prevent endless save loop, if this object is referenced
122
-     * by another object which falls in this transaction.
123
-     *
124
-     * @var boolean
125
-     */
126
-    protected $alreadyInSave = false;
127
-
128
-    /**
129
-     * Initializes internal state of Jalle19\StatusManager\Database\Base\Connection object.
130
-     */
131
-    public function __construct()
132
-    {
133
-    }
134
-
135
-    /**
136
-     * Returns whether the object has been modified.
137
-     *
138
-     * @return boolean True if the object has been modified.
139
-     */
140
-    public function isModified()
141
-    {
142
-        return !!$this->modifiedColumns;
143
-    }
144
-
145
-    /**
146
-     * Has specified column been modified?
147
-     *
148
-     * @param  string  $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
149
-     * @return boolean True if $col has been modified.
150
-     */
151
-    public function isColumnModified($col)
152
-    {
153
-        return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
154
-    }
155
-
156
-    /**
157
-     * Get the columns that have been modified in this object.
158
-     * @return array A unique list of the modified column names for this object.
159
-     */
160
-    public function getModifiedColumns()
161
-    {
162
-        return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
163
-    }
164
-
165
-    /**
166
-     * Returns whether the object has ever been saved.  This will
167
-     * be false, if the object was retrieved from storage or was created
168
-     * and then saved.
169
-     *
170
-     * @return boolean true, if the object has never been persisted.
171
-     */
172
-    public function isNew()
173
-    {
174
-        return $this->new;
175
-    }
176
-
177
-    /**
178
-     * Setter for the isNew attribute.  This method will be called
179
-     * by Propel-generated children and objects.
180
-     *
181
-     * @param boolean $b the state of the object.
182
-     */
183
-    public function setNew($b)
184
-    {
185
-        $this->new = (boolean) $b;
186
-    }
187
-
188
-    /**
189
-     * Whether this object has been deleted.
190
-     * @return boolean The deleted state of this object.
191
-     */
192
-    public function isDeleted()
193
-    {
194
-        return $this->deleted;
195
-    }
196
-
197
-    /**
198
-     * Specify whether this object has been deleted.
199
-     * @param  boolean $b The deleted state of this object.
200
-     * @return void
201
-     */
202
-    public function setDeleted($b)
203
-    {
204
-        $this->deleted = (boolean) $b;
205
-    }
206
-
207
-    /**
208
-     * Sets the modified state for the object to be false.
209
-     * @param  string $col If supplied, only the specified column is reset.
210
-     * @return void
211
-     */
212
-    public function resetModified($col = null)
213
-    {
214
-        if (null !== $col) {
215
-            if (isset($this->modifiedColumns[$col])) {
216
-                unset($this->modifiedColumns[$col]);
217
-            }
218
-        } else {
219
-            $this->modifiedColumns = array();
220
-        }
221
-    }
222
-
223
-    /**
224
-     * Compares this with another <code>Connection</code> instance.  If
225
-     * <code>obj</code> is an instance of <code>Connection</code>, delegates to
226
-     * <code>equals(Connection)</code>.  Otherwise, returns <code>false</code>.
227
-     *
228
-     * @param  mixed   $obj The object to compare to.
229
-     * @return boolean Whether equal to the object specified.
230
-     */
231
-    public function equals($obj)
232
-    {
233
-        if (!$obj instanceof static) {
234
-            return false;
235
-        }
236
-
237
-        if ($this === $obj) {
238
-            return true;
239
-        }
240
-
241
-        if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) {
242
-            return false;
243
-        }
244
-
245
-        return $this->getPrimaryKey() === $obj->getPrimaryKey();
246
-    }
247
-
248
-    /**
249
-     * Get the associative array of the virtual columns in this object
250
-     *
251
-     * @return array
252
-     */
253
-    public function getVirtualColumns()
254
-    {
255
-        return $this->virtualColumns;
256
-    }
257
-
258
-    /**
259
-     * Checks the existence of a virtual column in this object
260
-     *
261
-     * @param  string  $name The virtual column name
262
-     * @return boolean
263
-     */
264
-    public function hasVirtualColumn($name)
265
-    {
266
-        return array_key_exists($name, $this->virtualColumns);
267
-    }
268
-
269
-    /**
270
-     * Get the value of a virtual column in this object
271
-     *
272
-     * @param  string $name The virtual column name
273
-     * @return mixed
274
-     *
275
-     * @throws PropelException
276
-     */
277
-    public function getVirtualColumn($name)
278
-    {
279
-        if (!$this->hasVirtualColumn($name)) {
280
-            throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
281
-        }
282
-
283
-        return $this->virtualColumns[$name];
284
-    }
285
-
286
-    /**
287
-     * Set the value of a virtual column in this object
288
-     *
289
-     * @param string $name  The virtual column name
290
-     * @param mixed  $value The value to give to the virtual column
291
-     *
292
-     * @return $this|Connection The current object, for fluid interface
293
-     */
294
-    public function setVirtualColumn($name, $value)
295
-    {
296
-        $this->virtualColumns[$name] = $value;
297
-
298
-        return $this;
299
-    }
300
-
301
-    /**
302
-     * Logs a message using Propel::log().
303
-     *
304
-     * @param  string  $msg
305
-     * @param  int     $priority One of the Propel::LOG_* logging levels
306
-     * @return boolean
307
-     */
308
-    protected function log($msg, $priority = Propel::LOG_INFO)
309
-    {
310
-        return Propel::log(get_class($this) . ': ' . $msg, $priority);
311
-    }
312
-
313
-    /**
314
-     * Export the current object properties to a string, using a given parser format
315
-     * <code>
316
-     * $book = BookQuery::create()->findPk(9012);
317
-     * echo $book->exportTo('JSON');
318
-     *  => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
319
-     * </code>
320
-     *
321
-     * @param  mixed   $parser                 A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
322
-     * @param  boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
323
-     * @return string  The exported data
324
-     */
325
-    public function exportTo($parser, $includeLazyLoadColumns = true)
326
-    {
327
-        if (!$parser instanceof AbstractParser) {
328
-            $parser = AbstractParser::getParser($parser);
329
-        }
330
-
331
-        return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
332
-    }
333
-
334
-    /**
335
-     * Clean up internal collections prior to serializing
336
-     * Avoids recursive loops that turn into segmentation faults when serializing
337
-     */
338
-    public function __sleep()
339
-    {
340
-        $this->clearAllReferences();
341
-
342
-        $cls = new \ReflectionClass($this);
343
-        $propertyNames = [];
344
-        $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
345
-
346
-        foreach($serializableProperties as $property) {
347
-            $propertyNames[] = $property->getName();
348
-        }
349
-
350
-        return $propertyNames;
351
-    }
352
-
353
-    /**
354
-     * Get the [id] column value.
355
-     *
356
-     * @return int
357
-     */
358
-    public function getId()
359
-    {
360
-        return $this->id;
361
-    }
362
-
363
-    /**
364
-     * Get the [instance_name] column value.
365
-     *
366
-     * @return string
367
-     */
368
-    public function getInstanceName()
369
-    {
370
-        return $this->instance_name;
371
-    }
372
-
373
-    /**
374
-     * Get the [user_id] column value.
375
-     *
376
-     * @return int
377
-     */
378
-    public function getUserId()
379
-    {
380
-        return $this->user_id;
381
-    }
382
-
383
-    /**
384
-     * Get the [peer] column value.
385
-     *
386
-     * @return string
387
-     */
388
-    public function getPeer()
389
-    {
390
-        return $this->peer;
391
-    }
392
-
393
-    /**
394
-     * Get the [optionally formatted] temporal [started] column value.
395
-     *
396
-     *
397
-     * @param      string $format The date/time format string (either date()-style or strftime()-style).
398
-     *                            If format is NULL, then the raw DateTime object will be returned.
399
-     *
400
-     * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
401
-     *
402
-     * @throws PropelException - if unable to parse/validate the date/time value.
403
-     */
404
-    public function getStarted($format = NULL)
405
-    {
406
-        if ($format === null) {
407
-            return $this->started;
408
-        } else {
409
-            return $this->started instanceof \DateTime ? $this->started->format($format) : null;
410
-        }
411
-    }
412
-
413
-    /**
414
-     * Get the [type] column value.
415
-     *
416
-     * @return string
417
-     */
418
-    public function getType()
419
-    {
420
-        return $this->type;
421
-    }
422
-
423
-    /**
424
-     * Set the value of [id] column.
425
-     *
426
-     * @param int $v new value
427
-     * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
428
-     */
429
-    public function setId($v)
430
-    {
431
-        if ($v !== null) {
432
-            $v = (int) $v;
433
-        }
434
-
435
-        if ($this->id !== $v) {
436
-            $this->id = $v;
437
-            $this->modifiedColumns[ConnectionTableMap::COL_ID] = true;
438
-        }
439
-
440
-        return $this;
441
-    } // setId()
442
-
443
-    /**
444
-     * Set the value of [instance_name] column.
445
-     *
446
-     * @param string $v new value
447
-     * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
448
-     */
449
-    public function setInstanceName($v)
450
-    {
451
-        if ($v !== null) {
452
-            $v = (string) $v;
453
-        }
454
-
455
-        if ($this->instance_name !== $v) {
456
-            $this->instance_name = $v;
457
-            $this->modifiedColumns[ConnectionTableMap::COL_INSTANCE_NAME] = true;
458
-        }
459
-
460
-        if ($this->aInstance !== null && $this->aInstance->getName() !== $v) {
461
-            $this->aInstance = null;
462
-        }
463
-
464
-        return $this;
465
-    } // setInstanceName()
466
-
467
-    /**
468
-     * Set the value of [user_id] column.
469
-     *
470
-     * @param int $v new value
471
-     * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
472
-     */
473
-    public function setUserId($v)
474
-    {
475
-        if ($v !== null) {
476
-            $v = (int) $v;
477
-        }
478
-
479
-        if ($this->user_id !== $v) {
480
-            $this->user_id = $v;
481
-            $this->modifiedColumns[ConnectionTableMap::COL_USER_ID] = true;
482
-        }
483
-
484
-        if ($this->aUser !== null && $this->aUser->getId() !== $v) {
485
-            $this->aUser = null;
486
-        }
487
-
488
-        return $this;
489
-    } // setUserId()
490
-
491
-    /**
492
-     * Set the value of [peer] column.
493
-     *
494
-     * @param string $v new value
495
-     * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
496
-     */
497
-    public function setPeer($v)
498
-    {
499
-        if ($v !== null) {
500
-            $v = (string) $v;
501
-        }
502
-
503
-        if ($this->peer !== $v) {
504
-            $this->peer = $v;
505
-            $this->modifiedColumns[ConnectionTableMap::COL_PEER] = true;
506
-        }
507
-
508
-        return $this;
509
-    } // setPeer()
510
-
511
-    /**
512
-     * Sets the value of [started] column to a normalized version of the date/time value specified.
513
-     *
514
-     * @param  mixed $v string, integer (timestamp), or \DateTime value.
515
-     *               Empty strings are treated as NULL.
516
-     * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
517
-     */
518
-    public function setStarted($v)
519
-    {
520
-        $dt = PropelDateTime::newInstance($v, null, 'DateTime');
521
-        if ($this->started !== null || $dt !== null) {
522
-            if ($this->started === null || $dt === null || $dt->format("Y-m-d H:i:s") !== $this->started->format("Y-m-d H:i:s")) {
523
-                $this->started = $dt === null ? null : clone $dt;
524
-                $this->modifiedColumns[ConnectionTableMap::COL_STARTED] = true;
525
-            }
526
-        } // if either are not null
527
-
528
-        return $this;
529
-    } // setStarted()
530
-
531
-    /**
532
-     * Set the value of [type] column.
533
-     *
534
-     * @param string $v new value
535
-     * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
536
-     */
537
-    public function setType($v)
538
-    {
539
-        if ($v !== null) {
540
-            $v = (string) $v;
541
-        }
542
-
543
-        if ($this->type !== $v) {
544
-            $this->type = $v;
545
-            $this->modifiedColumns[ConnectionTableMap::COL_TYPE] = true;
546
-        }
547
-
548
-        return $this;
549
-    } // setType()
550
-
551
-    /**
552
-     * Indicates whether the columns in this object are only set to default values.
553
-     *
554
-     * This method can be used in conjunction with isModified() to indicate whether an object is both
555
-     * modified _and_ has some values set which are non-default.
556
-     *
557
-     * @return boolean Whether the columns in this object are only been set with default values.
558
-     */
559
-    public function hasOnlyDefaultValues()
560
-    {
561
-        // otherwise, everything was equal, so return TRUE
562
-        return true;
563
-    } // hasOnlyDefaultValues()
564
-
565
-    /**
566
-     * Hydrates (populates) the object variables with values from the database resultset.
567
-     *
568
-     * An offset (0-based "start column") is specified so that objects can be hydrated
569
-     * with a subset of the columns in the resultset rows.  This is needed, for example,
570
-     * for results of JOIN queries where the resultset row includes columns from two or
571
-     * more tables.
572
-     *
573
-     * @param array   $row       The row returned by DataFetcher->fetch().
574
-     * @param int     $startcol  0-based offset column which indicates which restultset column to start with.
575
-     * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
576
-     * @param string  $indexType The index type of $row. Mostly DataFetcher->getIndexType().
36
+	/**
37
+	 * TableMap class name
38
+	 */
39
+	const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\ConnectionTableMap';
40
+
41
+
42
+	/**
43
+	 * attribute to determine if this object has previously been saved.
44
+	 * @var boolean
45
+	 */
46
+	protected $new = true;
47
+
48
+	/**
49
+	 * attribute to determine whether this object has been deleted.
50
+	 * @var boolean
51
+	 */
52
+	protected $deleted = false;
53
+
54
+	/**
55
+	 * The columns that have been modified in current object.
56
+	 * Tracking modified columns allows us to only update modified columns.
57
+	 * @var array
58
+	 */
59
+	protected $modifiedColumns = array();
60
+
61
+	/**
62
+	 * The (virtual) columns that are added at runtime
63
+	 * The formatters can add supplementary columns based on a resultset
64
+	 * @var array
65
+	 */
66
+	protected $virtualColumns = array();
67
+
68
+	/**
69
+	 * The value for the id field.
70
+	 *
71
+	 * @var        int
72
+	 */
73
+	protected $id;
74
+
75
+	/**
76
+	 * The value for the instance_name field.
77
+	 *
78
+	 * @var        string
79
+	 */
80
+	protected $instance_name;
81
+
82
+	/**
83
+	 * The value for the user_id field.
84
+	 *
85
+	 * @var        int
86
+	 */
87
+	protected $user_id;
88
+
89
+	/**
90
+	 * The value for the peer field.
91
+	 *
92
+	 * @var        string
93
+	 */
94
+	protected $peer;
95
+
96
+	/**
97
+	 * The value for the started field.
98
+	 *
99
+	 * @var        \DateTime
100
+	 */
101
+	protected $started;
102
+
103
+	/**
104
+	 * The value for the type field.
105
+	 *
106
+	 * @var        string
107
+	 */
108
+	protected $type;
109
+
110
+	/**
111
+	 * @var        ChildInstance
112
+	 */
113
+	protected $aInstance;
114
+
115
+	/**
116
+	 * @var        ChildUser
117
+	 */
118
+	protected $aUser;
119
+
120
+	/**
121
+	 * Flag to prevent endless save loop, if this object is referenced
122
+	 * by another object which falls in this transaction.
123
+	 *
124
+	 * @var boolean
125
+	 */
126
+	protected $alreadyInSave = false;
127
+
128
+	/**
129
+	 * Initializes internal state of Jalle19\StatusManager\Database\Base\Connection object.
130
+	 */
131
+	public function __construct()
132
+	{
133
+	}
134
+
135
+	/**
136
+	 * Returns whether the object has been modified.
137
+	 *
138
+	 * @return boolean True if the object has been modified.
139
+	 */
140
+	public function isModified()
141
+	{
142
+		return !!$this->modifiedColumns;
143
+	}
144
+
145
+	/**
146
+	 * Has specified column been modified?
147
+	 *
148
+	 * @param  string  $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
149
+	 * @return boolean True if $col has been modified.
150
+	 */
151
+	public function isColumnModified($col)
152
+	{
153
+		return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
154
+	}
155
+
156
+	/**
157
+	 * Get the columns that have been modified in this object.
158
+	 * @return array A unique list of the modified column names for this object.
159
+	 */
160
+	public function getModifiedColumns()
161
+	{
162
+		return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
163
+	}
164
+
165
+	/**
166
+	 * Returns whether the object has ever been saved.  This will
167
+	 * be false, if the object was retrieved from storage or was created
168
+	 * and then saved.
169
+	 *
170
+	 * @return boolean true, if the object has never been persisted.
171
+	 */
172
+	public function isNew()
173
+	{
174
+		return $this->new;
175
+	}
176
+
177
+	/**
178
+	 * Setter for the isNew attribute.  This method will be called
179
+	 * by Propel-generated children and objects.
180
+	 *
181
+	 * @param boolean $b the state of the object.
182
+	 */
183
+	public function setNew($b)
184
+	{
185
+		$this->new = (boolean) $b;
186
+	}
187
+
188
+	/**
189
+	 * Whether this object has been deleted.
190
+	 * @return boolean The deleted state of this object.
191
+	 */
192
+	public function isDeleted()
193
+	{
194
+		return $this->deleted;
195
+	}
196
+
197
+	/**
198
+	 * Specify whether this object has been deleted.
199
+	 * @param  boolean $b The deleted state of this object.
200
+	 * @return void
201
+	 */
202
+	public function setDeleted($b)
203
+	{
204
+		$this->deleted = (boolean) $b;
205
+	}
206
+
207
+	/**
208
+	 * Sets the modified state for the object to be false.
209
+	 * @param  string $col If supplied, only the specified column is reset.
210
+	 * @return void
211
+	 */
212
+	public function resetModified($col = null)
213
+	{
214
+		if (null !== $col) {
215
+			if (isset($this->modifiedColumns[$col])) {
216
+				unset($this->modifiedColumns[$col]);
217
+			}
218
+		} else {
219
+			$this->modifiedColumns = array();
220
+		}
221
+	}
222
+
223
+	/**
224
+	 * Compares this with another <code>Connection</code> instance.  If
225
+	 * <code>obj</code> is an instance of <code>Connection</code>, delegates to
226
+	 * <code>equals(Connection)</code>.  Otherwise, returns <code>false</code>.
227
+	 *
228
+	 * @param  mixed   $obj The object to compare to.
229
+	 * @return boolean Whether equal to the object specified.
230
+	 */
231
+	public function equals($obj)
232
+	{
233
+		if (!$obj instanceof static) {
234
+			return false;
235
+		}
236
+
237
+		if ($this === $obj) {
238
+			return true;
239
+		}
240
+
241
+		if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) {
242
+			return false;
243
+		}
244
+
245
+		return $this->getPrimaryKey() === $obj->getPrimaryKey();
246
+	}
247
+
248
+	/**
249
+	 * Get the associative array of the virtual columns in this object
250
+	 *
251
+	 * @return array
252
+	 */
253
+	public function getVirtualColumns()
254
+	{
255
+		return $this->virtualColumns;
256
+	}
257
+
258
+	/**
259
+	 * Checks the existence of a virtual column in this object
260
+	 *
261
+	 * @param  string  $name The virtual column name
262
+	 * @return boolean
263
+	 */
264
+	public function hasVirtualColumn($name)
265
+	{
266
+		return array_key_exists($name, $this->virtualColumns);
267
+	}
268
+
269
+	/**
270
+	 * Get the value of a virtual column in this object
271
+	 *
272
+	 * @param  string $name The virtual column name
273
+	 * @return mixed
274
+	 *
275
+	 * @throws PropelException
276
+	 */
277
+	public function getVirtualColumn($name)
278
+	{
279
+		if (!$this->hasVirtualColumn($name)) {
280
+			throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
281
+		}
282
+
283
+		return $this->virtualColumns[$name];
284
+	}
285
+
286
+	/**
287
+	 * Set the value of a virtual column in this object
288
+	 *
289
+	 * @param string $name  The virtual column name
290
+	 * @param mixed  $value The value to give to the virtual column
291
+	 *
292
+	 * @return $this|Connection The current object, for fluid interface
293
+	 */
294
+	public function setVirtualColumn($name, $value)
295
+	{
296
+		$this->virtualColumns[$name] = $value;
297
+
298
+		return $this;
299
+	}
300
+
301
+	/**
302
+	 * Logs a message using Propel::log().
303
+	 *
304
+	 * @param  string  $msg
305
+	 * @param  int     $priority One of the Propel::LOG_* logging levels
306
+	 * @return boolean
307
+	 */
308
+	protected function log($msg, $priority = Propel::LOG_INFO)
309
+	{
310
+		return Propel::log(get_class($this) . ': ' . $msg, $priority);
311
+	}
312
+
313
+	/**
314
+	 * Export the current object properties to a string, using a given parser format
315
+	 * <code>
316
+	 * $book = BookQuery::create()->findPk(9012);
317
+	 * echo $book->exportTo('JSON');
318
+	 *  => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
319
+	 * </code>
320
+	 *
321
+	 * @param  mixed   $parser                 A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
322
+	 * @param  boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
323
+	 * @return string  The exported data
324
+	 */
325
+	public function exportTo($parser, $includeLazyLoadColumns = true)
326
+	{
327
+		if (!$parser instanceof AbstractParser) {
328
+			$parser = AbstractParser::getParser($parser);
329
+		}
330
+
331
+		return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
332
+	}
333
+
334
+	/**
335
+	 * Clean up internal collections prior to serializing
336
+	 * Avoids recursive loops that turn into segmentation faults when serializing
337
+	 */
338
+	public function __sleep()
339
+	{
340
+		$this->clearAllReferences();
341
+
342
+		$cls = new \ReflectionClass($this);
343
+		$propertyNames = [];
344
+		$serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
345
+
346
+		foreach($serializableProperties as $property) {
347
+			$propertyNames[] = $property->getName();
348
+		}
349
+
350
+		return $propertyNames;
351
+	}
352
+
353
+	/**
354
+	 * Get the [id] column value.
355
+	 *
356
+	 * @return int
357
+	 */
358
+	public function getId()
359
+	{
360
+		return $this->id;
361
+	}
362
+
363
+	/**
364
+	 * Get the [instance_name] column value.
365
+	 *
366
+	 * @return string
367
+	 */
368
+	public function getInstanceName()
369
+	{
370
+		return $this->instance_name;
371
+	}
372
+
373
+	/**
374
+	 * Get the [user_id] column value.
375
+	 *
376
+	 * @return int
377
+	 */
378
+	public function getUserId()
379
+	{
380
+		return $this->user_id;
381
+	}
382
+
383
+	/**
384
+	 * Get the [peer] column value.
385
+	 *
386
+	 * @return string
387
+	 */
388
+	public function getPeer()
389
+	{
390
+		return $this->peer;
391
+	}
392
+
393
+	/**
394
+	 * Get the [optionally formatted] temporal [started] column value.
395
+	 *
396
+	 *
397
+	 * @param      string $format The date/time format string (either date()-style or strftime()-style).
398
+	 *                            If format is NULL, then the raw DateTime object will be returned.
399
+	 *
400
+	 * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
401
+	 *
402
+	 * @throws PropelException - if unable to parse/validate the date/time value.
403
+	 */
404
+	public function getStarted($format = NULL)
405
+	{
406
+		if ($format === null) {
407
+			return $this->started;
408
+		} else {
409
+			return $this->started instanceof \DateTime ? $this->started->format($format) : null;
410
+		}
411
+	}
412
+
413
+	/**
414
+	 * Get the [type] column value.
415
+	 *
416
+	 * @return string
417
+	 */
418
+	public function getType()
419
+	{
420
+		return $this->type;
421
+	}
422
+
423
+	/**
424
+	 * Set the value of [id] column.
425
+	 *
426
+	 * @param int $v new value
427
+	 * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
428
+	 */
429
+	public function setId($v)
430
+	{
431
+		if ($v !== null) {
432
+			$v = (int) $v;
433
+		}
434
+
435
+		if ($this->id !== $v) {
436
+			$this->id = $v;
437
+			$this->modifiedColumns[ConnectionTableMap::COL_ID] = true;
438
+		}
439
+
440
+		return $this;
441
+	} // setId()
442
+
443
+	/**
444
+	 * Set the value of [instance_name] column.
445
+	 *
446
+	 * @param string $v new value
447
+	 * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
448
+	 */
449
+	public function setInstanceName($v)
450
+	{
451
+		if ($v !== null) {
452
+			$v = (string) $v;
453
+		}
454
+
455
+		if ($this->instance_name !== $v) {
456
+			$this->instance_name = $v;
457
+			$this->modifiedColumns[ConnectionTableMap::COL_INSTANCE_NAME] = true;
458
+		}
459
+
460
+		if ($this->aInstance !== null && $this->aInstance->getName() !== $v) {
461
+			$this->aInstance = null;
462
+		}
463
+
464
+		return $this;
465
+	} // setInstanceName()
466
+
467
+	/**
468
+	 * Set the value of [user_id] column.
469
+	 *
470
+	 * @param int $v new value
471
+	 * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
472
+	 */
473
+	public function setUserId($v)
474
+	{
475
+		if ($v !== null) {
476
+			$v = (int) $v;
477
+		}
478
+
479
+		if ($this->user_id !== $v) {
480
+			$this->user_id = $v;
481
+			$this->modifiedColumns[ConnectionTableMap::COL_USER_ID] = true;
482
+		}
483
+
484
+		if ($this->aUser !== null && $this->aUser->getId() !== $v) {
485
+			$this->aUser = null;
486
+		}
487
+
488
+		return $this;
489
+	} // setUserId()
490
+
491
+	/**
492
+	 * Set the value of [peer] column.
493
+	 *
494
+	 * @param string $v new value
495
+	 * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
496
+	 */
497
+	public function setPeer($v)
498
+	{
499
+		if ($v !== null) {
500
+			$v = (string) $v;
501
+		}
502
+
503
+		if ($this->peer !== $v) {
504
+			$this->peer = $v;
505
+			$this->modifiedColumns[ConnectionTableMap::COL_PEER] = true;
506
+		}
507
+
508
+		return $this;
509
+	} // setPeer()
510
+
511
+	/**
512
+	 * Sets the value of [started] column to a normalized version of the date/time value specified.
513
+	 *
514
+	 * @param  mixed $v string, integer (timestamp), or \DateTime value.
515
+	 *               Empty strings are treated as NULL.
516
+	 * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
517
+	 */
518
+	public function setStarted($v)
519
+	{
520
+		$dt = PropelDateTime::newInstance($v, null, 'DateTime');
521
+		if ($this->started !== null || $dt !== null) {
522
+			if ($this->started === null || $dt === null || $dt->format("Y-m-d H:i:s") !== $this->started->format("Y-m-d H:i:s")) {
523
+				$this->started = $dt === null ? null : clone $dt;
524
+				$this->modifiedColumns[ConnectionTableMap::COL_STARTED] = true;
525
+			}
526
+		} // if either are not null
527
+
528
+		return $this;
529
+	} // setStarted()
530
+
531
+	/**
532
+	 * Set the value of [type] column.
533
+	 *
534
+	 * @param string $v new value
535
+	 * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
536
+	 */
537
+	public function setType($v)
538
+	{
539
+		if ($v !== null) {
540
+			$v = (string) $v;
541
+		}
542
+
543
+		if ($this->type !== $v) {
544
+			$this->type = $v;
545
+			$this->modifiedColumns[ConnectionTableMap::COL_TYPE] = true;
546
+		}
547
+
548
+		return $this;
549
+	} // setType()
550
+
551
+	/**
552
+	 * Indicates whether the columns in this object are only set to default values.
553
+	 *
554
+	 * This method can be used in conjunction with isModified() to indicate whether an object is both
555
+	 * modified _and_ has some values set which are non-default.
556
+	 *
557
+	 * @return boolean Whether the columns in this object are only been set with default values.
558
+	 */
559
+	public function hasOnlyDefaultValues()
560
+	{
561
+		// otherwise, everything was equal, so return TRUE
562
+		return true;
563
+	} // hasOnlyDefaultValues()
564
+
565
+	/**
566
+	 * Hydrates (populates) the object variables with values from the database resultset.
567
+	 *
568
+	 * An offset (0-based "start column") is specified so that objects can be hydrated
569
+	 * with a subset of the columns in the resultset rows.  This is needed, for example,
570
+	 * for results of JOIN queries where the resultset row includes columns from two or
571
+	 * more tables.
572
+	 *
573
+	 * @param array   $row       The row returned by DataFetcher->fetch().
574
+	 * @param int     $startcol  0-based offset column which indicates which restultset column to start with.
575
+	 * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
576
+	 * @param string  $indexType The index type of $row. Mostly DataFetcher->getIndexType().
577 577
                                   One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
578
-     *                            TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
579
-     *
580
-     * @return int             next starting column
581
-     * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
582
-     */
583
-    public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
584
-    {
585
-        try {
586
-
587
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ConnectionTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
588
-            $this->id = (null !== $col) ? (int) $col : null;
589
-
590
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ConnectionTableMap::translateFieldName('InstanceName', TableMap::TYPE_PHPNAME, $indexType)];
591
-            $this->instance_name = (null !== $col) ? (string) $col : null;
592
-
593
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ConnectionTableMap::translateFieldName('UserId', TableMap::TYPE_PHPNAME, $indexType)];
594
-            $this->user_id = (null !== $col) ? (int) $col : null;
595
-
596
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ConnectionTableMap::translateFieldName('Peer', TableMap::TYPE_PHPNAME, $indexType)];
597
-            $this->peer = (null !== $col) ? (string) $col : null;
598
-
599
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ConnectionTableMap::translateFieldName('Started', TableMap::TYPE_PHPNAME, $indexType)];
600
-            $this->started = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null;
601
-
602
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ConnectionTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)];
603
-            $this->type = (null !== $col) ? (string) $col : null;
604
-            $this->resetModified();
605
-
606
-            $this->setNew(false);
607
-
608
-            if ($rehydrate) {
609
-                $this->ensureConsistency();
610
-            }
611
-
612
-            return $startcol + 6; // 6 = ConnectionTableMap::NUM_HYDRATE_COLUMNS.
613
-
614
-        } catch (Exception $e) {
615
-            throw new PropelException(sprintf('Error populating %s object', '\\Jalle19\\StatusManager\\Database\\Connection'), 0, $e);
616
-        }
617
-    }
618
-
619
-    /**
620
-     * Checks and repairs the internal consistency of the object.
621
-     *
622
-     * This method is executed after an already-instantiated object is re-hydrated
623
-     * from the database.  It exists to check any foreign keys to make sure that
624
-     * the objects related to the current object are correct based on foreign key.
625
-     *
626
-     * You can override this method in the stub class, but you should always invoke
627
-     * the base method from the overridden method (i.e. parent::ensureConsistency()),
628
-     * in case your model changes.
629
-     *
630
-     * @throws PropelException
631
-     */
632
-    public function ensureConsistency()
633
-    {
634
-        if ($this->aInstance !== null && $this->instance_name !== $this->aInstance->getName()) {
635
-            $this->aInstance = null;
636
-        }
637
-        if ($this->aUser !== null && $this->user_id !== $this->aUser->getId()) {
638
-            $this->aUser = null;
639
-        }
640
-    } // ensureConsistency
641
-
642
-    /**
643
-     * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
644
-     *
645
-     * This will only work if the object has been saved and has a valid primary key set.
646
-     *
647
-     * @param      boolean $deep (optional) Whether to also de-associated any related objects.
648
-     * @param      ConnectionInterface $con (optional) The ConnectionInterface connection to use.
649
-     * @return void
650
-     * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
651
-     */
652
-    public function reload($deep = false, ConnectionInterface $con = null)
653
-    {
654
-        if ($this->isDeleted()) {
655
-            throw new PropelException("Cannot reload a deleted object.");
656
-        }
657
-
658
-        if ($this->isNew()) {
659
-            throw new PropelException("Cannot reload an unsaved object.");
660
-        }
661
-
662
-        if ($con === null) {
663
-            $con = Propel::getServiceContainer()->getReadConnection(ConnectionTableMap::DATABASE_NAME);
664
-        }
665
-
666
-        // We don't need to alter the object instance pool; we're just modifying this instance
667
-        // already in the pool.
668
-
669
-        $dataFetcher = ChildConnectionQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
670
-        $row = $dataFetcher->fetch();
671
-        $dataFetcher->close();
672
-        if (!$row) {
673
-            throw new PropelException('Cannot find matching row in the database to reload object values.');
674
-        }
675
-        $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
676
-
677
-        if ($deep) {  // also de-associate any related objects?
678
-
679
-            $this->aInstance = null;
680
-            $this->aUser = null;
681
-        } // if (deep)
682
-    }
683
-
684
-    /**
685
-     * Removes this object from datastore and sets delete attribute.
686
-     *
687
-     * @param      ConnectionInterface $con
688
-     * @return void
689
-     * @throws PropelException
690
-     * @see Connection::setDeleted()
691
-     * @see Connection::isDeleted()
692
-     */
693
-    public function delete(ConnectionInterface $con = null)
694
-    {
695
-        if ($this->isDeleted()) {
696
-            throw new PropelException("This object has already been deleted.");
697
-        }
698
-
699
-        if ($con === null) {
700
-            $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
701
-        }
702
-
703
-        $con->transaction(function () use ($con) {
704
-            $deleteQuery = ChildConnectionQuery::create()
705
-                ->filterByPrimaryKey($this->getPrimaryKey());
706
-            $ret = $this->preDelete($con);
707
-            if ($ret) {
708
-                $deleteQuery->delete($con);
709
-                $this->postDelete($con);
710
-                $this->setDeleted(true);
711
-            }
712
-        });
713
-    }
714
-
715
-    /**
716
-     * Persists this object to the database.
717
-     *
718
-     * If the object is new, it inserts it; otherwise an update is performed.
719
-     * All modified related objects will also be persisted in the doSave()
720
-     * method.  This method wraps all precipitate database operations in a
721
-     * single transaction.
722
-     *
723
-     * @param      ConnectionInterface $con
724
-     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
725
-     * @throws PropelException
726
-     * @see doSave()
727
-     */
728
-    public function save(ConnectionInterface $con = null)
729
-    {
730
-        if ($this->isDeleted()) {
731
-            throw new PropelException("You cannot save an object that has been deleted.");
732
-        }
733
-
734
-        if ($con === null) {
735
-            $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
736
-        }
737
-
738
-        return $con->transaction(function () use ($con) {
739
-            $isInsert = $this->isNew();
740
-            $ret = $this->preSave($con);
741
-            if ($isInsert) {
742
-                $ret = $ret && $this->preInsert($con);
743
-            } else {
744
-                $ret = $ret && $this->preUpdate($con);
745
-            }
746
-            if ($ret) {
747
-                $affectedRows = $this->doSave($con);
748
-                if ($isInsert) {
749
-                    $this->postInsert($con);
750
-                } else {
751
-                    $this->postUpdate($con);
752
-                }
753
-                $this->postSave($con);
754
-                ConnectionTableMap::addInstanceToPool($this);
755
-            } else {
756
-                $affectedRows = 0;
757
-            }
758
-
759
-            return $affectedRows;
760
-        });
761
-    }
762
-
763
-    /**
764
-     * Performs the work of inserting or updating the row in the database.
765
-     *
766
-     * If the object is new, it inserts it; otherwise an update is performed.
767
-     * All related objects are also updated in this method.
768
-     *
769
-     * @param      ConnectionInterface $con
770
-     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
771
-     * @throws PropelException
772
-     * @see save()
773
-     */
774
-    protected function doSave(ConnectionInterface $con)
775
-    {
776
-        $affectedRows = 0; // initialize var to track total num of affected rows
777
-        if (!$this->alreadyInSave) {
778
-            $this->alreadyInSave = true;
779
-
780
-            // We call the save method on the following object(s) if they
781
-            // were passed to this object by their corresponding set
782
-            // method.  This object relates to these object(s) by a
783
-            // foreign key reference.
784
-
785
-            if ($this->aInstance !== null) {
786
-                if ($this->aInstance->isModified() || $this->aInstance->isNew()) {
787
-                    $affectedRows += $this->aInstance->save($con);
788
-                }
789
-                $this->setInstance($this->aInstance);
790
-            }
791
-
792
-            if ($this->aUser !== null) {
793
-                if ($this->aUser->isModified() || $this->aUser->isNew()) {
794
-                    $affectedRows += $this->aUser->save($con);
795
-                }
796
-                $this->setUser($this->aUser);
797
-            }
798
-
799
-            if ($this->isNew() || $this->isModified()) {
800
-                // persist changes
801
-                if ($this->isNew()) {
802
-                    $this->doInsert($con);
803
-                    $affectedRows += 1;
804
-                } else {
805
-                    $affectedRows += $this->doUpdate($con);
806
-                }
807
-                $this->resetModified();
808
-            }
809
-
810
-            $this->alreadyInSave = false;
811
-
812
-        }
813
-
814
-        return $affectedRows;
815
-    } // doSave()
816
-
817
-    /**
818
-     * Insert the row in the database.
819
-     *
820
-     * @param      ConnectionInterface $con
821
-     *
822
-     * @throws PropelException
823
-     * @see doSave()
824
-     */
825
-    protected function doInsert(ConnectionInterface $con)
826
-    {
827
-        $modifiedColumns = array();
828
-        $index = 0;
829
-
830
-        $this->modifiedColumns[ConnectionTableMap::COL_ID] = true;
831
-        if (null !== $this->id) {
832
-            throw new PropelException('Cannot insert a value for auto-increment primary key (' . ConnectionTableMap::COL_ID . ')');
833
-        }
834
-
835
-         // check the columns in natural order for more readable SQL queries
836
-        if ($this->isColumnModified(ConnectionTableMap::COL_ID)) {
837
-            $modifiedColumns[':p' . $index++]  = 'id';
838
-        }
839
-        if ($this->isColumnModified(ConnectionTableMap::COL_INSTANCE_NAME)) {
840
-            $modifiedColumns[':p' . $index++]  = 'instance_name';
841
-        }
842
-        if ($this->isColumnModified(ConnectionTableMap::COL_USER_ID)) {
843
-            $modifiedColumns[':p' . $index++]  = 'user_id';
844
-        }
845
-        if ($this->isColumnModified(ConnectionTableMap::COL_PEER)) {
846
-            $modifiedColumns[':p' . $index++]  = 'peer';
847
-        }
848
-        if ($this->isColumnModified(ConnectionTableMap::COL_STARTED)) {
849
-            $modifiedColumns[':p' . $index++]  = 'started';
850
-        }
851
-        if ($this->isColumnModified(ConnectionTableMap::COL_TYPE)) {
852
-            $modifiedColumns[':p' . $index++]  = 'type';
853
-        }
854
-
855
-        $sql = sprintf(
856
-            'INSERT INTO connection (%s) VALUES (%s)',
857
-            implode(', ', $modifiedColumns),
858
-            implode(', ', array_keys($modifiedColumns))
859
-        );
860
-
861
-        try {
862
-            $stmt = $con->prepare($sql);
863
-            foreach ($modifiedColumns as $identifier => $columnName) {
864
-                switch ($columnName) {
865
-                    case 'id':
866
-                        $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
867
-                        break;
868
-                    case 'instance_name':
869
-                        $stmt->bindValue($identifier, $this->instance_name, PDO::PARAM_STR);
870
-                        break;
871
-                    case 'user_id':
872
-                        $stmt->bindValue($identifier, $this->user_id, PDO::PARAM_INT);
873
-                        break;
874
-                    case 'peer':
875
-                        $stmt->bindValue($identifier, $this->peer, PDO::PARAM_STR);
876
-                        break;
877
-                    case 'started':
878
-                        $stmt->bindValue($identifier, $this->started ? $this->started->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
879
-                        break;
880
-                    case 'type':
881
-                        $stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
882
-                        break;
883
-                }
884
-            }
885
-            $stmt->execute();
886
-        } catch (Exception $e) {
887
-            Propel::log($e->getMessage(), Propel::LOG_ERR);
888
-            throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
889
-        }
890
-
891
-        try {
892
-            $pk = $con->lastInsertId();
893
-        } catch (Exception $e) {
894
-            throw new PropelException('Unable to get autoincrement id.', 0, $e);
895
-        }
896
-        $this->setId($pk);
897
-
898
-        $this->setNew(false);
899
-    }
900
-
901
-    /**
902
-     * Update the row in the database.
903
-     *
904
-     * @param      ConnectionInterface $con
905
-     *
906
-     * @return Integer Number of updated rows
907
-     * @see doSave()
908
-     */
909
-    protected function doUpdate(ConnectionInterface $con)
910
-    {
911
-        $selectCriteria = $this->buildPkeyCriteria();
912
-        $valuesCriteria = $this->buildCriteria();
913
-
914
-        return $selectCriteria->doUpdate($valuesCriteria, $con);
915
-    }
916
-
917
-    /**
918
-     * Retrieves a field from the object by name passed in as a string.
919
-     *
920
-     * @param      string $name name
921
-     * @param      string $type The type of fieldname the $name is of:
922
-     *                     one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
923
-     *                     TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
924
-     *                     Defaults to TableMap::TYPE_PHPNAME.
925
-     * @return mixed Value of field.
926
-     */
927
-    public function getByName($name, $type = TableMap::TYPE_PHPNAME)
928
-    {
929
-        $pos = ConnectionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
930
-        $field = $this->getByPosition($pos);
931
-
932
-        return $field;
933
-    }
934
-
935
-    /**
936
-     * Retrieves a field from the object by Position as specified in the xml schema.
937
-     * Zero-based.
938
-     *
939
-     * @param      int $pos position in xml schema
940
-     * @return mixed Value of field at $pos
941
-     */
942
-    public function getByPosition($pos)
943
-    {
944
-        switch ($pos) {
945
-            case 0:
946
-                return $this->getId();
947
-                break;
948
-            case 1:
949
-                return $this->getInstanceName();
950
-                break;
951
-            case 2:
952
-                return $this->getUserId();
953
-                break;
954
-            case 3:
955
-                return $this->getPeer();
956
-                break;
957
-            case 4:
958
-                return $this->getStarted();
959
-                break;
960
-            case 5:
961
-                return $this->getType();
962
-                break;
963
-            default:
964
-                return null;
965
-                break;
966
-        } // switch()
967
-    }
968
-
969
-    /**
970
-     * Exports the object as an array.
971
-     *
972
-     * You can specify the key type of the array by passing one of the class
973
-     * type constants.
974
-     *
975
-     * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
976
-     *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
977
-     *                    Defaults to TableMap::TYPE_PHPNAME.
978
-     * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
979
-     * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
980
-     * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
981
-     *
982
-     * @return array an associative array containing the field names (as keys) and field values
983
-     */
984
-    public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
985
-    {
986
-
987
-        if (isset($alreadyDumpedObjects['Connection'][$this->hashCode()])) {
988
-            return '*RECURSION*';
989
-        }
990
-        $alreadyDumpedObjects['Connection'][$this->hashCode()] = true;
991
-        $keys = ConnectionTableMap::getFieldNames($keyType);
992
-        $result = array(
993
-            $keys[0] => $this->getId(),
994
-            $keys[1] => $this->getInstanceName(),
995
-            $keys[2] => $this->getUserId(),
996
-            $keys[3] => $this->getPeer(),
997
-            $keys[4] => $this->getStarted(),
998
-            $keys[5] => $this->getType(),
999
-        );
1000
-        if ($result[$keys[4]] instanceof \DateTime) {
1001
-            $result[$keys[4]] = $result[$keys[4]]->format('c');
1002
-        }
1003
-
1004
-        $virtualColumns = $this->virtualColumns;
1005
-        foreach ($virtualColumns as $key => $virtualColumn) {
1006
-            $result[$key] = $virtualColumn;
1007
-        }
1008
-
1009
-        if ($includeForeignObjects) {
1010
-            if (null !== $this->aInstance) {
1011
-
1012
-                switch ($keyType) {
1013
-                    case TableMap::TYPE_CAMELNAME:
1014
-                        $key = 'instance';
1015
-                        break;
1016
-                    case TableMap::TYPE_FIELDNAME:
1017
-                        $key = 'instance';
1018
-                        break;
1019
-                    default:
1020
-                        $key = 'Instance';
1021
-                }
1022
-
1023
-                $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1024
-            }
1025
-            if (null !== $this->aUser) {
1026
-
1027
-                switch ($keyType) {
1028
-                    case TableMap::TYPE_CAMELNAME:
1029
-                        $key = 'user';
1030
-                        break;
1031
-                    case TableMap::TYPE_FIELDNAME:
1032
-                        $key = 'user';
1033
-                        break;
1034
-                    default:
1035
-                        $key = 'User';
1036
-                }
1037
-
1038
-                $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1039
-            }
1040
-        }
1041
-
1042
-        return $result;
1043
-    }
1044
-
1045
-    /**
1046
-     * Sets a field from the object by name passed in as a string.
1047
-     *
1048
-     * @param  string $name
1049
-     * @param  mixed  $value field value
1050
-     * @param  string $type The type of fieldname the $name is of:
1051
-     *                one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
1052
-     *                TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1053
-     *                Defaults to TableMap::TYPE_PHPNAME.
1054
-     * @return $this|\Jalle19\StatusManager\Database\Connection
1055
-     */
1056
-    public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
1057
-    {
1058
-        $pos = ConnectionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
1059
-
1060
-        return $this->setByPosition($pos, $value);
1061
-    }
1062
-
1063
-    /**
1064
-     * Sets a field from the object by Position as specified in the xml schema.
1065
-     * Zero-based.
1066
-     *
1067
-     * @param  int $pos position in xml schema
1068
-     * @param  mixed $value field value
1069
-     * @return $this|\Jalle19\StatusManager\Database\Connection
1070
-     */
1071
-    public function setByPosition($pos, $value)
1072
-    {
1073
-        switch ($pos) {
1074
-            case 0:
1075
-                $this->setId($value);
1076
-                break;
1077
-            case 1:
1078
-                $this->setInstanceName($value);
1079
-                break;
1080
-            case 2:
1081
-                $this->setUserId($value);
1082
-                break;
1083
-            case 3:
1084
-                $this->setPeer($value);
1085
-                break;
1086
-            case 4:
1087
-                $this->setStarted($value);
1088
-                break;
1089
-            case 5:
1090
-                $this->setType($value);
1091
-                break;
1092
-        } // switch()
1093
-
1094
-        return $this;
1095
-    }
1096
-
1097
-    /**
1098
-     * Populates the object using an array.
1099
-     *
1100
-     * This is particularly useful when populating an object from one of the
1101
-     * request arrays (e.g. $_POST).  This method goes through the column
1102
-     * names, checking to see whether a matching key exists in populated
1103
-     * array. If so the setByName() method is called for that column.
1104
-     *
1105
-     * You can specify the key type of the array by additionally passing one
1106
-     * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
1107
-     * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1108
-     * The default key type is the column's TableMap::TYPE_PHPNAME.
1109
-     *
1110
-     * @param      array  $arr     An array to populate the object from.
1111
-     * @param      string $keyType The type of keys the array uses.
1112
-     * @return void
1113
-     */
1114
-    public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
1115
-    {
1116
-        $keys = ConnectionTableMap::getFieldNames($keyType);
1117
-
1118
-        if (array_key_exists($keys[0], $arr)) {
1119
-            $this->setId($arr[$keys[0]]);
1120
-        }
1121
-        if (array_key_exists($keys[1], $arr)) {
1122
-            $this->setInstanceName($arr[$keys[1]]);
1123
-        }
1124
-        if (array_key_exists($keys[2], $arr)) {
1125
-            $this->setUserId($arr[$keys[2]]);
1126
-        }
1127
-        if (array_key_exists($keys[3], $arr)) {
1128
-            $this->setPeer($arr[$keys[3]]);
1129
-        }
1130
-        if (array_key_exists($keys[4], $arr)) {
1131
-            $this->setStarted($arr[$keys[4]]);
1132
-        }
1133
-        if (array_key_exists($keys[5], $arr)) {
1134
-            $this->setType($arr[$keys[5]]);
1135
-        }
1136
-    }
1137
-
1138
-     /**
1139
-     * Populate the current object from a string, using a given parser format
1140
-     * <code>
1141
-     * $book = new Book();
1142
-     * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
1143
-     * </code>
1144
-     *
1145
-     * You can specify the key type of the array by additionally passing one
1146
-     * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
1147
-     * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1148
-     * The default key type is the column's TableMap::TYPE_PHPNAME.
1149
-     *
1150
-     * @param mixed $parser A AbstractParser instance,
1151
-     *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
1152
-     * @param string $data The source data to import from
1153
-     * @param string $keyType The type of keys the array uses.
1154
-     *
1155
-     * @return $this|\Jalle19\StatusManager\Database\Connection The current object, for fluid interface
1156
-     */
1157
-    public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME)
1158
-    {
1159
-        if (!$parser instanceof AbstractParser) {
1160
-            $parser = AbstractParser::getParser($parser);
1161
-        }
1162
-
1163
-        $this->fromArray($parser->toArray($data), $keyType);
1164
-
1165
-        return $this;
1166
-    }
1167
-
1168
-    /**
1169
-     * Build a Criteria object containing the values of all modified columns in this object.
1170
-     *
1171
-     * @return Criteria The Criteria object containing all modified values.
1172
-     */
1173
-    public function buildCriteria()
1174
-    {
1175
-        $criteria = new Criteria(ConnectionTableMap::DATABASE_NAME);
1176
-
1177
-        if ($this->isColumnModified(ConnectionTableMap::COL_ID)) {
1178
-            $criteria->add(ConnectionTableMap::COL_ID, $this->id);
1179
-        }
1180
-        if ($this->isColumnModified(ConnectionTableMap::COL_INSTANCE_NAME)) {
1181
-            $criteria->add(ConnectionTableMap::COL_INSTANCE_NAME, $this->instance_name);
1182
-        }
1183
-        if ($this->isColumnModified(ConnectionTableMap::COL_USER_ID)) {
1184
-            $criteria->add(ConnectionTableMap::COL_USER_ID, $this->user_id);
1185
-        }
1186
-        if ($this->isColumnModified(ConnectionTableMap::COL_PEER)) {
1187
-            $criteria->add(ConnectionTableMap::COL_PEER, $this->peer);
1188
-        }
1189
-        if ($this->isColumnModified(ConnectionTableMap::COL_STARTED)) {
1190
-            $criteria->add(ConnectionTableMap::COL_STARTED, $this->started);
1191
-        }
1192
-        if ($this->isColumnModified(ConnectionTableMap::COL_TYPE)) {
1193
-            $criteria->add(ConnectionTableMap::COL_TYPE, $this->type);
1194
-        }
1195
-
1196
-        return $criteria;
1197
-    }
1198
-
1199
-    /**
1200
-     * Builds a Criteria object containing the primary key for this object.
1201
-     *
1202
-     * Unlike buildCriteria() this method includes the primary key values regardless
1203
-     * of whether or not they have been modified.
1204
-     *
1205
-     * @throws LogicException if no primary key is defined
1206
-     *
1207
-     * @return Criteria The Criteria object containing value(s) for primary key(s).
1208
-     */
1209
-    public function buildPkeyCriteria()
1210
-    {
1211
-        $criteria = ChildConnectionQuery::create();
1212
-        $criteria->add(ConnectionTableMap::COL_ID, $this->id);
1213
-
1214
-        return $criteria;
1215
-    }
1216
-
1217
-    /**
1218
-     * If the primary key is not null, return the hashcode of the
1219
-     * primary key. Otherwise, return the hash code of the object.
1220
-     *
1221
-     * @return int Hashcode
1222
-     */
1223
-    public function hashCode()
1224
-    {
1225
-        $validPk = null !== $this->getId();
1226
-
1227
-        $validPrimaryKeyFKs = 0;
1228
-        $primaryKeyFKs = [];
1229
-
1230
-        if ($validPk) {
1231
-            return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
1232
-        } elseif ($validPrimaryKeyFKs) {
1233
-            return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
1234
-        }
1235
-
1236
-        return spl_object_hash($this);
1237
-    }
1238
-
1239
-    /**
1240
-     * Returns the primary key for this object (row).
1241
-     * @return int
1242
-     */
1243
-    public function getPrimaryKey()
1244
-    {
1245
-        return $this->getId();
1246
-    }
1247
-
1248
-    /**
1249
-     * Generic method to set the primary key (id column).
1250
-     *
1251
-     * @param       int $key Primary key.
1252
-     * @return void
1253
-     */
1254
-    public function setPrimaryKey($key)
1255
-    {
1256
-        $this->setId($key);
1257
-    }
1258
-
1259
-    /**
1260
-     * Returns true if the primary key for this object is null.
1261
-     * @return boolean
1262
-     */
1263
-    public function isPrimaryKeyNull()
1264
-    {
1265
-        return null === $this->getId();
1266
-    }
1267
-
1268
-    /**
1269
-     * Sets contents of passed object to values from current object.
1270
-     *
1271
-     * If desired, this method can also make copies of all associated (fkey referrers)
1272
-     * objects.
1273
-     *
1274
-     * @param      object $copyObj An object of \Jalle19\StatusManager\Database\Connection (or compatible) type.
1275
-     * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1276
-     * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1277
-     * @throws PropelException
1278
-     */
1279
-    public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1280
-    {
1281
-        $copyObj->setInstanceName($this->getInstanceName());
1282
-        $copyObj->setUserId($this->getUserId());
1283
-        $copyObj->setPeer($this->getPeer());
1284
-        $copyObj->setStarted($this->getStarted());
1285
-        $copyObj->setType($this->getType());
1286
-        if ($makeNew) {
1287
-            $copyObj->setNew(true);
1288
-            $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
1289
-        }
1290
-    }
1291
-
1292
-    /**
1293
-     * Makes a copy of this object that will be inserted as a new row in table when saved.
1294
-     * It creates a new object filling in the simple attributes, but skipping any primary
1295
-     * keys that are defined for the table.
1296
-     *
1297
-     * If desired, this method can also make copies of all associated (fkey referrers)
1298
-     * objects.
1299
-     *
1300
-     * @param  boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1301
-     * @return \Jalle19\StatusManager\Database\Connection Clone of current object.
1302
-     * @throws PropelException
1303
-     */
1304
-    public function copy($deepCopy = false)
1305
-    {
1306
-        // we use get_class(), because this might be a subclass
1307
-        $clazz = get_class($this);
1308
-        $copyObj = new $clazz();
1309
-        $this->copyInto($copyObj, $deepCopy);
1310
-
1311
-        return $copyObj;
1312
-    }
1313
-
1314
-    /**
1315
-     * Declares an association between this object and a ChildInstance object.
1316
-     *
1317
-     * @param  ChildInstance $v
1318
-     * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
1319
-     * @throws PropelException
1320
-     */
1321
-    public function setInstance(ChildInstance $v = null)
1322
-    {
1323
-        if ($v === null) {
1324
-            $this->setInstanceName(NULL);
1325
-        } else {
1326
-            $this->setInstanceName($v->getName());
1327
-        }
1328
-
1329
-        $this->aInstance = $v;
1330
-
1331
-        // Add binding for other direction of this n:n relationship.
1332
-        // If this object has already been added to the ChildInstance object, it will not be re-added.
1333
-        if ($v !== null) {
1334
-            $v->addConnection($this);
1335
-        }
1336
-
1337
-
1338
-        return $this;
1339
-    }
1340
-
1341
-
1342
-    /**
1343
-     * Get the associated ChildInstance object
1344
-     *
1345
-     * @param  ConnectionInterface $con Optional Connection object.
1346
-     * @return ChildInstance The associated ChildInstance object.
1347
-     * @throws PropelException
1348
-     */
1349
-    public function getInstance(ConnectionInterface $con = null)
1350
-    {
1351
-        if ($this->aInstance === null && (($this->instance_name !== "" && $this->instance_name !== null))) {
1352
-            $this->aInstance = ChildInstanceQuery::create()->findPk($this->instance_name, $con);
1353
-            /* The following can be used additionally to
578
+	 *                            TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
579
+	 *
580
+	 * @return int             next starting column
581
+	 * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
582
+	 */
583
+	public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
584
+	{
585
+		try {
586
+
587
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : ConnectionTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
588
+			$this->id = (null !== $col) ? (int) $col : null;
589
+
590
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : ConnectionTableMap::translateFieldName('InstanceName', TableMap::TYPE_PHPNAME, $indexType)];
591
+			$this->instance_name = (null !== $col) ? (string) $col : null;
592
+
593
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ConnectionTableMap::translateFieldName('UserId', TableMap::TYPE_PHPNAME, $indexType)];
594
+			$this->user_id = (null !== $col) ? (int) $col : null;
595
+
596
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ConnectionTableMap::translateFieldName('Peer', TableMap::TYPE_PHPNAME, $indexType)];
597
+			$this->peer = (null !== $col) ? (string) $col : null;
598
+
599
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ConnectionTableMap::translateFieldName('Started', TableMap::TYPE_PHPNAME, $indexType)];
600
+			$this->started = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null;
601
+
602
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ConnectionTableMap::translateFieldName('Type', TableMap::TYPE_PHPNAME, $indexType)];
603
+			$this->type = (null !== $col) ? (string) $col : null;
604
+			$this->resetModified();
605
+
606
+			$this->setNew(false);
607
+
608
+			if ($rehydrate) {
609
+				$this->ensureConsistency();
610
+			}
611
+
612
+			return $startcol + 6; // 6 = ConnectionTableMap::NUM_HYDRATE_COLUMNS.
613
+
614
+		} catch (Exception $e) {
615
+			throw new PropelException(sprintf('Error populating %s object', '\\Jalle19\\StatusManager\\Database\\Connection'), 0, $e);
616
+		}
617
+	}
618
+
619
+	/**
620
+	 * Checks and repairs the internal consistency of the object.
621
+	 *
622
+	 * This method is executed after an already-instantiated object is re-hydrated
623
+	 * from the database.  It exists to check any foreign keys to make sure that
624
+	 * the objects related to the current object are correct based on foreign key.
625
+	 *
626
+	 * You can override this method in the stub class, but you should always invoke
627
+	 * the base method from the overridden method (i.e. parent::ensureConsistency()),
628
+	 * in case your model changes.
629
+	 *
630
+	 * @throws PropelException
631
+	 */
632
+	public function ensureConsistency()
633
+	{
634
+		if ($this->aInstance !== null && $this->instance_name !== $this->aInstance->getName()) {
635
+			$this->aInstance = null;
636
+		}
637
+		if ($this->aUser !== null && $this->user_id !== $this->aUser->getId()) {
638
+			$this->aUser = null;
639
+		}
640
+	} // ensureConsistency
641
+
642
+	/**
643
+	 * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
644
+	 *
645
+	 * This will only work if the object has been saved and has a valid primary key set.
646
+	 *
647
+	 * @param      boolean $deep (optional) Whether to also de-associated any related objects.
648
+	 * @param      ConnectionInterface $con (optional) The ConnectionInterface connection to use.
649
+	 * @return void
650
+	 * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
651
+	 */
652
+	public function reload($deep = false, ConnectionInterface $con = null)
653
+	{
654
+		if ($this->isDeleted()) {
655
+			throw new PropelException("Cannot reload a deleted object.");
656
+		}
657
+
658
+		if ($this->isNew()) {
659
+			throw new PropelException("Cannot reload an unsaved object.");
660
+		}
661
+
662
+		if ($con === null) {
663
+			$con = Propel::getServiceContainer()->getReadConnection(ConnectionTableMap::DATABASE_NAME);
664
+		}
665
+
666
+		// We don't need to alter the object instance pool; we're just modifying this instance
667
+		// already in the pool.
668
+
669
+		$dataFetcher = ChildConnectionQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
670
+		$row = $dataFetcher->fetch();
671
+		$dataFetcher->close();
672
+		if (!$row) {
673
+			throw new PropelException('Cannot find matching row in the database to reload object values.');
674
+		}
675
+		$this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
676
+
677
+		if ($deep) {  // also de-associate any related objects?
678
+
679
+			$this->aInstance = null;
680
+			$this->aUser = null;
681
+		} // if (deep)
682
+	}
683
+
684
+	/**
685
+	 * Removes this object from datastore and sets delete attribute.
686
+	 *
687
+	 * @param      ConnectionInterface $con
688
+	 * @return void
689
+	 * @throws PropelException
690
+	 * @see Connection::setDeleted()
691
+	 * @see Connection::isDeleted()
692
+	 */
693
+	public function delete(ConnectionInterface $con = null)
694
+	{
695
+		if ($this->isDeleted()) {
696
+			throw new PropelException("This object has already been deleted.");
697
+		}
698
+
699
+		if ($con === null) {
700
+			$con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
701
+		}
702
+
703
+		$con->transaction(function () use ($con) {
704
+			$deleteQuery = ChildConnectionQuery::create()
705
+				->filterByPrimaryKey($this->getPrimaryKey());
706
+			$ret = $this->preDelete($con);
707
+			if ($ret) {
708
+				$deleteQuery->delete($con);
709
+				$this->postDelete($con);
710
+				$this->setDeleted(true);
711
+			}
712
+		});
713
+	}
714
+
715
+	/**
716
+	 * Persists this object to the database.
717
+	 *
718
+	 * If the object is new, it inserts it; otherwise an update is performed.
719
+	 * All modified related objects will also be persisted in the doSave()
720
+	 * method.  This method wraps all precipitate database operations in a
721
+	 * single transaction.
722
+	 *
723
+	 * @param      ConnectionInterface $con
724
+	 * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
725
+	 * @throws PropelException
726
+	 * @see doSave()
727
+	 */
728
+	public function save(ConnectionInterface $con = null)
729
+	{
730
+		if ($this->isDeleted()) {
731
+			throw new PropelException("You cannot save an object that has been deleted.");
732
+		}
733
+
734
+		if ($con === null) {
735
+			$con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
736
+		}
737
+
738
+		return $con->transaction(function () use ($con) {
739
+			$isInsert = $this->isNew();
740
+			$ret = $this->preSave($con);
741
+			if ($isInsert) {
742
+				$ret = $ret && $this->preInsert($con);
743
+			} else {
744
+				$ret = $ret && $this->preUpdate($con);
745
+			}
746
+			if ($ret) {
747
+				$affectedRows = $this->doSave($con);
748
+				if ($isInsert) {
749
+					$this->postInsert($con);
750
+				} else {
751
+					$this->postUpdate($con);
752
+				}
753
+				$this->postSave($con);
754
+				ConnectionTableMap::addInstanceToPool($this);
755
+			} else {
756
+				$affectedRows = 0;
757
+			}
758
+
759
+			return $affectedRows;
760
+		});
761
+	}
762
+
763
+	/**
764
+	 * Performs the work of inserting or updating the row in the database.
765
+	 *
766
+	 * If the object is new, it inserts it; otherwise an update is performed.
767
+	 * All related objects are also updated in this method.
768
+	 *
769
+	 * @param      ConnectionInterface $con
770
+	 * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
771
+	 * @throws PropelException
772
+	 * @see save()
773
+	 */
774
+	protected function doSave(ConnectionInterface $con)
775
+	{
776
+		$affectedRows = 0; // initialize var to track total num of affected rows
777
+		if (!$this->alreadyInSave) {
778
+			$this->alreadyInSave = true;
779
+
780
+			// We call the save method on the following object(s) if they
781
+			// were passed to this object by their corresponding set
782
+			// method.  This object relates to these object(s) by a
783
+			// foreign key reference.
784
+
785
+			if ($this->aInstance !== null) {
786
+				if ($this->aInstance->isModified() || $this->aInstance->isNew()) {
787
+					$affectedRows += $this->aInstance->save($con);
788
+				}
789
+				$this->setInstance($this->aInstance);
790
+			}
791
+
792
+			if ($this->aUser !== null) {
793
+				if ($this->aUser->isModified() || $this->aUser->isNew()) {
794
+					$affectedRows += $this->aUser->save($con);
795
+				}
796
+				$this->setUser($this->aUser);
797
+			}
798
+
799
+			if ($this->isNew() || $this->isModified()) {
800
+				// persist changes
801
+				if ($this->isNew()) {
802
+					$this->doInsert($con);
803
+					$affectedRows += 1;
804
+				} else {
805
+					$affectedRows += $this->doUpdate($con);
806
+				}
807
+				$this->resetModified();
808
+			}
809
+
810
+			$this->alreadyInSave = false;
811
+
812
+		}
813
+
814
+		return $affectedRows;
815
+	} // doSave()
816
+
817
+	/**
818
+	 * Insert the row in the database.
819
+	 *
820
+	 * @param      ConnectionInterface $con
821
+	 *
822
+	 * @throws PropelException
823
+	 * @see doSave()
824
+	 */
825
+	protected function doInsert(ConnectionInterface $con)
826
+	{
827
+		$modifiedColumns = array();
828
+		$index = 0;
829
+
830
+		$this->modifiedColumns[ConnectionTableMap::COL_ID] = true;
831
+		if (null !== $this->id) {
832
+			throw new PropelException('Cannot insert a value for auto-increment primary key (' . ConnectionTableMap::COL_ID . ')');
833
+		}
834
+
835
+		 // check the columns in natural order for more readable SQL queries
836
+		if ($this->isColumnModified(ConnectionTableMap::COL_ID)) {
837
+			$modifiedColumns[':p' . $index++]  = 'id';
838
+		}
839
+		if ($this->isColumnModified(ConnectionTableMap::COL_INSTANCE_NAME)) {
840
+			$modifiedColumns[':p' . $index++]  = 'instance_name';
841
+		}
842
+		if ($this->isColumnModified(ConnectionTableMap::COL_USER_ID)) {
843
+			$modifiedColumns[':p' . $index++]  = 'user_id';
844
+		}
845
+		if ($this->isColumnModified(ConnectionTableMap::COL_PEER)) {
846
+			$modifiedColumns[':p' . $index++]  = 'peer';
847
+		}
848
+		if ($this->isColumnModified(ConnectionTableMap::COL_STARTED)) {
849
+			$modifiedColumns[':p' . $index++]  = 'started';
850
+		}
851
+		if ($this->isColumnModified(ConnectionTableMap::COL_TYPE)) {
852
+			$modifiedColumns[':p' . $index++]  = 'type';
853
+		}
854
+
855
+		$sql = sprintf(
856
+			'INSERT INTO connection (%s) VALUES (%s)',
857
+			implode(', ', $modifiedColumns),
858
+			implode(', ', array_keys($modifiedColumns))
859
+		);
860
+
861
+		try {
862
+			$stmt = $con->prepare($sql);
863
+			foreach ($modifiedColumns as $identifier => $columnName) {
864
+				switch ($columnName) {
865
+					case 'id':
866
+						$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
867
+						break;
868
+					case 'instance_name':
869
+						$stmt->bindValue($identifier, $this->instance_name, PDO::PARAM_STR);
870
+						break;
871
+					case 'user_id':
872
+						$stmt->bindValue($identifier, $this->user_id, PDO::PARAM_INT);
873
+						break;
874
+					case 'peer':
875
+						$stmt->bindValue($identifier, $this->peer, PDO::PARAM_STR);
876
+						break;
877
+					case 'started':
878
+						$stmt->bindValue($identifier, $this->started ? $this->started->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
879
+						break;
880
+					case 'type':
881
+						$stmt->bindValue($identifier, $this->type, PDO::PARAM_STR);
882
+						break;
883
+				}
884
+			}
885
+			$stmt->execute();
886
+		} catch (Exception $e) {
887
+			Propel::log($e->getMessage(), Propel::LOG_ERR);
888
+			throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
889
+		}
890
+
891
+		try {
892
+			$pk = $con->lastInsertId();
893
+		} catch (Exception $e) {
894
+			throw new PropelException('Unable to get autoincrement id.', 0, $e);
895
+		}
896
+		$this->setId($pk);
897
+
898
+		$this->setNew(false);
899
+	}
900
+
901
+	/**
902
+	 * Update the row in the database.
903
+	 *
904
+	 * @param      ConnectionInterface $con
905
+	 *
906
+	 * @return Integer Number of updated rows
907
+	 * @see doSave()
908
+	 */
909
+	protected function doUpdate(ConnectionInterface $con)
910
+	{
911
+		$selectCriteria = $this->buildPkeyCriteria();
912
+		$valuesCriteria = $this->buildCriteria();
913
+
914
+		return $selectCriteria->doUpdate($valuesCriteria, $con);
915
+	}
916
+
917
+	/**
918
+	 * Retrieves a field from the object by name passed in as a string.
919
+	 *
920
+	 * @param      string $name name
921
+	 * @param      string $type The type of fieldname the $name is of:
922
+	 *                     one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
923
+	 *                     TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
924
+	 *                     Defaults to TableMap::TYPE_PHPNAME.
925
+	 * @return mixed Value of field.
926
+	 */
927
+	public function getByName($name, $type = TableMap::TYPE_PHPNAME)
928
+	{
929
+		$pos = ConnectionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
930
+		$field = $this->getByPosition($pos);
931
+
932
+		return $field;
933
+	}
934
+
935
+	/**
936
+	 * Retrieves a field from the object by Position as specified in the xml schema.
937
+	 * Zero-based.
938
+	 *
939
+	 * @param      int $pos position in xml schema
940
+	 * @return mixed Value of field at $pos
941
+	 */
942
+	public function getByPosition($pos)
943
+	{
944
+		switch ($pos) {
945
+			case 0:
946
+				return $this->getId();
947
+				break;
948
+			case 1:
949
+				return $this->getInstanceName();
950
+				break;
951
+			case 2:
952
+				return $this->getUserId();
953
+				break;
954
+			case 3:
955
+				return $this->getPeer();
956
+				break;
957
+			case 4:
958
+				return $this->getStarted();
959
+				break;
960
+			case 5:
961
+				return $this->getType();
962
+				break;
963
+			default:
964
+				return null;
965
+				break;
966
+		} // switch()
967
+	}
968
+
969
+	/**
970
+	 * Exports the object as an array.
971
+	 *
972
+	 * You can specify the key type of the array by passing one of the class
973
+	 * type constants.
974
+	 *
975
+	 * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
976
+	 *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
977
+	 *                    Defaults to TableMap::TYPE_PHPNAME.
978
+	 * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
979
+	 * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
980
+	 * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
981
+	 *
982
+	 * @return array an associative array containing the field names (as keys) and field values
983
+	 */
984
+	public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
985
+	{
986
+
987
+		if (isset($alreadyDumpedObjects['Connection'][$this->hashCode()])) {
988
+			return '*RECURSION*';
989
+		}
990
+		$alreadyDumpedObjects['Connection'][$this->hashCode()] = true;
991
+		$keys = ConnectionTableMap::getFieldNames($keyType);
992
+		$result = array(
993
+			$keys[0] => $this->getId(),
994
+			$keys[1] => $this->getInstanceName(),
995
+			$keys[2] => $this->getUserId(),
996
+			$keys[3] => $this->getPeer(),
997
+			$keys[4] => $this->getStarted(),
998
+			$keys[5] => $this->getType(),
999
+		);
1000
+		if ($result[$keys[4]] instanceof \DateTime) {
1001
+			$result[$keys[4]] = $result[$keys[4]]->format('c');
1002
+		}
1003
+
1004
+		$virtualColumns = $this->virtualColumns;
1005
+		foreach ($virtualColumns as $key => $virtualColumn) {
1006
+			$result[$key] = $virtualColumn;
1007
+		}
1008
+
1009
+		if ($includeForeignObjects) {
1010
+			if (null !== $this->aInstance) {
1011
+
1012
+				switch ($keyType) {
1013
+					case TableMap::TYPE_CAMELNAME:
1014
+						$key = 'instance';
1015
+						break;
1016
+					case TableMap::TYPE_FIELDNAME:
1017
+						$key = 'instance';
1018
+						break;
1019
+					default:
1020
+						$key = 'Instance';
1021
+				}
1022
+
1023
+				$result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1024
+			}
1025
+			if (null !== $this->aUser) {
1026
+
1027
+				switch ($keyType) {
1028
+					case TableMap::TYPE_CAMELNAME:
1029
+						$key = 'user';
1030
+						break;
1031
+					case TableMap::TYPE_FIELDNAME:
1032
+						$key = 'user';
1033
+						break;
1034
+					default:
1035
+						$key = 'User';
1036
+				}
1037
+
1038
+				$result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1039
+			}
1040
+		}
1041
+
1042
+		return $result;
1043
+	}
1044
+
1045
+	/**
1046
+	 * Sets a field from the object by name passed in as a string.
1047
+	 *
1048
+	 * @param  string $name
1049
+	 * @param  mixed  $value field value
1050
+	 * @param  string $type The type of fieldname the $name is of:
1051
+	 *                one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
1052
+	 *                TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1053
+	 *                Defaults to TableMap::TYPE_PHPNAME.
1054
+	 * @return $this|\Jalle19\StatusManager\Database\Connection
1055
+	 */
1056
+	public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
1057
+	{
1058
+		$pos = ConnectionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
1059
+
1060
+		return $this->setByPosition($pos, $value);
1061
+	}
1062
+
1063
+	/**
1064
+	 * Sets a field from the object by Position as specified in the xml schema.
1065
+	 * Zero-based.
1066
+	 *
1067
+	 * @param  int $pos position in xml schema
1068
+	 * @param  mixed $value field value
1069
+	 * @return $this|\Jalle19\StatusManager\Database\Connection
1070
+	 */
1071
+	public function setByPosition($pos, $value)
1072
+	{
1073
+		switch ($pos) {
1074
+			case 0:
1075
+				$this->setId($value);
1076
+				break;
1077
+			case 1:
1078
+				$this->setInstanceName($value);
1079
+				break;
1080
+			case 2:
1081
+				$this->setUserId($value);
1082
+				break;
1083
+			case 3:
1084
+				$this->setPeer($value);
1085
+				break;
1086
+			case 4:
1087
+				$this->setStarted($value);
1088
+				break;
1089
+			case 5:
1090
+				$this->setType($value);
1091
+				break;
1092
+		} // switch()
1093
+
1094
+		return $this;
1095
+	}
1096
+
1097
+	/**
1098
+	 * Populates the object using an array.
1099
+	 *
1100
+	 * This is particularly useful when populating an object from one of the
1101
+	 * request arrays (e.g. $_POST).  This method goes through the column
1102
+	 * names, checking to see whether a matching key exists in populated
1103
+	 * array. If so the setByName() method is called for that column.
1104
+	 *
1105
+	 * You can specify the key type of the array by additionally passing one
1106
+	 * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
1107
+	 * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1108
+	 * The default key type is the column's TableMap::TYPE_PHPNAME.
1109
+	 *
1110
+	 * @param      array  $arr     An array to populate the object from.
1111
+	 * @param      string $keyType The type of keys the array uses.
1112
+	 * @return void
1113
+	 */
1114
+	public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
1115
+	{
1116
+		$keys = ConnectionTableMap::getFieldNames($keyType);
1117
+
1118
+		if (array_key_exists($keys[0], $arr)) {
1119
+			$this->setId($arr[$keys[0]]);
1120
+		}
1121
+		if (array_key_exists($keys[1], $arr)) {
1122
+			$this->setInstanceName($arr[$keys[1]]);
1123
+		}
1124
+		if (array_key_exists($keys[2], $arr)) {
1125
+			$this->setUserId($arr[$keys[2]]);
1126
+		}
1127
+		if (array_key_exists($keys[3], $arr)) {
1128
+			$this->setPeer($arr[$keys[3]]);
1129
+		}
1130
+		if (array_key_exists($keys[4], $arr)) {
1131
+			$this->setStarted($arr[$keys[4]]);
1132
+		}
1133
+		if (array_key_exists($keys[5], $arr)) {
1134
+			$this->setType($arr[$keys[5]]);
1135
+		}
1136
+	}
1137
+
1138
+	 /**
1139
+	  * Populate the current object from a string, using a given parser format
1140
+	  * <code>
1141
+	  * $book = new Book();
1142
+	  * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
1143
+	  * </code>
1144
+	  *
1145
+	  * You can specify the key type of the array by additionally passing one
1146
+	  * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
1147
+	  * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1148
+	  * The default key type is the column's TableMap::TYPE_PHPNAME.
1149
+	  *
1150
+	  * @param mixed $parser A AbstractParser instance,
1151
+	  *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
1152
+	  * @param string $data The source data to import from
1153
+	  * @param string $keyType The type of keys the array uses.
1154
+	  *
1155
+	  * @return $this|\Jalle19\StatusManager\Database\Connection The current object, for fluid interface
1156
+	  */
1157
+	public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME)
1158
+	{
1159
+		if (!$parser instanceof AbstractParser) {
1160
+			$parser = AbstractParser::getParser($parser);
1161
+		}
1162
+
1163
+		$this->fromArray($parser->toArray($data), $keyType);
1164
+
1165
+		return $this;
1166
+	}
1167
+
1168
+	/**
1169
+	 * Build a Criteria object containing the values of all modified columns in this object.
1170
+	 *
1171
+	 * @return Criteria The Criteria object containing all modified values.
1172
+	 */
1173
+	public function buildCriteria()
1174
+	{
1175
+		$criteria = new Criteria(ConnectionTableMap::DATABASE_NAME);
1176
+
1177
+		if ($this->isColumnModified(ConnectionTableMap::COL_ID)) {
1178
+			$criteria->add(ConnectionTableMap::COL_ID, $this->id);
1179
+		}
1180
+		if ($this->isColumnModified(ConnectionTableMap::COL_INSTANCE_NAME)) {
1181
+			$criteria->add(ConnectionTableMap::COL_INSTANCE_NAME, $this->instance_name);
1182
+		}
1183
+		if ($this->isColumnModified(ConnectionTableMap::COL_USER_ID)) {
1184
+			$criteria->add(ConnectionTableMap::COL_USER_ID, $this->user_id);
1185
+		}
1186
+		if ($this->isColumnModified(ConnectionTableMap::COL_PEER)) {
1187
+			$criteria->add(ConnectionTableMap::COL_PEER, $this->peer);
1188
+		}
1189
+		if ($this->isColumnModified(ConnectionTableMap::COL_STARTED)) {
1190
+			$criteria->add(ConnectionTableMap::COL_STARTED, $this->started);
1191
+		}
1192
+		if ($this->isColumnModified(ConnectionTableMap::COL_TYPE)) {
1193
+			$criteria->add(ConnectionTableMap::COL_TYPE, $this->type);
1194
+		}
1195
+
1196
+		return $criteria;
1197
+	}
1198
+
1199
+	/**
1200
+	 * Builds a Criteria object containing the primary key for this object.
1201
+	 *
1202
+	 * Unlike buildCriteria() this method includes the primary key values regardless
1203
+	 * of whether or not they have been modified.
1204
+	 *
1205
+	 * @throws LogicException if no primary key is defined
1206
+	 *
1207
+	 * @return Criteria The Criteria object containing value(s) for primary key(s).
1208
+	 */
1209
+	public function buildPkeyCriteria()
1210
+	{
1211
+		$criteria = ChildConnectionQuery::create();
1212
+		$criteria->add(ConnectionTableMap::COL_ID, $this->id);
1213
+
1214
+		return $criteria;
1215
+	}
1216
+
1217
+	/**
1218
+	 * If the primary key is not null, return the hashcode of the
1219
+	 * primary key. Otherwise, return the hash code of the object.
1220
+	 *
1221
+	 * @return int Hashcode
1222
+	 */
1223
+	public function hashCode()
1224
+	{
1225
+		$validPk = null !== $this->getId();
1226
+
1227
+		$validPrimaryKeyFKs = 0;
1228
+		$primaryKeyFKs = [];
1229
+
1230
+		if ($validPk) {
1231
+			return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
1232
+		} elseif ($validPrimaryKeyFKs) {
1233
+			return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
1234
+		}
1235
+
1236
+		return spl_object_hash($this);
1237
+	}
1238
+
1239
+	/**
1240
+	 * Returns the primary key for this object (row).
1241
+	 * @return int
1242
+	 */
1243
+	public function getPrimaryKey()
1244
+	{
1245
+		return $this->getId();
1246
+	}
1247
+
1248
+	/**
1249
+	 * Generic method to set the primary key (id column).
1250
+	 *
1251
+	 * @param       int $key Primary key.
1252
+	 * @return void
1253
+	 */
1254
+	public function setPrimaryKey($key)
1255
+	{
1256
+		$this->setId($key);
1257
+	}
1258
+
1259
+	/**
1260
+	 * Returns true if the primary key for this object is null.
1261
+	 * @return boolean
1262
+	 */
1263
+	public function isPrimaryKeyNull()
1264
+	{
1265
+		return null === $this->getId();
1266
+	}
1267
+
1268
+	/**
1269
+	 * Sets contents of passed object to values from current object.
1270
+	 *
1271
+	 * If desired, this method can also make copies of all associated (fkey referrers)
1272
+	 * objects.
1273
+	 *
1274
+	 * @param      object $copyObj An object of \Jalle19\StatusManager\Database\Connection (or compatible) type.
1275
+	 * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1276
+	 * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1277
+	 * @throws PropelException
1278
+	 */
1279
+	public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1280
+	{
1281
+		$copyObj->setInstanceName($this->getInstanceName());
1282
+		$copyObj->setUserId($this->getUserId());
1283
+		$copyObj->setPeer($this->getPeer());
1284
+		$copyObj->setStarted($this->getStarted());
1285
+		$copyObj->setType($this->getType());
1286
+		if ($makeNew) {
1287
+			$copyObj->setNew(true);
1288
+			$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
1289
+		}
1290
+	}
1291
+
1292
+	/**
1293
+	 * Makes a copy of this object that will be inserted as a new row in table when saved.
1294
+	 * It creates a new object filling in the simple attributes, but skipping any primary
1295
+	 * keys that are defined for the table.
1296
+	 *
1297
+	 * If desired, this method can also make copies of all associated (fkey referrers)
1298
+	 * objects.
1299
+	 *
1300
+	 * @param  boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1301
+	 * @return \Jalle19\StatusManager\Database\Connection Clone of current object.
1302
+	 * @throws PropelException
1303
+	 */
1304
+	public function copy($deepCopy = false)
1305
+	{
1306
+		// we use get_class(), because this might be a subclass
1307
+		$clazz = get_class($this);
1308
+		$copyObj = new $clazz();
1309
+		$this->copyInto($copyObj, $deepCopy);
1310
+
1311
+		return $copyObj;
1312
+	}
1313
+
1314
+	/**
1315
+	 * Declares an association between this object and a ChildInstance object.
1316
+	 *
1317
+	 * @param  ChildInstance $v
1318
+	 * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
1319
+	 * @throws PropelException
1320
+	 */
1321
+	public function setInstance(ChildInstance $v = null)
1322
+	{
1323
+		if ($v === null) {
1324
+			$this->setInstanceName(NULL);
1325
+		} else {
1326
+			$this->setInstanceName($v->getName());
1327
+		}
1328
+
1329
+		$this->aInstance = $v;
1330
+
1331
+		// Add binding for other direction of this n:n relationship.
1332
+		// If this object has already been added to the ChildInstance object, it will not be re-added.
1333
+		if ($v !== null) {
1334
+			$v->addConnection($this);
1335
+		}
1336
+
1337
+
1338
+		return $this;
1339
+	}
1340
+
1341
+
1342
+	/**
1343
+	 * Get the associated ChildInstance object
1344
+	 *
1345
+	 * @param  ConnectionInterface $con Optional Connection object.
1346
+	 * @return ChildInstance The associated ChildInstance object.
1347
+	 * @throws PropelException
1348
+	 */
1349
+	public function getInstance(ConnectionInterface $con = null)
1350
+	{
1351
+		if ($this->aInstance === null && (($this->instance_name !== "" && $this->instance_name !== null))) {
1352
+			$this->aInstance = ChildInstanceQuery::create()->findPk($this->instance_name, $con);
1353
+			/* The following can be used additionally to
1354 1354
                 guarantee the related object contains a reference
1355 1355
                 to this object.  This level of coupling may, however, be
1356 1356
                 undesirable since it could result in an only partially populated collection
1357 1357
                 in the referenced object.
1358 1358
                 $this->aInstance->addConnections($this);
1359 1359
              */
1360
-        }
1361
-
1362
-        return $this->aInstance;
1363
-    }
1364
-
1365
-    /**
1366
-     * Declares an association between this object and a ChildUser object.
1367
-     *
1368
-     * @param  ChildUser $v
1369
-     * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
1370
-     * @throws PropelException
1371
-     */
1372
-    public function setUser(ChildUser $v = null)
1373
-    {
1374
-        if ($v === null) {
1375
-            $this->setUserId(NULL);
1376
-        } else {
1377
-            $this->setUserId($v->getId());
1378
-        }
1379
-
1380
-        $this->aUser = $v;
1381
-
1382
-        // Add binding for other direction of this n:n relationship.
1383
-        // If this object has already been added to the ChildUser object, it will not be re-added.
1384
-        if ($v !== null) {
1385
-            $v->addConnection($this);
1386
-        }
1387
-
1388
-
1389
-        return $this;
1390
-    }
1391
-
1392
-
1393
-    /**
1394
-     * Get the associated ChildUser object
1395
-     *
1396
-     * @param  ConnectionInterface $con Optional Connection object.
1397
-     * @return ChildUser The associated ChildUser object.
1398
-     * @throws PropelException
1399
-     */
1400
-    public function getUser(ConnectionInterface $con = null)
1401
-    {
1402
-        if ($this->aUser === null && ($this->user_id !== null)) {
1403
-            $this->aUser = ChildUserQuery::create()->findPk($this->user_id, $con);
1404
-            /* The following can be used additionally to
1360
+		}
1361
+
1362
+		return $this->aInstance;
1363
+	}
1364
+
1365
+	/**
1366
+	 * Declares an association between this object and a ChildUser object.
1367
+	 *
1368
+	 * @param  ChildUser $v
1369
+	 * @return $this|\Jalle19\StatusManager\Database\Connection The current object (for fluent API support)
1370
+	 * @throws PropelException
1371
+	 */
1372
+	public function setUser(ChildUser $v = null)
1373
+	{
1374
+		if ($v === null) {
1375
+			$this->setUserId(NULL);
1376
+		} else {
1377
+			$this->setUserId($v->getId());
1378
+		}
1379
+
1380
+		$this->aUser = $v;
1381
+
1382
+		// Add binding for other direction of this n:n relationship.
1383
+		// If this object has already been added to the ChildUser object, it will not be re-added.
1384
+		if ($v !== null) {
1385
+			$v->addConnection($this);
1386
+		}
1387
+
1388
+
1389
+		return $this;
1390
+	}
1391
+
1392
+
1393
+	/**
1394
+	 * Get the associated ChildUser object
1395
+	 *
1396
+	 * @param  ConnectionInterface $con Optional Connection object.
1397
+	 * @return ChildUser The associated ChildUser object.
1398
+	 * @throws PropelException
1399
+	 */
1400
+	public function getUser(ConnectionInterface $con = null)
1401
+	{
1402
+		if ($this->aUser === null && ($this->user_id !== null)) {
1403
+			$this->aUser = ChildUserQuery::create()->findPk($this->user_id, $con);
1404
+			/* The following can be used additionally to
1405 1405
                 guarantee the related object contains a reference
1406 1406
                 to this object.  This level of coupling may, however, be
1407 1407
                 undesirable since it could result in an only partially populated collection
1408 1408
                 in the referenced object.
1409 1409
                 $this->aUser->addConnections($this);
1410 1410
              */
1411
-        }
1412
-
1413
-        return $this->aUser;
1414
-    }
1415
-
1416
-    /**
1417
-     * Clears the current object, sets all attributes to their default values and removes
1418
-     * outgoing references as well as back-references (from other objects to this one. Results probably in a database
1419
-     * change of those foreign objects when you call `save` there).
1420
-     */
1421
-    public function clear()
1422
-    {
1423
-        if (null !== $this->aInstance) {
1424
-            $this->aInstance->removeConnection($this);
1425
-        }
1426
-        if (null !== $this->aUser) {
1427
-            $this->aUser->removeConnection($this);
1428
-        }
1429
-        $this->id = null;
1430
-        $this->instance_name = null;
1431
-        $this->user_id = null;
1432
-        $this->peer = null;
1433
-        $this->started = null;
1434
-        $this->type = null;
1435
-        $this->alreadyInSave = false;
1436
-        $this->clearAllReferences();
1437
-        $this->resetModified();
1438
-        $this->setNew(true);
1439
-        $this->setDeleted(false);
1440
-    }
1441
-
1442
-    /**
1443
-     * Resets all references and back-references to other model objects or collections of model objects.
1444
-     *
1445
-     * This method is used to reset all php object references (not the actual reference in the database).
1446
-     * Necessary for object serialisation.
1447
-     *
1448
-     * @param      boolean $deep Whether to also clear the references on all referrer objects.
1449
-     */
1450
-    public function clearAllReferences($deep = false)
1451
-    {
1452
-        if ($deep) {
1453
-        } // if ($deep)
1454
-
1455
-        $this->aInstance = null;
1456
-        $this->aUser = null;
1457
-    }
1458
-
1459
-    /**
1460
-     * Return the string representation of this object
1461
-     *
1462
-     * @return string
1463
-     */
1464
-    public function __toString()
1465
-    {
1466
-        return (string) $this->exportTo(ConnectionTableMap::DEFAULT_STRING_FORMAT);
1467
-    }
1468
-
1469
-    /**
1470
-     * Code to be run before persisting the object
1471
-     * @param  ConnectionInterface $con
1472
-     * @return boolean
1473
-     */
1474
-    public function preSave(ConnectionInterface $con = null)
1475
-    {
1476
-        return true;
1477
-    }
1478
-
1479
-    /**
1480
-     * Code to be run after persisting the object
1481
-     * @param ConnectionInterface $con
1482
-     */
1483
-    public function postSave(ConnectionInterface $con = null)
1484
-    {
1485
-
1486
-    }
1487
-
1488
-    /**
1489
-     * Code to be run before inserting to database
1490
-     * @param  ConnectionInterface $con
1491
-     * @return boolean
1492
-     */
1493
-    public function preInsert(ConnectionInterface $con = null)
1494
-    {
1495
-        return true;
1496
-    }
1497
-
1498
-    /**
1499
-     * Code to be run after inserting to database
1500
-     * @param ConnectionInterface $con
1501
-     */
1502
-    public function postInsert(ConnectionInterface $con = null)
1503
-    {
1504
-
1505
-    }
1506
-
1507
-    /**
1508
-     * Code to be run before updating the object in database
1509
-     * @param  ConnectionInterface $con
1510
-     * @return boolean
1511
-     */
1512
-    public function preUpdate(ConnectionInterface $con = null)
1513
-    {
1514
-        return true;
1515
-    }
1516
-
1517
-    /**
1518
-     * Code to be run after updating the object in database
1519
-     * @param ConnectionInterface $con
1520
-     */
1521
-    public function postUpdate(ConnectionInterface $con = null)
1522
-    {
1523
-
1524
-    }
1525
-
1526
-    /**
1527
-     * Code to be run before deleting the object in database
1528
-     * @param  ConnectionInterface $con
1529
-     * @return boolean
1530
-     */
1531
-    public function preDelete(ConnectionInterface $con = null)
1532
-    {
1533
-        return true;
1534
-    }
1535
-
1536
-    /**
1537
-     * Code to be run after deleting the object in database
1538
-     * @param ConnectionInterface $con
1539
-     */
1540
-    public function postDelete(ConnectionInterface $con = null)
1541
-    {
1542
-
1543
-    }
1544
-
1545
-
1546
-    /**
1547
-     * Derived method to catches calls to undefined methods.
1548
-     *
1549
-     * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
1550
-     * Allows to define default __call() behavior if you overwrite __call()
1551
-     *
1552
-     * @param string $name
1553
-     * @param mixed  $params
1554
-     *
1555
-     * @return array|string
1556
-     */
1557
-    public function __call($name, $params)
1558
-    {
1559
-        if (0 === strpos($name, 'get')) {
1560
-            $virtualColumn = substr($name, 3);
1561
-            if ($this->hasVirtualColumn($virtualColumn)) {
1562
-                return $this->getVirtualColumn($virtualColumn);
1563
-            }
1564
-
1565
-            $virtualColumn = lcfirst($virtualColumn);
1566
-            if ($this->hasVirtualColumn($virtualColumn)) {
1567
-                return $this->getVirtualColumn($virtualColumn);
1568
-            }
1569
-        }
1570
-
1571
-        if (0 === strpos($name, 'from')) {
1572
-            $format = substr($name, 4);
1573
-
1574
-            return $this->importFrom($format, reset($params));
1575
-        }
1576
-
1577
-        if (0 === strpos($name, 'to')) {
1578
-            $format = substr($name, 2);
1579
-            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1580
-
1581
-            return $this->exportTo($format, $includeLazyLoadColumns);
1582
-        }
1583
-
1584
-        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1585
-    }
1411
+		}
1412
+
1413
+		return $this->aUser;
1414
+	}
1415
+
1416
+	/**
1417
+	 * Clears the current object, sets all attributes to their default values and removes
1418
+	 * outgoing references as well as back-references (from other objects to this one. Results probably in a database
1419
+	 * change of those foreign objects when you call `save` there).
1420
+	 */
1421
+	public function clear()
1422
+	{
1423
+		if (null !== $this->aInstance) {
1424
+			$this->aInstance->removeConnection($this);
1425
+		}
1426
+		if (null !== $this->aUser) {
1427
+			$this->aUser->removeConnection($this);
1428
+		}
1429
+		$this->id = null;
1430
+		$this->instance_name = null;
1431
+		$this->user_id = null;
1432
+		$this->peer = null;
1433
+		$this->started = null;
1434
+		$this->type = null;
1435
+		$this->alreadyInSave = false;
1436
+		$this->clearAllReferences();
1437
+		$this->resetModified();
1438
+		$this->setNew(true);
1439
+		$this->setDeleted(false);
1440
+	}
1441
+
1442
+	/**
1443
+	 * Resets all references and back-references to other model objects or collections of model objects.
1444
+	 *
1445
+	 * This method is used to reset all php object references (not the actual reference in the database).
1446
+	 * Necessary for object serialisation.
1447
+	 *
1448
+	 * @param      boolean $deep Whether to also clear the references on all referrer objects.
1449
+	 */
1450
+	public function clearAllReferences($deep = false)
1451
+	{
1452
+		if ($deep) {
1453
+		} // if ($deep)
1454
+
1455
+		$this->aInstance = null;
1456
+		$this->aUser = null;
1457
+	}
1458
+
1459
+	/**
1460
+	 * Return the string representation of this object
1461
+	 *
1462
+	 * @return string
1463
+	 */
1464
+	public function __toString()
1465
+	{
1466
+		return (string) $this->exportTo(ConnectionTableMap::DEFAULT_STRING_FORMAT);
1467
+	}
1468
+
1469
+	/**
1470
+	 * Code to be run before persisting the object
1471
+	 * @param  ConnectionInterface $con
1472
+	 * @return boolean
1473
+	 */
1474
+	public function preSave(ConnectionInterface $con = null)
1475
+	{
1476
+		return true;
1477
+	}
1478
+
1479
+	/**
1480
+	 * Code to be run after persisting the object
1481
+	 * @param ConnectionInterface $con
1482
+	 */
1483
+	public function postSave(ConnectionInterface $con = null)
1484
+	{
1485
+
1486
+	}
1487
+
1488
+	/**
1489
+	 * Code to be run before inserting to database
1490
+	 * @param  ConnectionInterface $con
1491
+	 * @return boolean
1492
+	 */
1493
+	public function preInsert(ConnectionInterface $con = null)
1494
+	{
1495
+		return true;
1496
+	}
1497
+
1498
+	/**
1499
+	 * Code to be run after inserting to database
1500
+	 * @param ConnectionInterface $con
1501
+	 */
1502
+	public function postInsert(ConnectionInterface $con = null)
1503
+	{
1504
+
1505
+	}
1506
+
1507
+	/**
1508
+	 * Code to be run before updating the object in database
1509
+	 * @param  ConnectionInterface $con
1510
+	 * @return boolean
1511
+	 */
1512
+	public function preUpdate(ConnectionInterface $con = null)
1513
+	{
1514
+		return true;
1515
+	}
1516
+
1517
+	/**
1518
+	 * Code to be run after updating the object in database
1519
+	 * @param ConnectionInterface $con
1520
+	 */
1521
+	public function postUpdate(ConnectionInterface $con = null)
1522
+	{
1523
+
1524
+	}
1525
+
1526
+	/**
1527
+	 * Code to be run before deleting the object in database
1528
+	 * @param  ConnectionInterface $con
1529
+	 * @return boolean
1530
+	 */
1531
+	public function preDelete(ConnectionInterface $con = null)
1532
+	{
1533
+		return true;
1534
+	}
1535
+
1536
+	/**
1537
+	 * Code to be run after deleting the object in database
1538
+	 * @param ConnectionInterface $con
1539
+	 */
1540
+	public function postDelete(ConnectionInterface $con = null)
1541
+	{
1542
+
1543
+	}
1544
+
1545
+
1546
+	/**
1547
+	 * Derived method to catches calls to undefined methods.
1548
+	 *
1549
+	 * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
1550
+	 * Allows to define default __call() behavior if you overwrite __call()
1551
+	 *
1552
+	 * @param string $name
1553
+	 * @param mixed  $params
1554
+	 *
1555
+	 * @return array|string
1556
+	 */
1557
+	public function __call($name, $params)
1558
+	{
1559
+		if (0 === strpos($name, 'get')) {
1560
+			$virtualColumn = substr($name, 3);
1561
+			if ($this->hasVirtualColumn($virtualColumn)) {
1562
+				return $this->getVirtualColumn($virtualColumn);
1563
+			}
1564
+
1565
+			$virtualColumn = lcfirst($virtualColumn);
1566
+			if ($this->hasVirtualColumn($virtualColumn)) {
1567
+				return $this->getVirtualColumn($virtualColumn);
1568
+			}
1569
+		}
1570
+
1571
+		if (0 === strpos($name, 'from')) {
1572
+			$format = substr($name, 4);
1573
+
1574
+			return $this->importFrom($format, reset($params));
1575
+		}
1576
+
1577
+		if (0 === strpos($name, 'to')) {
1578
+			$format = substr($name, 2);
1579
+			$includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1580
+
1581
+			return $this->exportTo($format, $includeLazyLoadColumns);
1582
+		}
1583
+
1584
+		throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1585
+	}
1586 1586
 
1587 1587
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         $propertyNames = [];
344 344
         $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
345 345
 
346
-        foreach($serializableProperties as $property) {
346
+        foreach ($serializableProperties as $property) {
347 347
             $propertyNames[] = $property->getName();
348 348
         }
349 349
 
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
             $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
701 701
         }
702 702
 
703
-        $con->transaction(function () use ($con) {
703
+        $con->transaction(function() use ($con) {
704 704
             $deleteQuery = ChildConnectionQuery::create()
705 705
                 ->filterByPrimaryKey($this->getPrimaryKey());
706 706
             $ret = $this->preDelete($con);
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
             $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
736 736
         }
737 737
 
738
-        return $con->transaction(function () use ($con) {
738
+        return $con->transaction(function() use ($con) {
739 739
             $isInsert = $this->isNew();
740 740
             $ret = $this->preSave($con);
741 741
             if ($isInsert) {
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
                         $key = 'Instance';
1021 1021
                 }
1022 1022
 
1023
-                $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1023
+                $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1024 1024
             }
1025 1025
             if (null !== $this->aUser) {
1026 1026
 
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
                         $key = 'User';
1036 1036
                 }
1037 1037
 
1038
-                $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1038
+                $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1039 1039
             }
1040 1040
         }
1041 1041
 
Please login to merge, or discard this patch.
src/cli/Database/Base/ConnectionQuery.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
      * $query->filterByStarted(array('max' => 'yesterday')); // WHERE started > '2011-03-13'
426 426
      * </code>
427 427
      *
428
-     * @param     mixed $started The value to use as filter.
428
+     * @param     integer $started The value to use as filter.
429 429
      *              Values can be integers (unix timestamps), DateTime objects, or strings.
430 430
      *              Empty strings are treated as NULL.
431 431
      *              Use scalar values for equality.
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     /**
491 491
      * Filter the query by a related \Jalle19\StatusManager\Database\Instance object
492 492
      *
493
-     * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter
493
+     * @param Instance $instance The related object(s) to use as filter
494 494
      * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
495 495
      *
496 496
      * @throws \Propel\Runtime\Exception\PropelException
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
     /**
568 568
      * Filter the query by a related \Jalle19\StatusManager\Database\User object
569 569
      *
570
-     * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user The related object(s) to use as filter
570
+     * @param User $user The related object(s) to use as filter
571 571
      * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
572 572
      *
573 573
      * @throws \Propel\Runtime\Exception\PropelException
Please login to merge, or discard this patch.
Indentation   +621 added lines, -622 removed lines patch added patch discarded remove patch
@@ -73,7 +73,6 @@  discard block
 block discarded – undo
73 73
  * @method     ChildConnection findOneByPeer(string $peer) Return the first ChildConnection filtered by the peer column
74 74
  * @method     ChildConnection findOneByStarted(string $started) Return the first ChildConnection filtered by the started column
75 75
  * @method     ChildConnection findOneByType(string $type) Return the first ChildConnection filtered by the type column *
76
-
77 76
  * @method     ChildConnection requirePk($key, ConnectionInterface $con = null) Return the ChildConnection by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
78 77
  * @method     ChildConnection requireOne(ConnectionInterface $con = null) Return the first ChildConnection matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
79 78
  *
@@ -96,626 +95,626 @@  discard block
 block discarded – undo
96 95
  */
97 96
 abstract class ConnectionQuery extends ModelCriteria
98 97
 {
99
-    protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException';
100
-
101
-    /**
102
-     * Initializes internal state of \Jalle19\StatusManager\Database\Base\ConnectionQuery object.
103
-     *
104
-     * @param     string $dbName The database name
105
-     * @param     string $modelName The phpName of a model, e.g. 'Book'
106
-     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
107
-     */
108
-    public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Connection', $modelAlias = null)
109
-    {
110
-        parent::__construct($dbName, $modelName, $modelAlias);
111
-    }
112
-
113
-    /**
114
-     * Returns a new ChildConnectionQuery object.
115
-     *
116
-     * @param     string $modelAlias The alias of a model in the query
117
-     * @param     Criteria $criteria Optional Criteria to build the query from
118
-     *
119
-     * @return ChildConnectionQuery
120
-     */
121
-    public static function create($modelAlias = null, Criteria $criteria = null)
122
-    {
123
-        if ($criteria instanceof ChildConnectionQuery) {
124
-            return $criteria;
125
-        }
126
-        $query = new ChildConnectionQuery();
127
-        if (null !== $modelAlias) {
128
-            $query->setModelAlias($modelAlias);
129
-        }
130
-        if ($criteria instanceof Criteria) {
131
-            $query->mergeWith($criteria);
132
-        }
133
-
134
-        return $query;
135
-    }
136
-
137
-    /**
138
-     * Find object by primary key.
139
-     * Propel uses the instance pool to skip the database if the object exists.
140
-     * Go fast if the query is untouched.
141
-     *
142
-     * <code>
143
-     * $obj  = $c->findPk(12, $con);
144
-     * </code>
145
-     *
146
-     * @param mixed $key Primary key to use for the query
147
-     * @param ConnectionInterface $con an optional connection object
148
-     *
149
-     * @return ChildConnection|array|mixed the result, formatted by the current formatter
150
-     */
151
-    public function findPk($key, ConnectionInterface $con = null)
152
-    {
153
-        if ($key === null) {
154
-            return null;
155
-        }
156
-        if ((null !== ($obj = ConnectionTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) {
157
-            // the object is already in the instance pool
158
-            return $obj;
159
-        }
160
-        if ($con === null) {
161
-            $con = Propel::getServiceContainer()->getReadConnection(ConnectionTableMap::DATABASE_NAME);
162
-        }
163
-        $this->basePreSelect($con);
164
-        if ($this->formatter || $this->modelAlias || $this->with || $this->select
165
-         || $this->selectColumns || $this->asColumns || $this->selectModifiers
166
-         || $this->map || $this->having || $this->joins) {
167
-            return $this->findPkComplex($key, $con);
168
-        } else {
169
-            return $this->findPkSimple($key, $con);
170
-        }
171
-    }
172
-
173
-    /**
174
-     * Find object by primary key using raw SQL to go fast.
175
-     * Bypass doSelect() and the object formatter by using generated code.
176
-     *
177
-     * @param     mixed $key Primary key to use for the query
178
-     * @param     ConnectionInterface $con A connection object
179
-     *
180
-     * @throws \Propel\Runtime\Exception\PropelException
181
-     *
182
-     * @return ChildConnection A model object, or null if the key is not found
183
-     */
184
-    protected function findPkSimple($key, ConnectionInterface $con)
185
-    {
186
-        $sql = 'SELECT id, instance_name, user_id, peer, started, type FROM connection WHERE id = :p0';
187
-        try {
188
-            $stmt = $con->prepare($sql);
189
-            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
190
-            $stmt->execute();
191
-        } catch (Exception $e) {
192
-            Propel::log($e->getMessage(), Propel::LOG_ERR);
193
-            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
194
-        }
195
-        $obj = null;
196
-        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
197
-            /** @var ChildConnection $obj */
198
-            $obj = new ChildConnection();
199
-            $obj->hydrate($row);
200
-            ConnectionTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
201
-        }
202
-        $stmt->closeCursor();
203
-
204
-        return $obj;
205
-    }
206
-
207
-    /**
208
-     * Find object by primary key.
209
-     *
210
-     * @param     mixed $key Primary key to use for the query
211
-     * @param     ConnectionInterface $con A connection object
212
-     *
213
-     * @return ChildConnection|array|mixed the result, formatted by the current formatter
214
-     */
215
-    protected function findPkComplex($key, ConnectionInterface $con)
216
-    {
217
-        // As the query uses a PK condition, no limit(1) is necessary.
218
-        $criteria = $this->isKeepQuery() ? clone $this : $this;
219
-        $dataFetcher = $criteria
220
-            ->filterByPrimaryKey($key)
221
-            ->doSelect($con);
222
-
223
-        return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
224
-    }
225
-
226
-    /**
227
-     * Find objects by primary key
228
-     * <code>
229
-     * $objs = $c->findPks(array(12, 56, 832), $con);
230
-     * </code>
231
-     * @param     array $keys Primary keys to use for the query
232
-     * @param     ConnectionInterface $con an optional connection object
233
-     *
234
-     * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
235
-     */
236
-    public function findPks($keys, ConnectionInterface $con = null)
237
-    {
238
-        if (null === $con) {
239
-            $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
240
-        }
241
-        $this->basePreSelect($con);
242
-        $criteria = $this->isKeepQuery() ? clone $this : $this;
243
-        $dataFetcher = $criteria
244
-            ->filterByPrimaryKeys($keys)
245
-            ->doSelect($con);
246
-
247
-        return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
248
-    }
249
-
250
-    /**
251
-     * Filter the query by primary key
252
-     *
253
-     * @param     mixed $key Primary key to use for the query
254
-     *
255
-     * @return $this|ChildConnectionQuery The current query, for fluid interface
256
-     */
257
-    public function filterByPrimaryKey($key)
258
-    {
259
-
260
-        return $this->addUsingAlias(ConnectionTableMap::COL_ID, $key, Criteria::EQUAL);
261
-    }
262
-
263
-    /**
264
-     * Filter the query by a list of primary keys
265
-     *
266
-     * @param     array $keys The list of primary key to use for the query
267
-     *
268
-     * @return $this|ChildConnectionQuery The current query, for fluid interface
269
-     */
270
-    public function filterByPrimaryKeys($keys)
271
-    {
272
-
273
-        return $this->addUsingAlias(ConnectionTableMap::COL_ID, $keys, Criteria::IN);
274
-    }
275
-
276
-    /**
277
-     * Filter the query on the id column
278
-     *
279
-     * Example usage:
280
-     * <code>
281
-     * $query->filterById(1234); // WHERE id = 1234
282
-     * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
283
-     * $query->filterById(array('min' => 12)); // WHERE id > 12
284
-     * </code>
285
-     *
286
-     * @param     mixed $id The value to use as filter.
287
-     *              Use scalar values for equality.
288
-     *              Use array values for in_array() equivalent.
289
-     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
290
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
291
-     *
292
-     * @return $this|ChildConnectionQuery The current query, for fluid interface
293
-     */
294
-    public function filterById($id = null, $comparison = null)
295
-    {
296
-        if (is_array($id)) {
297
-            $useMinMax = false;
298
-            if (isset($id['min'])) {
299
-                $this->addUsingAlias(ConnectionTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL);
300
-                $useMinMax = true;
301
-            }
302
-            if (isset($id['max'])) {
303
-                $this->addUsingAlias(ConnectionTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL);
304
-                $useMinMax = true;
305
-            }
306
-            if ($useMinMax) {
307
-                return $this;
308
-            }
309
-            if (null === $comparison) {
310
-                $comparison = Criteria::IN;
311
-            }
312
-        }
313
-
314
-        return $this->addUsingAlias(ConnectionTableMap::COL_ID, $id, $comparison);
315
-    }
316
-
317
-    /**
318
-     * Filter the query on the instance_name column
319
-     *
320
-     * Example usage:
321
-     * <code>
322
-     * $query->filterByInstanceName('fooValue');   // WHERE instance_name = 'fooValue'
323
-     * $query->filterByInstanceName('%fooValue%'); // WHERE instance_name LIKE '%fooValue%'
324
-     * </code>
325
-     *
326
-     * @param     string $instanceName The value to use as filter.
327
-     *              Accepts wildcards (* and % trigger a LIKE)
328
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
329
-     *
330
-     * @return $this|ChildConnectionQuery The current query, for fluid interface
331
-     */
332
-    public function filterByInstanceName($instanceName = null, $comparison = null)
333
-    {
334
-        if (null === $comparison) {
335
-            if (is_array($instanceName)) {
336
-                $comparison = Criteria::IN;
337
-            } elseif (preg_match('/[\%\*]/', $instanceName)) {
338
-                $instanceName = str_replace('*', '%', $instanceName);
339
-                $comparison = Criteria::LIKE;
340
-            }
341
-        }
342
-
343
-        return $this->addUsingAlias(ConnectionTableMap::COL_INSTANCE_NAME, $instanceName, $comparison);
344
-    }
345
-
346
-    /**
347
-     * Filter the query on the user_id column
348
-     *
349
-     * Example usage:
350
-     * <code>
351
-     * $query->filterByUserId(1234); // WHERE user_id = 1234
352
-     * $query->filterByUserId(array(12, 34)); // WHERE user_id IN (12, 34)
353
-     * $query->filterByUserId(array('min' => 12)); // WHERE user_id > 12
354
-     * </code>
355
-     *
356
-     * @see       filterByUser()
357
-     *
358
-     * @param     mixed $userId The value to use as filter.
359
-     *              Use scalar values for equality.
360
-     *              Use array values for in_array() equivalent.
361
-     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
362
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
363
-     *
364
-     * @return $this|ChildConnectionQuery The current query, for fluid interface
365
-     */
366
-    public function filterByUserId($userId = null, $comparison = null)
367
-    {
368
-        if (is_array($userId)) {
369
-            $useMinMax = false;
370
-            if (isset($userId['min'])) {
371
-                $this->addUsingAlias(ConnectionTableMap::COL_USER_ID, $userId['min'], Criteria::GREATER_EQUAL);
372
-                $useMinMax = true;
373
-            }
374
-            if (isset($userId['max'])) {
375
-                $this->addUsingAlias(ConnectionTableMap::COL_USER_ID, $userId['max'], Criteria::LESS_EQUAL);
376
-                $useMinMax = true;
377
-            }
378
-            if ($useMinMax) {
379
-                return $this;
380
-            }
381
-            if (null === $comparison) {
382
-                $comparison = Criteria::IN;
383
-            }
384
-        }
385
-
386
-        return $this->addUsingAlias(ConnectionTableMap::COL_USER_ID, $userId, $comparison);
387
-    }
388
-
389
-    /**
390
-     * Filter the query on the peer column
391
-     *
392
-     * Example usage:
393
-     * <code>
394
-     * $query->filterByPeer('fooValue');   // WHERE peer = 'fooValue'
395
-     * $query->filterByPeer('%fooValue%'); // WHERE peer LIKE '%fooValue%'
396
-     * </code>
397
-     *
398
-     * @param     string $peer The value to use as filter.
399
-     *              Accepts wildcards (* and % trigger a LIKE)
400
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
401
-     *
402
-     * @return $this|ChildConnectionQuery The current query, for fluid interface
403
-     */
404
-    public function filterByPeer($peer = null, $comparison = null)
405
-    {
406
-        if (null === $comparison) {
407
-            if (is_array($peer)) {
408
-                $comparison = Criteria::IN;
409
-            } elseif (preg_match('/[\%\*]/', $peer)) {
410
-                $peer = str_replace('*', '%', $peer);
411
-                $comparison = Criteria::LIKE;
412
-            }
413
-        }
414
-
415
-        return $this->addUsingAlias(ConnectionTableMap::COL_PEER, $peer, $comparison);
416
-    }
417
-
418
-    /**
419
-     * Filter the query on the started column
420
-     *
421
-     * Example usage:
422
-     * <code>
423
-     * $query->filterByStarted('2011-03-14'); // WHERE started = '2011-03-14'
424
-     * $query->filterByStarted('now'); // WHERE started = '2011-03-14'
425
-     * $query->filterByStarted(array('max' => 'yesterday')); // WHERE started > '2011-03-13'
426
-     * </code>
427
-     *
428
-     * @param     mixed $started The value to use as filter.
429
-     *              Values can be integers (unix timestamps), DateTime objects, or strings.
430
-     *              Empty strings are treated as NULL.
431
-     *              Use scalar values for equality.
432
-     *              Use array values for in_array() equivalent.
433
-     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
434
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
435
-     *
436
-     * @return $this|ChildConnectionQuery The current query, for fluid interface
437
-     */
438
-    public function filterByStarted($started = null, $comparison = null)
439
-    {
440
-        if (is_array($started)) {
441
-            $useMinMax = false;
442
-            if (isset($started['min'])) {
443
-                $this->addUsingAlias(ConnectionTableMap::COL_STARTED, $started['min'], Criteria::GREATER_EQUAL);
444
-                $useMinMax = true;
445
-            }
446
-            if (isset($started['max'])) {
447
-                $this->addUsingAlias(ConnectionTableMap::COL_STARTED, $started['max'], Criteria::LESS_EQUAL);
448
-                $useMinMax = true;
449
-            }
450
-            if ($useMinMax) {
451
-                return $this;
452
-            }
453
-            if (null === $comparison) {
454
-                $comparison = Criteria::IN;
455
-            }
456
-        }
457
-
458
-        return $this->addUsingAlias(ConnectionTableMap::COL_STARTED, $started, $comparison);
459
-    }
460
-
461
-    /**
462
-     * Filter the query on the type column
463
-     *
464
-     * Example usage:
465
-     * <code>
466
-     * $query->filterByType('fooValue');   // WHERE type = 'fooValue'
467
-     * $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
468
-     * </code>
469
-     *
470
-     * @param     string $type The value to use as filter.
471
-     *              Accepts wildcards (* and % trigger a LIKE)
472
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
473
-     *
474
-     * @return $this|ChildConnectionQuery The current query, for fluid interface
475
-     */
476
-    public function filterByType($type = null, $comparison = null)
477
-    {
478
-        if (null === $comparison) {
479
-            if (is_array($type)) {
480
-                $comparison = Criteria::IN;
481
-            } elseif (preg_match('/[\%\*]/', $type)) {
482
-                $type = str_replace('*', '%', $type);
483
-                $comparison = Criteria::LIKE;
484
-            }
485
-        }
486
-
487
-        return $this->addUsingAlias(ConnectionTableMap::COL_TYPE, $type, $comparison);
488
-    }
489
-
490
-    /**
491
-     * Filter the query by a related \Jalle19\StatusManager\Database\Instance object
492
-     *
493
-     * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter
494
-     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
495
-     *
496
-     * @throws \Propel\Runtime\Exception\PropelException
497
-     *
498
-     * @return ChildConnectionQuery The current query, for fluid interface
499
-     */
500
-    public function filterByInstance($instance, $comparison = null)
501
-    {
502
-        if ($instance instanceof \Jalle19\StatusManager\Database\Instance) {
503
-            return $this
504
-                ->addUsingAlias(ConnectionTableMap::COL_INSTANCE_NAME, $instance->getName(), $comparison);
505
-        } elseif ($instance instanceof ObjectCollection) {
506
-            if (null === $comparison) {
507
-                $comparison = Criteria::IN;
508
-            }
509
-
510
-            return $this
511
-                ->addUsingAlias(ConnectionTableMap::COL_INSTANCE_NAME, $instance->toKeyValue('PrimaryKey', 'Name'), $comparison);
512
-        } else {
513
-            throw new PropelException('filterByInstance() only accepts arguments of type \Jalle19\StatusManager\Database\Instance or Collection');
514
-        }
515
-    }
516
-
517
-    /**
518
-     * Adds a JOIN clause to the query using the Instance relation
519
-     *
520
-     * @param     string $relationAlias optional alias for the relation
521
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
522
-     *
523
-     * @return $this|ChildConnectionQuery The current query, for fluid interface
524
-     */
525
-    public function joinInstance($relationAlias = null, $joinType = Criteria::INNER_JOIN)
526
-    {
527
-        $tableMap = $this->getTableMap();
528
-        $relationMap = $tableMap->getRelation('Instance');
529
-
530
-        // create a ModelJoin object for this join
531
-        $join = new ModelJoin();
532
-        $join->setJoinType($joinType);
533
-        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
534
-        if ($previousJoin = $this->getPreviousJoin()) {
535
-            $join->setPreviousJoin($previousJoin);
536
-        }
537
-
538
-        // add the ModelJoin to the current object
539
-        if ($relationAlias) {
540
-            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
541
-            $this->addJoinObject($join, $relationAlias);
542
-        } else {
543
-            $this->addJoinObject($join, 'Instance');
544
-        }
545
-
546
-        return $this;
547
-    }
548
-
549
-    /**
550
-     * Use the Instance relation Instance object
551
-     *
552
-     * @see useQuery()
553
-     *
554
-     * @param     string $relationAlias optional alias for the relation,
555
-     *                                   to be used as main alias in the secondary query
556
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
557
-     *
558
-     * @return \Jalle19\StatusManager\Database\InstanceQuery A secondary query class using the current class as primary query
559
-     */
560
-    public function useInstanceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
561
-    {
562
-        return $this
563
-            ->joinInstance($relationAlias, $joinType)
564
-            ->useQuery($relationAlias ? $relationAlias : 'Instance', '\Jalle19\StatusManager\Database\InstanceQuery');
565
-    }
566
-
567
-    /**
568
-     * Filter the query by a related \Jalle19\StatusManager\Database\User object
569
-     *
570
-     * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user The related object(s) to use as filter
571
-     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
572
-     *
573
-     * @throws \Propel\Runtime\Exception\PropelException
574
-     *
575
-     * @return ChildConnectionQuery The current query, for fluid interface
576
-     */
577
-    public function filterByUser($user, $comparison = null)
578
-    {
579
-        if ($user instanceof \Jalle19\StatusManager\Database\User) {
580
-            return $this
581
-                ->addUsingAlias(ConnectionTableMap::COL_USER_ID, $user->getId(), $comparison);
582
-        } elseif ($user instanceof ObjectCollection) {
583
-            if (null === $comparison) {
584
-                $comparison = Criteria::IN;
585
-            }
586
-
587
-            return $this
588
-                ->addUsingAlias(ConnectionTableMap::COL_USER_ID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison);
589
-        } else {
590
-            throw new PropelException('filterByUser() only accepts arguments of type \Jalle19\StatusManager\Database\User or Collection');
591
-        }
592
-    }
593
-
594
-    /**
595
-     * Adds a JOIN clause to the query using the User relation
596
-     *
597
-     * @param     string $relationAlias optional alias for the relation
598
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
599
-     *
600
-     * @return $this|ChildConnectionQuery The current query, for fluid interface
601
-     */
602
-    public function joinUser($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
603
-    {
604
-        $tableMap = $this->getTableMap();
605
-        $relationMap = $tableMap->getRelation('User');
606
-
607
-        // create a ModelJoin object for this join
608
-        $join = new ModelJoin();
609
-        $join->setJoinType($joinType);
610
-        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
611
-        if ($previousJoin = $this->getPreviousJoin()) {
612
-            $join->setPreviousJoin($previousJoin);
613
-        }
614
-
615
-        // add the ModelJoin to the current object
616
-        if ($relationAlias) {
617
-            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
618
-            $this->addJoinObject($join, $relationAlias);
619
-        } else {
620
-            $this->addJoinObject($join, 'User');
621
-        }
622
-
623
-        return $this;
624
-    }
625
-
626
-    /**
627
-     * Use the User relation User object
628
-     *
629
-     * @see useQuery()
630
-     *
631
-     * @param     string $relationAlias optional alias for the relation,
632
-     *                                   to be used as main alias in the secondary query
633
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
634
-     *
635
-     * @return \Jalle19\StatusManager\Database\UserQuery A secondary query class using the current class as primary query
636
-     */
637
-    public function useUserQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
638
-    {
639
-        return $this
640
-            ->joinUser($relationAlias, $joinType)
641
-            ->useQuery($relationAlias ? $relationAlias : 'User', '\Jalle19\StatusManager\Database\UserQuery');
642
-    }
643
-
644
-    /**
645
-     * Exclude object from result
646
-     *
647
-     * @param   ChildConnection $connection Object to remove from the list of results
648
-     *
649
-     * @return $this|ChildConnectionQuery The current query, for fluid interface
650
-     */
651
-    public function prune($connection = null)
652
-    {
653
-        if ($connection) {
654
-            $this->addUsingAlias(ConnectionTableMap::COL_ID, $connection->getId(), Criteria::NOT_EQUAL);
655
-        }
656
-
657
-        return $this;
658
-    }
659
-
660
-    /**
661
-     * Deletes all rows from the connection table.
662
-     *
663
-     * @param ConnectionInterface $con the connection to use
664
-     * @return int The number of affected rows (if supported by underlying database driver).
665
-     */
666
-    public function doDeleteAll(ConnectionInterface $con = null)
667
-    {
668
-        if (null === $con) {
669
-            $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
670
-        }
671
-
672
-        // use transaction because $criteria could contain info
673
-        // for more than one table or we could emulating ON DELETE CASCADE, etc.
674
-        return $con->transaction(function () use ($con) {
675
-            $affectedRows = 0; // initialize var to track total num of affected rows
676
-            $affectedRows += parent::doDeleteAll($con);
677
-            // Because this db requires some delete cascade/set null emulation, we have to
678
-            // clear the cached instance *after* the emulation has happened (since
679
-            // instances get re-added by the select statement contained therein).
680
-            ConnectionTableMap::clearInstancePool();
681
-            ConnectionTableMap::clearRelatedInstancePool();
682
-
683
-            return $affectedRows;
684
-        });
685
-    }
686
-
687
-    /**
688
-     * Performs a DELETE on the database based on the current ModelCriteria
689
-     *
690
-     * @param ConnectionInterface $con the connection to use
691
-     * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
692
-     *                         if supported by native driver or if emulated using Propel.
693
-     * @throws PropelException Any exceptions caught during processing will be
694
-     *                         rethrown wrapped into a PropelException.
695
-     */
696
-    public function delete(ConnectionInterface $con = null)
697
-    {
698
-        if (null === $con) {
699
-            $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
700
-        }
701
-
702
-        $criteria = $this;
703
-
704
-        // Set the correct dbName
705
-        $criteria->setDbName(ConnectionTableMap::DATABASE_NAME);
706
-
707
-        // use transaction because $criteria could contain info
708
-        // for more than one table or we could emulating ON DELETE CASCADE, etc.
709
-        return $con->transaction(function () use ($con, $criteria) {
710
-            $affectedRows = 0; // initialize var to track total num of affected rows
711
-
712
-            ConnectionTableMap::removeInstanceFromPool($criteria);
713
-
714
-            $affectedRows += ModelCriteria::delete($con);
715
-            ConnectionTableMap::clearRelatedInstancePool();
716
-
717
-            return $affectedRows;
718
-        });
719
-    }
98
+	protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException';
99
+
100
+	/**
101
+	 * Initializes internal state of \Jalle19\StatusManager\Database\Base\ConnectionQuery object.
102
+	 *
103
+	 * @param     string $dbName The database name
104
+	 * @param     string $modelName The phpName of a model, e.g. 'Book'
105
+	 * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
106
+	 */
107
+	public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Connection', $modelAlias = null)
108
+	{
109
+		parent::__construct($dbName, $modelName, $modelAlias);
110
+	}
111
+
112
+	/**
113
+	 * Returns a new ChildConnectionQuery object.
114
+	 *
115
+	 * @param     string $modelAlias The alias of a model in the query
116
+	 * @param     Criteria $criteria Optional Criteria to build the query from
117
+	 *
118
+	 * @return ChildConnectionQuery
119
+	 */
120
+	public static function create($modelAlias = null, Criteria $criteria = null)
121
+	{
122
+		if ($criteria instanceof ChildConnectionQuery) {
123
+			return $criteria;
124
+		}
125
+		$query = new ChildConnectionQuery();
126
+		if (null !== $modelAlias) {
127
+			$query->setModelAlias($modelAlias);
128
+		}
129
+		if ($criteria instanceof Criteria) {
130
+			$query->mergeWith($criteria);
131
+		}
132
+
133
+		return $query;
134
+	}
135
+
136
+	/**
137
+	 * Find object by primary key.
138
+	 * Propel uses the instance pool to skip the database if the object exists.
139
+	 * Go fast if the query is untouched.
140
+	 *
141
+	 * <code>
142
+	 * $obj  = $c->findPk(12, $con);
143
+	 * </code>
144
+	 *
145
+	 * @param mixed $key Primary key to use for the query
146
+	 * @param ConnectionInterface $con an optional connection object
147
+	 *
148
+	 * @return ChildConnection|array|mixed the result, formatted by the current formatter
149
+	 */
150
+	public function findPk($key, ConnectionInterface $con = null)
151
+	{
152
+		if ($key === null) {
153
+			return null;
154
+		}
155
+		if ((null !== ($obj = ConnectionTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) {
156
+			// the object is already in the instance pool
157
+			return $obj;
158
+		}
159
+		if ($con === null) {
160
+			$con = Propel::getServiceContainer()->getReadConnection(ConnectionTableMap::DATABASE_NAME);
161
+		}
162
+		$this->basePreSelect($con);
163
+		if ($this->formatter || $this->modelAlias || $this->with || $this->select
164
+		 || $this->selectColumns || $this->asColumns || $this->selectModifiers
165
+		 || $this->map || $this->having || $this->joins) {
166
+			return $this->findPkComplex($key, $con);
167
+		} else {
168
+			return $this->findPkSimple($key, $con);
169
+		}
170
+	}
171
+
172
+	/**
173
+	 * Find object by primary key using raw SQL to go fast.
174
+	 * Bypass doSelect() and the object formatter by using generated code.
175
+	 *
176
+	 * @param     mixed $key Primary key to use for the query
177
+	 * @param     ConnectionInterface $con A connection object
178
+	 *
179
+	 * @throws \Propel\Runtime\Exception\PropelException
180
+	 *
181
+	 * @return ChildConnection A model object, or null if the key is not found
182
+	 */
183
+	protected function findPkSimple($key, ConnectionInterface $con)
184
+	{
185
+		$sql = 'SELECT id, instance_name, user_id, peer, started, type FROM connection WHERE id = :p0';
186
+		try {
187
+			$stmt = $con->prepare($sql);
188
+			$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
189
+			$stmt->execute();
190
+		} catch (Exception $e) {
191
+			Propel::log($e->getMessage(), Propel::LOG_ERR);
192
+			throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
193
+		}
194
+		$obj = null;
195
+		if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
196
+			/** @var ChildConnection $obj */
197
+			$obj = new ChildConnection();
198
+			$obj->hydrate($row);
199
+			ConnectionTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
200
+		}
201
+		$stmt->closeCursor();
202
+
203
+		return $obj;
204
+	}
205
+
206
+	/**
207
+	 * Find object by primary key.
208
+	 *
209
+	 * @param     mixed $key Primary key to use for the query
210
+	 * @param     ConnectionInterface $con A connection object
211
+	 *
212
+	 * @return ChildConnection|array|mixed the result, formatted by the current formatter
213
+	 */
214
+	protected function findPkComplex($key, ConnectionInterface $con)
215
+	{
216
+		// As the query uses a PK condition, no limit(1) is necessary.
217
+		$criteria = $this->isKeepQuery() ? clone $this : $this;
218
+		$dataFetcher = $criteria
219
+			->filterByPrimaryKey($key)
220
+			->doSelect($con);
221
+
222
+		return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
223
+	}
224
+
225
+	/**
226
+	 * Find objects by primary key
227
+	 * <code>
228
+	 * $objs = $c->findPks(array(12, 56, 832), $con);
229
+	 * </code>
230
+	 * @param     array $keys Primary keys to use for the query
231
+	 * @param     ConnectionInterface $con an optional connection object
232
+	 *
233
+	 * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
234
+	 */
235
+	public function findPks($keys, ConnectionInterface $con = null)
236
+	{
237
+		if (null === $con) {
238
+			$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
239
+		}
240
+		$this->basePreSelect($con);
241
+		$criteria = $this->isKeepQuery() ? clone $this : $this;
242
+		$dataFetcher = $criteria
243
+			->filterByPrimaryKeys($keys)
244
+			->doSelect($con);
245
+
246
+		return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
247
+	}
248
+
249
+	/**
250
+	 * Filter the query by primary key
251
+	 *
252
+	 * @param     mixed $key Primary key to use for the query
253
+	 *
254
+	 * @return $this|ChildConnectionQuery The current query, for fluid interface
255
+	 */
256
+	public function filterByPrimaryKey($key)
257
+	{
258
+
259
+		return $this->addUsingAlias(ConnectionTableMap::COL_ID, $key, Criteria::EQUAL);
260
+	}
261
+
262
+	/**
263
+	 * Filter the query by a list of primary keys
264
+	 *
265
+	 * @param     array $keys The list of primary key to use for the query
266
+	 *
267
+	 * @return $this|ChildConnectionQuery The current query, for fluid interface
268
+	 */
269
+	public function filterByPrimaryKeys($keys)
270
+	{
271
+
272
+		return $this->addUsingAlias(ConnectionTableMap::COL_ID, $keys, Criteria::IN);
273
+	}
274
+
275
+	/**
276
+	 * Filter the query on the id column
277
+	 *
278
+	 * Example usage:
279
+	 * <code>
280
+	 * $query->filterById(1234); // WHERE id = 1234
281
+	 * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
282
+	 * $query->filterById(array('min' => 12)); // WHERE id > 12
283
+	 * </code>
284
+	 *
285
+	 * @param     mixed $id The value to use as filter.
286
+	 *              Use scalar values for equality.
287
+	 *              Use array values for in_array() equivalent.
288
+	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
289
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
290
+	 *
291
+	 * @return $this|ChildConnectionQuery The current query, for fluid interface
292
+	 */
293
+	public function filterById($id = null, $comparison = null)
294
+	{
295
+		if (is_array($id)) {
296
+			$useMinMax = false;
297
+			if (isset($id['min'])) {
298
+				$this->addUsingAlias(ConnectionTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL);
299
+				$useMinMax = true;
300
+			}
301
+			if (isset($id['max'])) {
302
+				$this->addUsingAlias(ConnectionTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL);
303
+				$useMinMax = true;
304
+			}
305
+			if ($useMinMax) {
306
+				return $this;
307
+			}
308
+			if (null === $comparison) {
309
+				$comparison = Criteria::IN;
310
+			}
311
+		}
312
+
313
+		return $this->addUsingAlias(ConnectionTableMap::COL_ID, $id, $comparison);
314
+	}
315
+
316
+	/**
317
+	 * Filter the query on the instance_name column
318
+	 *
319
+	 * Example usage:
320
+	 * <code>
321
+	 * $query->filterByInstanceName('fooValue');   // WHERE instance_name = 'fooValue'
322
+	 * $query->filterByInstanceName('%fooValue%'); // WHERE instance_name LIKE '%fooValue%'
323
+	 * </code>
324
+	 *
325
+	 * @param     string $instanceName The value to use as filter.
326
+	 *              Accepts wildcards (* and % trigger a LIKE)
327
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
328
+	 *
329
+	 * @return $this|ChildConnectionQuery The current query, for fluid interface
330
+	 */
331
+	public function filterByInstanceName($instanceName = null, $comparison = null)
332
+	{
333
+		if (null === $comparison) {
334
+			if (is_array($instanceName)) {
335
+				$comparison = Criteria::IN;
336
+			} elseif (preg_match('/[\%\*]/', $instanceName)) {
337
+				$instanceName = str_replace('*', '%', $instanceName);
338
+				$comparison = Criteria::LIKE;
339
+			}
340
+		}
341
+
342
+		return $this->addUsingAlias(ConnectionTableMap::COL_INSTANCE_NAME, $instanceName, $comparison);
343
+	}
344
+
345
+	/**
346
+	 * Filter the query on the user_id column
347
+	 *
348
+	 * Example usage:
349
+	 * <code>
350
+	 * $query->filterByUserId(1234); // WHERE user_id = 1234
351
+	 * $query->filterByUserId(array(12, 34)); // WHERE user_id IN (12, 34)
352
+	 * $query->filterByUserId(array('min' => 12)); // WHERE user_id > 12
353
+	 * </code>
354
+	 *
355
+	 * @see       filterByUser()
356
+	 *
357
+	 * @param     mixed $userId The value to use as filter.
358
+	 *              Use scalar values for equality.
359
+	 *              Use array values for in_array() equivalent.
360
+	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
361
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
362
+	 *
363
+	 * @return $this|ChildConnectionQuery The current query, for fluid interface
364
+	 */
365
+	public function filterByUserId($userId = null, $comparison = null)
366
+	{
367
+		if (is_array($userId)) {
368
+			$useMinMax = false;
369
+			if (isset($userId['min'])) {
370
+				$this->addUsingAlias(ConnectionTableMap::COL_USER_ID, $userId['min'], Criteria::GREATER_EQUAL);
371
+				$useMinMax = true;
372
+			}
373
+			if (isset($userId['max'])) {
374
+				$this->addUsingAlias(ConnectionTableMap::COL_USER_ID, $userId['max'], Criteria::LESS_EQUAL);
375
+				$useMinMax = true;
376
+			}
377
+			if ($useMinMax) {
378
+				return $this;
379
+			}
380
+			if (null === $comparison) {
381
+				$comparison = Criteria::IN;
382
+			}
383
+		}
384
+
385
+		return $this->addUsingAlias(ConnectionTableMap::COL_USER_ID, $userId, $comparison);
386
+	}
387
+
388
+	/**
389
+	 * Filter the query on the peer column
390
+	 *
391
+	 * Example usage:
392
+	 * <code>
393
+	 * $query->filterByPeer('fooValue');   // WHERE peer = 'fooValue'
394
+	 * $query->filterByPeer('%fooValue%'); // WHERE peer LIKE '%fooValue%'
395
+	 * </code>
396
+	 *
397
+	 * @param     string $peer The value to use as filter.
398
+	 *              Accepts wildcards (* and % trigger a LIKE)
399
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
400
+	 *
401
+	 * @return $this|ChildConnectionQuery The current query, for fluid interface
402
+	 */
403
+	public function filterByPeer($peer = null, $comparison = null)
404
+	{
405
+		if (null === $comparison) {
406
+			if (is_array($peer)) {
407
+				$comparison = Criteria::IN;
408
+			} elseif (preg_match('/[\%\*]/', $peer)) {
409
+				$peer = str_replace('*', '%', $peer);
410
+				$comparison = Criteria::LIKE;
411
+			}
412
+		}
413
+
414
+		return $this->addUsingAlias(ConnectionTableMap::COL_PEER, $peer, $comparison);
415
+	}
416
+
417
+	/**
418
+	 * Filter the query on the started column
419
+	 *
420
+	 * Example usage:
421
+	 * <code>
422
+	 * $query->filterByStarted('2011-03-14'); // WHERE started = '2011-03-14'
423
+	 * $query->filterByStarted('now'); // WHERE started = '2011-03-14'
424
+	 * $query->filterByStarted(array('max' => 'yesterday')); // WHERE started > '2011-03-13'
425
+	 * </code>
426
+	 *
427
+	 * @param     mixed $started The value to use as filter.
428
+	 *              Values can be integers (unix timestamps), DateTime objects, or strings.
429
+	 *              Empty strings are treated as NULL.
430
+	 *              Use scalar values for equality.
431
+	 *              Use array values for in_array() equivalent.
432
+	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
433
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
434
+	 *
435
+	 * @return $this|ChildConnectionQuery The current query, for fluid interface
436
+	 */
437
+	public function filterByStarted($started = null, $comparison = null)
438
+	{
439
+		if (is_array($started)) {
440
+			$useMinMax = false;
441
+			if (isset($started['min'])) {
442
+				$this->addUsingAlias(ConnectionTableMap::COL_STARTED, $started['min'], Criteria::GREATER_EQUAL);
443
+				$useMinMax = true;
444
+			}
445
+			if (isset($started['max'])) {
446
+				$this->addUsingAlias(ConnectionTableMap::COL_STARTED, $started['max'], Criteria::LESS_EQUAL);
447
+				$useMinMax = true;
448
+			}
449
+			if ($useMinMax) {
450
+				return $this;
451
+			}
452
+			if (null === $comparison) {
453
+				$comparison = Criteria::IN;
454
+			}
455
+		}
456
+
457
+		return $this->addUsingAlias(ConnectionTableMap::COL_STARTED, $started, $comparison);
458
+	}
459
+
460
+	/**
461
+	 * Filter the query on the type column
462
+	 *
463
+	 * Example usage:
464
+	 * <code>
465
+	 * $query->filterByType('fooValue');   // WHERE type = 'fooValue'
466
+	 * $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
467
+	 * </code>
468
+	 *
469
+	 * @param     string $type The value to use as filter.
470
+	 *              Accepts wildcards (* and % trigger a LIKE)
471
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
472
+	 *
473
+	 * @return $this|ChildConnectionQuery The current query, for fluid interface
474
+	 */
475
+	public function filterByType($type = null, $comparison = null)
476
+	{
477
+		if (null === $comparison) {
478
+			if (is_array($type)) {
479
+				$comparison = Criteria::IN;
480
+			} elseif (preg_match('/[\%\*]/', $type)) {
481
+				$type = str_replace('*', '%', $type);
482
+				$comparison = Criteria::LIKE;
483
+			}
484
+		}
485
+
486
+		return $this->addUsingAlias(ConnectionTableMap::COL_TYPE, $type, $comparison);
487
+	}
488
+
489
+	/**
490
+	 * Filter the query by a related \Jalle19\StatusManager\Database\Instance object
491
+	 *
492
+	 * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter
493
+	 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
494
+	 *
495
+	 * @throws \Propel\Runtime\Exception\PropelException
496
+	 *
497
+	 * @return ChildConnectionQuery The current query, for fluid interface
498
+	 */
499
+	public function filterByInstance($instance, $comparison = null)
500
+	{
501
+		if ($instance instanceof \Jalle19\StatusManager\Database\Instance) {
502
+			return $this
503
+				->addUsingAlias(ConnectionTableMap::COL_INSTANCE_NAME, $instance->getName(), $comparison);
504
+		} elseif ($instance instanceof ObjectCollection) {
505
+			if (null === $comparison) {
506
+				$comparison = Criteria::IN;
507
+			}
508
+
509
+			return $this
510
+				->addUsingAlias(ConnectionTableMap::COL_INSTANCE_NAME, $instance->toKeyValue('PrimaryKey', 'Name'), $comparison);
511
+		} else {
512
+			throw new PropelException('filterByInstance() only accepts arguments of type \Jalle19\StatusManager\Database\Instance or Collection');
513
+		}
514
+	}
515
+
516
+	/**
517
+	 * Adds a JOIN clause to the query using the Instance relation
518
+	 *
519
+	 * @param     string $relationAlias optional alias for the relation
520
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
521
+	 *
522
+	 * @return $this|ChildConnectionQuery The current query, for fluid interface
523
+	 */
524
+	public function joinInstance($relationAlias = null, $joinType = Criteria::INNER_JOIN)
525
+	{
526
+		$tableMap = $this->getTableMap();
527
+		$relationMap = $tableMap->getRelation('Instance');
528
+
529
+		// create a ModelJoin object for this join
530
+		$join = new ModelJoin();
531
+		$join->setJoinType($joinType);
532
+		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
533
+		if ($previousJoin = $this->getPreviousJoin()) {
534
+			$join->setPreviousJoin($previousJoin);
535
+		}
536
+
537
+		// add the ModelJoin to the current object
538
+		if ($relationAlias) {
539
+			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
540
+			$this->addJoinObject($join, $relationAlias);
541
+		} else {
542
+			$this->addJoinObject($join, 'Instance');
543
+		}
544
+
545
+		return $this;
546
+	}
547
+
548
+	/**
549
+	 * Use the Instance relation Instance object
550
+	 *
551
+	 * @see useQuery()
552
+	 *
553
+	 * @param     string $relationAlias optional alias for the relation,
554
+	 *                                   to be used as main alias in the secondary query
555
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
556
+	 *
557
+	 * @return \Jalle19\StatusManager\Database\InstanceQuery A secondary query class using the current class as primary query
558
+	 */
559
+	public function useInstanceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
560
+	{
561
+		return $this
562
+			->joinInstance($relationAlias, $joinType)
563
+			->useQuery($relationAlias ? $relationAlias : 'Instance', '\Jalle19\StatusManager\Database\InstanceQuery');
564
+	}
565
+
566
+	/**
567
+	 * Filter the query by a related \Jalle19\StatusManager\Database\User object
568
+	 *
569
+	 * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user The related object(s) to use as filter
570
+	 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
571
+	 *
572
+	 * @throws \Propel\Runtime\Exception\PropelException
573
+	 *
574
+	 * @return ChildConnectionQuery The current query, for fluid interface
575
+	 */
576
+	public function filterByUser($user, $comparison = null)
577
+	{
578
+		if ($user instanceof \Jalle19\StatusManager\Database\User) {
579
+			return $this
580
+				->addUsingAlias(ConnectionTableMap::COL_USER_ID, $user->getId(), $comparison);
581
+		} elseif ($user instanceof ObjectCollection) {
582
+			if (null === $comparison) {
583
+				$comparison = Criteria::IN;
584
+			}
585
+
586
+			return $this
587
+				->addUsingAlias(ConnectionTableMap::COL_USER_ID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison);
588
+		} else {
589
+			throw new PropelException('filterByUser() only accepts arguments of type \Jalle19\StatusManager\Database\User or Collection');
590
+		}
591
+	}
592
+
593
+	/**
594
+	 * Adds a JOIN clause to the query using the User relation
595
+	 *
596
+	 * @param     string $relationAlias optional alias for the relation
597
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
598
+	 *
599
+	 * @return $this|ChildConnectionQuery The current query, for fluid interface
600
+	 */
601
+	public function joinUser($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
602
+	{
603
+		$tableMap = $this->getTableMap();
604
+		$relationMap = $tableMap->getRelation('User');
605
+
606
+		// create a ModelJoin object for this join
607
+		$join = new ModelJoin();
608
+		$join->setJoinType($joinType);
609
+		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
610
+		if ($previousJoin = $this->getPreviousJoin()) {
611
+			$join->setPreviousJoin($previousJoin);
612
+		}
613
+
614
+		// add the ModelJoin to the current object
615
+		if ($relationAlias) {
616
+			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
617
+			$this->addJoinObject($join, $relationAlias);
618
+		} else {
619
+			$this->addJoinObject($join, 'User');
620
+		}
621
+
622
+		return $this;
623
+	}
624
+
625
+	/**
626
+	 * Use the User relation User object
627
+	 *
628
+	 * @see useQuery()
629
+	 *
630
+	 * @param     string $relationAlias optional alias for the relation,
631
+	 *                                   to be used as main alias in the secondary query
632
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
633
+	 *
634
+	 * @return \Jalle19\StatusManager\Database\UserQuery A secondary query class using the current class as primary query
635
+	 */
636
+	public function useUserQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
637
+	{
638
+		return $this
639
+			->joinUser($relationAlias, $joinType)
640
+			->useQuery($relationAlias ? $relationAlias : 'User', '\Jalle19\StatusManager\Database\UserQuery');
641
+	}
642
+
643
+	/**
644
+	 * Exclude object from result
645
+	 *
646
+	 * @param   ChildConnection $connection Object to remove from the list of results
647
+	 *
648
+	 * @return $this|ChildConnectionQuery The current query, for fluid interface
649
+	 */
650
+	public function prune($connection = null)
651
+	{
652
+		if ($connection) {
653
+			$this->addUsingAlias(ConnectionTableMap::COL_ID, $connection->getId(), Criteria::NOT_EQUAL);
654
+		}
655
+
656
+		return $this;
657
+	}
658
+
659
+	/**
660
+	 * Deletes all rows from the connection table.
661
+	 *
662
+	 * @param ConnectionInterface $con the connection to use
663
+	 * @return int The number of affected rows (if supported by underlying database driver).
664
+	 */
665
+	public function doDeleteAll(ConnectionInterface $con = null)
666
+	{
667
+		if (null === $con) {
668
+			$con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
669
+		}
670
+
671
+		// use transaction because $criteria could contain info
672
+		// for more than one table or we could emulating ON DELETE CASCADE, etc.
673
+		return $con->transaction(function () use ($con) {
674
+			$affectedRows = 0; // initialize var to track total num of affected rows
675
+			$affectedRows += parent::doDeleteAll($con);
676
+			// Because this db requires some delete cascade/set null emulation, we have to
677
+			// clear the cached instance *after* the emulation has happened (since
678
+			// instances get re-added by the select statement contained therein).
679
+			ConnectionTableMap::clearInstancePool();
680
+			ConnectionTableMap::clearRelatedInstancePool();
681
+
682
+			return $affectedRows;
683
+		});
684
+	}
685
+
686
+	/**
687
+	 * Performs a DELETE on the database based on the current ModelCriteria
688
+	 *
689
+	 * @param ConnectionInterface $con the connection to use
690
+	 * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
691
+	 *                         if supported by native driver or if emulated using Propel.
692
+	 * @throws PropelException Any exceptions caught during processing will be
693
+	 *                         rethrown wrapped into a PropelException.
694
+	 */
695
+	public function delete(ConnectionInterface $con = null)
696
+	{
697
+		if (null === $con) {
698
+			$con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
699
+		}
700
+
701
+		$criteria = $this;
702
+
703
+		// Set the correct dbName
704
+		$criteria->setDbName(ConnectionTableMap::DATABASE_NAME);
705
+
706
+		// use transaction because $criteria could contain info
707
+		// for more than one table or we could emulating ON DELETE CASCADE, etc.
708
+		return $con->transaction(function () use ($con, $criteria) {
709
+			$affectedRows = 0; // initialize var to track total num of affected rows
710
+
711
+			ConnectionTableMap::removeInstanceFromPool($criteria);
712
+
713
+			$affectedRows += ModelCriteria::delete($con);
714
+			ConnectionTableMap::clearRelatedInstancePool();
715
+
716
+			return $affectedRows;
717
+		});
718
+	}
720 719
 
721 720
 } // ConnectionQuery
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 
621 621
         // use transaction because $criteria could contain info
622 622
         // for more than one table or we could emulating ON DELETE CASCADE, etc.
623
-        return $con->transaction(function () use ($con) {
623
+        return $con->transaction(function() use ($con) {
624 624
             $affectedRows = 0; // initialize var to track total num of affected rows
625 625
             $affectedRows += parent::doDeleteAll($con);
626 626
             // Because this db requires some delete cascade/set null emulation, we have to
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 
656 656
         // use transaction because $criteria could contain info
657 657
         // for more than one table or we could emulating ON DELETE CASCADE, etc.
658
-        return $con->transaction(function () use ($con, $criteria) {
658
+        return $con->transaction(function() use ($con, $criteria) {
659 659
             $affectedRows = 0; // initialize var to track total num of affected rows
660 660
 
661 661
             UserTableMap::removeInstanceFromPool($criteria);
Please login to merge, or discard this patch.
src/cli/Database/Base/Instance.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
      *
315 315
      * @param  string  $msg
316 316
      * @param  int     $priority One of the Propel::LOG_* logging levels
317
-     * @return boolean
317
+     * @return boolean|null
318 318
      */
319 319
     protected function log($msg, $priority = Propel::LOG_INFO)
320 320
     {
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
      *                     one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
759 759
      *                     TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
760 760
      *                     Defaults to TableMap::TYPE_PHPNAME.
761
-     * @return mixed Value of field.
761
+     * @return string|null Value of field.
762 762
      */
763 763
     public function getByName($name, $type = TableMap::TYPE_PHPNAME)
764 764
     {
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
      * Zero-based.
774 774
      *
775 775
      * @param      int $pos position in xml schema
776
-     * @return mixed Value of field at $pos
776
+     * @return string|null Value of field at $pos
777 777
      */
778 778
     public function getByPosition($pos)
779 779
     {
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
      * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
960 960
      * The default key type is the column's TableMap::TYPE_PHPNAME.
961 961
      *
962
-     * @param mixed $parser A AbstractParser instance,
962
+     * @param string $parser A AbstractParser instance,
963 963
      *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
964 964
      * @param string $data The source data to import from
965 965
      * @param string $keyType The type of keys the array uses.
Please login to merge, or discard this patch.
Indentation   +2274 added lines, -2274 removed lines patch added patch discarded remove patch
@@ -41,2280 +41,2280 @@
 block discarded – undo
41 41
 */
42 42
 abstract class Instance implements ActiveRecordInterface
43 43
 {
44
-    /**
45
-     * TableMap class name
46
-     */
47
-    const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\InstanceTableMap';
48
-
49
-
50
-    /**
51
-     * attribute to determine if this object has previously been saved.
52
-     * @var boolean
53
-     */
54
-    protected $new = true;
55
-
56
-    /**
57
-     * attribute to determine whether this object has been deleted.
58
-     * @var boolean
59
-     */
60
-    protected $deleted = false;
61
-
62
-    /**
63
-     * The columns that have been modified in current object.
64
-     * Tracking modified columns allows us to only update modified columns.
65
-     * @var array
66
-     */
67
-    protected $modifiedColumns = array();
68
-
69
-    /**
70
-     * The (virtual) columns that are added at runtime
71
-     * The formatters can add supplementary columns based on a resultset
72
-     * @var array
73
-     */
74
-    protected $virtualColumns = array();
75
-
76
-    /**
77
-     * The value for the name field.
78
-     *
79
-     * @var        string
80
-     */
81
-    protected $name;
82
-
83
-    /**
84
-     * @var        ObjectCollection|ChildUser[] Collection to store aggregation of ChildUser objects.
85
-     */
86
-    protected $collUsers;
87
-    protected $collUsersPartial;
88
-
89
-    /**
90
-     * @var        ObjectCollection|ChildConnection[] Collection to store aggregation of ChildConnection objects.
91
-     */
92
-    protected $collConnections;
93
-    protected $collConnectionsPartial;
94
-
95
-    /**
96
-     * @var        ObjectCollection|ChildChannel[] Collection to store aggregation of ChildChannel objects.
97
-     */
98
-    protected $collChannels;
99
-    protected $collChannelsPartial;
100
-
101
-    /**
102
-     * @var        ObjectCollection|ChildSubscription[] Collection to store aggregation of ChildSubscription objects.
103
-     */
104
-    protected $collSubscriptions;
105
-    protected $collSubscriptionsPartial;
106
-
107
-    /**
108
-     * Flag to prevent endless save loop, if this object is referenced
109
-     * by another object which falls in this transaction.
110
-     *
111
-     * @var boolean
112
-     */
113
-    protected $alreadyInSave = false;
114
-
115
-    /**
116
-     * An array of objects scheduled for deletion.
117
-     * @var ObjectCollection|ChildUser[]
118
-     */
119
-    protected $usersScheduledForDeletion = null;
120
-
121
-    /**
122
-     * An array of objects scheduled for deletion.
123
-     * @var ObjectCollection|ChildConnection[]
124
-     */
125
-    protected $connectionsScheduledForDeletion = null;
126
-
127
-    /**
128
-     * An array of objects scheduled for deletion.
129
-     * @var ObjectCollection|ChildChannel[]
130
-     */
131
-    protected $channelsScheduledForDeletion = null;
132
-
133
-    /**
134
-     * An array of objects scheduled for deletion.
135
-     * @var ObjectCollection|ChildSubscription[]
136
-     */
137
-    protected $subscriptionsScheduledForDeletion = null;
138
-
139
-    /**
140
-     * Initializes internal state of Jalle19\StatusManager\Database\Base\Instance object.
141
-     */
142
-    public function __construct()
143
-    {
144
-    }
145
-
146
-    /**
147
-     * Returns whether the object has been modified.
148
-     *
149
-     * @return boolean True if the object has been modified.
150
-     */
151
-    public function isModified()
152
-    {
153
-        return !!$this->modifiedColumns;
154
-    }
155
-
156
-    /**
157
-     * Has specified column been modified?
158
-     *
159
-     * @param  string  $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
160
-     * @return boolean True if $col has been modified.
161
-     */
162
-    public function isColumnModified($col)
163
-    {
164
-        return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
165
-    }
166
-
167
-    /**
168
-     * Get the columns that have been modified in this object.
169
-     * @return array A unique list of the modified column names for this object.
170
-     */
171
-    public function getModifiedColumns()
172
-    {
173
-        return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
174
-    }
175
-
176
-    /**
177
-     * Returns whether the object has ever been saved.  This will
178
-     * be false, if the object was retrieved from storage or was created
179
-     * and then saved.
180
-     *
181
-     * @return boolean true, if the object has never been persisted.
182
-     */
183
-    public function isNew()
184
-    {
185
-        return $this->new;
186
-    }
187
-
188
-    /**
189
-     * Setter for the isNew attribute.  This method will be called
190
-     * by Propel-generated children and objects.
191
-     *
192
-     * @param boolean $b the state of the object.
193
-     */
194
-    public function setNew($b)
195
-    {
196
-        $this->new = (boolean) $b;
197
-    }
198
-
199
-    /**
200
-     * Whether this object has been deleted.
201
-     * @return boolean The deleted state of this object.
202
-     */
203
-    public function isDeleted()
204
-    {
205
-        return $this->deleted;
206
-    }
207
-
208
-    /**
209
-     * Specify whether this object has been deleted.
210
-     * @param  boolean $b The deleted state of this object.
211
-     * @return void
212
-     */
213
-    public function setDeleted($b)
214
-    {
215
-        $this->deleted = (boolean) $b;
216
-    }
217
-
218
-    /**
219
-     * Sets the modified state for the object to be false.
220
-     * @param  string $col If supplied, only the specified column is reset.
221
-     * @return void
222
-     */
223
-    public function resetModified($col = null)
224
-    {
225
-        if (null !== $col) {
226
-            if (isset($this->modifiedColumns[$col])) {
227
-                unset($this->modifiedColumns[$col]);
228
-            }
229
-        } else {
230
-            $this->modifiedColumns = array();
231
-        }
232
-    }
233
-
234
-    /**
235
-     * Compares this with another <code>Instance</code> instance.  If
236
-     * <code>obj</code> is an instance of <code>Instance</code>, delegates to
237
-     * <code>equals(Instance)</code>.  Otherwise, returns <code>false</code>.
238
-     *
239
-     * @param  mixed   $obj The object to compare to.
240
-     * @return boolean Whether equal to the object specified.
241
-     */
242
-    public function equals($obj)
243
-    {
244
-        if (!$obj instanceof static) {
245
-            return false;
246
-        }
247
-
248
-        if ($this === $obj) {
249
-            return true;
250
-        }
251
-
252
-        if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) {
253
-            return false;
254
-        }
255
-
256
-        return $this->getPrimaryKey() === $obj->getPrimaryKey();
257
-    }
258
-
259
-    /**
260
-     * Get the associative array of the virtual columns in this object
261
-     *
262
-     * @return array
263
-     */
264
-    public function getVirtualColumns()
265
-    {
266
-        return $this->virtualColumns;
267
-    }
268
-
269
-    /**
270
-     * Checks the existence of a virtual column in this object
271
-     *
272
-     * @param  string  $name The virtual column name
273
-     * @return boolean
274
-     */
275
-    public function hasVirtualColumn($name)
276
-    {
277
-        return array_key_exists($name, $this->virtualColumns);
278
-    }
279
-
280
-    /**
281
-     * Get the value of a virtual column in this object
282
-     *
283
-     * @param  string $name The virtual column name
284
-     * @return mixed
285
-     *
286
-     * @throws PropelException
287
-     */
288
-    public function getVirtualColumn($name)
289
-    {
290
-        if (!$this->hasVirtualColumn($name)) {
291
-            throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
292
-        }
293
-
294
-        return $this->virtualColumns[$name];
295
-    }
296
-
297
-    /**
298
-     * Set the value of a virtual column in this object
299
-     *
300
-     * @param string $name  The virtual column name
301
-     * @param mixed  $value The value to give to the virtual column
302
-     *
303
-     * @return $this|Instance The current object, for fluid interface
304
-     */
305
-    public function setVirtualColumn($name, $value)
306
-    {
307
-        $this->virtualColumns[$name] = $value;
308
-
309
-        return $this;
310
-    }
311
-
312
-    /**
313
-     * Logs a message using Propel::log().
314
-     *
315
-     * @param  string  $msg
316
-     * @param  int     $priority One of the Propel::LOG_* logging levels
317
-     * @return boolean
318
-     */
319
-    protected function log($msg, $priority = Propel::LOG_INFO)
320
-    {
321
-        return Propel::log(get_class($this) . ': ' . $msg, $priority);
322
-    }
323
-
324
-    /**
325
-     * Export the current object properties to a string, using a given parser format
326
-     * <code>
327
-     * $book = BookQuery::create()->findPk(9012);
328
-     * echo $book->exportTo('JSON');
329
-     *  => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
330
-     * </code>
331
-     *
332
-     * @param  mixed   $parser                 A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
333
-     * @param  boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
334
-     * @return string  The exported data
335
-     */
336
-    public function exportTo($parser, $includeLazyLoadColumns = true)
337
-    {
338
-        if (!$parser instanceof AbstractParser) {
339
-            $parser = AbstractParser::getParser($parser);
340
-        }
341
-
342
-        return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
343
-    }
344
-
345
-    /**
346
-     * Clean up internal collections prior to serializing
347
-     * Avoids recursive loops that turn into segmentation faults when serializing
348
-     */
349
-    public function __sleep()
350
-    {
351
-        $this->clearAllReferences();
352
-
353
-        $cls = new \ReflectionClass($this);
354
-        $propertyNames = [];
355
-        $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
356
-
357
-        foreach($serializableProperties as $property) {
358
-            $propertyNames[] = $property->getName();
359
-        }
360
-
361
-        return $propertyNames;
362
-    }
363
-
364
-    /**
365
-     * Get the [name] column value.
366
-     *
367
-     * @return string
368
-     */
369
-    public function getName()
370
-    {
371
-        return $this->name;
372
-    }
373
-
374
-    /**
375
-     * Set the value of [name] column.
376
-     *
377
-     * @param string $v new value
378
-     * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)
379
-     */
380
-    public function setName($v)
381
-    {
382
-        if ($v !== null) {
383
-            $v = (string) $v;
384
-        }
385
-
386
-        if ($this->name !== $v) {
387
-            $this->name = $v;
388
-            $this->modifiedColumns[InstanceTableMap::COL_NAME] = true;
389
-        }
390
-
391
-        return $this;
392
-    } // setName()
393
-
394
-    /**
395
-     * Indicates whether the columns in this object are only set to default values.
396
-     *
397
-     * This method can be used in conjunction with isModified() to indicate whether an object is both
398
-     * modified _and_ has some values set which are non-default.
399
-     *
400
-     * @return boolean Whether the columns in this object are only been set with default values.
401
-     */
402
-    public function hasOnlyDefaultValues()
403
-    {
404
-        // otherwise, everything was equal, so return TRUE
405
-        return true;
406
-    } // hasOnlyDefaultValues()
407
-
408
-    /**
409
-     * Hydrates (populates) the object variables with values from the database resultset.
410
-     *
411
-     * An offset (0-based "start column") is specified so that objects can be hydrated
412
-     * with a subset of the columns in the resultset rows.  This is needed, for example,
413
-     * for results of JOIN queries where the resultset row includes columns from two or
414
-     * more tables.
415
-     *
416
-     * @param array   $row       The row returned by DataFetcher->fetch().
417
-     * @param int     $startcol  0-based offset column which indicates which restultset column to start with.
418
-     * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
419
-     * @param string  $indexType The index type of $row. Mostly DataFetcher->getIndexType().
44
+	/**
45
+	 * TableMap class name
46
+	 */
47
+	const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\InstanceTableMap';
48
+
49
+
50
+	/**
51
+	 * attribute to determine if this object has previously been saved.
52
+	 * @var boolean
53
+	 */
54
+	protected $new = true;
55
+
56
+	/**
57
+	 * attribute to determine whether this object has been deleted.
58
+	 * @var boolean
59
+	 */
60
+	protected $deleted = false;
61
+
62
+	/**
63
+	 * The columns that have been modified in current object.
64
+	 * Tracking modified columns allows us to only update modified columns.
65
+	 * @var array
66
+	 */
67
+	protected $modifiedColumns = array();
68
+
69
+	/**
70
+	 * The (virtual) columns that are added at runtime
71
+	 * The formatters can add supplementary columns based on a resultset
72
+	 * @var array
73
+	 */
74
+	protected $virtualColumns = array();
75
+
76
+	/**
77
+	 * The value for the name field.
78
+	 *
79
+	 * @var        string
80
+	 */
81
+	protected $name;
82
+
83
+	/**
84
+	 * @var        ObjectCollection|ChildUser[] Collection to store aggregation of ChildUser objects.
85
+	 */
86
+	protected $collUsers;
87
+	protected $collUsersPartial;
88
+
89
+	/**
90
+	 * @var        ObjectCollection|ChildConnection[] Collection to store aggregation of ChildConnection objects.
91
+	 */
92
+	protected $collConnections;
93
+	protected $collConnectionsPartial;
94
+
95
+	/**
96
+	 * @var        ObjectCollection|ChildChannel[] Collection to store aggregation of ChildChannel objects.
97
+	 */
98
+	protected $collChannels;
99
+	protected $collChannelsPartial;
100
+
101
+	/**
102
+	 * @var        ObjectCollection|ChildSubscription[] Collection to store aggregation of ChildSubscription objects.
103
+	 */
104
+	protected $collSubscriptions;
105
+	protected $collSubscriptionsPartial;
106
+
107
+	/**
108
+	 * Flag to prevent endless save loop, if this object is referenced
109
+	 * by another object which falls in this transaction.
110
+	 *
111
+	 * @var boolean
112
+	 */
113
+	protected $alreadyInSave = false;
114
+
115
+	/**
116
+	 * An array of objects scheduled for deletion.
117
+	 * @var ObjectCollection|ChildUser[]
118
+	 */
119
+	protected $usersScheduledForDeletion = null;
120
+
121
+	/**
122
+	 * An array of objects scheduled for deletion.
123
+	 * @var ObjectCollection|ChildConnection[]
124
+	 */
125
+	protected $connectionsScheduledForDeletion = null;
126
+
127
+	/**
128
+	 * An array of objects scheduled for deletion.
129
+	 * @var ObjectCollection|ChildChannel[]
130
+	 */
131
+	protected $channelsScheduledForDeletion = null;
132
+
133
+	/**
134
+	 * An array of objects scheduled for deletion.
135
+	 * @var ObjectCollection|ChildSubscription[]
136
+	 */
137
+	protected $subscriptionsScheduledForDeletion = null;
138
+
139
+	/**
140
+	 * Initializes internal state of Jalle19\StatusManager\Database\Base\Instance object.
141
+	 */
142
+	public function __construct()
143
+	{
144
+	}
145
+
146
+	/**
147
+	 * Returns whether the object has been modified.
148
+	 *
149
+	 * @return boolean True if the object has been modified.
150
+	 */
151
+	public function isModified()
152
+	{
153
+		return !!$this->modifiedColumns;
154
+	}
155
+
156
+	/**
157
+	 * Has specified column been modified?
158
+	 *
159
+	 * @param  string  $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
160
+	 * @return boolean True if $col has been modified.
161
+	 */
162
+	public function isColumnModified($col)
163
+	{
164
+		return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
165
+	}
166
+
167
+	/**
168
+	 * Get the columns that have been modified in this object.
169
+	 * @return array A unique list of the modified column names for this object.
170
+	 */
171
+	public function getModifiedColumns()
172
+	{
173
+		return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
174
+	}
175
+
176
+	/**
177
+	 * Returns whether the object has ever been saved.  This will
178
+	 * be false, if the object was retrieved from storage or was created
179
+	 * and then saved.
180
+	 *
181
+	 * @return boolean true, if the object has never been persisted.
182
+	 */
183
+	public function isNew()
184
+	{
185
+		return $this->new;
186
+	}
187
+
188
+	/**
189
+	 * Setter for the isNew attribute.  This method will be called
190
+	 * by Propel-generated children and objects.
191
+	 *
192
+	 * @param boolean $b the state of the object.
193
+	 */
194
+	public function setNew($b)
195
+	{
196
+		$this->new = (boolean) $b;
197
+	}
198
+
199
+	/**
200
+	 * Whether this object has been deleted.
201
+	 * @return boolean The deleted state of this object.
202
+	 */
203
+	public function isDeleted()
204
+	{
205
+		return $this->deleted;
206
+	}
207
+
208
+	/**
209
+	 * Specify whether this object has been deleted.
210
+	 * @param  boolean $b The deleted state of this object.
211
+	 * @return void
212
+	 */
213
+	public function setDeleted($b)
214
+	{
215
+		$this->deleted = (boolean) $b;
216
+	}
217
+
218
+	/**
219
+	 * Sets the modified state for the object to be false.
220
+	 * @param  string $col If supplied, only the specified column is reset.
221
+	 * @return void
222
+	 */
223
+	public function resetModified($col = null)
224
+	{
225
+		if (null !== $col) {
226
+			if (isset($this->modifiedColumns[$col])) {
227
+				unset($this->modifiedColumns[$col]);
228
+			}
229
+		} else {
230
+			$this->modifiedColumns = array();
231
+		}
232
+	}
233
+
234
+	/**
235
+	 * Compares this with another <code>Instance</code> instance.  If
236
+	 * <code>obj</code> is an instance of <code>Instance</code>, delegates to
237
+	 * <code>equals(Instance)</code>.  Otherwise, returns <code>false</code>.
238
+	 *
239
+	 * @param  mixed   $obj The object to compare to.
240
+	 * @return boolean Whether equal to the object specified.
241
+	 */
242
+	public function equals($obj)
243
+	{
244
+		if (!$obj instanceof static) {
245
+			return false;
246
+		}
247
+
248
+		if ($this === $obj) {
249
+			return true;
250
+		}
251
+
252
+		if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) {
253
+			return false;
254
+		}
255
+
256
+		return $this->getPrimaryKey() === $obj->getPrimaryKey();
257
+	}
258
+
259
+	/**
260
+	 * Get the associative array of the virtual columns in this object
261
+	 *
262
+	 * @return array
263
+	 */
264
+	public function getVirtualColumns()
265
+	{
266
+		return $this->virtualColumns;
267
+	}
268
+
269
+	/**
270
+	 * Checks the existence of a virtual column in this object
271
+	 *
272
+	 * @param  string  $name The virtual column name
273
+	 * @return boolean
274
+	 */
275
+	public function hasVirtualColumn($name)
276
+	{
277
+		return array_key_exists($name, $this->virtualColumns);
278
+	}
279
+
280
+	/**
281
+	 * Get the value of a virtual column in this object
282
+	 *
283
+	 * @param  string $name The virtual column name
284
+	 * @return mixed
285
+	 *
286
+	 * @throws PropelException
287
+	 */
288
+	public function getVirtualColumn($name)
289
+	{
290
+		if (!$this->hasVirtualColumn($name)) {
291
+			throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
292
+		}
293
+
294
+		return $this->virtualColumns[$name];
295
+	}
296
+
297
+	/**
298
+	 * Set the value of a virtual column in this object
299
+	 *
300
+	 * @param string $name  The virtual column name
301
+	 * @param mixed  $value The value to give to the virtual column
302
+	 *
303
+	 * @return $this|Instance The current object, for fluid interface
304
+	 */
305
+	public function setVirtualColumn($name, $value)
306
+	{
307
+		$this->virtualColumns[$name] = $value;
308
+
309
+		return $this;
310
+	}
311
+
312
+	/**
313
+	 * Logs a message using Propel::log().
314
+	 *
315
+	 * @param  string  $msg
316
+	 * @param  int     $priority One of the Propel::LOG_* logging levels
317
+	 * @return boolean
318
+	 */
319
+	protected function log($msg, $priority = Propel::LOG_INFO)
320
+	{
321
+		return Propel::log(get_class($this) . ': ' . $msg, $priority);
322
+	}
323
+
324
+	/**
325
+	 * Export the current object properties to a string, using a given parser format
326
+	 * <code>
327
+	 * $book = BookQuery::create()->findPk(9012);
328
+	 * echo $book->exportTo('JSON');
329
+	 *  => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
330
+	 * </code>
331
+	 *
332
+	 * @param  mixed   $parser                 A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
333
+	 * @param  boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
334
+	 * @return string  The exported data
335
+	 */
336
+	public function exportTo($parser, $includeLazyLoadColumns = true)
337
+	{
338
+		if (!$parser instanceof AbstractParser) {
339
+			$parser = AbstractParser::getParser($parser);
340
+		}
341
+
342
+		return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
343
+	}
344
+
345
+	/**
346
+	 * Clean up internal collections prior to serializing
347
+	 * Avoids recursive loops that turn into segmentation faults when serializing
348
+	 */
349
+	public function __sleep()
350
+	{
351
+		$this->clearAllReferences();
352
+
353
+		$cls = new \ReflectionClass($this);
354
+		$propertyNames = [];
355
+		$serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
356
+
357
+		foreach($serializableProperties as $property) {
358
+			$propertyNames[] = $property->getName();
359
+		}
360
+
361
+		return $propertyNames;
362
+	}
363
+
364
+	/**
365
+	 * Get the [name] column value.
366
+	 *
367
+	 * @return string
368
+	 */
369
+	public function getName()
370
+	{
371
+		return $this->name;
372
+	}
373
+
374
+	/**
375
+	 * Set the value of [name] column.
376
+	 *
377
+	 * @param string $v new value
378
+	 * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)
379
+	 */
380
+	public function setName($v)
381
+	{
382
+		if ($v !== null) {
383
+			$v = (string) $v;
384
+		}
385
+
386
+		if ($this->name !== $v) {
387
+			$this->name = $v;
388
+			$this->modifiedColumns[InstanceTableMap::COL_NAME] = true;
389
+		}
390
+
391
+		return $this;
392
+	} // setName()
393
+
394
+	/**
395
+	 * Indicates whether the columns in this object are only set to default values.
396
+	 *
397
+	 * This method can be used in conjunction with isModified() to indicate whether an object is both
398
+	 * modified _and_ has some values set which are non-default.
399
+	 *
400
+	 * @return boolean Whether the columns in this object are only been set with default values.
401
+	 */
402
+	public function hasOnlyDefaultValues()
403
+	{
404
+		// otherwise, everything was equal, so return TRUE
405
+		return true;
406
+	} // hasOnlyDefaultValues()
407
+
408
+	/**
409
+	 * Hydrates (populates) the object variables with values from the database resultset.
410
+	 *
411
+	 * An offset (0-based "start column") is specified so that objects can be hydrated
412
+	 * with a subset of the columns in the resultset rows.  This is needed, for example,
413
+	 * for results of JOIN queries where the resultset row includes columns from two or
414
+	 * more tables.
415
+	 *
416
+	 * @param array   $row       The row returned by DataFetcher->fetch().
417
+	 * @param int     $startcol  0-based offset column which indicates which restultset column to start with.
418
+	 * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
419
+	 * @param string  $indexType The index type of $row. Mostly DataFetcher->getIndexType().
420 420
                                   One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
421
-     *                            TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
422
-     *
423
-     * @return int             next starting column
424
-     * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
425
-     */
426
-    public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
427
-    {
428
-        try {
429
-
430
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : InstanceTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
431
-            $this->name = (null !== $col) ? (string) $col : null;
432
-            $this->resetModified();
433
-
434
-            $this->setNew(false);
435
-
436
-            if ($rehydrate) {
437
-                $this->ensureConsistency();
438
-            }
439
-
440
-            return $startcol + 1; // 1 = InstanceTableMap::NUM_HYDRATE_COLUMNS.
441
-
442
-        } catch (Exception $e) {
443
-            throw new PropelException(sprintf('Error populating %s object', '\\Jalle19\\StatusManager\\Database\\Instance'), 0, $e);
444
-        }
445
-    }
446
-
447
-    /**
448
-     * Checks and repairs the internal consistency of the object.
449
-     *
450
-     * This method is executed after an already-instantiated object is re-hydrated
451
-     * from the database.  It exists to check any foreign keys to make sure that
452
-     * the objects related to the current object are correct based on foreign key.
453
-     *
454
-     * You can override this method in the stub class, but you should always invoke
455
-     * the base method from the overridden method (i.e. parent::ensureConsistency()),
456
-     * in case your model changes.
457
-     *
458
-     * @throws PropelException
459
-     */
460
-    public function ensureConsistency()
461
-    {
462
-    } // ensureConsistency
463
-
464
-    /**
465
-     * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
466
-     *
467
-     * This will only work if the object has been saved and has a valid primary key set.
468
-     *
469
-     * @param      boolean $deep (optional) Whether to also de-associated any related objects.
470
-     * @param      ConnectionInterface $con (optional) The ConnectionInterface connection to use.
471
-     * @return void
472
-     * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
473
-     */
474
-    public function reload($deep = false, ConnectionInterface $con = null)
475
-    {
476
-        if ($this->isDeleted()) {
477
-            throw new PropelException("Cannot reload a deleted object.");
478
-        }
479
-
480
-        if ($this->isNew()) {
481
-            throw new PropelException("Cannot reload an unsaved object.");
482
-        }
483
-
484
-        if ($con === null) {
485
-            $con = Propel::getServiceContainer()->getReadConnection(InstanceTableMap::DATABASE_NAME);
486
-        }
487
-
488
-        // We don't need to alter the object instance pool; we're just modifying this instance
489
-        // already in the pool.
490
-
491
-        $dataFetcher = ChildInstanceQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
492
-        $row = $dataFetcher->fetch();
493
-        $dataFetcher->close();
494
-        if (!$row) {
495
-            throw new PropelException('Cannot find matching row in the database to reload object values.');
496
-        }
497
-        $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
498
-
499
-        if ($deep) {  // also de-associate any related objects?
500
-
501
-            $this->collUsers = null;
502
-
503
-            $this->collConnections = null;
504
-
505
-            $this->collChannels = null;
506
-
507
-            $this->collSubscriptions = null;
508
-
509
-        } // if (deep)
510
-    }
511
-
512
-    /**
513
-     * Removes this object from datastore and sets delete attribute.
514
-     *
515
-     * @param      ConnectionInterface $con
516
-     * @return void
517
-     * @throws PropelException
518
-     * @see Instance::setDeleted()
519
-     * @see Instance::isDeleted()
520
-     */
521
-    public function delete(ConnectionInterface $con = null)
522
-    {
523
-        if ($this->isDeleted()) {
524
-            throw new PropelException("This object has already been deleted.");
525
-        }
526
-
527
-        if ($con === null) {
528
-            $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
529
-        }
530
-
531
-        $con->transaction(function () use ($con) {
532
-            $deleteQuery = ChildInstanceQuery::create()
533
-                ->filterByPrimaryKey($this->getPrimaryKey());
534
-            $ret = $this->preDelete($con);
535
-            if ($ret) {
536
-                $deleteQuery->delete($con);
537
-                $this->postDelete($con);
538
-                $this->setDeleted(true);
539
-            }
540
-        });
541
-    }
542
-
543
-    /**
544
-     * Persists this object to the database.
545
-     *
546
-     * If the object is new, it inserts it; otherwise an update is performed.
547
-     * All modified related objects will also be persisted in the doSave()
548
-     * method.  This method wraps all precipitate database operations in a
549
-     * single transaction.
550
-     *
551
-     * @param      ConnectionInterface $con
552
-     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
553
-     * @throws PropelException
554
-     * @see doSave()
555
-     */
556
-    public function save(ConnectionInterface $con = null)
557
-    {
558
-        if ($this->isDeleted()) {
559
-            throw new PropelException("You cannot save an object that has been deleted.");
560
-        }
561
-
562
-        if ($con === null) {
563
-            $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
564
-        }
565
-
566
-        return $con->transaction(function () use ($con) {
567
-            $isInsert = $this->isNew();
568
-            $ret = $this->preSave($con);
569
-            if ($isInsert) {
570
-                $ret = $ret && $this->preInsert($con);
571
-            } else {
572
-                $ret = $ret && $this->preUpdate($con);
573
-            }
574
-            if ($ret) {
575
-                $affectedRows = $this->doSave($con);
576
-                if ($isInsert) {
577
-                    $this->postInsert($con);
578
-                } else {
579
-                    $this->postUpdate($con);
580
-                }
581
-                $this->postSave($con);
582
-                InstanceTableMap::addInstanceToPool($this);
583
-            } else {
584
-                $affectedRows = 0;
585
-            }
586
-
587
-            return $affectedRows;
588
-        });
589
-    }
590
-
591
-    /**
592
-     * Performs the work of inserting or updating the row in the database.
593
-     *
594
-     * If the object is new, it inserts it; otherwise an update is performed.
595
-     * All related objects are also updated in this method.
596
-     *
597
-     * @param      ConnectionInterface $con
598
-     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
599
-     * @throws PropelException
600
-     * @see save()
601
-     */
602
-    protected function doSave(ConnectionInterface $con)
603
-    {
604
-        $affectedRows = 0; // initialize var to track total num of affected rows
605
-        if (!$this->alreadyInSave) {
606
-            $this->alreadyInSave = true;
607
-
608
-            if ($this->isNew() || $this->isModified()) {
609
-                // persist changes
610
-                if ($this->isNew()) {
611
-                    $this->doInsert($con);
612
-                    $affectedRows += 1;
613
-                } else {
614
-                    $affectedRows += $this->doUpdate($con);
615
-                }
616
-                $this->resetModified();
617
-            }
618
-
619
-            if ($this->usersScheduledForDeletion !== null) {
620
-                if (!$this->usersScheduledForDeletion->isEmpty()) {
621
-                    \Jalle19\StatusManager\Database\UserQuery::create()
622
-                        ->filterByPrimaryKeys($this->usersScheduledForDeletion->getPrimaryKeys(false))
623
-                        ->delete($con);
624
-                    $this->usersScheduledForDeletion = null;
625
-                }
626
-            }
627
-
628
-            if ($this->collUsers !== null) {
629
-                foreach ($this->collUsers as $referrerFK) {
630
-                    if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
631
-                        $affectedRows += $referrerFK->save($con);
632
-                    }
633
-                }
634
-            }
635
-
636
-            if ($this->connectionsScheduledForDeletion !== null) {
637
-                if (!$this->connectionsScheduledForDeletion->isEmpty()) {
638
-                    \Jalle19\StatusManager\Database\ConnectionQuery::create()
639
-                        ->filterByPrimaryKeys($this->connectionsScheduledForDeletion->getPrimaryKeys(false))
640
-                        ->delete($con);
641
-                    $this->connectionsScheduledForDeletion = null;
642
-                }
643
-            }
644
-
645
-            if ($this->collConnections !== null) {
646
-                foreach ($this->collConnections as $referrerFK) {
647
-                    if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
648
-                        $affectedRows += $referrerFK->save($con);
649
-                    }
650
-                }
651
-            }
652
-
653
-            if ($this->channelsScheduledForDeletion !== null) {
654
-                if (!$this->channelsScheduledForDeletion->isEmpty()) {
655
-                    \Jalle19\StatusManager\Database\ChannelQuery::create()
656
-                        ->filterByPrimaryKeys($this->channelsScheduledForDeletion->getPrimaryKeys(false))
657
-                        ->delete($con);
658
-                    $this->channelsScheduledForDeletion = null;
659
-                }
660
-            }
661
-
662
-            if ($this->collChannels !== null) {
663
-                foreach ($this->collChannels as $referrerFK) {
664
-                    if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
665
-                        $affectedRows += $referrerFK->save($con);
666
-                    }
667
-                }
668
-            }
669
-
670
-            if ($this->subscriptionsScheduledForDeletion !== null) {
671
-                if (!$this->subscriptionsScheduledForDeletion->isEmpty()) {
672
-                    \Jalle19\StatusManager\Database\SubscriptionQuery::create()
673
-                        ->filterByPrimaryKeys($this->subscriptionsScheduledForDeletion->getPrimaryKeys(false))
674
-                        ->delete($con);
675
-                    $this->subscriptionsScheduledForDeletion = null;
676
-                }
677
-            }
678
-
679
-            if ($this->collSubscriptions !== null) {
680
-                foreach ($this->collSubscriptions as $referrerFK) {
681
-                    if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
682
-                        $affectedRows += $referrerFK->save($con);
683
-                    }
684
-                }
685
-            }
686
-
687
-            $this->alreadyInSave = false;
688
-
689
-        }
690
-
691
-        return $affectedRows;
692
-    } // doSave()
693
-
694
-    /**
695
-     * Insert the row in the database.
696
-     *
697
-     * @param      ConnectionInterface $con
698
-     *
699
-     * @throws PropelException
700
-     * @see doSave()
701
-     */
702
-    protected function doInsert(ConnectionInterface $con)
703
-    {
704
-        $modifiedColumns = array();
705
-        $index = 0;
706
-
707
-
708
-         // check the columns in natural order for more readable SQL queries
709
-        if ($this->isColumnModified(InstanceTableMap::COL_NAME)) {
710
-            $modifiedColumns[':p' . $index++]  = 'name';
711
-        }
712
-
713
-        $sql = sprintf(
714
-            'INSERT INTO instance (%s) VALUES (%s)',
715
-            implode(', ', $modifiedColumns),
716
-            implode(', ', array_keys($modifiedColumns))
717
-        );
718
-
719
-        try {
720
-            $stmt = $con->prepare($sql);
721
-            foreach ($modifiedColumns as $identifier => $columnName) {
722
-                switch ($columnName) {
723
-                    case 'name':
724
-                        $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
725
-                        break;
726
-                }
727
-            }
728
-            $stmt->execute();
729
-        } catch (Exception $e) {
730
-            Propel::log($e->getMessage(), Propel::LOG_ERR);
731
-            throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
732
-        }
733
-
734
-        $this->setNew(false);
735
-    }
736
-
737
-    /**
738
-     * Update the row in the database.
739
-     *
740
-     * @param      ConnectionInterface $con
741
-     *
742
-     * @return Integer Number of updated rows
743
-     * @see doSave()
744
-     */
745
-    protected function doUpdate(ConnectionInterface $con)
746
-    {
747
-        $selectCriteria = $this->buildPkeyCriteria();
748
-        $valuesCriteria = $this->buildCriteria();
749
-
750
-        return $selectCriteria->doUpdate($valuesCriteria, $con);
751
-    }
752
-
753
-    /**
754
-     * Retrieves a field from the object by name passed in as a string.
755
-     *
756
-     * @param      string $name name
757
-     * @param      string $type The type of fieldname the $name is of:
758
-     *                     one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
759
-     *                     TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
760
-     *                     Defaults to TableMap::TYPE_PHPNAME.
761
-     * @return mixed Value of field.
762
-     */
763
-    public function getByName($name, $type = TableMap::TYPE_PHPNAME)
764
-    {
765
-        $pos = InstanceTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
766
-        $field = $this->getByPosition($pos);
767
-
768
-        return $field;
769
-    }
770
-
771
-    /**
772
-     * Retrieves a field from the object by Position as specified in the xml schema.
773
-     * Zero-based.
774
-     *
775
-     * @param      int $pos position in xml schema
776
-     * @return mixed Value of field at $pos
777
-     */
778
-    public function getByPosition($pos)
779
-    {
780
-        switch ($pos) {
781
-            case 0:
782
-                return $this->getName();
783
-                break;
784
-            default:
785
-                return null;
786
-                break;
787
-        } // switch()
788
-    }
789
-
790
-    /**
791
-     * Exports the object as an array.
792
-     *
793
-     * You can specify the key type of the array by passing one of the class
794
-     * type constants.
795
-     *
796
-     * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
797
-     *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
798
-     *                    Defaults to TableMap::TYPE_PHPNAME.
799
-     * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
800
-     * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
801
-     * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
802
-     *
803
-     * @return array an associative array containing the field names (as keys) and field values
804
-     */
805
-    public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
806
-    {
807
-
808
-        if (isset($alreadyDumpedObjects['Instance'][$this->hashCode()])) {
809
-            return '*RECURSION*';
810
-        }
811
-        $alreadyDumpedObjects['Instance'][$this->hashCode()] = true;
812
-        $keys = InstanceTableMap::getFieldNames($keyType);
813
-        $result = array(
814
-            $keys[0] => $this->getName(),
815
-        );
816
-        $virtualColumns = $this->virtualColumns;
817
-        foreach ($virtualColumns as $key => $virtualColumn) {
818
-            $result[$key] = $virtualColumn;
819
-        }
820
-
821
-        if ($includeForeignObjects) {
822
-            if (null !== $this->collUsers) {
823
-
824
-                switch ($keyType) {
825
-                    case TableMap::TYPE_CAMELNAME:
826
-                        $key = 'users';
827
-                        break;
828
-                    case TableMap::TYPE_FIELDNAME:
829
-                        $key = 'users';
830
-                        break;
831
-                    default:
832
-                        $key = 'Users';
833
-                }
834
-
835
-                $result[$key] = $this->collUsers->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
836
-            }
837
-            if (null !== $this->collConnections) {
838
-
839
-                switch ($keyType) {
840
-                    case TableMap::TYPE_CAMELNAME:
841
-                        $key = 'connections';
842
-                        break;
843
-                    case TableMap::TYPE_FIELDNAME:
844
-                        $key = 'connections';
845
-                        break;
846
-                    default:
847
-                        $key = 'Connections';
848
-                }
849
-
850
-                $result[$key] = $this->collConnections->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
851
-            }
852
-            if (null !== $this->collChannels) {
853
-
854
-                switch ($keyType) {
855
-                    case TableMap::TYPE_CAMELNAME:
856
-                        $key = 'channels';
857
-                        break;
858
-                    case TableMap::TYPE_FIELDNAME:
859
-                        $key = 'channels';
860
-                        break;
861
-                    default:
862
-                        $key = 'Channels';
863
-                }
864
-
865
-                $result[$key] = $this->collChannels->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
866
-            }
867
-            if (null !== $this->collSubscriptions) {
868
-
869
-                switch ($keyType) {
870
-                    case TableMap::TYPE_CAMELNAME:
871
-                        $key = 'subscriptions';
872
-                        break;
873
-                    case TableMap::TYPE_FIELDNAME:
874
-                        $key = 'subscriptions';
875
-                        break;
876
-                    default:
877
-                        $key = 'Subscriptions';
878
-                }
879
-
880
-                $result[$key] = $this->collSubscriptions->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
881
-            }
882
-        }
883
-
884
-        return $result;
885
-    }
886
-
887
-    /**
888
-     * Sets a field from the object by name passed in as a string.
889
-     *
890
-     * @param  string $name
891
-     * @param  mixed  $value field value
892
-     * @param  string $type The type of fieldname the $name is of:
893
-     *                one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
894
-     *                TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
895
-     *                Defaults to TableMap::TYPE_PHPNAME.
896
-     * @return $this|\Jalle19\StatusManager\Database\Instance
897
-     */
898
-    public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
899
-    {
900
-        $pos = InstanceTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
901
-
902
-        return $this->setByPosition($pos, $value);
903
-    }
904
-
905
-    /**
906
-     * Sets a field from the object by Position as specified in the xml schema.
907
-     * Zero-based.
908
-     *
909
-     * @param  int $pos position in xml schema
910
-     * @param  mixed $value field value
911
-     * @return $this|\Jalle19\StatusManager\Database\Instance
912
-     */
913
-    public function setByPosition($pos, $value)
914
-    {
915
-        switch ($pos) {
916
-            case 0:
917
-                $this->setName($value);
918
-                break;
919
-        } // switch()
920
-
921
-        return $this;
922
-    }
923
-
924
-    /**
925
-     * Populates the object using an array.
926
-     *
927
-     * This is particularly useful when populating an object from one of the
928
-     * request arrays (e.g. $_POST).  This method goes through the column
929
-     * names, checking to see whether a matching key exists in populated
930
-     * array. If so the setByName() method is called for that column.
931
-     *
932
-     * You can specify the key type of the array by additionally passing one
933
-     * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
934
-     * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
935
-     * The default key type is the column's TableMap::TYPE_PHPNAME.
936
-     *
937
-     * @param      array  $arr     An array to populate the object from.
938
-     * @param      string $keyType The type of keys the array uses.
939
-     * @return void
940
-     */
941
-    public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
942
-    {
943
-        $keys = InstanceTableMap::getFieldNames($keyType);
944
-
945
-        if (array_key_exists($keys[0], $arr)) {
946
-            $this->setName($arr[$keys[0]]);
947
-        }
948
-    }
949
-
950
-     /**
951
-     * Populate the current object from a string, using a given parser format
952
-     * <code>
953
-     * $book = new Book();
954
-     * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
955
-     * </code>
956
-     *
957
-     * You can specify the key type of the array by additionally passing one
958
-     * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
959
-     * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
960
-     * The default key type is the column's TableMap::TYPE_PHPNAME.
961
-     *
962
-     * @param mixed $parser A AbstractParser instance,
963
-     *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
964
-     * @param string $data The source data to import from
965
-     * @param string $keyType The type of keys the array uses.
966
-     *
967
-     * @return $this|\Jalle19\StatusManager\Database\Instance The current object, for fluid interface
968
-     */
969
-    public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME)
970
-    {
971
-        if (!$parser instanceof AbstractParser) {
972
-            $parser = AbstractParser::getParser($parser);
973
-        }
974
-
975
-        $this->fromArray($parser->toArray($data), $keyType);
976
-
977
-        return $this;
978
-    }
979
-
980
-    /**
981
-     * Build a Criteria object containing the values of all modified columns in this object.
982
-     *
983
-     * @return Criteria The Criteria object containing all modified values.
984
-     */
985
-    public function buildCriteria()
986
-    {
987
-        $criteria = new Criteria(InstanceTableMap::DATABASE_NAME);
988
-
989
-        if ($this->isColumnModified(InstanceTableMap::COL_NAME)) {
990
-            $criteria->add(InstanceTableMap::COL_NAME, $this->name);
991
-        }
992
-
993
-        return $criteria;
994
-    }
995
-
996
-    /**
997
-     * Builds a Criteria object containing the primary key for this object.
998
-     *
999
-     * Unlike buildCriteria() this method includes the primary key values regardless
1000
-     * of whether or not they have been modified.
1001
-     *
1002
-     * @throws LogicException if no primary key is defined
1003
-     *
1004
-     * @return Criteria The Criteria object containing value(s) for primary key(s).
1005
-     */
1006
-    public function buildPkeyCriteria()
1007
-    {
1008
-        $criteria = ChildInstanceQuery::create();
1009
-        $criteria->add(InstanceTableMap::COL_NAME, $this->name);
1010
-
1011
-        return $criteria;
1012
-    }
1013
-
1014
-    /**
1015
-     * If the primary key is not null, return the hashcode of the
1016
-     * primary key. Otherwise, return the hash code of the object.
1017
-     *
1018
-     * @return int Hashcode
1019
-     */
1020
-    public function hashCode()
1021
-    {
1022
-        $validPk = null !== $this->getName();
1023
-
1024
-        $validPrimaryKeyFKs = 0;
1025
-        $primaryKeyFKs = [];
1026
-
1027
-        if ($validPk) {
1028
-            return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
1029
-        } elseif ($validPrimaryKeyFKs) {
1030
-            return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
1031
-        }
1032
-
1033
-        return spl_object_hash($this);
1034
-    }
1035
-
1036
-    /**
1037
-     * Returns the primary key for this object (row).
1038
-     * @return string
1039
-     */
1040
-    public function getPrimaryKey()
1041
-    {
1042
-        return $this->getName();
1043
-    }
1044
-
1045
-    /**
1046
-     * Generic method to set the primary key (name column).
1047
-     *
1048
-     * @param       string $key Primary key.
1049
-     * @return void
1050
-     */
1051
-    public function setPrimaryKey($key)
1052
-    {
1053
-        $this->setName($key);
1054
-    }
1055
-
1056
-    /**
1057
-     * Returns true if the primary key for this object is null.
1058
-     * @return boolean
1059
-     */
1060
-    public function isPrimaryKeyNull()
1061
-    {
1062
-        return null === $this->getName();
1063
-    }
1064
-
1065
-    /**
1066
-     * Sets contents of passed object to values from current object.
1067
-     *
1068
-     * If desired, this method can also make copies of all associated (fkey referrers)
1069
-     * objects.
1070
-     *
1071
-     * @param      object $copyObj An object of \Jalle19\StatusManager\Database\Instance (or compatible) type.
1072
-     * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1073
-     * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1074
-     * @throws PropelException
1075
-     */
1076
-    public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1077
-    {
1078
-        $copyObj->setName($this->getName());
1079
-
1080
-        if ($deepCopy) {
1081
-            // important: temporarily setNew(false) because this affects the behavior of
1082
-            // the getter/setter methods for fkey referrer objects.
1083
-            $copyObj->setNew(false);
1084
-
1085
-            foreach ($this->getUsers() as $relObj) {
1086
-                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1087
-                    $copyObj->addUser($relObj->copy($deepCopy));
1088
-                }
1089
-            }
1090
-
1091
-            foreach ($this->getConnections() as $relObj) {
1092
-                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1093
-                    $copyObj->addConnection($relObj->copy($deepCopy));
1094
-                }
1095
-            }
1096
-
1097
-            foreach ($this->getChannels() as $relObj) {
1098
-                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1099
-                    $copyObj->addChannel($relObj->copy($deepCopy));
1100
-                }
1101
-            }
1102
-
1103
-            foreach ($this->getSubscriptions() as $relObj) {
1104
-                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1105
-                    $copyObj->addSubscription($relObj->copy($deepCopy));
1106
-                }
1107
-            }
1108
-
1109
-        } // if ($deepCopy)
1110
-
1111
-        if ($makeNew) {
1112
-            $copyObj->setNew(true);
1113
-        }
1114
-    }
1115
-
1116
-    /**
1117
-     * Makes a copy of this object that will be inserted as a new row in table when saved.
1118
-     * It creates a new object filling in the simple attributes, but skipping any primary
1119
-     * keys that are defined for the table.
1120
-     *
1121
-     * If desired, this method can also make copies of all associated (fkey referrers)
1122
-     * objects.
1123
-     *
1124
-     * @param  boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1125
-     * @return \Jalle19\StatusManager\Database\Instance Clone of current object.
1126
-     * @throws PropelException
1127
-     */
1128
-    public function copy($deepCopy = false)
1129
-    {
1130
-        // we use get_class(), because this might be a subclass
1131
-        $clazz = get_class($this);
1132
-        $copyObj = new $clazz();
1133
-        $this->copyInto($copyObj, $deepCopy);
1134
-
1135
-        return $copyObj;
1136
-    }
1137
-
1138
-
1139
-    /**
1140
-     * Initializes a collection based on the name of a relation.
1141
-     * Avoids crafting an 'init[$relationName]s' method name
1142
-     * that wouldn't work when StandardEnglishPluralizer is used.
1143
-     *
1144
-     * @param      string $relationName The name of the relation to initialize
1145
-     * @return void
1146
-     */
1147
-    public function initRelation($relationName)
1148
-    {
1149
-        if ('User' == $relationName) {
1150
-            return $this->initUsers();
1151
-        }
1152
-        if ('Connection' == $relationName) {
1153
-            return $this->initConnections();
1154
-        }
1155
-        if ('Channel' == $relationName) {
1156
-            return $this->initChannels();
1157
-        }
1158
-        if ('Subscription' == $relationName) {
1159
-            return $this->initSubscriptions();
1160
-        }
1161
-    }
1162
-
1163
-    /**
1164
-     * Clears out the collUsers collection
1165
-     *
1166
-     * This does not modify the database; however, it will remove any associated objects, causing
1167
-     * them to be refetched by subsequent calls to accessor method.
1168
-     *
1169
-     * @return void
1170
-     * @see        addUsers()
1171
-     */
1172
-    public function clearUsers()
1173
-    {
1174
-        $this->collUsers = null; // important to set this to NULL since that means it is uninitialized
1175
-    }
1176
-
1177
-    /**
1178
-     * Reset is the collUsers collection loaded partially.
1179
-     */
1180
-    public function resetPartialUsers($v = true)
1181
-    {
1182
-        $this->collUsersPartial = $v;
1183
-    }
1184
-
1185
-    /**
1186
-     * Initializes the collUsers collection.
1187
-     *
1188
-     * By default this just sets the collUsers collection to an empty array (like clearcollUsers());
1189
-     * however, you may wish to override this method in your stub class to provide setting appropriate
1190
-     * to your application -- for example, setting the initial array to the values stored in database.
1191
-     *
1192
-     * @param      boolean $overrideExisting If set to true, the method call initializes
1193
-     *                                        the collection even if it is not empty
1194
-     *
1195
-     * @return void
1196
-     */
1197
-    public function initUsers($overrideExisting = true)
1198
-    {
1199
-        if (null !== $this->collUsers && !$overrideExisting) {
1200
-            return;
1201
-        }
1202
-
1203
-        $collectionClassName = UserTableMap::getTableMap()->getCollectionClassName();
1204
-
1205
-        $this->collUsers = new $collectionClassName;
1206
-        $this->collUsers->setModel('\Jalle19\StatusManager\Database\User');
1207
-    }
1208
-
1209
-    /**
1210
-     * Gets an array of ChildUser objects which contain a foreign key that references this object.
1211
-     *
1212
-     * If the $criteria is not null, it is used to always fetch the results from the database.
1213
-     * Otherwise the results are fetched from the database the first time, then cached.
1214
-     * Next time the same method is called without $criteria, the cached collection is returned.
1215
-     * If this ChildInstance is new, it will return
1216
-     * an empty collection or the current collection; the criteria is ignored on a new object.
1217
-     *
1218
-     * @param      Criteria $criteria optional Criteria object to narrow the query
1219
-     * @param      ConnectionInterface $con optional connection object
1220
-     * @return ObjectCollection|ChildUser[] List of ChildUser objects
1221
-     * @throws PropelException
1222
-     */
1223
-    public function getUsers(Criteria $criteria = null, ConnectionInterface $con = null)
1224
-    {
1225
-        $partial = $this->collUsersPartial && !$this->isNew();
1226
-        if (null === $this->collUsers || null !== $criteria  || $partial) {
1227
-            if ($this->isNew() && null === $this->collUsers) {
1228
-                // return empty collection
1229
-                $this->initUsers();
1230
-            } else {
1231
-                $collUsers = ChildUserQuery::create(null, $criteria)
1232
-                    ->filterByInstance($this)
1233
-                    ->find($con);
1234
-
1235
-                if (null !== $criteria) {
1236
-                    if (false !== $this->collUsersPartial && count($collUsers)) {
1237
-                        $this->initUsers(false);
1238
-
1239
-                        foreach ($collUsers as $obj) {
1240
-                            if (false == $this->collUsers->contains($obj)) {
1241
-                                $this->collUsers->append($obj);
1242
-                            }
1243
-                        }
1244
-
1245
-                        $this->collUsersPartial = true;
1246
-                    }
1247
-
1248
-                    return $collUsers;
1249
-                }
1250
-
1251
-                if ($partial && $this->collUsers) {
1252
-                    foreach ($this->collUsers as $obj) {
1253
-                        if ($obj->isNew()) {
1254
-                            $collUsers[] = $obj;
1255
-                        }
1256
-                    }
1257
-                }
1258
-
1259
-                $this->collUsers = $collUsers;
1260
-                $this->collUsersPartial = false;
1261
-            }
1262
-        }
1263
-
1264
-        return $this->collUsers;
1265
-    }
1266
-
1267
-    /**
1268
-     * Sets a collection of ChildUser objects related by a one-to-many relationship
1269
-     * to the current object.
1270
-     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1271
-     * and new objects from the given Propel collection.
1272
-     *
1273
-     * @param      Collection $users A Propel collection.
1274
-     * @param      ConnectionInterface $con Optional connection object
1275
-     * @return $this|ChildInstance The current object (for fluent API support)
1276
-     */
1277
-    public function setUsers(Collection $users, ConnectionInterface $con = null)
1278
-    {
1279
-        /** @var ChildUser[] $usersToDelete */
1280
-        $usersToDelete = $this->getUsers(new Criteria(), $con)->diff($users);
1281
-
1282
-
1283
-        $this->usersScheduledForDeletion = $usersToDelete;
1284
-
1285
-        foreach ($usersToDelete as $userRemoved) {
1286
-            $userRemoved->setInstance(null);
1287
-        }
1288
-
1289
-        $this->collUsers = null;
1290
-        foreach ($users as $user) {
1291
-            $this->addUser($user);
1292
-        }
1293
-
1294
-        $this->collUsers = $users;
1295
-        $this->collUsersPartial = false;
1296
-
1297
-        return $this;
1298
-    }
1299
-
1300
-    /**
1301
-     * Returns the number of related User objects.
1302
-     *
1303
-     * @param      Criteria $criteria
1304
-     * @param      boolean $distinct
1305
-     * @param      ConnectionInterface $con
1306
-     * @return int             Count of related User objects.
1307
-     * @throws PropelException
1308
-     */
1309
-    public function countUsers(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
1310
-    {
1311
-        $partial = $this->collUsersPartial && !$this->isNew();
1312
-        if (null === $this->collUsers || null !== $criteria || $partial) {
1313
-            if ($this->isNew() && null === $this->collUsers) {
1314
-                return 0;
1315
-            }
1316
-
1317
-            if ($partial && !$criteria) {
1318
-                return count($this->getUsers());
1319
-            }
1320
-
1321
-            $query = ChildUserQuery::create(null, $criteria);
1322
-            if ($distinct) {
1323
-                $query->distinct();
1324
-            }
1325
-
1326
-            return $query
1327
-                ->filterByInstance($this)
1328
-                ->count($con);
1329
-        }
1330
-
1331
-        return count($this->collUsers);
1332
-    }
1333
-
1334
-    /**
1335
-     * Method called to associate a ChildUser object to this object
1336
-     * through the ChildUser foreign key attribute.
1337
-     *
1338
-     * @param  ChildUser $l ChildUser
1339
-     * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)
1340
-     */
1341
-    public function addUser(ChildUser $l)
1342
-    {
1343
-        if ($this->collUsers === null) {
1344
-            $this->initUsers();
1345
-            $this->collUsersPartial = true;
1346
-        }
1347
-
1348
-        if (!$this->collUsers->contains($l)) {
1349
-            $this->doAddUser($l);
1350
-
1351
-            if ($this->usersScheduledForDeletion and $this->usersScheduledForDeletion->contains($l)) {
1352
-                $this->usersScheduledForDeletion->remove($this->usersScheduledForDeletion->search($l));
1353
-            }
1354
-        }
1355
-
1356
-        return $this;
1357
-    }
1358
-
1359
-    /**
1360
-     * @param ChildUser $user The ChildUser object to add.
1361
-     */
1362
-    protected function doAddUser(ChildUser $user)
1363
-    {
1364
-        $this->collUsers[]= $user;
1365
-        $user->setInstance($this);
1366
-    }
1367
-
1368
-    /**
1369
-     * @param  ChildUser $user The ChildUser object to remove.
1370
-     * @return $this|ChildInstance The current object (for fluent API support)
1371
-     */
1372
-    public function removeUser(ChildUser $user)
1373
-    {
1374
-        if ($this->getUsers()->contains($user)) {
1375
-            $pos = $this->collUsers->search($user);
1376
-            $this->collUsers->remove($pos);
1377
-            if (null === $this->usersScheduledForDeletion) {
1378
-                $this->usersScheduledForDeletion = clone $this->collUsers;
1379
-                $this->usersScheduledForDeletion->clear();
1380
-            }
1381
-            $this->usersScheduledForDeletion[]= clone $user;
1382
-            $user->setInstance(null);
1383
-        }
1384
-
1385
-        return $this;
1386
-    }
1387
-
1388
-    /**
1389
-     * Clears out the collConnections collection
1390
-     *
1391
-     * This does not modify the database; however, it will remove any associated objects, causing
1392
-     * them to be refetched by subsequent calls to accessor method.
1393
-     *
1394
-     * @return void
1395
-     * @see        addConnections()
1396
-     */
1397
-    public function clearConnections()
1398
-    {
1399
-        $this->collConnections = null; // important to set this to NULL since that means it is uninitialized
1400
-    }
1401
-
1402
-    /**
1403
-     * Reset is the collConnections collection loaded partially.
1404
-     */
1405
-    public function resetPartialConnections($v = true)
1406
-    {
1407
-        $this->collConnectionsPartial = $v;
1408
-    }
1409
-
1410
-    /**
1411
-     * Initializes the collConnections collection.
1412
-     *
1413
-     * By default this just sets the collConnections collection to an empty array (like clearcollConnections());
1414
-     * however, you may wish to override this method in your stub class to provide setting appropriate
1415
-     * to your application -- for example, setting the initial array to the values stored in database.
1416
-     *
1417
-     * @param      boolean $overrideExisting If set to true, the method call initializes
1418
-     *                                        the collection even if it is not empty
1419
-     *
1420
-     * @return void
1421
-     */
1422
-    public function initConnections($overrideExisting = true)
1423
-    {
1424
-        if (null !== $this->collConnections && !$overrideExisting) {
1425
-            return;
1426
-        }
1427
-
1428
-        $collectionClassName = ConnectionTableMap::getTableMap()->getCollectionClassName();
1429
-
1430
-        $this->collConnections = new $collectionClassName;
1431
-        $this->collConnections->setModel('\Jalle19\StatusManager\Database\Connection');
1432
-    }
1433
-
1434
-    /**
1435
-     * Gets an array of ChildConnection objects which contain a foreign key that references this object.
1436
-     *
1437
-     * If the $criteria is not null, it is used to always fetch the results from the database.
1438
-     * Otherwise the results are fetched from the database the first time, then cached.
1439
-     * Next time the same method is called without $criteria, the cached collection is returned.
1440
-     * If this ChildInstance is new, it will return
1441
-     * an empty collection or the current collection; the criteria is ignored on a new object.
1442
-     *
1443
-     * @param      Criteria $criteria optional Criteria object to narrow the query
1444
-     * @param      ConnectionInterface $con optional connection object
1445
-     * @return ObjectCollection|ChildConnection[] List of ChildConnection objects
1446
-     * @throws PropelException
1447
-     */
1448
-    public function getConnections(Criteria $criteria = null, ConnectionInterface $con = null)
1449
-    {
1450
-        $partial = $this->collConnectionsPartial && !$this->isNew();
1451
-        if (null === $this->collConnections || null !== $criteria  || $partial) {
1452
-            if ($this->isNew() && null === $this->collConnections) {
1453
-                // return empty collection
1454
-                $this->initConnections();
1455
-            } else {
1456
-                $collConnections = ChildConnectionQuery::create(null, $criteria)
1457
-                    ->filterByInstance($this)
1458
-                    ->find($con);
1459
-
1460
-                if (null !== $criteria) {
1461
-                    if (false !== $this->collConnectionsPartial && count($collConnections)) {
1462
-                        $this->initConnections(false);
1463
-
1464
-                        foreach ($collConnections as $obj) {
1465
-                            if (false == $this->collConnections->contains($obj)) {
1466
-                                $this->collConnections->append($obj);
1467
-                            }
1468
-                        }
1469
-
1470
-                        $this->collConnectionsPartial = true;
1471
-                    }
1472
-
1473
-                    return $collConnections;
1474
-                }
1475
-
1476
-                if ($partial && $this->collConnections) {
1477
-                    foreach ($this->collConnections as $obj) {
1478
-                        if ($obj->isNew()) {
1479
-                            $collConnections[] = $obj;
1480
-                        }
1481
-                    }
1482
-                }
1483
-
1484
-                $this->collConnections = $collConnections;
1485
-                $this->collConnectionsPartial = false;
1486
-            }
1487
-        }
1488
-
1489
-        return $this->collConnections;
1490
-    }
1491
-
1492
-    /**
1493
-     * Sets a collection of ChildConnection objects related by a one-to-many relationship
1494
-     * to the current object.
1495
-     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1496
-     * and new objects from the given Propel collection.
1497
-     *
1498
-     * @param      Collection $connections A Propel collection.
1499
-     * @param      ConnectionInterface $con Optional connection object
1500
-     * @return $this|ChildInstance The current object (for fluent API support)
1501
-     */
1502
-    public function setConnections(Collection $connections, ConnectionInterface $con = null)
1503
-    {
1504
-        /** @var ChildConnection[] $connectionsToDelete */
1505
-        $connectionsToDelete = $this->getConnections(new Criteria(), $con)->diff($connections);
1506
-
1507
-
1508
-        $this->connectionsScheduledForDeletion = $connectionsToDelete;
1509
-
1510
-        foreach ($connectionsToDelete as $connectionRemoved) {
1511
-            $connectionRemoved->setInstance(null);
1512
-        }
1513
-
1514
-        $this->collConnections = null;
1515
-        foreach ($connections as $connection) {
1516
-            $this->addConnection($connection);
1517
-        }
1518
-
1519
-        $this->collConnections = $connections;
1520
-        $this->collConnectionsPartial = false;
1521
-
1522
-        return $this;
1523
-    }
1524
-
1525
-    /**
1526
-     * Returns the number of related Connection objects.
1527
-     *
1528
-     * @param      Criteria $criteria
1529
-     * @param      boolean $distinct
1530
-     * @param      ConnectionInterface $con
1531
-     * @return int             Count of related Connection objects.
1532
-     * @throws PropelException
1533
-     */
1534
-    public function countConnections(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
1535
-    {
1536
-        $partial = $this->collConnectionsPartial && !$this->isNew();
1537
-        if (null === $this->collConnections || null !== $criteria || $partial) {
1538
-            if ($this->isNew() && null === $this->collConnections) {
1539
-                return 0;
1540
-            }
1541
-
1542
-            if ($partial && !$criteria) {
1543
-                return count($this->getConnections());
1544
-            }
1545
-
1546
-            $query = ChildConnectionQuery::create(null, $criteria);
1547
-            if ($distinct) {
1548
-                $query->distinct();
1549
-            }
1550
-
1551
-            return $query
1552
-                ->filterByInstance($this)
1553
-                ->count($con);
1554
-        }
1555
-
1556
-        return count($this->collConnections);
1557
-    }
1558
-
1559
-    /**
1560
-     * Method called to associate a ChildConnection object to this object
1561
-     * through the ChildConnection foreign key attribute.
1562
-     *
1563
-     * @param  ChildConnection $l ChildConnection
1564
-     * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)
1565
-     */
1566
-    public function addConnection(ChildConnection $l)
1567
-    {
1568
-        if ($this->collConnections === null) {
1569
-            $this->initConnections();
1570
-            $this->collConnectionsPartial = true;
1571
-        }
1572
-
1573
-        if (!$this->collConnections->contains($l)) {
1574
-            $this->doAddConnection($l);
1575
-
1576
-            if ($this->connectionsScheduledForDeletion and $this->connectionsScheduledForDeletion->contains($l)) {
1577
-                $this->connectionsScheduledForDeletion->remove($this->connectionsScheduledForDeletion->search($l));
1578
-            }
1579
-        }
1580
-
1581
-        return $this;
1582
-    }
1583
-
1584
-    /**
1585
-     * @param ChildConnection $connection The ChildConnection object to add.
1586
-     */
1587
-    protected function doAddConnection(ChildConnection $connection)
1588
-    {
1589
-        $this->collConnections[]= $connection;
1590
-        $connection->setInstance($this);
1591
-    }
1592
-
1593
-    /**
1594
-     * @param  ChildConnection $connection The ChildConnection object to remove.
1595
-     * @return $this|ChildInstance The current object (for fluent API support)
1596
-     */
1597
-    public function removeConnection(ChildConnection $connection)
1598
-    {
1599
-        if ($this->getConnections()->contains($connection)) {
1600
-            $pos = $this->collConnections->search($connection);
1601
-            $this->collConnections->remove($pos);
1602
-            if (null === $this->connectionsScheduledForDeletion) {
1603
-                $this->connectionsScheduledForDeletion = clone $this->collConnections;
1604
-                $this->connectionsScheduledForDeletion->clear();
1605
-            }
1606
-            $this->connectionsScheduledForDeletion[]= clone $connection;
1607
-            $connection->setInstance(null);
1608
-        }
1609
-
1610
-        return $this;
1611
-    }
1612
-
1613
-
1614
-    /**
1615
-     * If this collection has already been initialized with
1616
-     * an identical criteria, it returns the collection.
1617
-     * Otherwise if this Instance is new, it will return
1618
-     * an empty collection; or if this Instance has previously
1619
-     * been saved, it will retrieve related Connections from storage.
1620
-     *
1621
-     * This method is protected by default in order to keep the public
1622
-     * api reasonable.  You can provide public methods for those you
1623
-     * actually need in Instance.
1624
-     *
1625
-     * @param      Criteria $criteria optional Criteria object to narrow the query
1626
-     * @param      ConnectionInterface $con optional connection object
1627
-     * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1628
-     * @return ObjectCollection|ChildConnection[] List of ChildConnection objects
1629
-     */
1630
-    public function getConnectionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1631
-    {
1632
-        $query = ChildConnectionQuery::create(null, $criteria);
1633
-        $query->joinWith('User', $joinBehavior);
1634
-
1635
-        return $this->getConnections($query, $con);
1636
-    }
1637
-
1638
-    /**
1639
-     * Clears out the collChannels collection
1640
-     *
1641
-     * This does not modify the database; however, it will remove any associated objects, causing
1642
-     * them to be refetched by subsequent calls to accessor method.
1643
-     *
1644
-     * @return void
1645
-     * @see        addChannels()
1646
-     */
1647
-    public function clearChannels()
1648
-    {
1649
-        $this->collChannels = null; // important to set this to NULL since that means it is uninitialized
1650
-    }
1651
-
1652
-    /**
1653
-     * Reset is the collChannels collection loaded partially.
1654
-     */
1655
-    public function resetPartialChannels($v = true)
1656
-    {
1657
-        $this->collChannelsPartial = $v;
1658
-    }
1659
-
1660
-    /**
1661
-     * Initializes the collChannels collection.
1662
-     *
1663
-     * By default this just sets the collChannels collection to an empty array (like clearcollChannels());
1664
-     * however, you may wish to override this method in your stub class to provide setting appropriate
1665
-     * to your application -- for example, setting the initial array to the values stored in database.
1666
-     *
1667
-     * @param      boolean $overrideExisting If set to true, the method call initializes
1668
-     *                                        the collection even if it is not empty
1669
-     *
1670
-     * @return void
1671
-     */
1672
-    public function initChannels($overrideExisting = true)
1673
-    {
1674
-        if (null !== $this->collChannels && !$overrideExisting) {
1675
-            return;
1676
-        }
1677
-
1678
-        $collectionClassName = ChannelTableMap::getTableMap()->getCollectionClassName();
1679
-
1680
-        $this->collChannels = new $collectionClassName;
1681
-        $this->collChannels->setModel('\Jalle19\StatusManager\Database\Channel');
1682
-    }
1683
-
1684
-    /**
1685
-     * Gets an array of ChildChannel objects which contain a foreign key that references this object.
1686
-     *
1687
-     * If the $criteria is not null, it is used to always fetch the results from the database.
1688
-     * Otherwise the results are fetched from the database the first time, then cached.
1689
-     * Next time the same method is called without $criteria, the cached collection is returned.
1690
-     * If this ChildInstance is new, it will return
1691
-     * an empty collection or the current collection; the criteria is ignored on a new object.
1692
-     *
1693
-     * @param      Criteria $criteria optional Criteria object to narrow the query
1694
-     * @param      ConnectionInterface $con optional connection object
1695
-     * @return ObjectCollection|ChildChannel[] List of ChildChannel objects
1696
-     * @throws PropelException
1697
-     */
1698
-    public function getChannels(Criteria $criteria = null, ConnectionInterface $con = null)
1699
-    {
1700
-        $partial = $this->collChannelsPartial && !$this->isNew();
1701
-        if (null === $this->collChannels || null !== $criteria  || $partial) {
1702
-            if ($this->isNew() && null === $this->collChannels) {
1703
-                // return empty collection
1704
-                $this->initChannels();
1705
-            } else {
1706
-                $collChannels = ChildChannelQuery::create(null, $criteria)
1707
-                    ->filterByInstance($this)
1708
-                    ->find($con);
1709
-
1710
-                if (null !== $criteria) {
1711
-                    if (false !== $this->collChannelsPartial && count($collChannels)) {
1712
-                        $this->initChannels(false);
1713
-
1714
-                        foreach ($collChannels as $obj) {
1715
-                            if (false == $this->collChannels->contains($obj)) {
1716
-                                $this->collChannels->append($obj);
1717
-                            }
1718
-                        }
1719
-
1720
-                        $this->collChannelsPartial = true;
1721
-                    }
1722
-
1723
-                    return $collChannels;
1724
-                }
1725
-
1726
-                if ($partial && $this->collChannels) {
1727
-                    foreach ($this->collChannels as $obj) {
1728
-                        if ($obj->isNew()) {
1729
-                            $collChannels[] = $obj;
1730
-                        }
1731
-                    }
1732
-                }
1733
-
1734
-                $this->collChannels = $collChannels;
1735
-                $this->collChannelsPartial = false;
1736
-            }
1737
-        }
1738
-
1739
-        return $this->collChannels;
1740
-    }
1741
-
1742
-    /**
1743
-     * Sets a collection of ChildChannel objects related by a one-to-many relationship
1744
-     * to the current object.
1745
-     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1746
-     * and new objects from the given Propel collection.
1747
-     *
1748
-     * @param      Collection $channels A Propel collection.
1749
-     * @param      ConnectionInterface $con Optional connection object
1750
-     * @return $this|ChildInstance The current object (for fluent API support)
1751
-     */
1752
-    public function setChannels(Collection $channels, ConnectionInterface $con = null)
1753
-    {
1754
-        /** @var ChildChannel[] $channelsToDelete */
1755
-        $channelsToDelete = $this->getChannels(new Criteria(), $con)->diff($channels);
1756
-
1757
-
1758
-        $this->channelsScheduledForDeletion = $channelsToDelete;
1759
-
1760
-        foreach ($channelsToDelete as $channelRemoved) {
1761
-            $channelRemoved->setInstance(null);
1762
-        }
1763
-
1764
-        $this->collChannels = null;
1765
-        foreach ($channels as $channel) {
1766
-            $this->addChannel($channel);
1767
-        }
1768
-
1769
-        $this->collChannels = $channels;
1770
-        $this->collChannelsPartial = false;
1771
-
1772
-        return $this;
1773
-    }
1774
-
1775
-    /**
1776
-     * Returns the number of related Channel objects.
1777
-     *
1778
-     * @param      Criteria $criteria
1779
-     * @param      boolean $distinct
1780
-     * @param      ConnectionInterface $con
1781
-     * @return int             Count of related Channel objects.
1782
-     * @throws PropelException
1783
-     */
1784
-    public function countChannels(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
1785
-    {
1786
-        $partial = $this->collChannelsPartial && !$this->isNew();
1787
-        if (null === $this->collChannels || null !== $criteria || $partial) {
1788
-            if ($this->isNew() && null === $this->collChannels) {
1789
-                return 0;
1790
-            }
1791
-
1792
-            if ($partial && !$criteria) {
1793
-                return count($this->getChannels());
1794
-            }
1795
-
1796
-            $query = ChildChannelQuery::create(null, $criteria);
1797
-            if ($distinct) {
1798
-                $query->distinct();
1799
-            }
1800
-
1801
-            return $query
1802
-                ->filterByInstance($this)
1803
-                ->count($con);
1804
-        }
1805
-
1806
-        return count($this->collChannels);
1807
-    }
1808
-
1809
-    /**
1810
-     * Method called to associate a ChildChannel object to this object
1811
-     * through the ChildChannel foreign key attribute.
1812
-     *
1813
-     * @param  ChildChannel $l ChildChannel
1814
-     * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)
1815
-     */
1816
-    public function addChannel(ChildChannel $l)
1817
-    {
1818
-        if ($this->collChannels === null) {
1819
-            $this->initChannels();
1820
-            $this->collChannelsPartial = true;
1821
-        }
1822
-
1823
-        if (!$this->collChannels->contains($l)) {
1824
-            $this->doAddChannel($l);
1825
-
1826
-            if ($this->channelsScheduledForDeletion and $this->channelsScheduledForDeletion->contains($l)) {
1827
-                $this->channelsScheduledForDeletion->remove($this->channelsScheduledForDeletion->search($l));
1828
-            }
1829
-        }
1830
-
1831
-        return $this;
1832
-    }
1833
-
1834
-    /**
1835
-     * @param ChildChannel $channel The ChildChannel object to add.
1836
-     */
1837
-    protected function doAddChannel(ChildChannel $channel)
1838
-    {
1839
-        $this->collChannels[]= $channel;
1840
-        $channel->setInstance($this);
1841
-    }
1842
-
1843
-    /**
1844
-     * @param  ChildChannel $channel The ChildChannel object to remove.
1845
-     * @return $this|ChildInstance The current object (for fluent API support)
1846
-     */
1847
-    public function removeChannel(ChildChannel $channel)
1848
-    {
1849
-        if ($this->getChannels()->contains($channel)) {
1850
-            $pos = $this->collChannels->search($channel);
1851
-            $this->collChannels->remove($pos);
1852
-            if (null === $this->channelsScheduledForDeletion) {
1853
-                $this->channelsScheduledForDeletion = clone $this->collChannels;
1854
-                $this->channelsScheduledForDeletion->clear();
1855
-            }
1856
-            $this->channelsScheduledForDeletion[]= clone $channel;
1857
-            $channel->setInstance(null);
1858
-        }
1859
-
1860
-        return $this;
1861
-    }
1862
-
1863
-    /**
1864
-     * Clears out the collSubscriptions collection
1865
-     *
1866
-     * This does not modify the database; however, it will remove any associated objects, causing
1867
-     * them to be refetched by subsequent calls to accessor method.
1868
-     *
1869
-     * @return void
1870
-     * @see        addSubscriptions()
1871
-     */
1872
-    public function clearSubscriptions()
1873
-    {
1874
-        $this->collSubscriptions = null; // important to set this to NULL since that means it is uninitialized
1875
-    }
1876
-
1877
-    /**
1878
-     * Reset is the collSubscriptions collection loaded partially.
1879
-     */
1880
-    public function resetPartialSubscriptions($v = true)
1881
-    {
1882
-        $this->collSubscriptionsPartial = $v;
1883
-    }
1884
-
1885
-    /**
1886
-     * Initializes the collSubscriptions collection.
1887
-     *
1888
-     * By default this just sets the collSubscriptions collection to an empty array (like clearcollSubscriptions());
1889
-     * however, you may wish to override this method in your stub class to provide setting appropriate
1890
-     * to your application -- for example, setting the initial array to the values stored in database.
1891
-     *
1892
-     * @param      boolean $overrideExisting If set to true, the method call initializes
1893
-     *                                        the collection even if it is not empty
1894
-     *
1895
-     * @return void
1896
-     */
1897
-    public function initSubscriptions($overrideExisting = true)
1898
-    {
1899
-        if (null !== $this->collSubscriptions && !$overrideExisting) {
1900
-            return;
1901
-        }
1902
-
1903
-        $collectionClassName = SubscriptionTableMap::getTableMap()->getCollectionClassName();
1904
-
1905
-        $this->collSubscriptions = new $collectionClassName;
1906
-        $this->collSubscriptions->setModel('\Jalle19\StatusManager\Database\Subscription');
1907
-    }
1908
-
1909
-    /**
1910
-     * Gets an array of ChildSubscription objects which contain a foreign key that references this object.
1911
-     *
1912
-     * If the $criteria is not null, it is used to always fetch the results from the database.
1913
-     * Otherwise the results are fetched from the database the first time, then cached.
1914
-     * Next time the same method is called without $criteria, the cached collection is returned.
1915
-     * If this ChildInstance is new, it will return
1916
-     * an empty collection or the current collection; the criteria is ignored on a new object.
1917
-     *
1918
-     * @param      Criteria $criteria optional Criteria object to narrow the query
1919
-     * @param      ConnectionInterface $con optional connection object
1920
-     * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1921
-     * @throws PropelException
1922
-     */
1923
-    public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null)
1924
-    {
1925
-        $partial = $this->collSubscriptionsPartial && !$this->isNew();
1926
-        if (null === $this->collSubscriptions || null !== $criteria  || $partial) {
1927
-            if ($this->isNew() && null === $this->collSubscriptions) {
1928
-                // return empty collection
1929
-                $this->initSubscriptions();
1930
-            } else {
1931
-                $collSubscriptions = ChildSubscriptionQuery::create(null, $criteria)
1932
-                    ->filterByInstance($this)
1933
-                    ->find($con);
1934
-
1935
-                if (null !== $criteria) {
1936
-                    if (false !== $this->collSubscriptionsPartial && count($collSubscriptions)) {
1937
-                        $this->initSubscriptions(false);
1938
-
1939
-                        foreach ($collSubscriptions as $obj) {
1940
-                            if (false == $this->collSubscriptions->contains($obj)) {
1941
-                                $this->collSubscriptions->append($obj);
1942
-                            }
1943
-                        }
1944
-
1945
-                        $this->collSubscriptionsPartial = true;
1946
-                    }
1947
-
1948
-                    return $collSubscriptions;
1949
-                }
1950
-
1951
-                if ($partial && $this->collSubscriptions) {
1952
-                    foreach ($this->collSubscriptions as $obj) {
1953
-                        if ($obj->isNew()) {
1954
-                            $collSubscriptions[] = $obj;
1955
-                        }
1956
-                    }
1957
-                }
1958
-
1959
-                $this->collSubscriptions = $collSubscriptions;
1960
-                $this->collSubscriptionsPartial = false;
1961
-            }
1962
-        }
1963
-
1964
-        return $this->collSubscriptions;
1965
-    }
1966
-
1967
-    /**
1968
-     * Sets a collection of ChildSubscription objects related by a one-to-many relationship
1969
-     * to the current object.
1970
-     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1971
-     * and new objects from the given Propel collection.
1972
-     *
1973
-     * @param      Collection $subscriptions A Propel collection.
1974
-     * @param      ConnectionInterface $con Optional connection object
1975
-     * @return $this|ChildInstance The current object (for fluent API support)
1976
-     */
1977
-    public function setSubscriptions(Collection $subscriptions, ConnectionInterface $con = null)
1978
-    {
1979
-        /** @var ChildSubscription[] $subscriptionsToDelete */
1980
-        $subscriptionsToDelete = $this->getSubscriptions(new Criteria(), $con)->diff($subscriptions);
1981
-
1982
-
1983
-        $this->subscriptionsScheduledForDeletion = $subscriptionsToDelete;
1984
-
1985
-        foreach ($subscriptionsToDelete as $subscriptionRemoved) {
1986
-            $subscriptionRemoved->setInstance(null);
1987
-        }
1988
-
1989
-        $this->collSubscriptions = null;
1990
-        foreach ($subscriptions as $subscription) {
1991
-            $this->addSubscription($subscription);
1992
-        }
1993
-
1994
-        $this->collSubscriptions = $subscriptions;
1995
-        $this->collSubscriptionsPartial = false;
1996
-
1997
-        return $this;
1998
-    }
1999
-
2000
-    /**
2001
-     * Returns the number of related Subscription objects.
2002
-     *
2003
-     * @param      Criteria $criteria
2004
-     * @param      boolean $distinct
2005
-     * @param      ConnectionInterface $con
2006
-     * @return int             Count of related Subscription objects.
2007
-     * @throws PropelException
2008
-     */
2009
-    public function countSubscriptions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
2010
-    {
2011
-        $partial = $this->collSubscriptionsPartial && !$this->isNew();
2012
-        if (null === $this->collSubscriptions || null !== $criteria || $partial) {
2013
-            if ($this->isNew() && null === $this->collSubscriptions) {
2014
-                return 0;
2015
-            }
2016
-
2017
-            if ($partial && !$criteria) {
2018
-                return count($this->getSubscriptions());
2019
-            }
2020
-
2021
-            $query = ChildSubscriptionQuery::create(null, $criteria);
2022
-            if ($distinct) {
2023
-                $query->distinct();
2024
-            }
2025
-
2026
-            return $query
2027
-                ->filterByInstance($this)
2028
-                ->count($con);
2029
-        }
2030
-
2031
-        return count($this->collSubscriptions);
2032
-    }
2033
-
2034
-    /**
2035
-     * Method called to associate a ChildSubscription object to this object
2036
-     * through the ChildSubscription foreign key attribute.
2037
-     *
2038
-     * @param  ChildSubscription $l ChildSubscription
2039
-     * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)
2040
-     */
2041
-    public function addSubscription(ChildSubscription $l)
2042
-    {
2043
-        if ($this->collSubscriptions === null) {
2044
-            $this->initSubscriptions();
2045
-            $this->collSubscriptionsPartial = true;
2046
-        }
2047
-
2048
-        if (!$this->collSubscriptions->contains($l)) {
2049
-            $this->doAddSubscription($l);
2050
-
2051
-            if ($this->subscriptionsScheduledForDeletion and $this->subscriptionsScheduledForDeletion->contains($l)) {
2052
-                $this->subscriptionsScheduledForDeletion->remove($this->subscriptionsScheduledForDeletion->search($l));
2053
-            }
2054
-        }
2055
-
2056
-        return $this;
2057
-    }
2058
-
2059
-    /**
2060
-     * @param ChildSubscription $subscription The ChildSubscription object to add.
2061
-     */
2062
-    protected function doAddSubscription(ChildSubscription $subscription)
2063
-    {
2064
-        $this->collSubscriptions[]= $subscription;
2065
-        $subscription->setInstance($this);
2066
-    }
2067
-
2068
-    /**
2069
-     * @param  ChildSubscription $subscription The ChildSubscription object to remove.
2070
-     * @return $this|ChildInstance The current object (for fluent API support)
2071
-     */
2072
-    public function removeSubscription(ChildSubscription $subscription)
2073
-    {
2074
-        if ($this->getSubscriptions()->contains($subscription)) {
2075
-            $pos = $this->collSubscriptions->search($subscription);
2076
-            $this->collSubscriptions->remove($pos);
2077
-            if (null === $this->subscriptionsScheduledForDeletion) {
2078
-                $this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions;
2079
-                $this->subscriptionsScheduledForDeletion->clear();
2080
-            }
2081
-            $this->subscriptionsScheduledForDeletion[]= clone $subscription;
2082
-            $subscription->setInstance(null);
2083
-        }
2084
-
2085
-        return $this;
2086
-    }
2087
-
2088
-
2089
-    /**
2090
-     * If this collection has already been initialized with
2091
-     * an identical criteria, it returns the collection.
2092
-     * Otherwise if this Instance is new, it will return
2093
-     * an empty collection; or if this Instance has previously
2094
-     * been saved, it will retrieve related Subscriptions from storage.
2095
-     *
2096
-     * This method is protected by default in order to keep the public
2097
-     * api reasonable.  You can provide public methods for those you
2098
-     * actually need in Instance.
2099
-     *
2100
-     * @param      Criteria $criteria optional Criteria object to narrow the query
2101
-     * @param      ConnectionInterface $con optional connection object
2102
-     * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2103
-     * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
2104
-     */
2105
-    public function getSubscriptionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
2106
-    {
2107
-        $query = ChildSubscriptionQuery::create(null, $criteria);
2108
-        $query->joinWith('User', $joinBehavior);
2109
-
2110
-        return $this->getSubscriptions($query, $con);
2111
-    }
2112
-
2113
-
2114
-    /**
2115
-     * If this collection has already been initialized with
2116
-     * an identical criteria, it returns the collection.
2117
-     * Otherwise if this Instance is new, it will return
2118
-     * an empty collection; or if this Instance has previously
2119
-     * been saved, it will retrieve related Subscriptions from storage.
2120
-     *
2121
-     * This method is protected by default in order to keep the public
2122
-     * api reasonable.  You can provide public methods for those you
2123
-     * actually need in Instance.
2124
-     *
2125
-     * @param      Criteria $criteria optional Criteria object to narrow the query
2126
-     * @param      ConnectionInterface $con optional connection object
2127
-     * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2128
-     * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
2129
-     */
2130
-    public function getSubscriptionsJoinChannel(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
2131
-    {
2132
-        $query = ChildSubscriptionQuery::create(null, $criteria);
2133
-        $query->joinWith('Channel', $joinBehavior);
2134
-
2135
-        return $this->getSubscriptions($query, $con);
2136
-    }
2137
-
2138
-    /**
2139
-     * Clears the current object, sets all attributes to their default values and removes
2140
-     * outgoing references as well as back-references (from other objects to this one. Results probably in a database
2141
-     * change of those foreign objects when you call `save` there).
2142
-     */
2143
-    public function clear()
2144
-    {
2145
-        $this->name = null;
2146
-        $this->alreadyInSave = false;
2147
-        $this->clearAllReferences();
2148
-        $this->resetModified();
2149
-        $this->setNew(true);
2150
-        $this->setDeleted(false);
2151
-    }
2152
-
2153
-    /**
2154
-     * Resets all references and back-references to other model objects or collections of model objects.
2155
-     *
2156
-     * This method is used to reset all php object references (not the actual reference in the database).
2157
-     * Necessary for object serialisation.
2158
-     *
2159
-     * @param      boolean $deep Whether to also clear the references on all referrer objects.
2160
-     */
2161
-    public function clearAllReferences($deep = false)
2162
-    {
2163
-        if ($deep) {
2164
-            if ($this->collUsers) {
2165
-                foreach ($this->collUsers as $o) {
2166
-                    $o->clearAllReferences($deep);
2167
-                }
2168
-            }
2169
-            if ($this->collConnections) {
2170
-                foreach ($this->collConnections as $o) {
2171
-                    $o->clearAllReferences($deep);
2172
-                }
2173
-            }
2174
-            if ($this->collChannels) {
2175
-                foreach ($this->collChannels as $o) {
2176
-                    $o->clearAllReferences($deep);
2177
-                }
2178
-            }
2179
-            if ($this->collSubscriptions) {
2180
-                foreach ($this->collSubscriptions as $o) {
2181
-                    $o->clearAllReferences($deep);
2182
-                }
2183
-            }
2184
-        } // if ($deep)
2185
-
2186
-        $this->collUsers = null;
2187
-        $this->collConnections = null;
2188
-        $this->collChannels = null;
2189
-        $this->collSubscriptions = null;
2190
-    }
2191
-
2192
-    /**
2193
-     * Return the string representation of this object
2194
-     *
2195
-     * @return string
2196
-     */
2197
-    public function __toString()
2198
-    {
2199
-        return (string) $this->exportTo(InstanceTableMap::DEFAULT_STRING_FORMAT);
2200
-    }
2201
-
2202
-    /**
2203
-     * Code to be run before persisting the object
2204
-     * @param  ConnectionInterface $con
2205
-     * @return boolean
2206
-     */
2207
-    public function preSave(ConnectionInterface $con = null)
2208
-    {
2209
-        return true;
2210
-    }
2211
-
2212
-    /**
2213
-     * Code to be run after persisting the object
2214
-     * @param ConnectionInterface $con
2215
-     */
2216
-    public function postSave(ConnectionInterface $con = null)
2217
-    {
2218
-
2219
-    }
2220
-
2221
-    /**
2222
-     * Code to be run before inserting to database
2223
-     * @param  ConnectionInterface $con
2224
-     * @return boolean
2225
-     */
2226
-    public function preInsert(ConnectionInterface $con = null)
2227
-    {
2228
-        return true;
2229
-    }
2230
-
2231
-    /**
2232
-     * Code to be run after inserting to database
2233
-     * @param ConnectionInterface $con
2234
-     */
2235
-    public function postInsert(ConnectionInterface $con = null)
2236
-    {
2237
-
2238
-    }
2239
-
2240
-    /**
2241
-     * Code to be run before updating the object in database
2242
-     * @param  ConnectionInterface $con
2243
-     * @return boolean
2244
-     */
2245
-    public function preUpdate(ConnectionInterface $con = null)
2246
-    {
2247
-        return true;
2248
-    }
2249
-
2250
-    /**
2251
-     * Code to be run after updating the object in database
2252
-     * @param ConnectionInterface $con
2253
-     */
2254
-    public function postUpdate(ConnectionInterface $con = null)
2255
-    {
2256
-
2257
-    }
2258
-
2259
-    /**
2260
-     * Code to be run before deleting the object in database
2261
-     * @param  ConnectionInterface $con
2262
-     * @return boolean
2263
-     */
2264
-    public function preDelete(ConnectionInterface $con = null)
2265
-    {
2266
-        return true;
2267
-    }
2268
-
2269
-    /**
2270
-     * Code to be run after deleting the object in database
2271
-     * @param ConnectionInterface $con
2272
-     */
2273
-    public function postDelete(ConnectionInterface $con = null)
2274
-    {
2275
-
2276
-    }
2277
-
2278
-
2279
-    /**
2280
-     * Derived method to catches calls to undefined methods.
2281
-     *
2282
-     * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
2283
-     * Allows to define default __call() behavior if you overwrite __call()
2284
-     *
2285
-     * @param string $name
2286
-     * @param mixed  $params
2287
-     *
2288
-     * @return array|string
2289
-     */
2290
-    public function __call($name, $params)
2291
-    {
2292
-        if (0 === strpos($name, 'get')) {
2293
-            $virtualColumn = substr($name, 3);
2294
-            if ($this->hasVirtualColumn($virtualColumn)) {
2295
-                return $this->getVirtualColumn($virtualColumn);
2296
-            }
2297
-
2298
-            $virtualColumn = lcfirst($virtualColumn);
2299
-            if ($this->hasVirtualColumn($virtualColumn)) {
2300
-                return $this->getVirtualColumn($virtualColumn);
2301
-            }
2302
-        }
2303
-
2304
-        if (0 === strpos($name, 'from')) {
2305
-            $format = substr($name, 4);
2306
-
2307
-            return $this->importFrom($format, reset($params));
2308
-        }
2309
-
2310
-        if (0 === strpos($name, 'to')) {
2311
-            $format = substr($name, 2);
2312
-            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
2313
-
2314
-            return $this->exportTo($format, $includeLazyLoadColumns);
2315
-        }
2316
-
2317
-        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
2318
-    }
421
+	 *                            TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
422
+	 *
423
+	 * @return int             next starting column
424
+	 * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
425
+	 */
426
+	public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
427
+	{
428
+		try {
429
+
430
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : InstanceTableMap::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
431
+			$this->name = (null !== $col) ? (string) $col : null;
432
+			$this->resetModified();
433
+
434
+			$this->setNew(false);
435
+
436
+			if ($rehydrate) {
437
+				$this->ensureConsistency();
438
+			}
439
+
440
+			return $startcol + 1; // 1 = InstanceTableMap::NUM_HYDRATE_COLUMNS.
441
+
442
+		} catch (Exception $e) {
443
+			throw new PropelException(sprintf('Error populating %s object', '\\Jalle19\\StatusManager\\Database\\Instance'), 0, $e);
444
+		}
445
+	}
446
+
447
+	/**
448
+	 * Checks and repairs the internal consistency of the object.
449
+	 *
450
+	 * This method is executed after an already-instantiated object is re-hydrated
451
+	 * from the database.  It exists to check any foreign keys to make sure that
452
+	 * the objects related to the current object are correct based on foreign key.
453
+	 *
454
+	 * You can override this method in the stub class, but you should always invoke
455
+	 * the base method from the overridden method (i.e. parent::ensureConsistency()),
456
+	 * in case your model changes.
457
+	 *
458
+	 * @throws PropelException
459
+	 */
460
+	public function ensureConsistency()
461
+	{
462
+	} // ensureConsistency
463
+
464
+	/**
465
+	 * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
466
+	 *
467
+	 * This will only work if the object has been saved and has a valid primary key set.
468
+	 *
469
+	 * @param      boolean $deep (optional) Whether to also de-associated any related objects.
470
+	 * @param      ConnectionInterface $con (optional) The ConnectionInterface connection to use.
471
+	 * @return void
472
+	 * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
473
+	 */
474
+	public function reload($deep = false, ConnectionInterface $con = null)
475
+	{
476
+		if ($this->isDeleted()) {
477
+			throw new PropelException("Cannot reload a deleted object.");
478
+		}
479
+
480
+		if ($this->isNew()) {
481
+			throw new PropelException("Cannot reload an unsaved object.");
482
+		}
483
+
484
+		if ($con === null) {
485
+			$con = Propel::getServiceContainer()->getReadConnection(InstanceTableMap::DATABASE_NAME);
486
+		}
487
+
488
+		// We don't need to alter the object instance pool; we're just modifying this instance
489
+		// already in the pool.
490
+
491
+		$dataFetcher = ChildInstanceQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
492
+		$row = $dataFetcher->fetch();
493
+		$dataFetcher->close();
494
+		if (!$row) {
495
+			throw new PropelException('Cannot find matching row in the database to reload object values.');
496
+		}
497
+		$this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
498
+
499
+		if ($deep) {  // also de-associate any related objects?
500
+
501
+			$this->collUsers = null;
502
+
503
+			$this->collConnections = null;
504
+
505
+			$this->collChannels = null;
506
+
507
+			$this->collSubscriptions = null;
508
+
509
+		} // if (deep)
510
+	}
511
+
512
+	/**
513
+	 * Removes this object from datastore and sets delete attribute.
514
+	 *
515
+	 * @param      ConnectionInterface $con
516
+	 * @return void
517
+	 * @throws PropelException
518
+	 * @see Instance::setDeleted()
519
+	 * @see Instance::isDeleted()
520
+	 */
521
+	public function delete(ConnectionInterface $con = null)
522
+	{
523
+		if ($this->isDeleted()) {
524
+			throw new PropelException("This object has already been deleted.");
525
+		}
526
+
527
+		if ($con === null) {
528
+			$con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
529
+		}
530
+
531
+		$con->transaction(function () use ($con) {
532
+			$deleteQuery = ChildInstanceQuery::create()
533
+				->filterByPrimaryKey($this->getPrimaryKey());
534
+			$ret = $this->preDelete($con);
535
+			if ($ret) {
536
+				$deleteQuery->delete($con);
537
+				$this->postDelete($con);
538
+				$this->setDeleted(true);
539
+			}
540
+		});
541
+	}
542
+
543
+	/**
544
+	 * Persists this object to the database.
545
+	 *
546
+	 * If the object is new, it inserts it; otherwise an update is performed.
547
+	 * All modified related objects will also be persisted in the doSave()
548
+	 * method.  This method wraps all precipitate database operations in a
549
+	 * single transaction.
550
+	 *
551
+	 * @param      ConnectionInterface $con
552
+	 * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
553
+	 * @throws PropelException
554
+	 * @see doSave()
555
+	 */
556
+	public function save(ConnectionInterface $con = null)
557
+	{
558
+		if ($this->isDeleted()) {
559
+			throw new PropelException("You cannot save an object that has been deleted.");
560
+		}
561
+
562
+		if ($con === null) {
563
+			$con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
564
+		}
565
+
566
+		return $con->transaction(function () use ($con) {
567
+			$isInsert = $this->isNew();
568
+			$ret = $this->preSave($con);
569
+			if ($isInsert) {
570
+				$ret = $ret && $this->preInsert($con);
571
+			} else {
572
+				$ret = $ret && $this->preUpdate($con);
573
+			}
574
+			if ($ret) {
575
+				$affectedRows = $this->doSave($con);
576
+				if ($isInsert) {
577
+					$this->postInsert($con);
578
+				} else {
579
+					$this->postUpdate($con);
580
+				}
581
+				$this->postSave($con);
582
+				InstanceTableMap::addInstanceToPool($this);
583
+			} else {
584
+				$affectedRows = 0;
585
+			}
586
+
587
+			return $affectedRows;
588
+		});
589
+	}
590
+
591
+	/**
592
+	 * Performs the work of inserting or updating the row in the database.
593
+	 *
594
+	 * If the object is new, it inserts it; otherwise an update is performed.
595
+	 * All related objects are also updated in this method.
596
+	 *
597
+	 * @param      ConnectionInterface $con
598
+	 * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
599
+	 * @throws PropelException
600
+	 * @see save()
601
+	 */
602
+	protected function doSave(ConnectionInterface $con)
603
+	{
604
+		$affectedRows = 0; // initialize var to track total num of affected rows
605
+		if (!$this->alreadyInSave) {
606
+			$this->alreadyInSave = true;
607
+
608
+			if ($this->isNew() || $this->isModified()) {
609
+				// persist changes
610
+				if ($this->isNew()) {
611
+					$this->doInsert($con);
612
+					$affectedRows += 1;
613
+				} else {
614
+					$affectedRows += $this->doUpdate($con);
615
+				}
616
+				$this->resetModified();
617
+			}
618
+
619
+			if ($this->usersScheduledForDeletion !== null) {
620
+				if (!$this->usersScheduledForDeletion->isEmpty()) {
621
+					\Jalle19\StatusManager\Database\UserQuery::create()
622
+						->filterByPrimaryKeys($this->usersScheduledForDeletion->getPrimaryKeys(false))
623
+						->delete($con);
624
+					$this->usersScheduledForDeletion = null;
625
+				}
626
+			}
627
+
628
+			if ($this->collUsers !== null) {
629
+				foreach ($this->collUsers as $referrerFK) {
630
+					if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
631
+						$affectedRows += $referrerFK->save($con);
632
+					}
633
+				}
634
+			}
635
+
636
+			if ($this->connectionsScheduledForDeletion !== null) {
637
+				if (!$this->connectionsScheduledForDeletion->isEmpty()) {
638
+					\Jalle19\StatusManager\Database\ConnectionQuery::create()
639
+						->filterByPrimaryKeys($this->connectionsScheduledForDeletion->getPrimaryKeys(false))
640
+						->delete($con);
641
+					$this->connectionsScheduledForDeletion = null;
642
+				}
643
+			}
644
+
645
+			if ($this->collConnections !== null) {
646
+				foreach ($this->collConnections as $referrerFK) {
647
+					if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
648
+						$affectedRows += $referrerFK->save($con);
649
+					}
650
+				}
651
+			}
652
+
653
+			if ($this->channelsScheduledForDeletion !== null) {
654
+				if (!$this->channelsScheduledForDeletion->isEmpty()) {
655
+					\Jalle19\StatusManager\Database\ChannelQuery::create()
656
+						->filterByPrimaryKeys($this->channelsScheduledForDeletion->getPrimaryKeys(false))
657
+						->delete($con);
658
+					$this->channelsScheduledForDeletion = null;
659
+				}
660
+			}
661
+
662
+			if ($this->collChannels !== null) {
663
+				foreach ($this->collChannels as $referrerFK) {
664
+					if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
665
+						$affectedRows += $referrerFK->save($con);
666
+					}
667
+				}
668
+			}
669
+
670
+			if ($this->subscriptionsScheduledForDeletion !== null) {
671
+				if (!$this->subscriptionsScheduledForDeletion->isEmpty()) {
672
+					\Jalle19\StatusManager\Database\SubscriptionQuery::create()
673
+						->filterByPrimaryKeys($this->subscriptionsScheduledForDeletion->getPrimaryKeys(false))
674
+						->delete($con);
675
+					$this->subscriptionsScheduledForDeletion = null;
676
+				}
677
+			}
678
+
679
+			if ($this->collSubscriptions !== null) {
680
+				foreach ($this->collSubscriptions as $referrerFK) {
681
+					if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
682
+						$affectedRows += $referrerFK->save($con);
683
+					}
684
+				}
685
+			}
686
+
687
+			$this->alreadyInSave = false;
688
+
689
+		}
690
+
691
+		return $affectedRows;
692
+	} // doSave()
693
+
694
+	/**
695
+	 * Insert the row in the database.
696
+	 *
697
+	 * @param      ConnectionInterface $con
698
+	 *
699
+	 * @throws PropelException
700
+	 * @see doSave()
701
+	 */
702
+	protected function doInsert(ConnectionInterface $con)
703
+	{
704
+		$modifiedColumns = array();
705
+		$index = 0;
706
+
707
+
708
+		 // check the columns in natural order for more readable SQL queries
709
+		if ($this->isColumnModified(InstanceTableMap::COL_NAME)) {
710
+			$modifiedColumns[':p' . $index++]  = 'name';
711
+		}
712
+
713
+		$sql = sprintf(
714
+			'INSERT INTO instance (%s) VALUES (%s)',
715
+			implode(', ', $modifiedColumns),
716
+			implode(', ', array_keys($modifiedColumns))
717
+		);
718
+
719
+		try {
720
+			$stmt = $con->prepare($sql);
721
+			foreach ($modifiedColumns as $identifier => $columnName) {
722
+				switch ($columnName) {
723
+					case 'name':
724
+						$stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
725
+						break;
726
+				}
727
+			}
728
+			$stmt->execute();
729
+		} catch (Exception $e) {
730
+			Propel::log($e->getMessage(), Propel::LOG_ERR);
731
+			throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
732
+		}
733
+
734
+		$this->setNew(false);
735
+	}
736
+
737
+	/**
738
+	 * Update the row in the database.
739
+	 *
740
+	 * @param      ConnectionInterface $con
741
+	 *
742
+	 * @return Integer Number of updated rows
743
+	 * @see doSave()
744
+	 */
745
+	protected function doUpdate(ConnectionInterface $con)
746
+	{
747
+		$selectCriteria = $this->buildPkeyCriteria();
748
+		$valuesCriteria = $this->buildCriteria();
749
+
750
+		return $selectCriteria->doUpdate($valuesCriteria, $con);
751
+	}
752
+
753
+	/**
754
+	 * Retrieves a field from the object by name passed in as a string.
755
+	 *
756
+	 * @param      string $name name
757
+	 * @param      string $type The type of fieldname the $name is of:
758
+	 *                     one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
759
+	 *                     TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
760
+	 *                     Defaults to TableMap::TYPE_PHPNAME.
761
+	 * @return mixed Value of field.
762
+	 */
763
+	public function getByName($name, $type = TableMap::TYPE_PHPNAME)
764
+	{
765
+		$pos = InstanceTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
766
+		$field = $this->getByPosition($pos);
767
+
768
+		return $field;
769
+	}
770
+
771
+	/**
772
+	 * Retrieves a field from the object by Position as specified in the xml schema.
773
+	 * Zero-based.
774
+	 *
775
+	 * @param      int $pos position in xml schema
776
+	 * @return mixed Value of field at $pos
777
+	 */
778
+	public function getByPosition($pos)
779
+	{
780
+		switch ($pos) {
781
+			case 0:
782
+				return $this->getName();
783
+				break;
784
+			default:
785
+				return null;
786
+				break;
787
+		} // switch()
788
+	}
789
+
790
+	/**
791
+	 * Exports the object as an array.
792
+	 *
793
+	 * You can specify the key type of the array by passing one of the class
794
+	 * type constants.
795
+	 *
796
+	 * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
797
+	 *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
798
+	 *                    Defaults to TableMap::TYPE_PHPNAME.
799
+	 * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
800
+	 * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
801
+	 * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
802
+	 *
803
+	 * @return array an associative array containing the field names (as keys) and field values
804
+	 */
805
+	public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
806
+	{
807
+
808
+		if (isset($alreadyDumpedObjects['Instance'][$this->hashCode()])) {
809
+			return '*RECURSION*';
810
+		}
811
+		$alreadyDumpedObjects['Instance'][$this->hashCode()] = true;
812
+		$keys = InstanceTableMap::getFieldNames($keyType);
813
+		$result = array(
814
+			$keys[0] => $this->getName(),
815
+		);
816
+		$virtualColumns = $this->virtualColumns;
817
+		foreach ($virtualColumns as $key => $virtualColumn) {
818
+			$result[$key] = $virtualColumn;
819
+		}
820
+
821
+		if ($includeForeignObjects) {
822
+			if (null !== $this->collUsers) {
823
+
824
+				switch ($keyType) {
825
+					case TableMap::TYPE_CAMELNAME:
826
+						$key = 'users';
827
+						break;
828
+					case TableMap::TYPE_FIELDNAME:
829
+						$key = 'users';
830
+						break;
831
+					default:
832
+						$key = 'Users';
833
+				}
834
+
835
+				$result[$key] = $this->collUsers->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
836
+			}
837
+			if (null !== $this->collConnections) {
838
+
839
+				switch ($keyType) {
840
+					case TableMap::TYPE_CAMELNAME:
841
+						$key = 'connections';
842
+						break;
843
+					case TableMap::TYPE_FIELDNAME:
844
+						$key = 'connections';
845
+						break;
846
+					default:
847
+						$key = 'Connections';
848
+				}
849
+
850
+				$result[$key] = $this->collConnections->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
851
+			}
852
+			if (null !== $this->collChannels) {
853
+
854
+				switch ($keyType) {
855
+					case TableMap::TYPE_CAMELNAME:
856
+						$key = 'channels';
857
+						break;
858
+					case TableMap::TYPE_FIELDNAME:
859
+						$key = 'channels';
860
+						break;
861
+					default:
862
+						$key = 'Channels';
863
+				}
864
+
865
+				$result[$key] = $this->collChannels->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
866
+			}
867
+			if (null !== $this->collSubscriptions) {
868
+
869
+				switch ($keyType) {
870
+					case TableMap::TYPE_CAMELNAME:
871
+						$key = 'subscriptions';
872
+						break;
873
+					case TableMap::TYPE_FIELDNAME:
874
+						$key = 'subscriptions';
875
+						break;
876
+					default:
877
+						$key = 'Subscriptions';
878
+				}
879
+
880
+				$result[$key] = $this->collSubscriptions->toArray(null, false, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
881
+			}
882
+		}
883
+
884
+		return $result;
885
+	}
886
+
887
+	/**
888
+	 * Sets a field from the object by name passed in as a string.
889
+	 *
890
+	 * @param  string $name
891
+	 * @param  mixed  $value field value
892
+	 * @param  string $type The type of fieldname the $name is of:
893
+	 *                one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
894
+	 *                TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
895
+	 *                Defaults to TableMap::TYPE_PHPNAME.
896
+	 * @return $this|\Jalle19\StatusManager\Database\Instance
897
+	 */
898
+	public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
899
+	{
900
+		$pos = InstanceTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
901
+
902
+		return $this->setByPosition($pos, $value);
903
+	}
904
+
905
+	/**
906
+	 * Sets a field from the object by Position as specified in the xml schema.
907
+	 * Zero-based.
908
+	 *
909
+	 * @param  int $pos position in xml schema
910
+	 * @param  mixed $value field value
911
+	 * @return $this|\Jalle19\StatusManager\Database\Instance
912
+	 */
913
+	public function setByPosition($pos, $value)
914
+	{
915
+		switch ($pos) {
916
+			case 0:
917
+				$this->setName($value);
918
+				break;
919
+		} // switch()
920
+
921
+		return $this;
922
+	}
923
+
924
+	/**
925
+	 * Populates the object using an array.
926
+	 *
927
+	 * This is particularly useful when populating an object from one of the
928
+	 * request arrays (e.g. $_POST).  This method goes through the column
929
+	 * names, checking to see whether a matching key exists in populated
930
+	 * array. If so the setByName() method is called for that column.
931
+	 *
932
+	 * You can specify the key type of the array by additionally passing one
933
+	 * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
934
+	 * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
935
+	 * The default key type is the column's TableMap::TYPE_PHPNAME.
936
+	 *
937
+	 * @param      array  $arr     An array to populate the object from.
938
+	 * @param      string $keyType The type of keys the array uses.
939
+	 * @return void
940
+	 */
941
+	public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
942
+	{
943
+		$keys = InstanceTableMap::getFieldNames($keyType);
944
+
945
+		if (array_key_exists($keys[0], $arr)) {
946
+			$this->setName($arr[$keys[0]]);
947
+		}
948
+	}
949
+
950
+	 /**
951
+	  * Populate the current object from a string, using a given parser format
952
+	  * <code>
953
+	  * $book = new Book();
954
+	  * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
955
+	  * </code>
956
+	  *
957
+	  * You can specify the key type of the array by additionally passing one
958
+	  * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
959
+	  * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
960
+	  * The default key type is the column's TableMap::TYPE_PHPNAME.
961
+	  *
962
+	  * @param mixed $parser A AbstractParser instance,
963
+	  *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
964
+	  * @param string $data The source data to import from
965
+	  * @param string $keyType The type of keys the array uses.
966
+	  *
967
+	  * @return $this|\Jalle19\StatusManager\Database\Instance The current object, for fluid interface
968
+	  */
969
+	public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME)
970
+	{
971
+		if (!$parser instanceof AbstractParser) {
972
+			$parser = AbstractParser::getParser($parser);
973
+		}
974
+
975
+		$this->fromArray($parser->toArray($data), $keyType);
976
+
977
+		return $this;
978
+	}
979
+
980
+	/**
981
+	 * Build a Criteria object containing the values of all modified columns in this object.
982
+	 *
983
+	 * @return Criteria The Criteria object containing all modified values.
984
+	 */
985
+	public function buildCriteria()
986
+	{
987
+		$criteria = new Criteria(InstanceTableMap::DATABASE_NAME);
988
+
989
+		if ($this->isColumnModified(InstanceTableMap::COL_NAME)) {
990
+			$criteria->add(InstanceTableMap::COL_NAME, $this->name);
991
+		}
992
+
993
+		return $criteria;
994
+	}
995
+
996
+	/**
997
+	 * Builds a Criteria object containing the primary key for this object.
998
+	 *
999
+	 * Unlike buildCriteria() this method includes the primary key values regardless
1000
+	 * of whether or not they have been modified.
1001
+	 *
1002
+	 * @throws LogicException if no primary key is defined
1003
+	 *
1004
+	 * @return Criteria The Criteria object containing value(s) for primary key(s).
1005
+	 */
1006
+	public function buildPkeyCriteria()
1007
+	{
1008
+		$criteria = ChildInstanceQuery::create();
1009
+		$criteria->add(InstanceTableMap::COL_NAME, $this->name);
1010
+
1011
+		return $criteria;
1012
+	}
1013
+
1014
+	/**
1015
+	 * If the primary key is not null, return the hashcode of the
1016
+	 * primary key. Otherwise, return the hash code of the object.
1017
+	 *
1018
+	 * @return int Hashcode
1019
+	 */
1020
+	public function hashCode()
1021
+	{
1022
+		$validPk = null !== $this->getName();
1023
+
1024
+		$validPrimaryKeyFKs = 0;
1025
+		$primaryKeyFKs = [];
1026
+
1027
+		if ($validPk) {
1028
+			return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
1029
+		} elseif ($validPrimaryKeyFKs) {
1030
+			return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
1031
+		}
1032
+
1033
+		return spl_object_hash($this);
1034
+	}
1035
+
1036
+	/**
1037
+	 * Returns the primary key for this object (row).
1038
+	 * @return string
1039
+	 */
1040
+	public function getPrimaryKey()
1041
+	{
1042
+		return $this->getName();
1043
+	}
1044
+
1045
+	/**
1046
+	 * Generic method to set the primary key (name column).
1047
+	 *
1048
+	 * @param       string $key Primary key.
1049
+	 * @return void
1050
+	 */
1051
+	public function setPrimaryKey($key)
1052
+	{
1053
+		$this->setName($key);
1054
+	}
1055
+
1056
+	/**
1057
+	 * Returns true if the primary key for this object is null.
1058
+	 * @return boolean
1059
+	 */
1060
+	public function isPrimaryKeyNull()
1061
+	{
1062
+		return null === $this->getName();
1063
+	}
1064
+
1065
+	/**
1066
+	 * Sets contents of passed object to values from current object.
1067
+	 *
1068
+	 * If desired, this method can also make copies of all associated (fkey referrers)
1069
+	 * objects.
1070
+	 *
1071
+	 * @param      object $copyObj An object of \Jalle19\StatusManager\Database\Instance (or compatible) type.
1072
+	 * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1073
+	 * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1074
+	 * @throws PropelException
1075
+	 */
1076
+	public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1077
+	{
1078
+		$copyObj->setName($this->getName());
1079
+
1080
+		if ($deepCopy) {
1081
+			// important: temporarily setNew(false) because this affects the behavior of
1082
+			// the getter/setter methods for fkey referrer objects.
1083
+			$copyObj->setNew(false);
1084
+
1085
+			foreach ($this->getUsers() as $relObj) {
1086
+				if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1087
+					$copyObj->addUser($relObj->copy($deepCopy));
1088
+				}
1089
+			}
1090
+
1091
+			foreach ($this->getConnections() as $relObj) {
1092
+				if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1093
+					$copyObj->addConnection($relObj->copy($deepCopy));
1094
+				}
1095
+			}
1096
+
1097
+			foreach ($this->getChannels() as $relObj) {
1098
+				if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1099
+					$copyObj->addChannel($relObj->copy($deepCopy));
1100
+				}
1101
+			}
1102
+
1103
+			foreach ($this->getSubscriptions() as $relObj) {
1104
+				if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
1105
+					$copyObj->addSubscription($relObj->copy($deepCopy));
1106
+				}
1107
+			}
1108
+
1109
+		} // if ($deepCopy)
1110
+
1111
+		if ($makeNew) {
1112
+			$copyObj->setNew(true);
1113
+		}
1114
+	}
1115
+
1116
+	/**
1117
+	 * Makes a copy of this object that will be inserted as a new row in table when saved.
1118
+	 * It creates a new object filling in the simple attributes, but skipping any primary
1119
+	 * keys that are defined for the table.
1120
+	 *
1121
+	 * If desired, this method can also make copies of all associated (fkey referrers)
1122
+	 * objects.
1123
+	 *
1124
+	 * @param  boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1125
+	 * @return \Jalle19\StatusManager\Database\Instance Clone of current object.
1126
+	 * @throws PropelException
1127
+	 */
1128
+	public function copy($deepCopy = false)
1129
+	{
1130
+		// we use get_class(), because this might be a subclass
1131
+		$clazz = get_class($this);
1132
+		$copyObj = new $clazz();
1133
+		$this->copyInto($copyObj, $deepCopy);
1134
+
1135
+		return $copyObj;
1136
+	}
1137
+
1138
+
1139
+	/**
1140
+	 * Initializes a collection based on the name of a relation.
1141
+	 * Avoids crafting an 'init[$relationName]s' method name
1142
+	 * that wouldn't work when StandardEnglishPluralizer is used.
1143
+	 *
1144
+	 * @param      string $relationName The name of the relation to initialize
1145
+	 * @return void
1146
+	 */
1147
+	public function initRelation($relationName)
1148
+	{
1149
+		if ('User' == $relationName) {
1150
+			return $this->initUsers();
1151
+		}
1152
+		if ('Connection' == $relationName) {
1153
+			return $this->initConnections();
1154
+		}
1155
+		if ('Channel' == $relationName) {
1156
+			return $this->initChannels();
1157
+		}
1158
+		if ('Subscription' == $relationName) {
1159
+			return $this->initSubscriptions();
1160
+		}
1161
+	}
1162
+
1163
+	/**
1164
+	 * Clears out the collUsers collection
1165
+	 *
1166
+	 * This does not modify the database; however, it will remove any associated objects, causing
1167
+	 * them to be refetched by subsequent calls to accessor method.
1168
+	 *
1169
+	 * @return void
1170
+	 * @see        addUsers()
1171
+	 */
1172
+	public function clearUsers()
1173
+	{
1174
+		$this->collUsers = null; // important to set this to NULL since that means it is uninitialized
1175
+	}
1176
+
1177
+	/**
1178
+	 * Reset is the collUsers collection loaded partially.
1179
+	 */
1180
+	public function resetPartialUsers($v = true)
1181
+	{
1182
+		$this->collUsersPartial = $v;
1183
+	}
1184
+
1185
+	/**
1186
+	 * Initializes the collUsers collection.
1187
+	 *
1188
+	 * By default this just sets the collUsers collection to an empty array (like clearcollUsers());
1189
+	 * however, you may wish to override this method in your stub class to provide setting appropriate
1190
+	 * to your application -- for example, setting the initial array to the values stored in database.
1191
+	 *
1192
+	 * @param      boolean $overrideExisting If set to true, the method call initializes
1193
+	 *                                        the collection even if it is not empty
1194
+	 *
1195
+	 * @return void
1196
+	 */
1197
+	public function initUsers($overrideExisting = true)
1198
+	{
1199
+		if (null !== $this->collUsers && !$overrideExisting) {
1200
+			return;
1201
+		}
1202
+
1203
+		$collectionClassName = UserTableMap::getTableMap()->getCollectionClassName();
1204
+
1205
+		$this->collUsers = new $collectionClassName;
1206
+		$this->collUsers->setModel('\Jalle19\StatusManager\Database\User');
1207
+	}
1208
+
1209
+	/**
1210
+	 * Gets an array of ChildUser objects which contain a foreign key that references this object.
1211
+	 *
1212
+	 * If the $criteria is not null, it is used to always fetch the results from the database.
1213
+	 * Otherwise the results are fetched from the database the first time, then cached.
1214
+	 * Next time the same method is called without $criteria, the cached collection is returned.
1215
+	 * If this ChildInstance is new, it will return
1216
+	 * an empty collection or the current collection; the criteria is ignored on a new object.
1217
+	 *
1218
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
1219
+	 * @param      ConnectionInterface $con optional connection object
1220
+	 * @return ObjectCollection|ChildUser[] List of ChildUser objects
1221
+	 * @throws PropelException
1222
+	 */
1223
+	public function getUsers(Criteria $criteria = null, ConnectionInterface $con = null)
1224
+	{
1225
+		$partial = $this->collUsersPartial && !$this->isNew();
1226
+		if (null === $this->collUsers || null !== $criteria  || $partial) {
1227
+			if ($this->isNew() && null === $this->collUsers) {
1228
+				// return empty collection
1229
+				$this->initUsers();
1230
+			} else {
1231
+				$collUsers = ChildUserQuery::create(null, $criteria)
1232
+					->filterByInstance($this)
1233
+					->find($con);
1234
+
1235
+				if (null !== $criteria) {
1236
+					if (false !== $this->collUsersPartial && count($collUsers)) {
1237
+						$this->initUsers(false);
1238
+
1239
+						foreach ($collUsers as $obj) {
1240
+							if (false == $this->collUsers->contains($obj)) {
1241
+								$this->collUsers->append($obj);
1242
+							}
1243
+						}
1244
+
1245
+						$this->collUsersPartial = true;
1246
+					}
1247
+
1248
+					return $collUsers;
1249
+				}
1250
+
1251
+				if ($partial && $this->collUsers) {
1252
+					foreach ($this->collUsers as $obj) {
1253
+						if ($obj->isNew()) {
1254
+							$collUsers[] = $obj;
1255
+						}
1256
+					}
1257
+				}
1258
+
1259
+				$this->collUsers = $collUsers;
1260
+				$this->collUsersPartial = false;
1261
+			}
1262
+		}
1263
+
1264
+		return $this->collUsers;
1265
+	}
1266
+
1267
+	/**
1268
+	 * Sets a collection of ChildUser objects related by a one-to-many relationship
1269
+	 * to the current object.
1270
+	 * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1271
+	 * and new objects from the given Propel collection.
1272
+	 *
1273
+	 * @param      Collection $users A Propel collection.
1274
+	 * @param      ConnectionInterface $con Optional connection object
1275
+	 * @return $this|ChildInstance The current object (for fluent API support)
1276
+	 */
1277
+	public function setUsers(Collection $users, ConnectionInterface $con = null)
1278
+	{
1279
+		/** @var ChildUser[] $usersToDelete */
1280
+		$usersToDelete = $this->getUsers(new Criteria(), $con)->diff($users);
1281
+
1282
+
1283
+		$this->usersScheduledForDeletion = $usersToDelete;
1284
+
1285
+		foreach ($usersToDelete as $userRemoved) {
1286
+			$userRemoved->setInstance(null);
1287
+		}
1288
+
1289
+		$this->collUsers = null;
1290
+		foreach ($users as $user) {
1291
+			$this->addUser($user);
1292
+		}
1293
+
1294
+		$this->collUsers = $users;
1295
+		$this->collUsersPartial = false;
1296
+
1297
+		return $this;
1298
+	}
1299
+
1300
+	/**
1301
+	 * Returns the number of related User objects.
1302
+	 *
1303
+	 * @param      Criteria $criteria
1304
+	 * @param      boolean $distinct
1305
+	 * @param      ConnectionInterface $con
1306
+	 * @return int             Count of related User objects.
1307
+	 * @throws PropelException
1308
+	 */
1309
+	public function countUsers(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
1310
+	{
1311
+		$partial = $this->collUsersPartial && !$this->isNew();
1312
+		if (null === $this->collUsers || null !== $criteria || $partial) {
1313
+			if ($this->isNew() && null === $this->collUsers) {
1314
+				return 0;
1315
+			}
1316
+
1317
+			if ($partial && !$criteria) {
1318
+				return count($this->getUsers());
1319
+			}
1320
+
1321
+			$query = ChildUserQuery::create(null, $criteria);
1322
+			if ($distinct) {
1323
+				$query->distinct();
1324
+			}
1325
+
1326
+			return $query
1327
+				->filterByInstance($this)
1328
+				->count($con);
1329
+		}
1330
+
1331
+		return count($this->collUsers);
1332
+	}
1333
+
1334
+	/**
1335
+	 * Method called to associate a ChildUser object to this object
1336
+	 * through the ChildUser foreign key attribute.
1337
+	 *
1338
+	 * @param  ChildUser $l ChildUser
1339
+	 * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)
1340
+	 */
1341
+	public function addUser(ChildUser $l)
1342
+	{
1343
+		if ($this->collUsers === null) {
1344
+			$this->initUsers();
1345
+			$this->collUsersPartial = true;
1346
+		}
1347
+
1348
+		if (!$this->collUsers->contains($l)) {
1349
+			$this->doAddUser($l);
1350
+
1351
+			if ($this->usersScheduledForDeletion and $this->usersScheduledForDeletion->contains($l)) {
1352
+				$this->usersScheduledForDeletion->remove($this->usersScheduledForDeletion->search($l));
1353
+			}
1354
+		}
1355
+
1356
+		return $this;
1357
+	}
1358
+
1359
+	/**
1360
+	 * @param ChildUser $user The ChildUser object to add.
1361
+	 */
1362
+	protected function doAddUser(ChildUser $user)
1363
+	{
1364
+		$this->collUsers[]= $user;
1365
+		$user->setInstance($this);
1366
+	}
1367
+
1368
+	/**
1369
+	 * @param  ChildUser $user The ChildUser object to remove.
1370
+	 * @return $this|ChildInstance The current object (for fluent API support)
1371
+	 */
1372
+	public function removeUser(ChildUser $user)
1373
+	{
1374
+		if ($this->getUsers()->contains($user)) {
1375
+			$pos = $this->collUsers->search($user);
1376
+			$this->collUsers->remove($pos);
1377
+			if (null === $this->usersScheduledForDeletion) {
1378
+				$this->usersScheduledForDeletion = clone $this->collUsers;
1379
+				$this->usersScheduledForDeletion->clear();
1380
+			}
1381
+			$this->usersScheduledForDeletion[]= clone $user;
1382
+			$user->setInstance(null);
1383
+		}
1384
+
1385
+		return $this;
1386
+	}
1387
+
1388
+	/**
1389
+	 * Clears out the collConnections collection
1390
+	 *
1391
+	 * This does not modify the database; however, it will remove any associated objects, causing
1392
+	 * them to be refetched by subsequent calls to accessor method.
1393
+	 *
1394
+	 * @return void
1395
+	 * @see        addConnections()
1396
+	 */
1397
+	public function clearConnections()
1398
+	{
1399
+		$this->collConnections = null; // important to set this to NULL since that means it is uninitialized
1400
+	}
1401
+
1402
+	/**
1403
+	 * Reset is the collConnections collection loaded partially.
1404
+	 */
1405
+	public function resetPartialConnections($v = true)
1406
+	{
1407
+		$this->collConnectionsPartial = $v;
1408
+	}
1409
+
1410
+	/**
1411
+	 * Initializes the collConnections collection.
1412
+	 *
1413
+	 * By default this just sets the collConnections collection to an empty array (like clearcollConnections());
1414
+	 * however, you may wish to override this method in your stub class to provide setting appropriate
1415
+	 * to your application -- for example, setting the initial array to the values stored in database.
1416
+	 *
1417
+	 * @param      boolean $overrideExisting If set to true, the method call initializes
1418
+	 *                                        the collection even if it is not empty
1419
+	 *
1420
+	 * @return void
1421
+	 */
1422
+	public function initConnections($overrideExisting = true)
1423
+	{
1424
+		if (null !== $this->collConnections && !$overrideExisting) {
1425
+			return;
1426
+		}
1427
+
1428
+		$collectionClassName = ConnectionTableMap::getTableMap()->getCollectionClassName();
1429
+
1430
+		$this->collConnections = new $collectionClassName;
1431
+		$this->collConnections->setModel('\Jalle19\StatusManager\Database\Connection');
1432
+	}
1433
+
1434
+	/**
1435
+	 * Gets an array of ChildConnection objects which contain a foreign key that references this object.
1436
+	 *
1437
+	 * If the $criteria is not null, it is used to always fetch the results from the database.
1438
+	 * Otherwise the results are fetched from the database the first time, then cached.
1439
+	 * Next time the same method is called without $criteria, the cached collection is returned.
1440
+	 * If this ChildInstance is new, it will return
1441
+	 * an empty collection or the current collection; the criteria is ignored on a new object.
1442
+	 *
1443
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
1444
+	 * @param      ConnectionInterface $con optional connection object
1445
+	 * @return ObjectCollection|ChildConnection[] List of ChildConnection objects
1446
+	 * @throws PropelException
1447
+	 */
1448
+	public function getConnections(Criteria $criteria = null, ConnectionInterface $con = null)
1449
+	{
1450
+		$partial = $this->collConnectionsPartial && !$this->isNew();
1451
+		if (null === $this->collConnections || null !== $criteria  || $partial) {
1452
+			if ($this->isNew() && null === $this->collConnections) {
1453
+				// return empty collection
1454
+				$this->initConnections();
1455
+			} else {
1456
+				$collConnections = ChildConnectionQuery::create(null, $criteria)
1457
+					->filterByInstance($this)
1458
+					->find($con);
1459
+
1460
+				if (null !== $criteria) {
1461
+					if (false !== $this->collConnectionsPartial && count($collConnections)) {
1462
+						$this->initConnections(false);
1463
+
1464
+						foreach ($collConnections as $obj) {
1465
+							if (false == $this->collConnections->contains($obj)) {
1466
+								$this->collConnections->append($obj);
1467
+							}
1468
+						}
1469
+
1470
+						$this->collConnectionsPartial = true;
1471
+					}
1472
+
1473
+					return $collConnections;
1474
+				}
1475
+
1476
+				if ($partial && $this->collConnections) {
1477
+					foreach ($this->collConnections as $obj) {
1478
+						if ($obj->isNew()) {
1479
+							$collConnections[] = $obj;
1480
+						}
1481
+					}
1482
+				}
1483
+
1484
+				$this->collConnections = $collConnections;
1485
+				$this->collConnectionsPartial = false;
1486
+			}
1487
+		}
1488
+
1489
+		return $this->collConnections;
1490
+	}
1491
+
1492
+	/**
1493
+	 * Sets a collection of ChildConnection objects related by a one-to-many relationship
1494
+	 * to the current object.
1495
+	 * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1496
+	 * and new objects from the given Propel collection.
1497
+	 *
1498
+	 * @param      Collection $connections A Propel collection.
1499
+	 * @param      ConnectionInterface $con Optional connection object
1500
+	 * @return $this|ChildInstance The current object (for fluent API support)
1501
+	 */
1502
+	public function setConnections(Collection $connections, ConnectionInterface $con = null)
1503
+	{
1504
+		/** @var ChildConnection[] $connectionsToDelete */
1505
+		$connectionsToDelete = $this->getConnections(new Criteria(), $con)->diff($connections);
1506
+
1507
+
1508
+		$this->connectionsScheduledForDeletion = $connectionsToDelete;
1509
+
1510
+		foreach ($connectionsToDelete as $connectionRemoved) {
1511
+			$connectionRemoved->setInstance(null);
1512
+		}
1513
+
1514
+		$this->collConnections = null;
1515
+		foreach ($connections as $connection) {
1516
+			$this->addConnection($connection);
1517
+		}
1518
+
1519
+		$this->collConnections = $connections;
1520
+		$this->collConnectionsPartial = false;
1521
+
1522
+		return $this;
1523
+	}
1524
+
1525
+	/**
1526
+	 * Returns the number of related Connection objects.
1527
+	 *
1528
+	 * @param      Criteria $criteria
1529
+	 * @param      boolean $distinct
1530
+	 * @param      ConnectionInterface $con
1531
+	 * @return int             Count of related Connection objects.
1532
+	 * @throws PropelException
1533
+	 */
1534
+	public function countConnections(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
1535
+	{
1536
+		$partial = $this->collConnectionsPartial && !$this->isNew();
1537
+		if (null === $this->collConnections || null !== $criteria || $partial) {
1538
+			if ($this->isNew() && null === $this->collConnections) {
1539
+				return 0;
1540
+			}
1541
+
1542
+			if ($partial && !$criteria) {
1543
+				return count($this->getConnections());
1544
+			}
1545
+
1546
+			$query = ChildConnectionQuery::create(null, $criteria);
1547
+			if ($distinct) {
1548
+				$query->distinct();
1549
+			}
1550
+
1551
+			return $query
1552
+				->filterByInstance($this)
1553
+				->count($con);
1554
+		}
1555
+
1556
+		return count($this->collConnections);
1557
+	}
1558
+
1559
+	/**
1560
+	 * Method called to associate a ChildConnection object to this object
1561
+	 * through the ChildConnection foreign key attribute.
1562
+	 *
1563
+	 * @param  ChildConnection $l ChildConnection
1564
+	 * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)
1565
+	 */
1566
+	public function addConnection(ChildConnection $l)
1567
+	{
1568
+		if ($this->collConnections === null) {
1569
+			$this->initConnections();
1570
+			$this->collConnectionsPartial = true;
1571
+		}
1572
+
1573
+		if (!$this->collConnections->contains($l)) {
1574
+			$this->doAddConnection($l);
1575
+
1576
+			if ($this->connectionsScheduledForDeletion and $this->connectionsScheduledForDeletion->contains($l)) {
1577
+				$this->connectionsScheduledForDeletion->remove($this->connectionsScheduledForDeletion->search($l));
1578
+			}
1579
+		}
1580
+
1581
+		return $this;
1582
+	}
1583
+
1584
+	/**
1585
+	 * @param ChildConnection $connection The ChildConnection object to add.
1586
+	 */
1587
+	protected function doAddConnection(ChildConnection $connection)
1588
+	{
1589
+		$this->collConnections[]= $connection;
1590
+		$connection->setInstance($this);
1591
+	}
1592
+
1593
+	/**
1594
+	 * @param  ChildConnection $connection The ChildConnection object to remove.
1595
+	 * @return $this|ChildInstance The current object (for fluent API support)
1596
+	 */
1597
+	public function removeConnection(ChildConnection $connection)
1598
+	{
1599
+		if ($this->getConnections()->contains($connection)) {
1600
+			$pos = $this->collConnections->search($connection);
1601
+			$this->collConnections->remove($pos);
1602
+			if (null === $this->connectionsScheduledForDeletion) {
1603
+				$this->connectionsScheduledForDeletion = clone $this->collConnections;
1604
+				$this->connectionsScheduledForDeletion->clear();
1605
+			}
1606
+			$this->connectionsScheduledForDeletion[]= clone $connection;
1607
+			$connection->setInstance(null);
1608
+		}
1609
+
1610
+		return $this;
1611
+	}
1612
+
1613
+
1614
+	/**
1615
+	 * If this collection has already been initialized with
1616
+	 * an identical criteria, it returns the collection.
1617
+	 * Otherwise if this Instance is new, it will return
1618
+	 * an empty collection; or if this Instance has previously
1619
+	 * been saved, it will retrieve related Connections from storage.
1620
+	 *
1621
+	 * This method is protected by default in order to keep the public
1622
+	 * api reasonable.  You can provide public methods for those you
1623
+	 * actually need in Instance.
1624
+	 *
1625
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
1626
+	 * @param      ConnectionInterface $con optional connection object
1627
+	 * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
1628
+	 * @return ObjectCollection|ChildConnection[] List of ChildConnection objects
1629
+	 */
1630
+	public function getConnectionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1631
+	{
1632
+		$query = ChildConnectionQuery::create(null, $criteria);
1633
+		$query->joinWith('User', $joinBehavior);
1634
+
1635
+		return $this->getConnections($query, $con);
1636
+	}
1637
+
1638
+	/**
1639
+	 * Clears out the collChannels collection
1640
+	 *
1641
+	 * This does not modify the database; however, it will remove any associated objects, causing
1642
+	 * them to be refetched by subsequent calls to accessor method.
1643
+	 *
1644
+	 * @return void
1645
+	 * @see        addChannels()
1646
+	 */
1647
+	public function clearChannels()
1648
+	{
1649
+		$this->collChannels = null; // important to set this to NULL since that means it is uninitialized
1650
+	}
1651
+
1652
+	/**
1653
+	 * Reset is the collChannels collection loaded partially.
1654
+	 */
1655
+	public function resetPartialChannels($v = true)
1656
+	{
1657
+		$this->collChannelsPartial = $v;
1658
+	}
1659
+
1660
+	/**
1661
+	 * Initializes the collChannels collection.
1662
+	 *
1663
+	 * By default this just sets the collChannels collection to an empty array (like clearcollChannels());
1664
+	 * however, you may wish to override this method in your stub class to provide setting appropriate
1665
+	 * to your application -- for example, setting the initial array to the values stored in database.
1666
+	 *
1667
+	 * @param      boolean $overrideExisting If set to true, the method call initializes
1668
+	 *                                        the collection even if it is not empty
1669
+	 *
1670
+	 * @return void
1671
+	 */
1672
+	public function initChannels($overrideExisting = true)
1673
+	{
1674
+		if (null !== $this->collChannels && !$overrideExisting) {
1675
+			return;
1676
+		}
1677
+
1678
+		$collectionClassName = ChannelTableMap::getTableMap()->getCollectionClassName();
1679
+
1680
+		$this->collChannels = new $collectionClassName;
1681
+		$this->collChannels->setModel('\Jalle19\StatusManager\Database\Channel');
1682
+	}
1683
+
1684
+	/**
1685
+	 * Gets an array of ChildChannel objects which contain a foreign key that references this object.
1686
+	 *
1687
+	 * If the $criteria is not null, it is used to always fetch the results from the database.
1688
+	 * Otherwise the results are fetched from the database the first time, then cached.
1689
+	 * Next time the same method is called without $criteria, the cached collection is returned.
1690
+	 * If this ChildInstance is new, it will return
1691
+	 * an empty collection or the current collection; the criteria is ignored on a new object.
1692
+	 *
1693
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
1694
+	 * @param      ConnectionInterface $con optional connection object
1695
+	 * @return ObjectCollection|ChildChannel[] List of ChildChannel objects
1696
+	 * @throws PropelException
1697
+	 */
1698
+	public function getChannels(Criteria $criteria = null, ConnectionInterface $con = null)
1699
+	{
1700
+		$partial = $this->collChannelsPartial && !$this->isNew();
1701
+		if (null === $this->collChannels || null !== $criteria  || $partial) {
1702
+			if ($this->isNew() && null === $this->collChannels) {
1703
+				// return empty collection
1704
+				$this->initChannels();
1705
+			} else {
1706
+				$collChannels = ChildChannelQuery::create(null, $criteria)
1707
+					->filterByInstance($this)
1708
+					->find($con);
1709
+
1710
+				if (null !== $criteria) {
1711
+					if (false !== $this->collChannelsPartial && count($collChannels)) {
1712
+						$this->initChannels(false);
1713
+
1714
+						foreach ($collChannels as $obj) {
1715
+							if (false == $this->collChannels->contains($obj)) {
1716
+								$this->collChannels->append($obj);
1717
+							}
1718
+						}
1719
+
1720
+						$this->collChannelsPartial = true;
1721
+					}
1722
+
1723
+					return $collChannels;
1724
+				}
1725
+
1726
+				if ($partial && $this->collChannels) {
1727
+					foreach ($this->collChannels as $obj) {
1728
+						if ($obj->isNew()) {
1729
+							$collChannels[] = $obj;
1730
+						}
1731
+					}
1732
+				}
1733
+
1734
+				$this->collChannels = $collChannels;
1735
+				$this->collChannelsPartial = false;
1736
+			}
1737
+		}
1738
+
1739
+		return $this->collChannels;
1740
+	}
1741
+
1742
+	/**
1743
+	 * Sets a collection of ChildChannel objects related by a one-to-many relationship
1744
+	 * to the current object.
1745
+	 * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1746
+	 * and new objects from the given Propel collection.
1747
+	 *
1748
+	 * @param      Collection $channels A Propel collection.
1749
+	 * @param      ConnectionInterface $con Optional connection object
1750
+	 * @return $this|ChildInstance The current object (for fluent API support)
1751
+	 */
1752
+	public function setChannels(Collection $channels, ConnectionInterface $con = null)
1753
+	{
1754
+		/** @var ChildChannel[] $channelsToDelete */
1755
+		$channelsToDelete = $this->getChannels(new Criteria(), $con)->diff($channels);
1756
+
1757
+
1758
+		$this->channelsScheduledForDeletion = $channelsToDelete;
1759
+
1760
+		foreach ($channelsToDelete as $channelRemoved) {
1761
+			$channelRemoved->setInstance(null);
1762
+		}
1763
+
1764
+		$this->collChannels = null;
1765
+		foreach ($channels as $channel) {
1766
+			$this->addChannel($channel);
1767
+		}
1768
+
1769
+		$this->collChannels = $channels;
1770
+		$this->collChannelsPartial = false;
1771
+
1772
+		return $this;
1773
+	}
1774
+
1775
+	/**
1776
+	 * Returns the number of related Channel objects.
1777
+	 *
1778
+	 * @param      Criteria $criteria
1779
+	 * @param      boolean $distinct
1780
+	 * @param      ConnectionInterface $con
1781
+	 * @return int             Count of related Channel objects.
1782
+	 * @throws PropelException
1783
+	 */
1784
+	public function countChannels(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
1785
+	{
1786
+		$partial = $this->collChannelsPartial && !$this->isNew();
1787
+		if (null === $this->collChannels || null !== $criteria || $partial) {
1788
+			if ($this->isNew() && null === $this->collChannels) {
1789
+				return 0;
1790
+			}
1791
+
1792
+			if ($partial && !$criteria) {
1793
+				return count($this->getChannels());
1794
+			}
1795
+
1796
+			$query = ChildChannelQuery::create(null, $criteria);
1797
+			if ($distinct) {
1798
+				$query->distinct();
1799
+			}
1800
+
1801
+			return $query
1802
+				->filterByInstance($this)
1803
+				->count($con);
1804
+		}
1805
+
1806
+		return count($this->collChannels);
1807
+	}
1808
+
1809
+	/**
1810
+	 * Method called to associate a ChildChannel object to this object
1811
+	 * through the ChildChannel foreign key attribute.
1812
+	 *
1813
+	 * @param  ChildChannel $l ChildChannel
1814
+	 * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)
1815
+	 */
1816
+	public function addChannel(ChildChannel $l)
1817
+	{
1818
+		if ($this->collChannels === null) {
1819
+			$this->initChannels();
1820
+			$this->collChannelsPartial = true;
1821
+		}
1822
+
1823
+		if (!$this->collChannels->contains($l)) {
1824
+			$this->doAddChannel($l);
1825
+
1826
+			if ($this->channelsScheduledForDeletion and $this->channelsScheduledForDeletion->contains($l)) {
1827
+				$this->channelsScheduledForDeletion->remove($this->channelsScheduledForDeletion->search($l));
1828
+			}
1829
+		}
1830
+
1831
+		return $this;
1832
+	}
1833
+
1834
+	/**
1835
+	 * @param ChildChannel $channel The ChildChannel object to add.
1836
+	 */
1837
+	protected function doAddChannel(ChildChannel $channel)
1838
+	{
1839
+		$this->collChannels[]= $channel;
1840
+		$channel->setInstance($this);
1841
+	}
1842
+
1843
+	/**
1844
+	 * @param  ChildChannel $channel The ChildChannel object to remove.
1845
+	 * @return $this|ChildInstance The current object (for fluent API support)
1846
+	 */
1847
+	public function removeChannel(ChildChannel $channel)
1848
+	{
1849
+		if ($this->getChannels()->contains($channel)) {
1850
+			$pos = $this->collChannels->search($channel);
1851
+			$this->collChannels->remove($pos);
1852
+			if (null === $this->channelsScheduledForDeletion) {
1853
+				$this->channelsScheduledForDeletion = clone $this->collChannels;
1854
+				$this->channelsScheduledForDeletion->clear();
1855
+			}
1856
+			$this->channelsScheduledForDeletion[]= clone $channel;
1857
+			$channel->setInstance(null);
1858
+		}
1859
+
1860
+		return $this;
1861
+	}
1862
+
1863
+	/**
1864
+	 * Clears out the collSubscriptions collection
1865
+	 *
1866
+	 * This does not modify the database; however, it will remove any associated objects, causing
1867
+	 * them to be refetched by subsequent calls to accessor method.
1868
+	 *
1869
+	 * @return void
1870
+	 * @see        addSubscriptions()
1871
+	 */
1872
+	public function clearSubscriptions()
1873
+	{
1874
+		$this->collSubscriptions = null; // important to set this to NULL since that means it is uninitialized
1875
+	}
1876
+
1877
+	/**
1878
+	 * Reset is the collSubscriptions collection loaded partially.
1879
+	 */
1880
+	public function resetPartialSubscriptions($v = true)
1881
+	{
1882
+		$this->collSubscriptionsPartial = $v;
1883
+	}
1884
+
1885
+	/**
1886
+	 * Initializes the collSubscriptions collection.
1887
+	 *
1888
+	 * By default this just sets the collSubscriptions collection to an empty array (like clearcollSubscriptions());
1889
+	 * however, you may wish to override this method in your stub class to provide setting appropriate
1890
+	 * to your application -- for example, setting the initial array to the values stored in database.
1891
+	 *
1892
+	 * @param      boolean $overrideExisting If set to true, the method call initializes
1893
+	 *                                        the collection even if it is not empty
1894
+	 *
1895
+	 * @return void
1896
+	 */
1897
+	public function initSubscriptions($overrideExisting = true)
1898
+	{
1899
+		if (null !== $this->collSubscriptions && !$overrideExisting) {
1900
+			return;
1901
+		}
1902
+
1903
+		$collectionClassName = SubscriptionTableMap::getTableMap()->getCollectionClassName();
1904
+
1905
+		$this->collSubscriptions = new $collectionClassName;
1906
+		$this->collSubscriptions->setModel('\Jalle19\StatusManager\Database\Subscription');
1907
+	}
1908
+
1909
+	/**
1910
+	 * Gets an array of ChildSubscription objects which contain a foreign key that references this object.
1911
+	 *
1912
+	 * If the $criteria is not null, it is used to always fetch the results from the database.
1913
+	 * Otherwise the results are fetched from the database the first time, then cached.
1914
+	 * Next time the same method is called without $criteria, the cached collection is returned.
1915
+	 * If this ChildInstance is new, it will return
1916
+	 * an empty collection or the current collection; the criteria is ignored on a new object.
1917
+	 *
1918
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
1919
+	 * @param      ConnectionInterface $con optional connection object
1920
+	 * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
1921
+	 * @throws PropelException
1922
+	 */
1923
+	public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null)
1924
+	{
1925
+		$partial = $this->collSubscriptionsPartial && !$this->isNew();
1926
+		if (null === $this->collSubscriptions || null !== $criteria  || $partial) {
1927
+			if ($this->isNew() && null === $this->collSubscriptions) {
1928
+				// return empty collection
1929
+				$this->initSubscriptions();
1930
+			} else {
1931
+				$collSubscriptions = ChildSubscriptionQuery::create(null, $criteria)
1932
+					->filterByInstance($this)
1933
+					->find($con);
1934
+
1935
+				if (null !== $criteria) {
1936
+					if (false !== $this->collSubscriptionsPartial && count($collSubscriptions)) {
1937
+						$this->initSubscriptions(false);
1938
+
1939
+						foreach ($collSubscriptions as $obj) {
1940
+							if (false == $this->collSubscriptions->contains($obj)) {
1941
+								$this->collSubscriptions->append($obj);
1942
+							}
1943
+						}
1944
+
1945
+						$this->collSubscriptionsPartial = true;
1946
+					}
1947
+
1948
+					return $collSubscriptions;
1949
+				}
1950
+
1951
+				if ($partial && $this->collSubscriptions) {
1952
+					foreach ($this->collSubscriptions as $obj) {
1953
+						if ($obj->isNew()) {
1954
+							$collSubscriptions[] = $obj;
1955
+						}
1956
+					}
1957
+				}
1958
+
1959
+				$this->collSubscriptions = $collSubscriptions;
1960
+				$this->collSubscriptionsPartial = false;
1961
+			}
1962
+		}
1963
+
1964
+		return $this->collSubscriptions;
1965
+	}
1966
+
1967
+	/**
1968
+	 * Sets a collection of ChildSubscription objects related by a one-to-many relationship
1969
+	 * to the current object.
1970
+	 * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
1971
+	 * and new objects from the given Propel collection.
1972
+	 *
1973
+	 * @param      Collection $subscriptions A Propel collection.
1974
+	 * @param      ConnectionInterface $con Optional connection object
1975
+	 * @return $this|ChildInstance The current object (for fluent API support)
1976
+	 */
1977
+	public function setSubscriptions(Collection $subscriptions, ConnectionInterface $con = null)
1978
+	{
1979
+		/** @var ChildSubscription[] $subscriptionsToDelete */
1980
+		$subscriptionsToDelete = $this->getSubscriptions(new Criteria(), $con)->diff($subscriptions);
1981
+
1982
+
1983
+		$this->subscriptionsScheduledForDeletion = $subscriptionsToDelete;
1984
+
1985
+		foreach ($subscriptionsToDelete as $subscriptionRemoved) {
1986
+			$subscriptionRemoved->setInstance(null);
1987
+		}
1988
+
1989
+		$this->collSubscriptions = null;
1990
+		foreach ($subscriptions as $subscription) {
1991
+			$this->addSubscription($subscription);
1992
+		}
1993
+
1994
+		$this->collSubscriptions = $subscriptions;
1995
+		$this->collSubscriptionsPartial = false;
1996
+
1997
+		return $this;
1998
+	}
1999
+
2000
+	/**
2001
+	 * Returns the number of related Subscription objects.
2002
+	 *
2003
+	 * @param      Criteria $criteria
2004
+	 * @param      boolean $distinct
2005
+	 * @param      ConnectionInterface $con
2006
+	 * @return int             Count of related Subscription objects.
2007
+	 * @throws PropelException
2008
+	 */
2009
+	public function countSubscriptions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
2010
+	{
2011
+		$partial = $this->collSubscriptionsPartial && !$this->isNew();
2012
+		if (null === $this->collSubscriptions || null !== $criteria || $partial) {
2013
+			if ($this->isNew() && null === $this->collSubscriptions) {
2014
+				return 0;
2015
+			}
2016
+
2017
+			if ($partial && !$criteria) {
2018
+				return count($this->getSubscriptions());
2019
+			}
2020
+
2021
+			$query = ChildSubscriptionQuery::create(null, $criteria);
2022
+			if ($distinct) {
2023
+				$query->distinct();
2024
+			}
2025
+
2026
+			return $query
2027
+				->filterByInstance($this)
2028
+				->count($con);
2029
+		}
2030
+
2031
+		return count($this->collSubscriptions);
2032
+	}
2033
+
2034
+	/**
2035
+	 * Method called to associate a ChildSubscription object to this object
2036
+	 * through the ChildSubscription foreign key attribute.
2037
+	 *
2038
+	 * @param  ChildSubscription $l ChildSubscription
2039
+	 * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)
2040
+	 */
2041
+	public function addSubscription(ChildSubscription $l)
2042
+	{
2043
+		if ($this->collSubscriptions === null) {
2044
+			$this->initSubscriptions();
2045
+			$this->collSubscriptionsPartial = true;
2046
+		}
2047
+
2048
+		if (!$this->collSubscriptions->contains($l)) {
2049
+			$this->doAddSubscription($l);
2050
+
2051
+			if ($this->subscriptionsScheduledForDeletion and $this->subscriptionsScheduledForDeletion->contains($l)) {
2052
+				$this->subscriptionsScheduledForDeletion->remove($this->subscriptionsScheduledForDeletion->search($l));
2053
+			}
2054
+		}
2055
+
2056
+		return $this;
2057
+	}
2058
+
2059
+	/**
2060
+	 * @param ChildSubscription $subscription The ChildSubscription object to add.
2061
+	 */
2062
+	protected function doAddSubscription(ChildSubscription $subscription)
2063
+	{
2064
+		$this->collSubscriptions[]= $subscription;
2065
+		$subscription->setInstance($this);
2066
+	}
2067
+
2068
+	/**
2069
+	 * @param  ChildSubscription $subscription The ChildSubscription object to remove.
2070
+	 * @return $this|ChildInstance The current object (for fluent API support)
2071
+	 */
2072
+	public function removeSubscription(ChildSubscription $subscription)
2073
+	{
2074
+		if ($this->getSubscriptions()->contains($subscription)) {
2075
+			$pos = $this->collSubscriptions->search($subscription);
2076
+			$this->collSubscriptions->remove($pos);
2077
+			if (null === $this->subscriptionsScheduledForDeletion) {
2078
+				$this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions;
2079
+				$this->subscriptionsScheduledForDeletion->clear();
2080
+			}
2081
+			$this->subscriptionsScheduledForDeletion[]= clone $subscription;
2082
+			$subscription->setInstance(null);
2083
+		}
2084
+
2085
+		return $this;
2086
+	}
2087
+
2088
+
2089
+	/**
2090
+	 * If this collection has already been initialized with
2091
+	 * an identical criteria, it returns the collection.
2092
+	 * Otherwise if this Instance is new, it will return
2093
+	 * an empty collection; or if this Instance has previously
2094
+	 * been saved, it will retrieve related Subscriptions from storage.
2095
+	 *
2096
+	 * This method is protected by default in order to keep the public
2097
+	 * api reasonable.  You can provide public methods for those you
2098
+	 * actually need in Instance.
2099
+	 *
2100
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
2101
+	 * @param      ConnectionInterface $con optional connection object
2102
+	 * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2103
+	 * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
2104
+	 */
2105
+	public function getSubscriptionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
2106
+	{
2107
+		$query = ChildSubscriptionQuery::create(null, $criteria);
2108
+		$query->joinWith('User', $joinBehavior);
2109
+
2110
+		return $this->getSubscriptions($query, $con);
2111
+	}
2112
+
2113
+
2114
+	/**
2115
+	 * If this collection has already been initialized with
2116
+	 * an identical criteria, it returns the collection.
2117
+	 * Otherwise if this Instance is new, it will return
2118
+	 * an empty collection; or if this Instance has previously
2119
+	 * been saved, it will retrieve related Subscriptions from storage.
2120
+	 *
2121
+	 * This method is protected by default in order to keep the public
2122
+	 * api reasonable.  You can provide public methods for those you
2123
+	 * actually need in Instance.
2124
+	 *
2125
+	 * @param      Criteria $criteria optional Criteria object to narrow the query
2126
+	 * @param      ConnectionInterface $con optional connection object
2127
+	 * @param      string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)
2128
+	 * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects
2129
+	 */
2130
+	public function getSubscriptionsJoinChannel(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
2131
+	{
2132
+		$query = ChildSubscriptionQuery::create(null, $criteria);
2133
+		$query->joinWith('Channel', $joinBehavior);
2134
+
2135
+		return $this->getSubscriptions($query, $con);
2136
+	}
2137
+
2138
+	/**
2139
+	 * Clears the current object, sets all attributes to their default values and removes
2140
+	 * outgoing references as well as back-references (from other objects to this one. Results probably in a database
2141
+	 * change of those foreign objects when you call `save` there).
2142
+	 */
2143
+	public function clear()
2144
+	{
2145
+		$this->name = null;
2146
+		$this->alreadyInSave = false;
2147
+		$this->clearAllReferences();
2148
+		$this->resetModified();
2149
+		$this->setNew(true);
2150
+		$this->setDeleted(false);
2151
+	}
2152
+
2153
+	/**
2154
+	 * Resets all references and back-references to other model objects or collections of model objects.
2155
+	 *
2156
+	 * This method is used to reset all php object references (not the actual reference in the database).
2157
+	 * Necessary for object serialisation.
2158
+	 *
2159
+	 * @param      boolean $deep Whether to also clear the references on all referrer objects.
2160
+	 */
2161
+	public function clearAllReferences($deep = false)
2162
+	{
2163
+		if ($deep) {
2164
+			if ($this->collUsers) {
2165
+				foreach ($this->collUsers as $o) {
2166
+					$o->clearAllReferences($deep);
2167
+				}
2168
+			}
2169
+			if ($this->collConnections) {
2170
+				foreach ($this->collConnections as $o) {
2171
+					$o->clearAllReferences($deep);
2172
+				}
2173
+			}
2174
+			if ($this->collChannels) {
2175
+				foreach ($this->collChannels as $o) {
2176
+					$o->clearAllReferences($deep);
2177
+				}
2178
+			}
2179
+			if ($this->collSubscriptions) {
2180
+				foreach ($this->collSubscriptions as $o) {
2181
+					$o->clearAllReferences($deep);
2182
+				}
2183
+			}
2184
+		} // if ($deep)
2185
+
2186
+		$this->collUsers = null;
2187
+		$this->collConnections = null;
2188
+		$this->collChannels = null;
2189
+		$this->collSubscriptions = null;
2190
+	}
2191
+
2192
+	/**
2193
+	 * Return the string representation of this object
2194
+	 *
2195
+	 * @return string
2196
+	 */
2197
+	public function __toString()
2198
+	{
2199
+		return (string) $this->exportTo(InstanceTableMap::DEFAULT_STRING_FORMAT);
2200
+	}
2201
+
2202
+	/**
2203
+	 * Code to be run before persisting the object
2204
+	 * @param  ConnectionInterface $con
2205
+	 * @return boolean
2206
+	 */
2207
+	public function preSave(ConnectionInterface $con = null)
2208
+	{
2209
+		return true;
2210
+	}
2211
+
2212
+	/**
2213
+	 * Code to be run after persisting the object
2214
+	 * @param ConnectionInterface $con
2215
+	 */
2216
+	public function postSave(ConnectionInterface $con = null)
2217
+	{
2218
+
2219
+	}
2220
+
2221
+	/**
2222
+	 * Code to be run before inserting to database
2223
+	 * @param  ConnectionInterface $con
2224
+	 * @return boolean
2225
+	 */
2226
+	public function preInsert(ConnectionInterface $con = null)
2227
+	{
2228
+		return true;
2229
+	}
2230
+
2231
+	/**
2232
+	 * Code to be run after inserting to database
2233
+	 * @param ConnectionInterface $con
2234
+	 */
2235
+	public function postInsert(ConnectionInterface $con = null)
2236
+	{
2237
+
2238
+	}
2239
+
2240
+	/**
2241
+	 * Code to be run before updating the object in database
2242
+	 * @param  ConnectionInterface $con
2243
+	 * @return boolean
2244
+	 */
2245
+	public function preUpdate(ConnectionInterface $con = null)
2246
+	{
2247
+		return true;
2248
+	}
2249
+
2250
+	/**
2251
+	 * Code to be run after updating the object in database
2252
+	 * @param ConnectionInterface $con
2253
+	 */
2254
+	public function postUpdate(ConnectionInterface $con = null)
2255
+	{
2256
+
2257
+	}
2258
+
2259
+	/**
2260
+	 * Code to be run before deleting the object in database
2261
+	 * @param  ConnectionInterface $con
2262
+	 * @return boolean
2263
+	 */
2264
+	public function preDelete(ConnectionInterface $con = null)
2265
+	{
2266
+		return true;
2267
+	}
2268
+
2269
+	/**
2270
+	 * Code to be run after deleting the object in database
2271
+	 * @param ConnectionInterface $con
2272
+	 */
2273
+	public function postDelete(ConnectionInterface $con = null)
2274
+	{
2275
+
2276
+	}
2277
+
2278
+
2279
+	/**
2280
+	 * Derived method to catches calls to undefined methods.
2281
+	 *
2282
+	 * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
2283
+	 * Allows to define default __call() behavior if you overwrite __call()
2284
+	 *
2285
+	 * @param string $name
2286
+	 * @param mixed  $params
2287
+	 *
2288
+	 * @return array|string
2289
+	 */
2290
+	public function __call($name, $params)
2291
+	{
2292
+		if (0 === strpos($name, 'get')) {
2293
+			$virtualColumn = substr($name, 3);
2294
+			if ($this->hasVirtualColumn($virtualColumn)) {
2295
+				return $this->getVirtualColumn($virtualColumn);
2296
+			}
2297
+
2298
+			$virtualColumn = lcfirst($virtualColumn);
2299
+			if ($this->hasVirtualColumn($virtualColumn)) {
2300
+				return $this->getVirtualColumn($virtualColumn);
2301
+			}
2302
+		}
2303
+
2304
+		if (0 === strpos($name, 'from')) {
2305
+			$format = substr($name, 4);
2306
+
2307
+			return $this->importFrom($format, reset($params));
2308
+		}
2309
+
2310
+		if (0 === strpos($name, 'to')) {
2311
+			$format = substr($name, 2);
2312
+			$includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
2313
+
2314
+			return $this->exportTo($format, $includeLazyLoadColumns);
2315
+		}
2316
+
2317
+		throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
2318
+	}
2319 2319
 
2320 2320
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         $propertyNames = [];
355 355
         $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
356 356
 
357
-        foreach($serializableProperties as $property) {
357
+        foreach ($serializableProperties as $property) {
358 358
             $propertyNames[] = $property->getName();
359 359
         }
360 360
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
             $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
529 529
         }
530 530
 
531
-        $con->transaction(function () use ($con) {
531
+        $con->transaction(function() use ($con) {
532 532
             $deleteQuery = ChildInstanceQuery::create()
533 533
                 ->filterByPrimaryKey($this->getPrimaryKey());
534 534
             $ret = $this->preDelete($con);
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
             $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
564 564
         }
565 565
 
566
-        return $con->transaction(function () use ($con) {
566
+        return $con->transaction(function() use ($con) {
567 567
             $isInsert = $this->isNew();
568 568
             $ret = $this->preSave($con);
569 569
             if ($isInsert) {
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 
708 708
          // check the columns in natural order for more readable SQL queries
709 709
         if ($this->isColumnModified(InstanceTableMap::COL_NAME)) {
710
-            $modifiedColumns[':p' . $index++]  = 'name';
710
+            $modifiedColumns[':p' . $index++] = 'name';
711 711
         }
712 712
 
713 713
         $sql = sprintf(
@@ -1223,7 +1223,7 @@  discard block
 block discarded – undo
1223 1223
     public function getUsers(Criteria $criteria = null, ConnectionInterface $con = null)
1224 1224
     {
1225 1225
         $partial = $this->collUsersPartial && !$this->isNew();
1226
-        if (null === $this->collUsers || null !== $criteria  || $partial) {
1226
+        if (null === $this->collUsers || null !== $criteria || $partial) {
1227 1227
             if ($this->isNew() && null === $this->collUsers) {
1228 1228
                 // return empty collection
1229 1229
                 $this->initUsers();
@@ -1361,7 +1361,7 @@  discard block
 block discarded – undo
1361 1361
      */
1362 1362
     protected function doAddUser(ChildUser $user)
1363 1363
     {
1364
-        $this->collUsers[]= $user;
1364
+        $this->collUsers[] = $user;
1365 1365
         $user->setInstance($this);
1366 1366
     }
1367 1367
 
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
                 $this->usersScheduledForDeletion = clone $this->collUsers;
1379 1379
                 $this->usersScheduledForDeletion->clear();
1380 1380
             }
1381
-            $this->usersScheduledForDeletion[]= clone $user;
1381
+            $this->usersScheduledForDeletion[] = clone $user;
1382 1382
             $user->setInstance(null);
1383 1383
         }
1384 1384
 
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
     public function getConnections(Criteria $criteria = null, ConnectionInterface $con = null)
1449 1449
     {
1450 1450
         $partial = $this->collConnectionsPartial && !$this->isNew();
1451
-        if (null === $this->collConnections || null !== $criteria  || $partial) {
1451
+        if (null === $this->collConnections || null !== $criteria || $partial) {
1452 1452
             if ($this->isNew() && null === $this->collConnections) {
1453 1453
                 // return empty collection
1454 1454
                 $this->initConnections();
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
      */
1587 1587
     protected function doAddConnection(ChildConnection $connection)
1588 1588
     {
1589
-        $this->collConnections[]= $connection;
1589
+        $this->collConnections[] = $connection;
1590 1590
         $connection->setInstance($this);
1591 1591
     }
1592 1592
 
@@ -1603,7 +1603,7 @@  discard block
 block discarded – undo
1603 1603
                 $this->connectionsScheduledForDeletion = clone $this->collConnections;
1604 1604
                 $this->connectionsScheduledForDeletion->clear();
1605 1605
             }
1606
-            $this->connectionsScheduledForDeletion[]= clone $connection;
1606
+            $this->connectionsScheduledForDeletion[] = clone $connection;
1607 1607
             $connection->setInstance(null);
1608 1608
         }
1609 1609
 
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
     public function getChannels(Criteria $criteria = null, ConnectionInterface $con = null)
1699 1699
     {
1700 1700
         $partial = $this->collChannelsPartial && !$this->isNew();
1701
-        if (null === $this->collChannels || null !== $criteria  || $partial) {
1701
+        if (null === $this->collChannels || null !== $criteria || $partial) {
1702 1702
             if ($this->isNew() && null === $this->collChannels) {
1703 1703
                 // return empty collection
1704 1704
                 $this->initChannels();
@@ -1836,7 +1836,7 @@  discard block
 block discarded – undo
1836 1836
      */
1837 1837
     protected function doAddChannel(ChildChannel $channel)
1838 1838
     {
1839
-        $this->collChannels[]= $channel;
1839
+        $this->collChannels[] = $channel;
1840 1840
         $channel->setInstance($this);
1841 1841
     }
1842 1842
 
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
                 $this->channelsScheduledForDeletion = clone $this->collChannels;
1854 1854
                 $this->channelsScheduledForDeletion->clear();
1855 1855
             }
1856
-            $this->channelsScheduledForDeletion[]= clone $channel;
1856
+            $this->channelsScheduledForDeletion[] = clone $channel;
1857 1857
             $channel->setInstance(null);
1858 1858
         }
1859 1859
 
@@ -1923,7 +1923,7 @@  discard block
 block discarded – undo
1923 1923
     public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null)
1924 1924
     {
1925 1925
         $partial = $this->collSubscriptionsPartial && !$this->isNew();
1926
-        if (null === $this->collSubscriptions || null !== $criteria  || $partial) {
1926
+        if (null === $this->collSubscriptions || null !== $criteria || $partial) {
1927 1927
             if ($this->isNew() && null === $this->collSubscriptions) {
1928 1928
                 // return empty collection
1929 1929
                 $this->initSubscriptions();
@@ -2061,7 +2061,7 @@  discard block
 block discarded – undo
2061 2061
      */
2062 2062
     protected function doAddSubscription(ChildSubscription $subscription)
2063 2063
     {
2064
-        $this->collSubscriptions[]= $subscription;
2064
+        $this->collSubscriptions[] = $subscription;
2065 2065
         $subscription->setInstance($this);
2066 2066
     }
2067 2067
 
@@ -2078,7 +2078,7 @@  discard block
 block discarded – undo
2078 2078
                 $this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions;
2079 2079
                 $this->subscriptionsScheduledForDeletion->clear();
2080 2080
             }
2081
-            $this->subscriptionsScheduledForDeletion[]= clone $subscription;
2081
+            $this->subscriptionsScheduledForDeletion[] = clone $subscription;
2082 2082
             $subscription->setInstance(null);
2083 2083
         }
2084 2084
 
Please login to merge, or discard this patch.
src/cli/Database/Base/InstanceQuery.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
      * $obj  = $c->findPk(12, $con);
139 139
      * </code>
140 140
      *
141
-     * @param mixed $key Primary key to use for the query
141
+     * @param string $key Primary key to use for the query
142 142
      * @param ConnectionInterface $con an optional connection object
143 143
      *
144 144
      * @return ChildInstance|array|mixed the result, formatted by the current formatter
Please login to merge, or discard this patch.
Indentation   +574 added lines, -575 removed lines patch added patch discarded remove patch
@@ -78,7 +78,6 @@  discard block
 block discarded – undo
78 78
  * @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
79 79
  *
80 80
  * @method     ChildInstance findOneByName(string $name) Return the first ChildInstance filtered by the name column *
81
-
82 81
  * @method     ChildInstance requirePk($key, ConnectionInterface $con = null) Return the ChildInstance by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
83 82
  * @method     ChildInstance requireOne(ConnectionInterface $con = null) Return the first ChildInstance matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
84 83
  *
@@ -91,579 +90,579 @@  discard block
 block discarded – undo
91 90
  */
92 91
 abstract class InstanceQuery extends ModelCriteria
93 92
 {
94
-    protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException';
95
-
96
-    /**
97
-     * Initializes internal state of \Jalle19\StatusManager\Database\Base\InstanceQuery object.
98
-     *
99
-     * @param     string $dbName The database name
100
-     * @param     string $modelName The phpName of a model, e.g. 'Book'
101
-     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
102
-     */
103
-    public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Instance', $modelAlias = null)
104
-    {
105
-        parent::__construct($dbName, $modelName, $modelAlias);
106
-    }
107
-
108
-    /**
109
-     * Returns a new ChildInstanceQuery object.
110
-     *
111
-     * @param     string $modelAlias The alias of a model in the query
112
-     * @param     Criteria $criteria Optional Criteria to build the query from
113
-     *
114
-     * @return ChildInstanceQuery
115
-     */
116
-    public static function create($modelAlias = null, Criteria $criteria = null)
117
-    {
118
-        if ($criteria instanceof ChildInstanceQuery) {
119
-            return $criteria;
120
-        }
121
-        $query = new ChildInstanceQuery();
122
-        if (null !== $modelAlias) {
123
-            $query->setModelAlias($modelAlias);
124
-        }
125
-        if ($criteria instanceof Criteria) {
126
-            $query->mergeWith($criteria);
127
-        }
128
-
129
-        return $query;
130
-    }
131
-
132
-    /**
133
-     * Find object by primary key.
134
-     * Propel uses the instance pool to skip the database if the object exists.
135
-     * Go fast if the query is untouched.
136
-     *
137
-     * <code>
138
-     * $obj  = $c->findPk(12, $con);
139
-     * </code>
140
-     *
141
-     * @param mixed $key Primary key to use for the query
142
-     * @param ConnectionInterface $con an optional connection object
143
-     *
144
-     * @return ChildInstance|array|mixed the result, formatted by the current formatter
145
-     */
146
-    public function findPk($key, ConnectionInterface $con = null)
147
-    {
148
-        if ($key === null) {
149
-            return null;
150
-        }
151
-        if ((null !== ($obj = InstanceTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) {
152
-            // the object is already in the instance pool
153
-            return $obj;
154
-        }
155
-        if ($con === null) {
156
-            $con = Propel::getServiceContainer()->getReadConnection(InstanceTableMap::DATABASE_NAME);
157
-        }
158
-        $this->basePreSelect($con);
159
-        if ($this->formatter || $this->modelAlias || $this->with || $this->select
160
-         || $this->selectColumns || $this->asColumns || $this->selectModifiers
161
-         || $this->map || $this->having || $this->joins) {
162
-            return $this->findPkComplex($key, $con);
163
-        } else {
164
-            return $this->findPkSimple($key, $con);
165
-        }
166
-    }
167
-
168
-    /**
169
-     * Find object by primary key using raw SQL to go fast.
170
-     * Bypass doSelect() and the object formatter by using generated code.
171
-     *
172
-     * @param     mixed $key Primary key to use for the query
173
-     * @param     ConnectionInterface $con A connection object
174
-     *
175
-     * @throws \Propel\Runtime\Exception\PropelException
176
-     *
177
-     * @return ChildInstance A model object, or null if the key is not found
178
-     */
179
-    protected function findPkSimple($key, ConnectionInterface $con)
180
-    {
181
-        $sql = 'SELECT name FROM instance WHERE name = :p0';
182
-        try {
183
-            $stmt = $con->prepare($sql);
184
-            $stmt->bindValue(':p0', $key, PDO::PARAM_STR);
185
-            $stmt->execute();
186
-        } catch (Exception $e) {
187
-            Propel::log($e->getMessage(), Propel::LOG_ERR);
188
-            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
189
-        }
190
-        $obj = null;
191
-        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
192
-            /** @var ChildInstance $obj */
193
-            $obj = new ChildInstance();
194
-            $obj->hydrate($row);
195
-            InstanceTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
196
-        }
197
-        $stmt->closeCursor();
198
-
199
-        return $obj;
200
-    }
201
-
202
-    /**
203
-     * Find object by primary key.
204
-     *
205
-     * @param     mixed $key Primary key to use for the query
206
-     * @param     ConnectionInterface $con A connection object
207
-     *
208
-     * @return ChildInstance|array|mixed the result, formatted by the current formatter
209
-     */
210
-    protected function findPkComplex($key, ConnectionInterface $con)
211
-    {
212
-        // As the query uses a PK condition, no limit(1) is necessary.
213
-        $criteria = $this->isKeepQuery() ? clone $this : $this;
214
-        $dataFetcher = $criteria
215
-            ->filterByPrimaryKey($key)
216
-            ->doSelect($con);
217
-
218
-        return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
219
-    }
220
-
221
-    /**
222
-     * Find objects by primary key
223
-     * <code>
224
-     * $objs = $c->findPks(array(12, 56, 832), $con);
225
-     * </code>
226
-     * @param     array $keys Primary keys to use for the query
227
-     * @param     ConnectionInterface $con an optional connection object
228
-     *
229
-     * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
230
-     */
231
-    public function findPks($keys, ConnectionInterface $con = null)
232
-    {
233
-        if (null === $con) {
234
-            $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
235
-        }
236
-        $this->basePreSelect($con);
237
-        $criteria = $this->isKeepQuery() ? clone $this : $this;
238
-        $dataFetcher = $criteria
239
-            ->filterByPrimaryKeys($keys)
240
-            ->doSelect($con);
241
-
242
-        return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
243
-    }
244
-
245
-    /**
246
-     * Filter the query by primary key
247
-     *
248
-     * @param     mixed $key Primary key to use for the query
249
-     *
250
-     * @return $this|ChildInstanceQuery The current query, for fluid interface
251
-     */
252
-    public function filterByPrimaryKey($key)
253
-    {
254
-
255
-        return $this->addUsingAlias(InstanceTableMap::COL_NAME, $key, Criteria::EQUAL);
256
-    }
257
-
258
-    /**
259
-     * Filter the query by a list of primary keys
260
-     *
261
-     * @param     array $keys The list of primary key to use for the query
262
-     *
263
-     * @return $this|ChildInstanceQuery The current query, for fluid interface
264
-     */
265
-    public function filterByPrimaryKeys($keys)
266
-    {
267
-
268
-        return $this->addUsingAlias(InstanceTableMap::COL_NAME, $keys, Criteria::IN);
269
-    }
270
-
271
-    /**
272
-     * Filter the query on the name column
273
-     *
274
-     * Example usage:
275
-     * <code>
276
-     * $query->filterByName('fooValue');   // WHERE name = 'fooValue'
277
-     * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
278
-     * </code>
279
-     *
280
-     * @param     string $name The value to use as filter.
281
-     *              Accepts wildcards (* and % trigger a LIKE)
282
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
283
-     *
284
-     * @return $this|ChildInstanceQuery The current query, for fluid interface
285
-     */
286
-    public function filterByName($name = null, $comparison = null)
287
-    {
288
-        if (null === $comparison) {
289
-            if (is_array($name)) {
290
-                $comparison = Criteria::IN;
291
-            } elseif (preg_match('/[\%\*]/', $name)) {
292
-                $name = str_replace('*', '%', $name);
293
-                $comparison = Criteria::LIKE;
294
-            }
295
-        }
296
-
297
-        return $this->addUsingAlias(InstanceTableMap::COL_NAME, $name, $comparison);
298
-    }
299
-
300
-    /**
301
-     * Filter the query by a related \Jalle19\StatusManager\Database\User object
302
-     *
303
-     * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user the related object to use as filter
304
-     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
305
-     *
306
-     * @return ChildInstanceQuery The current query, for fluid interface
307
-     */
308
-    public function filterByUser($user, $comparison = null)
309
-    {
310
-        if ($user instanceof \Jalle19\StatusManager\Database\User) {
311
-            return $this
312
-                ->addUsingAlias(InstanceTableMap::COL_NAME, $user->getInstanceName(), $comparison);
313
-        } elseif ($user instanceof ObjectCollection) {
314
-            return $this
315
-                ->useUserQuery()
316
-                ->filterByPrimaryKeys($user->getPrimaryKeys())
317
-                ->endUse();
318
-        } else {
319
-            throw new PropelException('filterByUser() only accepts arguments of type \Jalle19\StatusManager\Database\User or Collection');
320
-        }
321
-    }
322
-
323
-    /**
324
-     * Adds a JOIN clause to the query using the User relation
325
-     *
326
-     * @param     string $relationAlias optional alias for the relation
327
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
328
-     *
329
-     * @return $this|ChildInstanceQuery The current query, for fluid interface
330
-     */
331
-    public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN)
332
-    {
333
-        $tableMap = $this->getTableMap();
334
-        $relationMap = $tableMap->getRelation('User');
335
-
336
-        // create a ModelJoin object for this join
337
-        $join = new ModelJoin();
338
-        $join->setJoinType($joinType);
339
-        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
340
-        if ($previousJoin = $this->getPreviousJoin()) {
341
-            $join->setPreviousJoin($previousJoin);
342
-        }
343
-
344
-        // add the ModelJoin to the current object
345
-        if ($relationAlias) {
346
-            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
347
-            $this->addJoinObject($join, $relationAlias);
348
-        } else {
349
-            $this->addJoinObject($join, 'User');
350
-        }
351
-
352
-        return $this;
353
-    }
354
-
355
-    /**
356
-     * Use the User relation User object
357
-     *
358
-     * @see useQuery()
359
-     *
360
-     * @param     string $relationAlias optional alias for the relation,
361
-     *                                   to be used as main alias in the secondary query
362
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
363
-     *
364
-     * @return \Jalle19\StatusManager\Database\UserQuery A secondary query class using the current class as primary query
365
-     */
366
-    public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
367
-    {
368
-        return $this
369
-            ->joinUser($relationAlias, $joinType)
370
-            ->useQuery($relationAlias ? $relationAlias : 'User', '\Jalle19\StatusManager\Database\UserQuery');
371
-    }
372
-
373
-    /**
374
-     * Filter the query by a related \Jalle19\StatusManager\Database\Connection object
375
-     *
376
-     * @param \Jalle19\StatusManager\Database\Connection|ObjectCollection $connection the related object to use as filter
377
-     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
378
-     *
379
-     * @return ChildInstanceQuery The current query, for fluid interface
380
-     */
381
-    public function filterByConnection($connection, $comparison = null)
382
-    {
383
-        if ($connection instanceof \Jalle19\StatusManager\Database\Connection) {
384
-            return $this
385
-                ->addUsingAlias(InstanceTableMap::COL_NAME, $connection->getInstanceName(), $comparison);
386
-        } elseif ($connection instanceof ObjectCollection) {
387
-            return $this
388
-                ->useConnectionQuery()
389
-                ->filterByPrimaryKeys($connection->getPrimaryKeys())
390
-                ->endUse();
391
-        } else {
392
-            throw new PropelException('filterByConnection() only accepts arguments of type \Jalle19\StatusManager\Database\Connection or Collection');
393
-        }
394
-    }
395
-
396
-    /**
397
-     * Adds a JOIN clause to the query using the Connection relation
398
-     *
399
-     * @param     string $relationAlias optional alias for the relation
400
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
401
-     *
402
-     * @return $this|ChildInstanceQuery The current query, for fluid interface
403
-     */
404
-    public function joinConnection($relationAlias = null, $joinType = Criteria::INNER_JOIN)
405
-    {
406
-        $tableMap = $this->getTableMap();
407
-        $relationMap = $tableMap->getRelation('Connection');
408
-
409
-        // create a ModelJoin object for this join
410
-        $join = new ModelJoin();
411
-        $join->setJoinType($joinType);
412
-        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
413
-        if ($previousJoin = $this->getPreviousJoin()) {
414
-            $join->setPreviousJoin($previousJoin);
415
-        }
416
-
417
-        // add the ModelJoin to the current object
418
-        if ($relationAlias) {
419
-            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
420
-            $this->addJoinObject($join, $relationAlias);
421
-        } else {
422
-            $this->addJoinObject($join, 'Connection');
423
-        }
424
-
425
-        return $this;
426
-    }
427
-
428
-    /**
429
-     * Use the Connection relation Connection object
430
-     *
431
-     * @see useQuery()
432
-     *
433
-     * @param     string $relationAlias optional alias for the relation,
434
-     *                                   to be used as main alias in the secondary query
435
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
436
-     *
437
-     * @return \Jalle19\StatusManager\Database\ConnectionQuery A secondary query class using the current class as primary query
438
-     */
439
-    public function useConnectionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
440
-    {
441
-        return $this
442
-            ->joinConnection($relationAlias, $joinType)
443
-            ->useQuery($relationAlias ? $relationAlias : 'Connection', '\Jalle19\StatusManager\Database\ConnectionQuery');
444
-    }
445
-
446
-    /**
447
-     * Filter the query by a related \Jalle19\StatusManager\Database\Channel object
448
-     *
449
-     * @param \Jalle19\StatusManager\Database\Channel|ObjectCollection $channel the related object to use as filter
450
-     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
451
-     *
452
-     * @return ChildInstanceQuery The current query, for fluid interface
453
-     */
454
-    public function filterByChannel($channel, $comparison = null)
455
-    {
456
-        if ($channel instanceof \Jalle19\StatusManager\Database\Channel) {
457
-            return $this
458
-                ->addUsingAlias(InstanceTableMap::COL_NAME, $channel->getInstanceName(), $comparison);
459
-        } elseif ($channel instanceof ObjectCollection) {
460
-            return $this
461
-                ->useChannelQuery()
462
-                ->filterByPrimaryKeys($channel->getPrimaryKeys())
463
-                ->endUse();
464
-        } else {
465
-            throw new PropelException('filterByChannel() only accepts arguments of type \Jalle19\StatusManager\Database\Channel or Collection');
466
-        }
467
-    }
468
-
469
-    /**
470
-     * Adds a JOIN clause to the query using the Channel relation
471
-     *
472
-     * @param     string $relationAlias optional alias for the relation
473
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
474
-     *
475
-     * @return $this|ChildInstanceQuery The current query, for fluid interface
476
-     */
477
-    public function joinChannel($relationAlias = null, $joinType = Criteria::INNER_JOIN)
478
-    {
479
-        $tableMap = $this->getTableMap();
480
-        $relationMap = $tableMap->getRelation('Channel');
481
-
482
-        // create a ModelJoin object for this join
483
-        $join = new ModelJoin();
484
-        $join->setJoinType($joinType);
485
-        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
486
-        if ($previousJoin = $this->getPreviousJoin()) {
487
-            $join->setPreviousJoin($previousJoin);
488
-        }
489
-
490
-        // add the ModelJoin to the current object
491
-        if ($relationAlias) {
492
-            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
493
-            $this->addJoinObject($join, $relationAlias);
494
-        } else {
495
-            $this->addJoinObject($join, 'Channel');
496
-        }
497
-
498
-        return $this;
499
-    }
500
-
501
-    /**
502
-     * Use the Channel relation Channel object
503
-     *
504
-     * @see useQuery()
505
-     *
506
-     * @param     string $relationAlias optional alias for the relation,
507
-     *                                   to be used as main alias in the secondary query
508
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
509
-     *
510
-     * @return \Jalle19\StatusManager\Database\ChannelQuery A secondary query class using the current class as primary query
511
-     */
512
-    public function useChannelQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
513
-    {
514
-        return $this
515
-            ->joinChannel($relationAlias, $joinType)
516
-            ->useQuery($relationAlias ? $relationAlias : 'Channel', '\Jalle19\StatusManager\Database\ChannelQuery');
517
-    }
518
-
519
-    /**
520
-     * Filter the query by a related \Jalle19\StatusManager\Database\Subscription object
521
-     *
522
-     * @param \Jalle19\StatusManager\Database\Subscription|ObjectCollection $subscription the related object to use as filter
523
-     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
524
-     *
525
-     * @return ChildInstanceQuery The current query, for fluid interface
526
-     */
527
-    public function filterBySubscription($subscription, $comparison = null)
528
-    {
529
-        if ($subscription instanceof \Jalle19\StatusManager\Database\Subscription) {
530
-            return $this
531
-                ->addUsingAlias(InstanceTableMap::COL_NAME, $subscription->getInstanceName(), $comparison);
532
-        } elseif ($subscription instanceof ObjectCollection) {
533
-            return $this
534
-                ->useSubscriptionQuery()
535
-                ->filterByPrimaryKeys($subscription->getPrimaryKeys())
536
-                ->endUse();
537
-        } else {
538
-            throw new PropelException('filterBySubscription() only accepts arguments of type \Jalle19\StatusManager\Database\Subscription or Collection');
539
-        }
540
-    }
541
-
542
-    /**
543
-     * Adds a JOIN clause to the query using the Subscription relation
544
-     *
545
-     * @param     string $relationAlias optional alias for the relation
546
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
547
-     *
548
-     * @return $this|ChildInstanceQuery The current query, for fluid interface
549
-     */
550
-    public function joinSubscription($relationAlias = null, $joinType = Criteria::INNER_JOIN)
551
-    {
552
-        $tableMap = $this->getTableMap();
553
-        $relationMap = $tableMap->getRelation('Subscription');
554
-
555
-        // create a ModelJoin object for this join
556
-        $join = new ModelJoin();
557
-        $join->setJoinType($joinType);
558
-        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
559
-        if ($previousJoin = $this->getPreviousJoin()) {
560
-            $join->setPreviousJoin($previousJoin);
561
-        }
562
-
563
-        // add the ModelJoin to the current object
564
-        if ($relationAlias) {
565
-            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
566
-            $this->addJoinObject($join, $relationAlias);
567
-        } else {
568
-            $this->addJoinObject($join, 'Subscription');
569
-        }
570
-
571
-        return $this;
572
-    }
573
-
574
-    /**
575
-     * Use the Subscription relation Subscription object
576
-     *
577
-     * @see useQuery()
578
-     *
579
-     * @param     string $relationAlias optional alias for the relation,
580
-     *                                   to be used as main alias in the secondary query
581
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
582
-     *
583
-     * @return \Jalle19\StatusManager\Database\SubscriptionQuery A secondary query class using the current class as primary query
584
-     */
585
-    public function useSubscriptionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
586
-    {
587
-        return $this
588
-            ->joinSubscription($relationAlias, $joinType)
589
-            ->useQuery($relationAlias ? $relationAlias : 'Subscription', '\Jalle19\StatusManager\Database\SubscriptionQuery');
590
-    }
591
-
592
-    /**
593
-     * Exclude object from result
594
-     *
595
-     * @param   ChildInstance $instance Object to remove from the list of results
596
-     *
597
-     * @return $this|ChildInstanceQuery The current query, for fluid interface
598
-     */
599
-    public function prune($instance = null)
600
-    {
601
-        if ($instance) {
602
-            $this->addUsingAlias(InstanceTableMap::COL_NAME, $instance->getName(), Criteria::NOT_EQUAL);
603
-        }
604
-
605
-        return $this;
606
-    }
607
-
608
-    /**
609
-     * Deletes all rows from the instance table.
610
-     *
611
-     * @param ConnectionInterface $con the connection to use
612
-     * @return int The number of affected rows (if supported by underlying database driver).
613
-     */
614
-    public function doDeleteAll(ConnectionInterface $con = null)
615
-    {
616
-        if (null === $con) {
617
-            $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
618
-        }
619
-
620
-        // use transaction because $criteria could contain info
621
-        // for more than one table or we could emulating ON DELETE CASCADE, etc.
622
-        return $con->transaction(function () use ($con) {
623
-            $affectedRows = 0; // initialize var to track total num of affected rows
624
-            $affectedRows += parent::doDeleteAll($con);
625
-            // Because this db requires some delete cascade/set null emulation, we have to
626
-            // clear the cached instance *after* the emulation has happened (since
627
-            // instances get re-added by the select statement contained therein).
628
-            InstanceTableMap::clearInstancePool();
629
-            InstanceTableMap::clearRelatedInstancePool();
630
-
631
-            return $affectedRows;
632
-        });
633
-    }
634
-
635
-    /**
636
-     * Performs a DELETE on the database based on the current ModelCriteria
637
-     *
638
-     * @param ConnectionInterface $con the connection to use
639
-     * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
640
-     *                         if supported by native driver or if emulated using Propel.
641
-     * @throws PropelException Any exceptions caught during processing will be
642
-     *                         rethrown wrapped into a PropelException.
643
-     */
644
-    public function delete(ConnectionInterface $con = null)
645
-    {
646
-        if (null === $con) {
647
-            $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
648
-        }
649
-
650
-        $criteria = $this;
651
-
652
-        // Set the correct dbName
653
-        $criteria->setDbName(InstanceTableMap::DATABASE_NAME);
654
-
655
-        // use transaction because $criteria could contain info
656
-        // for more than one table or we could emulating ON DELETE CASCADE, etc.
657
-        return $con->transaction(function () use ($con, $criteria) {
658
-            $affectedRows = 0; // initialize var to track total num of affected rows
659
-
660
-            InstanceTableMap::removeInstanceFromPool($criteria);
661
-
662
-            $affectedRows += ModelCriteria::delete($con);
663
-            InstanceTableMap::clearRelatedInstancePool();
664
-
665
-            return $affectedRows;
666
-        });
667
-    }
93
+	protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException';
94
+
95
+	/**
96
+	 * Initializes internal state of \Jalle19\StatusManager\Database\Base\InstanceQuery object.
97
+	 *
98
+	 * @param     string $dbName The database name
99
+	 * @param     string $modelName The phpName of a model, e.g. 'Book'
100
+	 * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
101
+	 */
102
+	public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Instance', $modelAlias = null)
103
+	{
104
+		parent::__construct($dbName, $modelName, $modelAlias);
105
+	}
106
+
107
+	/**
108
+	 * Returns a new ChildInstanceQuery object.
109
+	 *
110
+	 * @param     string $modelAlias The alias of a model in the query
111
+	 * @param     Criteria $criteria Optional Criteria to build the query from
112
+	 *
113
+	 * @return ChildInstanceQuery
114
+	 */
115
+	public static function create($modelAlias = null, Criteria $criteria = null)
116
+	{
117
+		if ($criteria instanceof ChildInstanceQuery) {
118
+			return $criteria;
119
+		}
120
+		$query = new ChildInstanceQuery();
121
+		if (null !== $modelAlias) {
122
+			$query->setModelAlias($modelAlias);
123
+		}
124
+		if ($criteria instanceof Criteria) {
125
+			$query->mergeWith($criteria);
126
+		}
127
+
128
+		return $query;
129
+	}
130
+
131
+	/**
132
+	 * Find object by primary key.
133
+	 * Propel uses the instance pool to skip the database if the object exists.
134
+	 * Go fast if the query is untouched.
135
+	 *
136
+	 * <code>
137
+	 * $obj  = $c->findPk(12, $con);
138
+	 * </code>
139
+	 *
140
+	 * @param mixed $key Primary key to use for the query
141
+	 * @param ConnectionInterface $con an optional connection object
142
+	 *
143
+	 * @return ChildInstance|array|mixed the result, formatted by the current formatter
144
+	 */
145
+	public function findPk($key, ConnectionInterface $con = null)
146
+	{
147
+		if ($key === null) {
148
+			return null;
149
+		}
150
+		if ((null !== ($obj = InstanceTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) {
151
+			// the object is already in the instance pool
152
+			return $obj;
153
+		}
154
+		if ($con === null) {
155
+			$con = Propel::getServiceContainer()->getReadConnection(InstanceTableMap::DATABASE_NAME);
156
+		}
157
+		$this->basePreSelect($con);
158
+		if ($this->formatter || $this->modelAlias || $this->with || $this->select
159
+		 || $this->selectColumns || $this->asColumns || $this->selectModifiers
160
+		 || $this->map || $this->having || $this->joins) {
161
+			return $this->findPkComplex($key, $con);
162
+		} else {
163
+			return $this->findPkSimple($key, $con);
164
+		}
165
+	}
166
+
167
+	/**
168
+	 * Find object by primary key using raw SQL to go fast.
169
+	 * Bypass doSelect() and the object formatter by using generated code.
170
+	 *
171
+	 * @param     mixed $key Primary key to use for the query
172
+	 * @param     ConnectionInterface $con A connection object
173
+	 *
174
+	 * @throws \Propel\Runtime\Exception\PropelException
175
+	 *
176
+	 * @return ChildInstance A model object, or null if the key is not found
177
+	 */
178
+	protected function findPkSimple($key, ConnectionInterface $con)
179
+	{
180
+		$sql = 'SELECT name FROM instance WHERE name = :p0';
181
+		try {
182
+			$stmt = $con->prepare($sql);
183
+			$stmt->bindValue(':p0', $key, PDO::PARAM_STR);
184
+			$stmt->execute();
185
+		} catch (Exception $e) {
186
+			Propel::log($e->getMessage(), Propel::LOG_ERR);
187
+			throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
188
+		}
189
+		$obj = null;
190
+		if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
191
+			/** @var ChildInstance $obj */
192
+			$obj = new ChildInstance();
193
+			$obj->hydrate($row);
194
+			InstanceTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
195
+		}
196
+		$stmt->closeCursor();
197
+
198
+		return $obj;
199
+	}
200
+
201
+	/**
202
+	 * Find object by primary key.
203
+	 *
204
+	 * @param     mixed $key Primary key to use for the query
205
+	 * @param     ConnectionInterface $con A connection object
206
+	 *
207
+	 * @return ChildInstance|array|mixed the result, formatted by the current formatter
208
+	 */
209
+	protected function findPkComplex($key, ConnectionInterface $con)
210
+	{
211
+		// As the query uses a PK condition, no limit(1) is necessary.
212
+		$criteria = $this->isKeepQuery() ? clone $this : $this;
213
+		$dataFetcher = $criteria
214
+			->filterByPrimaryKey($key)
215
+			->doSelect($con);
216
+
217
+		return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
218
+	}
219
+
220
+	/**
221
+	 * Find objects by primary key
222
+	 * <code>
223
+	 * $objs = $c->findPks(array(12, 56, 832), $con);
224
+	 * </code>
225
+	 * @param     array $keys Primary keys to use for the query
226
+	 * @param     ConnectionInterface $con an optional connection object
227
+	 *
228
+	 * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
229
+	 */
230
+	public function findPks($keys, ConnectionInterface $con = null)
231
+	{
232
+		if (null === $con) {
233
+			$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
234
+		}
235
+		$this->basePreSelect($con);
236
+		$criteria = $this->isKeepQuery() ? clone $this : $this;
237
+		$dataFetcher = $criteria
238
+			->filterByPrimaryKeys($keys)
239
+			->doSelect($con);
240
+
241
+		return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
242
+	}
243
+
244
+	/**
245
+	 * Filter the query by primary key
246
+	 *
247
+	 * @param     mixed $key Primary key to use for the query
248
+	 *
249
+	 * @return $this|ChildInstanceQuery The current query, for fluid interface
250
+	 */
251
+	public function filterByPrimaryKey($key)
252
+	{
253
+
254
+		return $this->addUsingAlias(InstanceTableMap::COL_NAME, $key, Criteria::EQUAL);
255
+	}
256
+
257
+	/**
258
+	 * Filter the query by a list of primary keys
259
+	 *
260
+	 * @param     array $keys The list of primary key to use for the query
261
+	 *
262
+	 * @return $this|ChildInstanceQuery The current query, for fluid interface
263
+	 */
264
+	public function filterByPrimaryKeys($keys)
265
+	{
266
+
267
+		return $this->addUsingAlias(InstanceTableMap::COL_NAME, $keys, Criteria::IN);
268
+	}
269
+
270
+	/**
271
+	 * Filter the query on the name column
272
+	 *
273
+	 * Example usage:
274
+	 * <code>
275
+	 * $query->filterByName('fooValue');   // WHERE name = 'fooValue'
276
+	 * $query->filterByName('%fooValue%'); // WHERE name LIKE '%fooValue%'
277
+	 * </code>
278
+	 *
279
+	 * @param     string $name The value to use as filter.
280
+	 *              Accepts wildcards (* and % trigger a LIKE)
281
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
282
+	 *
283
+	 * @return $this|ChildInstanceQuery The current query, for fluid interface
284
+	 */
285
+	public function filterByName($name = null, $comparison = null)
286
+	{
287
+		if (null === $comparison) {
288
+			if (is_array($name)) {
289
+				$comparison = Criteria::IN;
290
+			} elseif (preg_match('/[\%\*]/', $name)) {
291
+				$name = str_replace('*', '%', $name);
292
+				$comparison = Criteria::LIKE;
293
+			}
294
+		}
295
+
296
+		return $this->addUsingAlias(InstanceTableMap::COL_NAME, $name, $comparison);
297
+	}
298
+
299
+	/**
300
+	 * Filter the query by a related \Jalle19\StatusManager\Database\User object
301
+	 *
302
+	 * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user the related object to use as filter
303
+	 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
304
+	 *
305
+	 * @return ChildInstanceQuery The current query, for fluid interface
306
+	 */
307
+	public function filterByUser($user, $comparison = null)
308
+	{
309
+		if ($user instanceof \Jalle19\StatusManager\Database\User) {
310
+			return $this
311
+				->addUsingAlias(InstanceTableMap::COL_NAME, $user->getInstanceName(), $comparison);
312
+		} elseif ($user instanceof ObjectCollection) {
313
+			return $this
314
+				->useUserQuery()
315
+				->filterByPrimaryKeys($user->getPrimaryKeys())
316
+				->endUse();
317
+		} else {
318
+			throw new PropelException('filterByUser() only accepts arguments of type \Jalle19\StatusManager\Database\User or Collection');
319
+		}
320
+	}
321
+
322
+	/**
323
+	 * Adds a JOIN clause to the query using the User relation
324
+	 *
325
+	 * @param     string $relationAlias optional alias for the relation
326
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
327
+	 *
328
+	 * @return $this|ChildInstanceQuery The current query, for fluid interface
329
+	 */
330
+	public function joinUser($relationAlias = null, $joinType = Criteria::INNER_JOIN)
331
+	{
332
+		$tableMap = $this->getTableMap();
333
+		$relationMap = $tableMap->getRelation('User');
334
+
335
+		// create a ModelJoin object for this join
336
+		$join = new ModelJoin();
337
+		$join->setJoinType($joinType);
338
+		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
339
+		if ($previousJoin = $this->getPreviousJoin()) {
340
+			$join->setPreviousJoin($previousJoin);
341
+		}
342
+
343
+		// add the ModelJoin to the current object
344
+		if ($relationAlias) {
345
+			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
346
+			$this->addJoinObject($join, $relationAlias);
347
+		} else {
348
+			$this->addJoinObject($join, 'User');
349
+		}
350
+
351
+		return $this;
352
+	}
353
+
354
+	/**
355
+	 * Use the User relation User object
356
+	 *
357
+	 * @see useQuery()
358
+	 *
359
+	 * @param     string $relationAlias optional alias for the relation,
360
+	 *                                   to be used as main alias in the secondary query
361
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
362
+	 *
363
+	 * @return \Jalle19\StatusManager\Database\UserQuery A secondary query class using the current class as primary query
364
+	 */
365
+	public function useUserQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
366
+	{
367
+		return $this
368
+			->joinUser($relationAlias, $joinType)
369
+			->useQuery($relationAlias ? $relationAlias : 'User', '\Jalle19\StatusManager\Database\UserQuery');
370
+	}
371
+
372
+	/**
373
+	 * Filter the query by a related \Jalle19\StatusManager\Database\Connection object
374
+	 *
375
+	 * @param \Jalle19\StatusManager\Database\Connection|ObjectCollection $connection the related object to use as filter
376
+	 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
377
+	 *
378
+	 * @return ChildInstanceQuery The current query, for fluid interface
379
+	 */
380
+	public function filterByConnection($connection, $comparison = null)
381
+	{
382
+		if ($connection instanceof \Jalle19\StatusManager\Database\Connection) {
383
+			return $this
384
+				->addUsingAlias(InstanceTableMap::COL_NAME, $connection->getInstanceName(), $comparison);
385
+		} elseif ($connection instanceof ObjectCollection) {
386
+			return $this
387
+				->useConnectionQuery()
388
+				->filterByPrimaryKeys($connection->getPrimaryKeys())
389
+				->endUse();
390
+		} else {
391
+			throw new PropelException('filterByConnection() only accepts arguments of type \Jalle19\StatusManager\Database\Connection or Collection');
392
+		}
393
+	}
394
+
395
+	/**
396
+	 * Adds a JOIN clause to the query using the Connection relation
397
+	 *
398
+	 * @param     string $relationAlias optional alias for the relation
399
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
400
+	 *
401
+	 * @return $this|ChildInstanceQuery The current query, for fluid interface
402
+	 */
403
+	public function joinConnection($relationAlias = null, $joinType = Criteria::INNER_JOIN)
404
+	{
405
+		$tableMap = $this->getTableMap();
406
+		$relationMap = $tableMap->getRelation('Connection');
407
+
408
+		// create a ModelJoin object for this join
409
+		$join = new ModelJoin();
410
+		$join->setJoinType($joinType);
411
+		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
412
+		if ($previousJoin = $this->getPreviousJoin()) {
413
+			$join->setPreviousJoin($previousJoin);
414
+		}
415
+
416
+		// add the ModelJoin to the current object
417
+		if ($relationAlias) {
418
+			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
419
+			$this->addJoinObject($join, $relationAlias);
420
+		} else {
421
+			$this->addJoinObject($join, 'Connection');
422
+		}
423
+
424
+		return $this;
425
+	}
426
+
427
+	/**
428
+	 * Use the Connection relation Connection object
429
+	 *
430
+	 * @see useQuery()
431
+	 *
432
+	 * @param     string $relationAlias optional alias for the relation,
433
+	 *                                   to be used as main alias in the secondary query
434
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
435
+	 *
436
+	 * @return \Jalle19\StatusManager\Database\ConnectionQuery A secondary query class using the current class as primary query
437
+	 */
438
+	public function useConnectionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
439
+	{
440
+		return $this
441
+			->joinConnection($relationAlias, $joinType)
442
+			->useQuery($relationAlias ? $relationAlias : 'Connection', '\Jalle19\StatusManager\Database\ConnectionQuery');
443
+	}
444
+
445
+	/**
446
+	 * Filter the query by a related \Jalle19\StatusManager\Database\Channel object
447
+	 *
448
+	 * @param \Jalle19\StatusManager\Database\Channel|ObjectCollection $channel the related object to use as filter
449
+	 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
450
+	 *
451
+	 * @return ChildInstanceQuery The current query, for fluid interface
452
+	 */
453
+	public function filterByChannel($channel, $comparison = null)
454
+	{
455
+		if ($channel instanceof \Jalle19\StatusManager\Database\Channel) {
456
+			return $this
457
+				->addUsingAlias(InstanceTableMap::COL_NAME, $channel->getInstanceName(), $comparison);
458
+		} elseif ($channel instanceof ObjectCollection) {
459
+			return $this
460
+				->useChannelQuery()
461
+				->filterByPrimaryKeys($channel->getPrimaryKeys())
462
+				->endUse();
463
+		} else {
464
+			throw new PropelException('filterByChannel() only accepts arguments of type \Jalle19\StatusManager\Database\Channel or Collection');
465
+		}
466
+	}
467
+
468
+	/**
469
+	 * Adds a JOIN clause to the query using the Channel relation
470
+	 *
471
+	 * @param     string $relationAlias optional alias for the relation
472
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
473
+	 *
474
+	 * @return $this|ChildInstanceQuery The current query, for fluid interface
475
+	 */
476
+	public function joinChannel($relationAlias = null, $joinType = Criteria::INNER_JOIN)
477
+	{
478
+		$tableMap = $this->getTableMap();
479
+		$relationMap = $tableMap->getRelation('Channel');
480
+
481
+		// create a ModelJoin object for this join
482
+		$join = new ModelJoin();
483
+		$join->setJoinType($joinType);
484
+		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
485
+		if ($previousJoin = $this->getPreviousJoin()) {
486
+			$join->setPreviousJoin($previousJoin);
487
+		}
488
+
489
+		// add the ModelJoin to the current object
490
+		if ($relationAlias) {
491
+			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
492
+			$this->addJoinObject($join, $relationAlias);
493
+		} else {
494
+			$this->addJoinObject($join, 'Channel');
495
+		}
496
+
497
+		return $this;
498
+	}
499
+
500
+	/**
501
+	 * Use the Channel relation Channel object
502
+	 *
503
+	 * @see useQuery()
504
+	 *
505
+	 * @param     string $relationAlias optional alias for the relation,
506
+	 *                                   to be used as main alias in the secondary query
507
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
508
+	 *
509
+	 * @return \Jalle19\StatusManager\Database\ChannelQuery A secondary query class using the current class as primary query
510
+	 */
511
+	public function useChannelQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
512
+	{
513
+		return $this
514
+			->joinChannel($relationAlias, $joinType)
515
+			->useQuery($relationAlias ? $relationAlias : 'Channel', '\Jalle19\StatusManager\Database\ChannelQuery');
516
+	}
517
+
518
+	/**
519
+	 * Filter the query by a related \Jalle19\StatusManager\Database\Subscription object
520
+	 *
521
+	 * @param \Jalle19\StatusManager\Database\Subscription|ObjectCollection $subscription the related object to use as filter
522
+	 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
523
+	 *
524
+	 * @return ChildInstanceQuery The current query, for fluid interface
525
+	 */
526
+	public function filterBySubscription($subscription, $comparison = null)
527
+	{
528
+		if ($subscription instanceof \Jalle19\StatusManager\Database\Subscription) {
529
+			return $this
530
+				->addUsingAlias(InstanceTableMap::COL_NAME, $subscription->getInstanceName(), $comparison);
531
+		} elseif ($subscription instanceof ObjectCollection) {
532
+			return $this
533
+				->useSubscriptionQuery()
534
+				->filterByPrimaryKeys($subscription->getPrimaryKeys())
535
+				->endUse();
536
+		} else {
537
+			throw new PropelException('filterBySubscription() only accepts arguments of type \Jalle19\StatusManager\Database\Subscription or Collection');
538
+		}
539
+	}
540
+
541
+	/**
542
+	 * Adds a JOIN clause to the query using the Subscription relation
543
+	 *
544
+	 * @param     string $relationAlias optional alias for the relation
545
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
546
+	 *
547
+	 * @return $this|ChildInstanceQuery The current query, for fluid interface
548
+	 */
549
+	public function joinSubscription($relationAlias = null, $joinType = Criteria::INNER_JOIN)
550
+	{
551
+		$tableMap = $this->getTableMap();
552
+		$relationMap = $tableMap->getRelation('Subscription');
553
+
554
+		// create a ModelJoin object for this join
555
+		$join = new ModelJoin();
556
+		$join->setJoinType($joinType);
557
+		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
558
+		if ($previousJoin = $this->getPreviousJoin()) {
559
+			$join->setPreviousJoin($previousJoin);
560
+		}
561
+
562
+		// add the ModelJoin to the current object
563
+		if ($relationAlias) {
564
+			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
565
+			$this->addJoinObject($join, $relationAlias);
566
+		} else {
567
+			$this->addJoinObject($join, 'Subscription');
568
+		}
569
+
570
+		return $this;
571
+	}
572
+
573
+	/**
574
+	 * Use the Subscription relation Subscription object
575
+	 *
576
+	 * @see useQuery()
577
+	 *
578
+	 * @param     string $relationAlias optional alias for the relation,
579
+	 *                                   to be used as main alias in the secondary query
580
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
581
+	 *
582
+	 * @return \Jalle19\StatusManager\Database\SubscriptionQuery A secondary query class using the current class as primary query
583
+	 */
584
+	public function useSubscriptionQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
585
+	{
586
+		return $this
587
+			->joinSubscription($relationAlias, $joinType)
588
+			->useQuery($relationAlias ? $relationAlias : 'Subscription', '\Jalle19\StatusManager\Database\SubscriptionQuery');
589
+	}
590
+
591
+	/**
592
+	 * Exclude object from result
593
+	 *
594
+	 * @param   ChildInstance $instance Object to remove from the list of results
595
+	 *
596
+	 * @return $this|ChildInstanceQuery The current query, for fluid interface
597
+	 */
598
+	public function prune($instance = null)
599
+	{
600
+		if ($instance) {
601
+			$this->addUsingAlias(InstanceTableMap::COL_NAME, $instance->getName(), Criteria::NOT_EQUAL);
602
+		}
603
+
604
+		return $this;
605
+	}
606
+
607
+	/**
608
+	 * Deletes all rows from the instance table.
609
+	 *
610
+	 * @param ConnectionInterface $con the connection to use
611
+	 * @return int The number of affected rows (if supported by underlying database driver).
612
+	 */
613
+	public function doDeleteAll(ConnectionInterface $con = null)
614
+	{
615
+		if (null === $con) {
616
+			$con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
617
+		}
618
+
619
+		// use transaction because $criteria could contain info
620
+		// for more than one table or we could emulating ON DELETE CASCADE, etc.
621
+		return $con->transaction(function () use ($con) {
622
+			$affectedRows = 0; // initialize var to track total num of affected rows
623
+			$affectedRows += parent::doDeleteAll($con);
624
+			// Because this db requires some delete cascade/set null emulation, we have to
625
+			// clear the cached instance *after* the emulation has happened (since
626
+			// instances get re-added by the select statement contained therein).
627
+			InstanceTableMap::clearInstancePool();
628
+			InstanceTableMap::clearRelatedInstancePool();
629
+
630
+			return $affectedRows;
631
+		});
632
+	}
633
+
634
+	/**
635
+	 * Performs a DELETE on the database based on the current ModelCriteria
636
+	 *
637
+	 * @param ConnectionInterface $con the connection to use
638
+	 * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
639
+	 *                         if supported by native driver or if emulated using Propel.
640
+	 * @throws PropelException Any exceptions caught during processing will be
641
+	 *                         rethrown wrapped into a PropelException.
642
+	 */
643
+	public function delete(ConnectionInterface $con = null)
644
+	{
645
+		if (null === $con) {
646
+			$con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
647
+		}
648
+
649
+		$criteria = $this;
650
+
651
+		// Set the correct dbName
652
+		$criteria->setDbName(InstanceTableMap::DATABASE_NAME);
653
+
654
+		// use transaction because $criteria could contain info
655
+		// for more than one table or we could emulating ON DELETE CASCADE, etc.
656
+		return $con->transaction(function () use ($con, $criteria) {
657
+			$affectedRows = 0; // initialize var to track total num of affected rows
658
+
659
+			InstanceTableMap::removeInstanceFromPool($criteria);
660
+
661
+			$affectedRows += ModelCriteria::delete($con);
662
+			InstanceTableMap::clearRelatedInstancePool();
663
+
664
+			return $affectedRows;
665
+		});
666
+	}
668 667
 
669 668
 } // InstanceQuery
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 
621 621
         // use transaction because $criteria could contain info
622 622
         // for more than one table or we could emulating ON DELETE CASCADE, etc.
623
-        return $con->transaction(function () use ($con) {
623
+        return $con->transaction(function() use ($con) {
624 624
             $affectedRows = 0; // initialize var to track total num of affected rows
625 625
             $affectedRows += parent::doDeleteAll($con);
626 626
             // Because this db requires some delete cascade/set null emulation, we have to
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 
656 656
         // use transaction because $criteria could contain info
657 657
         // for more than one table or we could emulating ON DELETE CASCADE, etc.
658
-        return $con->transaction(function () use ($con, $criteria) {
658
+        return $con->transaction(function() use ($con, $criteria) {
659 659
             $affectedRows = 0; // initialize var to track total num of affected rows
660 660
 
661 661
             UserTableMap::removeInstanceFromPool($criteria);
Please login to merge, or discard this patch.
src/cli/Database/Base/Subscription.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      *
306 306
      * @param  string  $msg
307 307
      * @param  int     $priority One of the Propel::LOG_* logging levels
308
-     * @return boolean
308
+     * @return boolean|null
309 309
      */
310 310
     protected function log($msg, $priority = Propel::LOG_INFO)
311 311
     {
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
      * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1029 1029
      * The default key type is the column's TableMap::TYPE_PHPNAME.
1030 1030
      *
1031
-     * @param mixed $parser A AbstractParser instance,
1031
+     * @param string $parser A AbstractParser instance,
1032 1032
      *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
1033 1033
      * @param string $data The source data to import from
1034 1034
      * @param string $keyType The type of keys the array uses.
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,6 @@
 block discarded – undo
17 17
 use Propel\Runtime\ActiveQuery\Criteria;
18 18
 use Propel\Runtime\ActiveQuery\ModelCriteria;
19 19
 use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
20
-use Propel\Runtime\Collection\Collection;
21 20
 use Propel\Runtime\Connection\ConnectionInterface;
22 21
 use Propel\Runtime\Exception\BadMethodCallException;
23 22
 use Propel\Runtime\Exception\LogicException;
Please login to merge, or discard this patch.
Indentation   +1818 added lines, -1818 removed lines patch added patch discarded remove patch
@@ -35,1842 +35,1842 @@
 block discarded – undo
35 35
 */
36 36
 abstract class Subscription implements ActiveRecordInterface
37 37
 {
38
-    /**
39
-     * TableMap class name
40
-     */
41
-    const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\SubscriptionTableMap';
42
-
43
-
44
-    /**
45
-     * attribute to determine if this object has previously been saved.
46
-     * @var boolean
47
-     */
48
-    protected $new = true;
49
-
50
-    /**
51
-     * attribute to determine whether this object has been deleted.
52
-     * @var boolean
53
-     */
54
-    protected $deleted = false;
55
-
56
-    /**
57
-     * The columns that have been modified in current object.
58
-     * Tracking modified columns allows us to only update modified columns.
59
-     * @var array
60
-     */
61
-    protected $modifiedColumns = array();
62
-
63
-    /**
64
-     * The (virtual) columns that are added at runtime
65
-     * The formatters can add supplementary columns based on a resultset
66
-     * @var array
67
-     */
68
-    protected $virtualColumns = array();
69
-
70
-    /**
71
-     * The value for the id field.
72
-     *
73
-     * @var        int
74
-     */
75
-    protected $id;
76
-
77
-    /**
78
-     * The value for the instance_name field.
79
-     *
80
-     * @var        string
81
-     */
82
-    protected $instance_name;
83
-
84
-    /**
85
-     * The value for the user_id field.
86
-     *
87
-     * @var        int
88
-     */
89
-    protected $user_id;
90
-
91
-    /**
92
-     * The value for the channel_id field.
93
-     *
94
-     * @var        int
95
-     */
96
-    protected $channel_id;
97
-
98
-    /**
99
-     * The value for the subscription_id field.
100
-     *
101
-     * @var        int
102
-     */
103
-    protected $subscription_id;
104
-
105
-    /**
106
-     * The value for the started field.
107
-     *
108
-     * @var        \DateTime
109
-     */
110
-    protected $started;
111
-
112
-    /**
113
-     * The value for the stopped field.
114
-     *
115
-     * @var        \DateTime
116
-     */
117
-    protected $stopped;
118
-
119
-    /**
120
-     * The value for the title field.
121
-     *
122
-     * @var        string
123
-     */
124
-    protected $title;
125
-
126
-    /**
127
-     * The value for the service field.
128
-     *
129
-     * @var        string
130
-     */
131
-    protected $service;
132
-
133
-    /**
134
-     * @var        ChildInstance
135
-     */
136
-    protected $aInstance;
137
-
138
-    /**
139
-     * @var        ChildUser
140
-     */
141
-    protected $aUser;
142
-
143
-    /**
144
-     * @var        ChildChannel
145
-     */
146
-    protected $aChannel;
147
-
148
-    /**
149
-     * Flag to prevent endless save loop, if this object is referenced
150
-     * by another object which falls in this transaction.
151
-     *
152
-     * @var boolean
153
-     */
154
-    protected $alreadyInSave = false;
155
-
156
-    /**
157
-     * Initializes internal state of Jalle19\StatusManager\Database\Base\Subscription object.
158
-     */
159
-    public function __construct()
160
-    {
161
-    }
162
-
163
-    /**
164
-     * Returns whether the object has been modified.
165
-     *
166
-     * @return boolean True if the object has been modified.
167
-     */
168
-    public function isModified()
169
-    {
170
-        return !!$this->modifiedColumns;
171
-    }
172
-
173
-    /**
174
-     * Has specified column been modified?
175
-     *
176
-     * @param  string  $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
177
-     * @return boolean True if $col has been modified.
178
-     */
179
-    public function isColumnModified($col)
180
-    {
181
-        return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
182
-    }
183
-
184
-    /**
185
-     * Get the columns that have been modified in this object.
186
-     * @return array A unique list of the modified column names for this object.
187
-     */
188
-    public function getModifiedColumns()
189
-    {
190
-        return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
191
-    }
192
-
193
-    /**
194
-     * Returns whether the object has ever been saved.  This will
195
-     * be false, if the object was retrieved from storage or was created
196
-     * and then saved.
197
-     *
198
-     * @return boolean true, if the object has never been persisted.
199
-     */
200
-    public function isNew()
201
-    {
202
-        return $this->new;
203
-    }
204
-
205
-    /**
206
-     * Setter for the isNew attribute.  This method will be called
207
-     * by Propel-generated children and objects.
208
-     *
209
-     * @param boolean $b the state of the object.
210
-     */
211
-    public function setNew($b)
212
-    {
213
-        $this->new = (boolean) $b;
214
-    }
215
-
216
-    /**
217
-     * Whether this object has been deleted.
218
-     * @return boolean The deleted state of this object.
219
-     */
220
-    public function isDeleted()
221
-    {
222
-        return $this->deleted;
223
-    }
224
-
225
-    /**
226
-     * Specify whether this object has been deleted.
227
-     * @param  boolean $b The deleted state of this object.
228
-     * @return void
229
-     */
230
-    public function setDeleted($b)
231
-    {
232
-        $this->deleted = (boolean) $b;
233
-    }
234
-
235
-    /**
236
-     * Sets the modified state for the object to be false.
237
-     * @param  string $col If supplied, only the specified column is reset.
238
-     * @return void
239
-     */
240
-    public function resetModified($col = null)
241
-    {
242
-        if (null !== $col) {
243
-            if (isset($this->modifiedColumns[$col])) {
244
-                unset($this->modifiedColumns[$col]);
245
-            }
246
-        } else {
247
-            $this->modifiedColumns = array();
248
-        }
249
-    }
250
-
251
-    /**
252
-     * Compares this with another <code>Subscription</code> instance.  If
253
-     * <code>obj</code> is an instance of <code>Subscription</code>, delegates to
254
-     * <code>equals(Subscription)</code>.  Otherwise, returns <code>false</code>.
255
-     *
256
-     * @param  mixed   $obj The object to compare to.
257
-     * @return boolean Whether equal to the object specified.
258
-     */
259
-    public function equals($obj)
260
-    {
261
-        if (!$obj instanceof static) {
262
-            return false;
263
-        }
264
-
265
-        if ($this === $obj) {
266
-            return true;
267
-        }
268
-
269
-        if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) {
270
-            return false;
271
-        }
272
-
273
-        return $this->getPrimaryKey() === $obj->getPrimaryKey();
274
-    }
275
-
276
-    /**
277
-     * Get the associative array of the virtual columns in this object
278
-     *
279
-     * @return array
280
-     */
281
-    public function getVirtualColumns()
282
-    {
283
-        return $this->virtualColumns;
284
-    }
285
-
286
-    /**
287
-     * Checks the existence of a virtual column in this object
288
-     *
289
-     * @param  string  $name The virtual column name
290
-     * @return boolean
291
-     */
292
-    public function hasVirtualColumn($name)
293
-    {
294
-        return array_key_exists($name, $this->virtualColumns);
295
-    }
296
-
297
-    /**
298
-     * Get the value of a virtual column in this object
299
-     *
300
-     * @param  string $name The virtual column name
301
-     * @return mixed
302
-     *
303
-     * @throws PropelException
304
-     */
305
-    public function getVirtualColumn($name)
306
-    {
307
-        if (!$this->hasVirtualColumn($name)) {
308
-            throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
309
-        }
310
-
311
-        return $this->virtualColumns[$name];
312
-    }
313
-
314
-    /**
315
-     * Set the value of a virtual column in this object
316
-     *
317
-     * @param string $name  The virtual column name
318
-     * @param mixed  $value The value to give to the virtual column
319
-     *
320
-     * @return $this|Subscription The current object, for fluid interface
321
-     */
322
-    public function setVirtualColumn($name, $value)
323
-    {
324
-        $this->virtualColumns[$name] = $value;
325
-
326
-        return $this;
327
-    }
328
-
329
-    /**
330
-     * Logs a message using Propel::log().
331
-     *
332
-     * @param  string  $msg
333
-     * @param  int     $priority One of the Propel::LOG_* logging levels
334
-     * @return boolean
335
-     */
336
-    protected function log($msg, $priority = Propel::LOG_INFO)
337
-    {
338
-        return Propel::log(get_class($this) . ': ' . $msg, $priority);
339
-    }
340
-
341
-    /**
342
-     * Export the current object properties to a string, using a given parser format
343
-     * <code>
344
-     * $book = BookQuery::create()->findPk(9012);
345
-     * echo $book->exportTo('JSON');
346
-     *  => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
347
-     * </code>
348
-     *
349
-     * @param  mixed   $parser                 A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
350
-     * @param  boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
351
-     * @return string  The exported data
352
-     */
353
-    public function exportTo($parser, $includeLazyLoadColumns = true)
354
-    {
355
-        if (!$parser instanceof AbstractParser) {
356
-            $parser = AbstractParser::getParser($parser);
357
-        }
358
-
359
-        return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
360
-    }
361
-
362
-    /**
363
-     * Clean up internal collections prior to serializing
364
-     * Avoids recursive loops that turn into segmentation faults when serializing
365
-     */
366
-    public function __sleep()
367
-    {
368
-        $this->clearAllReferences();
369
-
370
-        $cls = new \ReflectionClass($this);
371
-        $propertyNames = [];
372
-        $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
373
-
374
-        foreach($serializableProperties as $property) {
375
-            $propertyNames[] = $property->getName();
376
-        }
377
-
378
-        return $propertyNames;
379
-    }
380
-
381
-    /**
382
-     * Get the [id] column value.
383
-     *
384
-     * @return int
385
-     */
386
-    public function getId()
387
-    {
388
-        return $this->id;
389
-    }
390
-
391
-    /**
392
-     * Get the [instance_name] column value.
393
-     *
394
-     * @return string
395
-     */
396
-    public function getInstanceName()
397
-    {
398
-        return $this->instance_name;
399
-    }
400
-
401
-    /**
402
-     * Get the [user_id] column value.
403
-     *
404
-     * @return int
405
-     */
406
-    public function getUserId()
407
-    {
408
-        return $this->user_id;
409
-    }
410
-
411
-    /**
412
-     * Get the [channel_id] column value.
413
-     *
414
-     * @return int
415
-     */
416
-    public function getChannelId()
417
-    {
418
-        return $this->channel_id;
419
-    }
420
-
421
-    /**
422
-     * Get the [subscription_id] column value.
423
-     *
424
-     * @return int
425
-     */
426
-    public function getSubscriptionId()
427
-    {
428
-        return $this->subscription_id;
429
-    }
430
-
431
-    /**
432
-     * Get the [optionally formatted] temporal [started] column value.
433
-     *
434
-     *
435
-     * @param      string $format The date/time format string (either date()-style or strftime()-style).
436
-     *                            If format is NULL, then the raw DateTime object will be returned.
437
-     *
438
-     * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
439
-     *
440
-     * @throws PropelException - if unable to parse/validate the date/time value.
441
-     */
442
-    public function getStarted($format = NULL)
443
-    {
444
-        if ($format === null) {
445
-            return $this->started;
446
-        } else {
447
-            return $this->started instanceof \DateTime ? $this->started->format($format) : null;
448
-        }
449
-    }
450
-
451
-    /**
452
-     * Get the [optionally formatted] temporal [stopped] column value.
453
-     *
454
-     *
455
-     * @param      string $format The date/time format string (either date()-style or strftime()-style).
456
-     *                            If format is NULL, then the raw DateTime object will be returned.
457
-     *
458
-     * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
459
-     *
460
-     * @throws PropelException - if unable to parse/validate the date/time value.
461
-     */
462
-    public function getStopped($format = NULL)
463
-    {
464
-        if ($format === null) {
465
-            return $this->stopped;
466
-        } else {
467
-            return $this->stopped instanceof \DateTime ? $this->stopped->format($format) : null;
468
-        }
469
-    }
470
-
471
-    /**
472
-     * Get the [title] column value.
473
-     *
474
-     * @return string
475
-     */
476
-    public function getTitle()
477
-    {
478
-        return $this->title;
479
-    }
480
-
481
-    /**
482
-     * Get the [service] column value.
483
-     *
484
-     * @return string
485
-     */
486
-    public function getService()
487
-    {
488
-        return $this->service;
489
-    }
490
-
491
-    /**
492
-     * Set the value of [id] column.
493
-     *
494
-     * @param int $v new value
495
-     * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
496
-     */
497
-    public function setId($v)
498
-    {
499
-        if ($v !== null) {
500
-            $v = (int) $v;
501
-        }
502
-
503
-        if ($this->id !== $v) {
504
-            $this->id = $v;
505
-            $this->modifiedColumns[SubscriptionTableMap::COL_ID] = true;
506
-        }
507
-
508
-        return $this;
509
-    } // setId()
510
-
511
-    /**
512
-     * Set the value of [instance_name] column.
513
-     *
514
-     * @param string $v new value
515
-     * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
516
-     */
517
-    public function setInstanceName($v)
518
-    {
519
-        if ($v !== null) {
520
-            $v = (string) $v;
521
-        }
522
-
523
-        if ($this->instance_name !== $v) {
524
-            $this->instance_name = $v;
525
-            $this->modifiedColumns[SubscriptionTableMap::COL_INSTANCE_NAME] = true;
526
-        }
527
-
528
-        if ($this->aInstance !== null && $this->aInstance->getName() !== $v) {
529
-            $this->aInstance = null;
530
-        }
531
-
532
-        return $this;
533
-    } // setInstanceName()
534
-
535
-    /**
536
-     * Set the value of [user_id] column.
537
-     *
538
-     * @param int $v new value
539
-     * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
540
-     */
541
-    public function setUserId($v)
542
-    {
543
-        if ($v !== null) {
544
-            $v = (int) $v;
545
-        }
546
-
547
-        if ($this->user_id !== $v) {
548
-            $this->user_id = $v;
549
-            $this->modifiedColumns[SubscriptionTableMap::COL_USER_ID] = true;
550
-        }
551
-
552
-        if ($this->aUser !== null && $this->aUser->getId() !== $v) {
553
-            $this->aUser = null;
554
-        }
555
-
556
-        return $this;
557
-    } // setUserId()
558
-
559
-    /**
560
-     * Set the value of [channel_id] column.
561
-     *
562
-     * @param int $v new value
563
-     * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
564
-     */
565
-    public function setChannelId($v)
566
-    {
567
-        if ($v !== null) {
568
-            $v = (int) $v;
569
-        }
570
-
571
-        if ($this->channel_id !== $v) {
572
-            $this->channel_id = $v;
573
-            $this->modifiedColumns[SubscriptionTableMap::COL_CHANNEL_ID] = true;
574
-        }
575
-
576
-        if ($this->aChannel !== null && $this->aChannel->getId() !== $v) {
577
-            $this->aChannel = null;
578
-        }
579
-
580
-        return $this;
581
-    } // setChannelId()
582
-
583
-    /**
584
-     * Set the value of [subscription_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 setSubscriptionId($v)
590
-    {
591
-        if ($v !== null) {
592
-            $v = (int) $v;
593
-        }
594
-
595
-        if ($this->subscription_id !== $v) {
596
-            $this->subscription_id = $v;
597
-            $this->modifiedColumns[SubscriptionTableMap::COL_SUBSCRIPTION_ID] = true;
598
-        }
599
-
600
-        return $this;
601
-    } // setSubscriptionId()
602
-
603
-    /**
604
-     * Sets the value of [started] column to a normalized version of the date/time value specified.
605
-     *
606
-     * @param  mixed $v string, integer (timestamp), or \DateTime value.
607
-     *               Empty strings are treated as NULL.
608
-     * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
609
-     */
610
-    public function setStarted($v)
611
-    {
612
-        $dt = PropelDateTime::newInstance($v, null, 'DateTime');
613
-        if ($this->started !== null || $dt !== null) {
614
-            if ($this->started === null || $dt === null || $dt->format("Y-m-d H:i:s") !== $this->started->format("Y-m-d H:i:s")) {
615
-                $this->started = $dt === null ? null : clone $dt;
616
-                $this->modifiedColumns[SubscriptionTableMap::COL_STARTED] = true;
617
-            }
618
-        } // if either are not null
619
-
620
-        return $this;
621
-    } // setStarted()
622
-
623
-    /**
624
-     * Sets the value of [stopped] column to a normalized version of the date/time value specified.
625
-     *
626
-     * @param  mixed $v string, integer (timestamp), or \DateTime value.
627
-     *               Empty strings are treated as NULL.
628
-     * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
629
-     */
630
-    public function setStopped($v)
631
-    {
632
-        $dt = PropelDateTime::newInstance($v, null, 'DateTime');
633
-        if ($this->stopped !== null || $dt !== null) {
634
-            if ($this->stopped === null || $dt === null || $dt->format("Y-m-d H:i:s") !== $this->stopped->format("Y-m-d H:i:s")) {
635
-                $this->stopped = $dt === null ? null : clone $dt;
636
-                $this->modifiedColumns[SubscriptionTableMap::COL_STOPPED] = true;
637
-            }
638
-        } // if either are not null
639
-
640
-        return $this;
641
-    } // setStopped()
642
-
643
-    /**
644
-     * Set the value of [title] column.
645
-     *
646
-     * @param string $v new value
647
-     * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
648
-     */
649
-    public function setTitle($v)
650
-    {
651
-        if ($v !== null) {
652
-            $v = (string) $v;
653
-        }
654
-
655
-        if ($this->title !== $v) {
656
-            $this->title = $v;
657
-            $this->modifiedColumns[SubscriptionTableMap::COL_TITLE] = true;
658
-        }
659
-
660
-        return $this;
661
-    } // setTitle()
662
-
663
-    /**
664
-     * Set the value of [service] column.
665
-     *
666
-     * @param string $v new value
667
-     * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
668
-     */
669
-    public function setService($v)
670
-    {
671
-        if ($v !== null) {
672
-            $v = (string) $v;
673
-        }
674
-
675
-        if ($this->service !== $v) {
676
-            $this->service = $v;
677
-            $this->modifiedColumns[SubscriptionTableMap::COL_SERVICE] = true;
678
-        }
679
-
680
-        return $this;
681
-    } // setService()
682
-
683
-    /**
684
-     * Indicates whether the columns in this object are only set to default values.
685
-     *
686
-     * This method can be used in conjunction with isModified() to indicate whether an object is both
687
-     * modified _and_ has some values set which are non-default.
688
-     *
689
-     * @return boolean Whether the columns in this object are only been set with default values.
690
-     */
691
-    public function hasOnlyDefaultValues()
692
-    {
693
-        // otherwise, everything was equal, so return TRUE
694
-        return true;
695
-    } // hasOnlyDefaultValues()
696
-
697
-    /**
698
-     * Hydrates (populates) the object variables with values from the database resultset.
699
-     *
700
-     * An offset (0-based "start column") is specified so that objects can be hydrated
701
-     * with a subset of the columns in the resultset rows.  This is needed, for example,
702
-     * for results of JOIN queries where the resultset row includes columns from two or
703
-     * more tables.
704
-     *
705
-     * @param array   $row       The row returned by DataFetcher->fetch().
706
-     * @param int     $startcol  0-based offset column which indicates which restultset column to start with.
707
-     * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
708
-     * @param string  $indexType The index type of $row. Mostly DataFetcher->getIndexType().
38
+	/**
39
+	 * TableMap class name
40
+	 */
41
+	const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\SubscriptionTableMap';
42
+
43
+
44
+	/**
45
+	 * attribute to determine if this object has previously been saved.
46
+	 * @var boolean
47
+	 */
48
+	protected $new = true;
49
+
50
+	/**
51
+	 * attribute to determine whether this object has been deleted.
52
+	 * @var boolean
53
+	 */
54
+	protected $deleted = false;
55
+
56
+	/**
57
+	 * The columns that have been modified in current object.
58
+	 * Tracking modified columns allows us to only update modified columns.
59
+	 * @var array
60
+	 */
61
+	protected $modifiedColumns = array();
62
+
63
+	/**
64
+	 * The (virtual) columns that are added at runtime
65
+	 * The formatters can add supplementary columns based on a resultset
66
+	 * @var array
67
+	 */
68
+	protected $virtualColumns = array();
69
+
70
+	/**
71
+	 * The value for the id field.
72
+	 *
73
+	 * @var        int
74
+	 */
75
+	protected $id;
76
+
77
+	/**
78
+	 * The value for the instance_name field.
79
+	 *
80
+	 * @var        string
81
+	 */
82
+	protected $instance_name;
83
+
84
+	/**
85
+	 * The value for the user_id field.
86
+	 *
87
+	 * @var        int
88
+	 */
89
+	protected $user_id;
90
+
91
+	/**
92
+	 * The value for the channel_id field.
93
+	 *
94
+	 * @var        int
95
+	 */
96
+	protected $channel_id;
97
+
98
+	/**
99
+	 * The value for the subscription_id field.
100
+	 *
101
+	 * @var        int
102
+	 */
103
+	protected $subscription_id;
104
+
105
+	/**
106
+	 * The value for the started field.
107
+	 *
108
+	 * @var        \DateTime
109
+	 */
110
+	protected $started;
111
+
112
+	/**
113
+	 * The value for the stopped field.
114
+	 *
115
+	 * @var        \DateTime
116
+	 */
117
+	protected $stopped;
118
+
119
+	/**
120
+	 * The value for the title field.
121
+	 *
122
+	 * @var        string
123
+	 */
124
+	protected $title;
125
+
126
+	/**
127
+	 * The value for the service field.
128
+	 *
129
+	 * @var        string
130
+	 */
131
+	protected $service;
132
+
133
+	/**
134
+	 * @var        ChildInstance
135
+	 */
136
+	protected $aInstance;
137
+
138
+	/**
139
+	 * @var        ChildUser
140
+	 */
141
+	protected $aUser;
142
+
143
+	/**
144
+	 * @var        ChildChannel
145
+	 */
146
+	protected $aChannel;
147
+
148
+	/**
149
+	 * Flag to prevent endless save loop, if this object is referenced
150
+	 * by another object which falls in this transaction.
151
+	 *
152
+	 * @var boolean
153
+	 */
154
+	protected $alreadyInSave = false;
155
+
156
+	/**
157
+	 * Initializes internal state of Jalle19\StatusManager\Database\Base\Subscription object.
158
+	 */
159
+	public function __construct()
160
+	{
161
+	}
162
+
163
+	/**
164
+	 * Returns whether the object has been modified.
165
+	 *
166
+	 * @return boolean True if the object has been modified.
167
+	 */
168
+	public function isModified()
169
+	{
170
+		return !!$this->modifiedColumns;
171
+	}
172
+
173
+	/**
174
+	 * Has specified column been modified?
175
+	 *
176
+	 * @param  string  $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID
177
+	 * @return boolean True if $col has been modified.
178
+	 */
179
+	public function isColumnModified($col)
180
+	{
181
+		return $this->modifiedColumns && isset($this->modifiedColumns[$col]);
182
+	}
183
+
184
+	/**
185
+	 * Get the columns that have been modified in this object.
186
+	 * @return array A unique list of the modified column names for this object.
187
+	 */
188
+	public function getModifiedColumns()
189
+	{
190
+		return $this->modifiedColumns ? array_keys($this->modifiedColumns) : [];
191
+	}
192
+
193
+	/**
194
+	 * Returns whether the object has ever been saved.  This will
195
+	 * be false, if the object was retrieved from storage or was created
196
+	 * and then saved.
197
+	 *
198
+	 * @return boolean true, if the object has never been persisted.
199
+	 */
200
+	public function isNew()
201
+	{
202
+		return $this->new;
203
+	}
204
+
205
+	/**
206
+	 * Setter for the isNew attribute.  This method will be called
207
+	 * by Propel-generated children and objects.
208
+	 *
209
+	 * @param boolean $b the state of the object.
210
+	 */
211
+	public function setNew($b)
212
+	{
213
+		$this->new = (boolean) $b;
214
+	}
215
+
216
+	/**
217
+	 * Whether this object has been deleted.
218
+	 * @return boolean The deleted state of this object.
219
+	 */
220
+	public function isDeleted()
221
+	{
222
+		return $this->deleted;
223
+	}
224
+
225
+	/**
226
+	 * Specify whether this object has been deleted.
227
+	 * @param  boolean $b The deleted state of this object.
228
+	 * @return void
229
+	 */
230
+	public function setDeleted($b)
231
+	{
232
+		$this->deleted = (boolean) $b;
233
+	}
234
+
235
+	/**
236
+	 * Sets the modified state for the object to be false.
237
+	 * @param  string $col If supplied, only the specified column is reset.
238
+	 * @return void
239
+	 */
240
+	public function resetModified($col = null)
241
+	{
242
+		if (null !== $col) {
243
+			if (isset($this->modifiedColumns[$col])) {
244
+				unset($this->modifiedColumns[$col]);
245
+			}
246
+		} else {
247
+			$this->modifiedColumns = array();
248
+		}
249
+	}
250
+
251
+	/**
252
+	 * Compares this with another <code>Subscription</code> instance.  If
253
+	 * <code>obj</code> is an instance of <code>Subscription</code>, delegates to
254
+	 * <code>equals(Subscription)</code>.  Otherwise, returns <code>false</code>.
255
+	 *
256
+	 * @param  mixed   $obj The object to compare to.
257
+	 * @return boolean Whether equal to the object specified.
258
+	 */
259
+	public function equals($obj)
260
+	{
261
+		if (!$obj instanceof static) {
262
+			return false;
263
+		}
264
+
265
+		if ($this === $obj) {
266
+			return true;
267
+		}
268
+
269
+		if (null === $this->getPrimaryKey() || null === $obj->getPrimaryKey()) {
270
+			return false;
271
+		}
272
+
273
+		return $this->getPrimaryKey() === $obj->getPrimaryKey();
274
+	}
275
+
276
+	/**
277
+	 * Get the associative array of the virtual columns in this object
278
+	 *
279
+	 * @return array
280
+	 */
281
+	public function getVirtualColumns()
282
+	{
283
+		return $this->virtualColumns;
284
+	}
285
+
286
+	/**
287
+	 * Checks the existence of a virtual column in this object
288
+	 *
289
+	 * @param  string  $name The virtual column name
290
+	 * @return boolean
291
+	 */
292
+	public function hasVirtualColumn($name)
293
+	{
294
+		return array_key_exists($name, $this->virtualColumns);
295
+	}
296
+
297
+	/**
298
+	 * Get the value of a virtual column in this object
299
+	 *
300
+	 * @param  string $name The virtual column name
301
+	 * @return mixed
302
+	 *
303
+	 * @throws PropelException
304
+	 */
305
+	public function getVirtualColumn($name)
306
+	{
307
+		if (!$this->hasVirtualColumn($name)) {
308
+			throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name));
309
+		}
310
+
311
+		return $this->virtualColumns[$name];
312
+	}
313
+
314
+	/**
315
+	 * Set the value of a virtual column in this object
316
+	 *
317
+	 * @param string $name  The virtual column name
318
+	 * @param mixed  $value The value to give to the virtual column
319
+	 *
320
+	 * @return $this|Subscription The current object, for fluid interface
321
+	 */
322
+	public function setVirtualColumn($name, $value)
323
+	{
324
+		$this->virtualColumns[$name] = $value;
325
+
326
+		return $this;
327
+	}
328
+
329
+	/**
330
+	 * Logs a message using Propel::log().
331
+	 *
332
+	 * @param  string  $msg
333
+	 * @param  int     $priority One of the Propel::LOG_* logging levels
334
+	 * @return boolean
335
+	 */
336
+	protected function log($msg, $priority = Propel::LOG_INFO)
337
+	{
338
+		return Propel::log(get_class($this) . ': ' . $msg, $priority);
339
+	}
340
+
341
+	/**
342
+	 * Export the current object properties to a string, using a given parser format
343
+	 * <code>
344
+	 * $book = BookQuery::create()->findPk(9012);
345
+	 * echo $book->exportTo('JSON');
346
+	 *  => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
347
+	 * </code>
348
+	 *
349
+	 * @param  mixed   $parser                 A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
350
+	 * @param  boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.
351
+	 * @return string  The exported data
352
+	 */
353
+	public function exportTo($parser, $includeLazyLoadColumns = true)
354
+	{
355
+		if (!$parser instanceof AbstractParser) {
356
+			$parser = AbstractParser::getParser($parser);
357
+		}
358
+
359
+		return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true));
360
+	}
361
+
362
+	/**
363
+	 * Clean up internal collections prior to serializing
364
+	 * Avoids recursive loops that turn into segmentation faults when serializing
365
+	 */
366
+	public function __sleep()
367
+	{
368
+		$this->clearAllReferences();
369
+
370
+		$cls = new \ReflectionClass($this);
371
+		$propertyNames = [];
372
+		$serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
373
+
374
+		foreach($serializableProperties as $property) {
375
+			$propertyNames[] = $property->getName();
376
+		}
377
+
378
+		return $propertyNames;
379
+	}
380
+
381
+	/**
382
+	 * Get the [id] column value.
383
+	 *
384
+	 * @return int
385
+	 */
386
+	public function getId()
387
+	{
388
+		return $this->id;
389
+	}
390
+
391
+	/**
392
+	 * Get the [instance_name] column value.
393
+	 *
394
+	 * @return string
395
+	 */
396
+	public function getInstanceName()
397
+	{
398
+		return $this->instance_name;
399
+	}
400
+
401
+	/**
402
+	 * Get the [user_id] column value.
403
+	 *
404
+	 * @return int
405
+	 */
406
+	public function getUserId()
407
+	{
408
+		return $this->user_id;
409
+	}
410
+
411
+	/**
412
+	 * Get the [channel_id] column value.
413
+	 *
414
+	 * @return int
415
+	 */
416
+	public function getChannelId()
417
+	{
418
+		return $this->channel_id;
419
+	}
420
+
421
+	/**
422
+	 * Get the [subscription_id] column value.
423
+	 *
424
+	 * @return int
425
+	 */
426
+	public function getSubscriptionId()
427
+	{
428
+		return $this->subscription_id;
429
+	}
430
+
431
+	/**
432
+	 * Get the [optionally formatted] temporal [started] column value.
433
+	 *
434
+	 *
435
+	 * @param      string $format The date/time format string (either date()-style or strftime()-style).
436
+	 *                            If format is NULL, then the raw DateTime object will be returned.
437
+	 *
438
+	 * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
439
+	 *
440
+	 * @throws PropelException - if unable to parse/validate the date/time value.
441
+	 */
442
+	public function getStarted($format = NULL)
443
+	{
444
+		if ($format === null) {
445
+			return $this->started;
446
+		} else {
447
+			return $this->started instanceof \DateTime ? $this->started->format($format) : null;
448
+		}
449
+	}
450
+
451
+	/**
452
+	 * Get the [optionally formatted] temporal [stopped] column value.
453
+	 *
454
+	 *
455
+	 * @param      string $format The date/time format string (either date()-style or strftime()-style).
456
+	 *                            If format is NULL, then the raw DateTime object will be returned.
457
+	 *
458
+	 * @return string|DateTime Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
459
+	 *
460
+	 * @throws PropelException - if unable to parse/validate the date/time value.
461
+	 */
462
+	public function getStopped($format = NULL)
463
+	{
464
+		if ($format === null) {
465
+			return $this->stopped;
466
+		} else {
467
+			return $this->stopped instanceof \DateTime ? $this->stopped->format($format) : null;
468
+		}
469
+	}
470
+
471
+	/**
472
+	 * Get the [title] column value.
473
+	 *
474
+	 * @return string
475
+	 */
476
+	public function getTitle()
477
+	{
478
+		return $this->title;
479
+	}
480
+
481
+	/**
482
+	 * Get the [service] column value.
483
+	 *
484
+	 * @return string
485
+	 */
486
+	public function getService()
487
+	{
488
+		return $this->service;
489
+	}
490
+
491
+	/**
492
+	 * Set the value of [id] column.
493
+	 *
494
+	 * @param int $v new value
495
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
496
+	 */
497
+	public function setId($v)
498
+	{
499
+		if ($v !== null) {
500
+			$v = (int) $v;
501
+		}
502
+
503
+		if ($this->id !== $v) {
504
+			$this->id = $v;
505
+			$this->modifiedColumns[SubscriptionTableMap::COL_ID] = true;
506
+		}
507
+
508
+		return $this;
509
+	} // setId()
510
+
511
+	/**
512
+	 * Set the value of [instance_name] column.
513
+	 *
514
+	 * @param string $v new value
515
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
516
+	 */
517
+	public function setInstanceName($v)
518
+	{
519
+		if ($v !== null) {
520
+			$v = (string) $v;
521
+		}
522
+
523
+		if ($this->instance_name !== $v) {
524
+			$this->instance_name = $v;
525
+			$this->modifiedColumns[SubscriptionTableMap::COL_INSTANCE_NAME] = true;
526
+		}
527
+
528
+		if ($this->aInstance !== null && $this->aInstance->getName() !== $v) {
529
+			$this->aInstance = null;
530
+		}
531
+
532
+		return $this;
533
+	} // setInstanceName()
534
+
535
+	/**
536
+	 * Set the value of [user_id] column.
537
+	 *
538
+	 * @param int $v new value
539
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
540
+	 */
541
+	public function setUserId($v)
542
+	{
543
+		if ($v !== null) {
544
+			$v = (int) $v;
545
+		}
546
+
547
+		if ($this->user_id !== $v) {
548
+			$this->user_id = $v;
549
+			$this->modifiedColumns[SubscriptionTableMap::COL_USER_ID] = true;
550
+		}
551
+
552
+		if ($this->aUser !== null && $this->aUser->getId() !== $v) {
553
+			$this->aUser = null;
554
+		}
555
+
556
+		return $this;
557
+	} // setUserId()
558
+
559
+	/**
560
+	 * Set the value of [channel_id] column.
561
+	 *
562
+	 * @param int $v new value
563
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
564
+	 */
565
+	public function setChannelId($v)
566
+	{
567
+		if ($v !== null) {
568
+			$v = (int) $v;
569
+		}
570
+
571
+		if ($this->channel_id !== $v) {
572
+			$this->channel_id = $v;
573
+			$this->modifiedColumns[SubscriptionTableMap::COL_CHANNEL_ID] = true;
574
+		}
575
+
576
+		if ($this->aChannel !== null && $this->aChannel->getId() !== $v) {
577
+			$this->aChannel = null;
578
+		}
579
+
580
+		return $this;
581
+	} // setChannelId()
582
+
583
+	/**
584
+	 * Set the value of [subscription_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 setSubscriptionId($v)
590
+	{
591
+		if ($v !== null) {
592
+			$v = (int) $v;
593
+		}
594
+
595
+		if ($this->subscription_id !== $v) {
596
+			$this->subscription_id = $v;
597
+			$this->modifiedColumns[SubscriptionTableMap::COL_SUBSCRIPTION_ID] = true;
598
+		}
599
+
600
+		return $this;
601
+	} // setSubscriptionId()
602
+
603
+	/**
604
+	 * Sets the value of [started] column to a normalized version of the date/time value specified.
605
+	 *
606
+	 * @param  mixed $v string, integer (timestamp), or \DateTime value.
607
+	 *               Empty strings are treated as NULL.
608
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
609
+	 */
610
+	public function setStarted($v)
611
+	{
612
+		$dt = PropelDateTime::newInstance($v, null, 'DateTime');
613
+		if ($this->started !== null || $dt !== null) {
614
+			if ($this->started === null || $dt === null || $dt->format("Y-m-d H:i:s") !== $this->started->format("Y-m-d H:i:s")) {
615
+				$this->started = $dt === null ? null : clone $dt;
616
+				$this->modifiedColumns[SubscriptionTableMap::COL_STARTED] = true;
617
+			}
618
+		} // if either are not null
619
+
620
+		return $this;
621
+	} // setStarted()
622
+
623
+	/**
624
+	 * Sets the value of [stopped] column to a normalized version of the date/time value specified.
625
+	 *
626
+	 * @param  mixed $v string, integer (timestamp), or \DateTime value.
627
+	 *               Empty strings are treated as NULL.
628
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
629
+	 */
630
+	public function setStopped($v)
631
+	{
632
+		$dt = PropelDateTime::newInstance($v, null, 'DateTime');
633
+		if ($this->stopped !== null || $dt !== null) {
634
+			if ($this->stopped === null || $dt === null || $dt->format("Y-m-d H:i:s") !== $this->stopped->format("Y-m-d H:i:s")) {
635
+				$this->stopped = $dt === null ? null : clone $dt;
636
+				$this->modifiedColumns[SubscriptionTableMap::COL_STOPPED] = true;
637
+			}
638
+		} // if either are not null
639
+
640
+		return $this;
641
+	} // setStopped()
642
+
643
+	/**
644
+	 * Set the value of [title] column.
645
+	 *
646
+	 * @param string $v new value
647
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
648
+	 */
649
+	public function setTitle($v)
650
+	{
651
+		if ($v !== null) {
652
+			$v = (string) $v;
653
+		}
654
+
655
+		if ($this->title !== $v) {
656
+			$this->title = $v;
657
+			$this->modifiedColumns[SubscriptionTableMap::COL_TITLE] = true;
658
+		}
659
+
660
+		return $this;
661
+	} // setTitle()
662
+
663
+	/**
664
+	 * Set the value of [service] column.
665
+	 *
666
+	 * @param string $v new value
667
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
668
+	 */
669
+	public function setService($v)
670
+	{
671
+		if ($v !== null) {
672
+			$v = (string) $v;
673
+		}
674
+
675
+		if ($this->service !== $v) {
676
+			$this->service = $v;
677
+			$this->modifiedColumns[SubscriptionTableMap::COL_SERVICE] = true;
678
+		}
679
+
680
+		return $this;
681
+	} // setService()
682
+
683
+	/**
684
+	 * Indicates whether the columns in this object are only set to default values.
685
+	 *
686
+	 * This method can be used in conjunction with isModified() to indicate whether an object is both
687
+	 * modified _and_ has some values set which are non-default.
688
+	 *
689
+	 * @return boolean Whether the columns in this object are only been set with default values.
690
+	 */
691
+	public function hasOnlyDefaultValues()
692
+	{
693
+		// otherwise, everything was equal, so return TRUE
694
+		return true;
695
+	} // hasOnlyDefaultValues()
696
+
697
+	/**
698
+	 * Hydrates (populates) the object variables with values from the database resultset.
699
+	 *
700
+	 * An offset (0-based "start column") is specified so that objects can be hydrated
701
+	 * with a subset of the columns in the resultset rows.  This is needed, for example,
702
+	 * for results of JOIN queries where the resultset row includes columns from two or
703
+	 * more tables.
704
+	 *
705
+	 * @param array   $row       The row returned by DataFetcher->fetch().
706
+	 * @param int     $startcol  0-based offset column which indicates which restultset column to start with.
707
+	 * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
708
+	 * @param string  $indexType The index type of $row. Mostly DataFetcher->getIndexType().
709 709
                                   One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
710
-     *                            TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
711
-     *
712
-     * @return int             next starting column
713
-     * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
714
-     */
715
-    public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
716
-    {
717
-        try {
718
-
719
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : SubscriptionTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
720
-            $this->id = (null !== $col) ? (int) $col : null;
721
-
722
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : SubscriptionTableMap::translateFieldName('InstanceName', TableMap::TYPE_PHPNAME, $indexType)];
723
-            $this->instance_name = (null !== $col) ? (string) $col : null;
724
-
725
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : SubscriptionTableMap::translateFieldName('UserId', TableMap::TYPE_PHPNAME, $indexType)];
726
-            $this->user_id = (null !== $col) ? (int) $col : null;
727
-
728
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : SubscriptionTableMap::translateFieldName('ChannelId', TableMap::TYPE_PHPNAME, $indexType)];
729
-            $this->channel_id = (null !== $col) ? (int) $col : null;
730
-
731
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : SubscriptionTableMap::translateFieldName('SubscriptionId', TableMap::TYPE_PHPNAME, $indexType)];
732
-            $this->subscription_id = (null !== $col) ? (int) $col : null;
733
-
734
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : SubscriptionTableMap::translateFieldName('Started', TableMap::TYPE_PHPNAME, $indexType)];
735
-            $this->started = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null;
736
-
737
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : SubscriptionTableMap::translateFieldName('Stopped', TableMap::TYPE_PHPNAME, $indexType)];
738
-            $this->stopped = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null;
739
-
740
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : SubscriptionTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
741
-            $this->title = (null !== $col) ? (string) $col : null;
742
-
743
-            $col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : SubscriptionTableMap::translateFieldName('Service', TableMap::TYPE_PHPNAME, $indexType)];
744
-            $this->service = (null !== $col) ? (string) $col : null;
745
-            $this->resetModified();
746
-
747
-            $this->setNew(false);
748
-
749
-            if ($rehydrate) {
750
-                $this->ensureConsistency();
751
-            }
752
-
753
-            return $startcol + 9; // 9 = SubscriptionTableMap::NUM_HYDRATE_COLUMNS.
754
-
755
-        } catch (Exception $e) {
756
-            throw new PropelException(sprintf('Error populating %s object', '\\Jalle19\\StatusManager\\Database\\Subscription'), 0, $e);
757
-        }
758
-    }
759
-
760
-    /**
761
-     * Checks and repairs the internal consistency of the object.
762
-     *
763
-     * This method is executed after an already-instantiated object is re-hydrated
764
-     * from the database.  It exists to check any foreign keys to make sure that
765
-     * the objects related to the current object are correct based on foreign key.
766
-     *
767
-     * You can override this method in the stub class, but you should always invoke
768
-     * the base method from the overridden method (i.e. parent::ensureConsistency()),
769
-     * in case your model changes.
770
-     *
771
-     * @throws PropelException
772
-     */
773
-    public function ensureConsistency()
774
-    {
775
-        if ($this->aInstance !== null && $this->instance_name !== $this->aInstance->getName()) {
776
-            $this->aInstance = null;
777
-        }
778
-        if ($this->aUser !== null && $this->user_id !== $this->aUser->getId()) {
779
-            $this->aUser = null;
780
-        }
781
-        if ($this->aChannel !== null && $this->channel_id !== $this->aChannel->getId()) {
782
-            $this->aChannel = null;
783
-        }
784
-    } // ensureConsistency
785
-
786
-    /**
787
-     * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
788
-     *
789
-     * This will only work if the object has been saved and has a valid primary key set.
790
-     *
791
-     * @param      boolean $deep (optional) Whether to also de-associated any related objects.
792
-     * @param      ConnectionInterface $con (optional) The ConnectionInterface connection to use.
793
-     * @return void
794
-     * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
795
-     */
796
-    public function reload($deep = false, ConnectionInterface $con = null)
797
-    {
798
-        if ($this->isDeleted()) {
799
-            throw new PropelException("Cannot reload a deleted object.");
800
-        }
801
-
802
-        if ($this->isNew()) {
803
-            throw new PropelException("Cannot reload an unsaved object.");
804
-        }
805
-
806
-        if ($con === null) {
807
-            $con = Propel::getServiceContainer()->getReadConnection(SubscriptionTableMap::DATABASE_NAME);
808
-        }
809
-
810
-        // We don't need to alter the object instance pool; we're just modifying this instance
811
-        // already in the pool.
812
-
813
-        $dataFetcher = ChildSubscriptionQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
814
-        $row = $dataFetcher->fetch();
815
-        $dataFetcher->close();
816
-        if (!$row) {
817
-            throw new PropelException('Cannot find matching row in the database to reload object values.');
818
-        }
819
-        $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
820
-
821
-        if ($deep) {  // also de-associate any related objects?
822
-
823
-            $this->aInstance = null;
824
-            $this->aUser = null;
825
-            $this->aChannel = null;
826
-        } // if (deep)
827
-    }
828
-
829
-    /**
830
-     * Removes this object from datastore and sets delete attribute.
831
-     *
832
-     * @param      ConnectionInterface $con
833
-     * @return void
834
-     * @throws PropelException
835
-     * @see Subscription::setDeleted()
836
-     * @see Subscription::isDeleted()
837
-     */
838
-    public function delete(ConnectionInterface $con = null)
839
-    {
840
-        if ($this->isDeleted()) {
841
-            throw new PropelException("This object has already been deleted.");
842
-        }
843
-
844
-        if ($con === null) {
845
-            $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
846
-        }
847
-
848
-        $con->transaction(function () use ($con) {
849
-            $deleteQuery = ChildSubscriptionQuery::create()
850
-                ->filterByPrimaryKey($this->getPrimaryKey());
851
-            $ret = $this->preDelete($con);
852
-            if ($ret) {
853
-                $deleteQuery->delete($con);
854
-                $this->postDelete($con);
855
-                $this->setDeleted(true);
856
-            }
857
-        });
858
-    }
859
-
860
-    /**
861
-     * Persists this object to the database.
862
-     *
863
-     * If the object is new, it inserts it; otherwise an update is performed.
864
-     * All modified related objects will also be persisted in the doSave()
865
-     * method.  This method wraps all precipitate database operations in a
866
-     * single transaction.
867
-     *
868
-     * @param      ConnectionInterface $con
869
-     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
870
-     * @throws PropelException
871
-     * @see doSave()
872
-     */
873
-    public function save(ConnectionInterface $con = null)
874
-    {
875
-        if ($this->isDeleted()) {
876
-            throw new PropelException("You cannot save an object that has been deleted.");
877
-        }
878
-
879
-        if ($con === null) {
880
-            $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
881
-        }
882
-
883
-        return $con->transaction(function () use ($con) {
884
-            $isInsert = $this->isNew();
885
-            $ret = $this->preSave($con);
886
-            if ($isInsert) {
887
-                $ret = $ret && $this->preInsert($con);
888
-            } else {
889
-                $ret = $ret && $this->preUpdate($con);
890
-            }
891
-            if ($ret) {
892
-                $affectedRows = $this->doSave($con);
893
-                if ($isInsert) {
894
-                    $this->postInsert($con);
895
-                } else {
896
-                    $this->postUpdate($con);
897
-                }
898
-                $this->postSave($con);
899
-                SubscriptionTableMap::addInstanceToPool($this);
900
-            } else {
901
-                $affectedRows = 0;
902
-            }
903
-
904
-            return $affectedRows;
905
-        });
906
-    }
907
-
908
-    /**
909
-     * Performs the work of inserting or updating the row in the database.
910
-     *
911
-     * If the object is new, it inserts it; otherwise an update is performed.
912
-     * All related objects are also updated in this method.
913
-     *
914
-     * @param      ConnectionInterface $con
915
-     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
916
-     * @throws PropelException
917
-     * @see save()
918
-     */
919
-    protected function doSave(ConnectionInterface $con)
920
-    {
921
-        $affectedRows = 0; // initialize var to track total num of affected rows
922
-        if (!$this->alreadyInSave) {
923
-            $this->alreadyInSave = true;
924
-
925
-            // We call the save method on the following object(s) if they
926
-            // were passed to this object by their corresponding set
927
-            // method.  This object relates to these object(s) by a
928
-            // foreign key reference.
929
-
930
-            if ($this->aInstance !== null) {
931
-                if ($this->aInstance->isModified() || $this->aInstance->isNew()) {
932
-                    $affectedRows += $this->aInstance->save($con);
933
-                }
934
-                $this->setInstance($this->aInstance);
935
-            }
936
-
937
-            if ($this->aUser !== null) {
938
-                if ($this->aUser->isModified() || $this->aUser->isNew()) {
939
-                    $affectedRows += $this->aUser->save($con);
940
-                }
941
-                $this->setUser($this->aUser);
942
-            }
943
-
944
-            if ($this->aChannel !== null) {
945
-                if ($this->aChannel->isModified() || $this->aChannel->isNew()) {
946
-                    $affectedRows += $this->aChannel->save($con);
947
-                }
948
-                $this->setChannel($this->aChannel);
949
-            }
950
-
951
-            if ($this->isNew() || $this->isModified()) {
952
-                // persist changes
953
-                if ($this->isNew()) {
954
-                    $this->doInsert($con);
955
-                    $affectedRows += 1;
956
-                } else {
957
-                    $affectedRows += $this->doUpdate($con);
958
-                }
959
-                $this->resetModified();
960
-            }
961
-
962
-            $this->alreadyInSave = false;
963
-
964
-        }
965
-
966
-        return $affectedRows;
967
-    } // doSave()
968
-
969
-    /**
970
-     * Insert the row in the database.
971
-     *
972
-     * @param      ConnectionInterface $con
973
-     *
974
-     * @throws PropelException
975
-     * @see doSave()
976
-     */
977
-    protected function doInsert(ConnectionInterface $con)
978
-    {
979
-        $modifiedColumns = array();
980
-        $index = 0;
981
-
982
-        $this->modifiedColumns[SubscriptionTableMap::COL_ID] = true;
983
-        if (null !== $this->id) {
984
-            throw new PropelException('Cannot insert a value for auto-increment primary key (' . SubscriptionTableMap::COL_ID . ')');
985
-        }
986
-
987
-         // check the columns in natural order for more readable SQL queries
988
-        if ($this->isColumnModified(SubscriptionTableMap::COL_ID)) {
989
-            $modifiedColumns[':p' . $index++]  = 'id';
990
-        }
991
-        if ($this->isColumnModified(SubscriptionTableMap::COL_INSTANCE_NAME)) {
992
-            $modifiedColumns[':p' . $index++]  = 'instance_name';
993
-        }
994
-        if ($this->isColumnModified(SubscriptionTableMap::COL_USER_ID)) {
995
-            $modifiedColumns[':p' . $index++]  = 'user_id';
996
-        }
997
-        if ($this->isColumnModified(SubscriptionTableMap::COL_CHANNEL_ID)) {
998
-            $modifiedColumns[':p' . $index++]  = 'channel_id';
999
-        }
1000
-        if ($this->isColumnModified(SubscriptionTableMap::COL_SUBSCRIPTION_ID)) {
1001
-            $modifiedColumns[':p' . $index++]  = 'subscription_id';
1002
-        }
1003
-        if ($this->isColumnModified(SubscriptionTableMap::COL_STARTED)) {
1004
-            $modifiedColumns[':p' . $index++]  = 'started';
1005
-        }
1006
-        if ($this->isColumnModified(SubscriptionTableMap::COL_STOPPED)) {
1007
-            $modifiedColumns[':p' . $index++]  = 'stopped';
1008
-        }
1009
-        if ($this->isColumnModified(SubscriptionTableMap::COL_TITLE)) {
1010
-            $modifiedColumns[':p' . $index++]  = 'title';
1011
-        }
1012
-        if ($this->isColumnModified(SubscriptionTableMap::COL_SERVICE)) {
1013
-            $modifiedColumns[':p' . $index++]  = 'service';
1014
-        }
1015
-
1016
-        $sql = sprintf(
1017
-            'INSERT INTO subscription (%s) VALUES (%s)',
1018
-            implode(', ', $modifiedColumns),
1019
-            implode(', ', array_keys($modifiedColumns))
1020
-        );
1021
-
1022
-        try {
1023
-            $stmt = $con->prepare($sql);
1024
-            foreach ($modifiedColumns as $identifier => $columnName) {
1025
-                switch ($columnName) {
1026
-                    case 'id':
1027
-                        $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
1028
-                        break;
1029
-                    case 'instance_name':
1030
-                        $stmt->bindValue($identifier, $this->instance_name, PDO::PARAM_STR);
1031
-                        break;
1032
-                    case 'user_id':
1033
-                        $stmt->bindValue($identifier, $this->user_id, PDO::PARAM_INT);
1034
-                        break;
1035
-                    case 'channel_id':
1036
-                        $stmt->bindValue($identifier, $this->channel_id, PDO::PARAM_INT);
1037
-                        break;
1038
-                    case 'subscription_id':
1039
-                        $stmt->bindValue($identifier, $this->subscription_id, PDO::PARAM_INT);
1040
-                        break;
1041
-                    case 'started':
1042
-                        $stmt->bindValue($identifier, $this->started ? $this->started->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
1043
-                        break;
1044
-                    case 'stopped':
1045
-                        $stmt->bindValue($identifier, $this->stopped ? $this->stopped->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
1046
-                        break;
1047
-                    case 'title':
1048
-                        $stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
1049
-                        break;
1050
-                    case 'service':
1051
-                        $stmt->bindValue($identifier, $this->service, PDO::PARAM_STR);
1052
-                        break;
1053
-                }
1054
-            }
1055
-            $stmt->execute();
1056
-        } catch (Exception $e) {
1057
-            Propel::log($e->getMessage(), Propel::LOG_ERR);
1058
-            throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
1059
-        }
1060
-
1061
-        try {
1062
-            $pk = $con->lastInsertId();
1063
-        } catch (Exception $e) {
1064
-            throw new PropelException('Unable to get autoincrement id.', 0, $e);
1065
-        }
1066
-        $this->setId($pk);
1067
-
1068
-        $this->setNew(false);
1069
-    }
1070
-
1071
-    /**
1072
-     * Update the row in the database.
1073
-     *
1074
-     * @param      ConnectionInterface $con
1075
-     *
1076
-     * @return Integer Number of updated rows
1077
-     * @see doSave()
1078
-     */
1079
-    protected function doUpdate(ConnectionInterface $con)
1080
-    {
1081
-        $selectCriteria = $this->buildPkeyCriteria();
1082
-        $valuesCriteria = $this->buildCriteria();
1083
-
1084
-        return $selectCriteria->doUpdate($valuesCriteria, $con);
1085
-    }
1086
-
1087
-    /**
1088
-     * Retrieves a field from the object by name passed in as a string.
1089
-     *
1090
-     * @param      string $name name
1091
-     * @param      string $type The type of fieldname the $name is of:
1092
-     *                     one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
1093
-     *                     TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1094
-     *                     Defaults to TableMap::TYPE_PHPNAME.
1095
-     * @return mixed Value of field.
1096
-     */
1097
-    public function getByName($name, $type = TableMap::TYPE_PHPNAME)
1098
-    {
1099
-        $pos = SubscriptionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
1100
-        $field = $this->getByPosition($pos);
1101
-
1102
-        return $field;
1103
-    }
1104
-
1105
-    /**
1106
-     * Retrieves a field from the object by Position as specified in the xml schema.
1107
-     * Zero-based.
1108
-     *
1109
-     * @param      int $pos position in xml schema
1110
-     * @return mixed Value of field at $pos
1111
-     */
1112
-    public function getByPosition($pos)
1113
-    {
1114
-        switch ($pos) {
1115
-            case 0:
1116
-                return $this->getId();
1117
-                break;
1118
-            case 1:
1119
-                return $this->getInstanceName();
1120
-                break;
1121
-            case 2:
1122
-                return $this->getUserId();
1123
-                break;
1124
-            case 3:
1125
-                return $this->getChannelId();
1126
-                break;
1127
-            case 4:
1128
-                return $this->getSubscriptionId();
1129
-                break;
1130
-            case 5:
1131
-                return $this->getStarted();
1132
-                break;
1133
-            case 6:
1134
-                return $this->getStopped();
1135
-                break;
1136
-            case 7:
1137
-                return $this->getTitle();
1138
-                break;
1139
-            case 8:
1140
-                return $this->getService();
1141
-                break;
1142
-            default:
1143
-                return null;
1144
-                break;
1145
-        } // switch()
1146
-    }
1147
-
1148
-    /**
1149
-     * Exports the object as an array.
1150
-     *
1151
-     * You can specify the key type of the array by passing one of the class
1152
-     * type constants.
1153
-     *
1154
-     * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
1155
-     *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1156
-     *                    Defaults to TableMap::TYPE_PHPNAME.
1157
-     * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
1158
-     * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
1159
-     * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
1160
-     *
1161
-     * @return array an associative array containing the field names (as keys) and field values
1162
-     */
1163
-    public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
1164
-    {
1165
-
1166
-        if (isset($alreadyDumpedObjects['Subscription'][$this->hashCode()])) {
1167
-            return '*RECURSION*';
1168
-        }
1169
-        $alreadyDumpedObjects['Subscription'][$this->hashCode()] = true;
1170
-        $keys = SubscriptionTableMap::getFieldNames($keyType);
1171
-        $result = array(
1172
-            $keys[0] => $this->getId(),
1173
-            $keys[1] => $this->getInstanceName(),
1174
-            $keys[2] => $this->getUserId(),
1175
-            $keys[3] => $this->getChannelId(),
1176
-            $keys[4] => $this->getSubscriptionId(),
1177
-            $keys[5] => $this->getStarted(),
1178
-            $keys[6] => $this->getStopped(),
1179
-            $keys[7] => $this->getTitle(),
1180
-            $keys[8] => $this->getService(),
1181
-        );
1182
-        if ($result[$keys[5]] instanceof \DateTime) {
1183
-            $result[$keys[5]] = $result[$keys[5]]->format('c');
1184
-        }
1185
-
1186
-        if ($result[$keys[6]] instanceof \DateTime) {
1187
-            $result[$keys[6]] = $result[$keys[6]]->format('c');
1188
-        }
1189
-
1190
-        $virtualColumns = $this->virtualColumns;
1191
-        foreach ($virtualColumns as $key => $virtualColumn) {
1192
-            $result[$key] = $virtualColumn;
1193
-        }
1194
-
1195
-        if ($includeForeignObjects) {
1196
-            if (null !== $this->aInstance) {
1197
-
1198
-                switch ($keyType) {
1199
-                    case TableMap::TYPE_CAMELNAME:
1200
-                        $key = 'instance';
1201
-                        break;
1202
-                    case TableMap::TYPE_FIELDNAME:
1203
-                        $key = 'instance';
1204
-                        break;
1205
-                    default:
1206
-                        $key = 'Instance';
1207
-                }
1208
-
1209
-                $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1210
-            }
1211
-            if (null !== $this->aUser) {
1212
-
1213
-                switch ($keyType) {
1214
-                    case TableMap::TYPE_CAMELNAME:
1215
-                        $key = 'user';
1216
-                        break;
1217
-                    case TableMap::TYPE_FIELDNAME:
1218
-                        $key = 'user';
1219
-                        break;
1220
-                    default:
1221
-                        $key = 'User';
1222
-                }
1223
-
1224
-                $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1225
-            }
1226
-            if (null !== $this->aChannel) {
1227
-
1228
-                switch ($keyType) {
1229
-                    case TableMap::TYPE_CAMELNAME:
1230
-                        $key = 'channel';
1231
-                        break;
1232
-                    case TableMap::TYPE_FIELDNAME:
1233
-                        $key = 'channel';
1234
-                        break;
1235
-                    default:
1236
-                        $key = 'Channel';
1237
-                }
1238
-
1239
-                $result[$key] = $this->aChannel->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1240
-            }
1241
-        }
1242
-
1243
-        return $result;
1244
-    }
1245
-
1246
-    /**
1247
-     * Sets a field from the object by name passed in as a string.
1248
-     *
1249
-     * @param  string $name
1250
-     * @param  mixed  $value field value
1251
-     * @param  string $type The type of fieldname the $name is of:
1252
-     *                one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
1253
-     *                TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1254
-     *                Defaults to TableMap::TYPE_PHPNAME.
1255
-     * @return $this|\Jalle19\StatusManager\Database\Subscription
1256
-     */
1257
-    public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
1258
-    {
1259
-        $pos = SubscriptionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
1260
-
1261
-        return $this->setByPosition($pos, $value);
1262
-    }
1263
-
1264
-    /**
1265
-     * Sets a field from the object by Position as specified in the xml schema.
1266
-     * Zero-based.
1267
-     *
1268
-     * @param  int $pos position in xml schema
1269
-     * @param  mixed $value field value
1270
-     * @return $this|\Jalle19\StatusManager\Database\Subscription
1271
-     */
1272
-    public function setByPosition($pos, $value)
1273
-    {
1274
-        switch ($pos) {
1275
-            case 0:
1276
-                $this->setId($value);
1277
-                break;
1278
-            case 1:
1279
-                $this->setInstanceName($value);
1280
-                break;
1281
-            case 2:
1282
-                $this->setUserId($value);
1283
-                break;
1284
-            case 3:
1285
-                $this->setChannelId($value);
1286
-                break;
1287
-            case 4:
1288
-                $this->setSubscriptionId($value);
1289
-                break;
1290
-            case 5:
1291
-                $this->setStarted($value);
1292
-                break;
1293
-            case 6:
1294
-                $this->setStopped($value);
1295
-                break;
1296
-            case 7:
1297
-                $this->setTitle($value);
1298
-                break;
1299
-            case 8:
1300
-                $this->setService($value);
1301
-                break;
1302
-        } // switch()
1303
-
1304
-        return $this;
1305
-    }
1306
-
1307
-    /**
1308
-     * Populates the object using an array.
1309
-     *
1310
-     * This is particularly useful when populating an object from one of the
1311
-     * request arrays (e.g. $_POST).  This method goes through the column
1312
-     * names, checking to see whether a matching key exists in populated
1313
-     * array. If so the setByName() method is called for that column.
1314
-     *
1315
-     * You can specify the key type of the array by additionally passing one
1316
-     * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
1317
-     * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1318
-     * The default key type is the column's TableMap::TYPE_PHPNAME.
1319
-     *
1320
-     * @param      array  $arr     An array to populate the object from.
1321
-     * @param      string $keyType The type of keys the array uses.
1322
-     * @return void
1323
-     */
1324
-    public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
1325
-    {
1326
-        $keys = SubscriptionTableMap::getFieldNames($keyType);
1327
-
1328
-        if (array_key_exists($keys[0], $arr)) {
1329
-            $this->setId($arr[$keys[0]]);
1330
-        }
1331
-        if (array_key_exists($keys[1], $arr)) {
1332
-            $this->setInstanceName($arr[$keys[1]]);
1333
-        }
1334
-        if (array_key_exists($keys[2], $arr)) {
1335
-            $this->setUserId($arr[$keys[2]]);
1336
-        }
1337
-        if (array_key_exists($keys[3], $arr)) {
1338
-            $this->setChannelId($arr[$keys[3]]);
1339
-        }
1340
-        if (array_key_exists($keys[4], $arr)) {
1341
-            $this->setSubscriptionId($arr[$keys[4]]);
1342
-        }
1343
-        if (array_key_exists($keys[5], $arr)) {
1344
-            $this->setStarted($arr[$keys[5]]);
1345
-        }
1346
-        if (array_key_exists($keys[6], $arr)) {
1347
-            $this->setStopped($arr[$keys[6]]);
1348
-        }
1349
-        if (array_key_exists($keys[7], $arr)) {
1350
-            $this->setTitle($arr[$keys[7]]);
1351
-        }
1352
-        if (array_key_exists($keys[8], $arr)) {
1353
-            $this->setService($arr[$keys[8]]);
1354
-        }
1355
-    }
1356
-
1357
-     /**
1358
-     * Populate the current object from a string, using a given parser format
1359
-     * <code>
1360
-     * $book = new Book();
1361
-     * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
1362
-     * </code>
1363
-     *
1364
-     * You can specify the key type of the array by additionally passing one
1365
-     * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
1366
-     * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1367
-     * The default key type is the column's TableMap::TYPE_PHPNAME.
1368
-     *
1369
-     * @param mixed $parser A AbstractParser instance,
1370
-     *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
1371
-     * @param string $data The source data to import from
1372
-     * @param string $keyType The type of keys the array uses.
1373
-     *
1374
-     * @return $this|\Jalle19\StatusManager\Database\Subscription The current object, for fluid interface
1375
-     */
1376
-    public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME)
1377
-    {
1378
-        if (!$parser instanceof AbstractParser) {
1379
-            $parser = AbstractParser::getParser($parser);
1380
-        }
1381
-
1382
-        $this->fromArray($parser->toArray($data), $keyType);
1383
-
1384
-        return $this;
1385
-    }
1386
-
1387
-    /**
1388
-     * Build a Criteria object containing the values of all modified columns in this object.
1389
-     *
1390
-     * @return Criteria The Criteria object containing all modified values.
1391
-     */
1392
-    public function buildCriteria()
1393
-    {
1394
-        $criteria = new Criteria(SubscriptionTableMap::DATABASE_NAME);
1395
-
1396
-        if ($this->isColumnModified(SubscriptionTableMap::COL_ID)) {
1397
-            $criteria->add(SubscriptionTableMap::COL_ID, $this->id);
1398
-        }
1399
-        if ($this->isColumnModified(SubscriptionTableMap::COL_INSTANCE_NAME)) {
1400
-            $criteria->add(SubscriptionTableMap::COL_INSTANCE_NAME, $this->instance_name);
1401
-        }
1402
-        if ($this->isColumnModified(SubscriptionTableMap::COL_USER_ID)) {
1403
-            $criteria->add(SubscriptionTableMap::COL_USER_ID, $this->user_id);
1404
-        }
1405
-        if ($this->isColumnModified(SubscriptionTableMap::COL_CHANNEL_ID)) {
1406
-            $criteria->add(SubscriptionTableMap::COL_CHANNEL_ID, $this->channel_id);
1407
-        }
1408
-        if ($this->isColumnModified(SubscriptionTableMap::COL_SUBSCRIPTION_ID)) {
1409
-            $criteria->add(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $this->subscription_id);
1410
-        }
1411
-        if ($this->isColumnModified(SubscriptionTableMap::COL_STARTED)) {
1412
-            $criteria->add(SubscriptionTableMap::COL_STARTED, $this->started);
1413
-        }
1414
-        if ($this->isColumnModified(SubscriptionTableMap::COL_STOPPED)) {
1415
-            $criteria->add(SubscriptionTableMap::COL_STOPPED, $this->stopped);
1416
-        }
1417
-        if ($this->isColumnModified(SubscriptionTableMap::COL_TITLE)) {
1418
-            $criteria->add(SubscriptionTableMap::COL_TITLE, $this->title);
1419
-        }
1420
-        if ($this->isColumnModified(SubscriptionTableMap::COL_SERVICE)) {
1421
-            $criteria->add(SubscriptionTableMap::COL_SERVICE, $this->service);
1422
-        }
1423
-
1424
-        return $criteria;
1425
-    }
1426
-
1427
-    /**
1428
-     * Builds a Criteria object containing the primary key for this object.
1429
-     *
1430
-     * Unlike buildCriteria() this method includes the primary key values regardless
1431
-     * of whether or not they have been modified.
1432
-     *
1433
-     * @throws LogicException if no primary key is defined
1434
-     *
1435
-     * @return Criteria The Criteria object containing value(s) for primary key(s).
1436
-     */
1437
-    public function buildPkeyCriteria()
1438
-    {
1439
-        $criteria = ChildSubscriptionQuery::create();
1440
-        $criteria->add(SubscriptionTableMap::COL_ID, $this->id);
1441
-
1442
-        return $criteria;
1443
-    }
1444
-
1445
-    /**
1446
-     * If the primary key is not null, return the hashcode of the
1447
-     * primary key. Otherwise, return the hash code of the object.
1448
-     *
1449
-     * @return int Hashcode
1450
-     */
1451
-    public function hashCode()
1452
-    {
1453
-        $validPk = null !== $this->getId();
1454
-
1455
-        $validPrimaryKeyFKs = 0;
1456
-        $primaryKeyFKs = [];
1457
-
1458
-        if ($validPk) {
1459
-            return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
1460
-        } elseif ($validPrimaryKeyFKs) {
1461
-            return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
1462
-        }
1463
-
1464
-        return spl_object_hash($this);
1465
-    }
1466
-
1467
-    /**
1468
-     * Returns the primary key for this object (row).
1469
-     * @return int
1470
-     */
1471
-    public function getPrimaryKey()
1472
-    {
1473
-        return $this->getId();
1474
-    }
1475
-
1476
-    /**
1477
-     * Generic method to set the primary key (id column).
1478
-     *
1479
-     * @param       int $key Primary key.
1480
-     * @return void
1481
-     */
1482
-    public function setPrimaryKey($key)
1483
-    {
1484
-        $this->setId($key);
1485
-    }
1486
-
1487
-    /**
1488
-     * Returns true if the primary key for this object is null.
1489
-     * @return boolean
1490
-     */
1491
-    public function isPrimaryKeyNull()
1492
-    {
1493
-        return null === $this->getId();
1494
-    }
1495
-
1496
-    /**
1497
-     * Sets contents of passed object to values from current object.
1498
-     *
1499
-     * If desired, this method can also make copies of all associated (fkey referrers)
1500
-     * objects.
1501
-     *
1502
-     * @param      object $copyObj An object of \Jalle19\StatusManager\Database\Subscription (or compatible) type.
1503
-     * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1504
-     * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1505
-     * @throws PropelException
1506
-     */
1507
-    public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1508
-    {
1509
-        $copyObj->setInstanceName($this->getInstanceName());
1510
-        $copyObj->setUserId($this->getUserId());
1511
-        $copyObj->setChannelId($this->getChannelId());
1512
-        $copyObj->setSubscriptionId($this->getSubscriptionId());
1513
-        $copyObj->setStarted($this->getStarted());
1514
-        $copyObj->setStopped($this->getStopped());
1515
-        $copyObj->setTitle($this->getTitle());
1516
-        $copyObj->setService($this->getService());
1517
-        if ($makeNew) {
1518
-            $copyObj->setNew(true);
1519
-            $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
1520
-        }
1521
-    }
1522
-
1523
-    /**
1524
-     * Makes a copy of this object that will be inserted as a new row in table when saved.
1525
-     * It creates a new object filling in the simple attributes, but skipping any primary
1526
-     * keys that are defined for the table.
1527
-     *
1528
-     * If desired, this method can also make copies of all associated (fkey referrers)
1529
-     * objects.
1530
-     *
1531
-     * @param  boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1532
-     * @return \Jalle19\StatusManager\Database\Subscription Clone of current object.
1533
-     * @throws PropelException
1534
-     */
1535
-    public function copy($deepCopy = false)
1536
-    {
1537
-        // we use get_class(), because this might be a subclass
1538
-        $clazz = get_class($this);
1539
-        $copyObj = new $clazz();
1540
-        $this->copyInto($copyObj, $deepCopy);
1541
-
1542
-        return $copyObj;
1543
-    }
1544
-
1545
-    /**
1546
-     * Declares an association between this object and a ChildInstance object.
1547
-     *
1548
-     * @param  ChildInstance $v
1549
-     * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
1550
-     * @throws PropelException
1551
-     */
1552
-    public function setInstance(ChildInstance $v = null)
1553
-    {
1554
-        if ($v === null) {
1555
-            $this->setInstanceName(NULL);
1556
-        } else {
1557
-            $this->setInstanceName($v->getName());
1558
-        }
1559
-
1560
-        $this->aInstance = $v;
1561
-
1562
-        // Add binding for other direction of this n:n relationship.
1563
-        // If this object has already been added to the ChildInstance object, it will not be re-added.
1564
-        if ($v !== null) {
1565
-            $v->addSubscription($this);
1566
-        }
1567
-
1568
-
1569
-        return $this;
1570
-    }
1571
-
1572
-
1573
-    /**
1574
-     * Get the associated ChildInstance object
1575
-     *
1576
-     * @param  ConnectionInterface $con Optional Connection object.
1577
-     * @return ChildInstance The associated ChildInstance object.
1578
-     * @throws PropelException
1579
-     */
1580
-    public function getInstance(ConnectionInterface $con = null)
1581
-    {
1582
-        if ($this->aInstance === null && (($this->instance_name !== "" && $this->instance_name !== null))) {
1583
-            $this->aInstance = ChildInstanceQuery::create()->findPk($this->instance_name, $con);
1584
-            /* The following can be used additionally to
710
+	 *                            TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
711
+	 *
712
+	 * @return int             next starting column
713
+	 * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
714
+	 */
715
+	public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)
716
+	{
717
+		try {
718
+
719
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : SubscriptionTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
720
+			$this->id = (null !== $col) ? (int) $col : null;
721
+
722
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : SubscriptionTableMap::translateFieldName('InstanceName', TableMap::TYPE_PHPNAME, $indexType)];
723
+			$this->instance_name = (null !== $col) ? (string) $col : null;
724
+
725
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : SubscriptionTableMap::translateFieldName('UserId', TableMap::TYPE_PHPNAME, $indexType)];
726
+			$this->user_id = (null !== $col) ? (int) $col : null;
727
+
728
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : SubscriptionTableMap::translateFieldName('ChannelId', TableMap::TYPE_PHPNAME, $indexType)];
729
+			$this->channel_id = (null !== $col) ? (int) $col : null;
730
+
731
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : SubscriptionTableMap::translateFieldName('SubscriptionId', TableMap::TYPE_PHPNAME, $indexType)];
732
+			$this->subscription_id = (null !== $col) ? (int) $col : null;
733
+
734
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : SubscriptionTableMap::translateFieldName('Started', TableMap::TYPE_PHPNAME, $indexType)];
735
+			$this->started = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null;
736
+
737
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : SubscriptionTableMap::translateFieldName('Stopped', TableMap::TYPE_PHPNAME, $indexType)];
738
+			$this->stopped = (null !== $col) ? PropelDateTime::newInstance($col, null, 'DateTime') : null;
739
+
740
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : SubscriptionTableMap::translateFieldName('Title', TableMap::TYPE_PHPNAME, $indexType)];
741
+			$this->title = (null !== $col) ? (string) $col : null;
742
+
743
+			$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : SubscriptionTableMap::translateFieldName('Service', TableMap::TYPE_PHPNAME, $indexType)];
744
+			$this->service = (null !== $col) ? (string) $col : null;
745
+			$this->resetModified();
746
+
747
+			$this->setNew(false);
748
+
749
+			if ($rehydrate) {
750
+				$this->ensureConsistency();
751
+			}
752
+
753
+			return $startcol + 9; // 9 = SubscriptionTableMap::NUM_HYDRATE_COLUMNS.
754
+
755
+		} catch (Exception $e) {
756
+			throw new PropelException(sprintf('Error populating %s object', '\\Jalle19\\StatusManager\\Database\\Subscription'), 0, $e);
757
+		}
758
+	}
759
+
760
+	/**
761
+	 * Checks and repairs the internal consistency of the object.
762
+	 *
763
+	 * This method is executed after an already-instantiated object is re-hydrated
764
+	 * from the database.  It exists to check any foreign keys to make sure that
765
+	 * the objects related to the current object are correct based on foreign key.
766
+	 *
767
+	 * You can override this method in the stub class, but you should always invoke
768
+	 * the base method from the overridden method (i.e. parent::ensureConsistency()),
769
+	 * in case your model changes.
770
+	 *
771
+	 * @throws PropelException
772
+	 */
773
+	public function ensureConsistency()
774
+	{
775
+		if ($this->aInstance !== null && $this->instance_name !== $this->aInstance->getName()) {
776
+			$this->aInstance = null;
777
+		}
778
+		if ($this->aUser !== null && $this->user_id !== $this->aUser->getId()) {
779
+			$this->aUser = null;
780
+		}
781
+		if ($this->aChannel !== null && $this->channel_id !== $this->aChannel->getId()) {
782
+			$this->aChannel = null;
783
+		}
784
+	} // ensureConsistency
785
+
786
+	/**
787
+	 * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
788
+	 *
789
+	 * This will only work if the object has been saved and has a valid primary key set.
790
+	 *
791
+	 * @param      boolean $deep (optional) Whether to also de-associated any related objects.
792
+	 * @param      ConnectionInterface $con (optional) The ConnectionInterface connection to use.
793
+	 * @return void
794
+	 * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
795
+	 */
796
+	public function reload($deep = false, ConnectionInterface $con = null)
797
+	{
798
+		if ($this->isDeleted()) {
799
+			throw new PropelException("Cannot reload a deleted object.");
800
+		}
801
+
802
+		if ($this->isNew()) {
803
+			throw new PropelException("Cannot reload an unsaved object.");
804
+		}
805
+
806
+		if ($con === null) {
807
+			$con = Propel::getServiceContainer()->getReadConnection(SubscriptionTableMap::DATABASE_NAME);
808
+		}
809
+
810
+		// We don't need to alter the object instance pool; we're just modifying this instance
811
+		// already in the pool.
812
+
813
+		$dataFetcher = ChildSubscriptionQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con);
814
+		$row = $dataFetcher->fetch();
815
+		$dataFetcher->close();
816
+		if (!$row) {
817
+			throw new PropelException('Cannot find matching row in the database to reload object values.');
818
+		}
819
+		$this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate
820
+
821
+		if ($deep) {  // also de-associate any related objects?
822
+
823
+			$this->aInstance = null;
824
+			$this->aUser = null;
825
+			$this->aChannel = null;
826
+		} // if (deep)
827
+	}
828
+
829
+	/**
830
+	 * Removes this object from datastore and sets delete attribute.
831
+	 *
832
+	 * @param      ConnectionInterface $con
833
+	 * @return void
834
+	 * @throws PropelException
835
+	 * @see Subscription::setDeleted()
836
+	 * @see Subscription::isDeleted()
837
+	 */
838
+	public function delete(ConnectionInterface $con = null)
839
+	{
840
+		if ($this->isDeleted()) {
841
+			throw new PropelException("This object has already been deleted.");
842
+		}
843
+
844
+		if ($con === null) {
845
+			$con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
846
+		}
847
+
848
+		$con->transaction(function () use ($con) {
849
+			$deleteQuery = ChildSubscriptionQuery::create()
850
+				->filterByPrimaryKey($this->getPrimaryKey());
851
+			$ret = $this->preDelete($con);
852
+			if ($ret) {
853
+				$deleteQuery->delete($con);
854
+				$this->postDelete($con);
855
+				$this->setDeleted(true);
856
+			}
857
+		});
858
+	}
859
+
860
+	/**
861
+	 * Persists this object to the database.
862
+	 *
863
+	 * If the object is new, it inserts it; otherwise an update is performed.
864
+	 * All modified related objects will also be persisted in the doSave()
865
+	 * method.  This method wraps all precipitate database operations in a
866
+	 * single transaction.
867
+	 *
868
+	 * @param      ConnectionInterface $con
869
+	 * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
870
+	 * @throws PropelException
871
+	 * @see doSave()
872
+	 */
873
+	public function save(ConnectionInterface $con = null)
874
+	{
875
+		if ($this->isDeleted()) {
876
+			throw new PropelException("You cannot save an object that has been deleted.");
877
+		}
878
+
879
+		if ($con === null) {
880
+			$con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
881
+		}
882
+
883
+		return $con->transaction(function () use ($con) {
884
+			$isInsert = $this->isNew();
885
+			$ret = $this->preSave($con);
886
+			if ($isInsert) {
887
+				$ret = $ret && $this->preInsert($con);
888
+			} else {
889
+				$ret = $ret && $this->preUpdate($con);
890
+			}
891
+			if ($ret) {
892
+				$affectedRows = $this->doSave($con);
893
+				if ($isInsert) {
894
+					$this->postInsert($con);
895
+				} else {
896
+					$this->postUpdate($con);
897
+				}
898
+				$this->postSave($con);
899
+				SubscriptionTableMap::addInstanceToPool($this);
900
+			} else {
901
+				$affectedRows = 0;
902
+			}
903
+
904
+			return $affectedRows;
905
+		});
906
+	}
907
+
908
+	/**
909
+	 * Performs the work of inserting or updating the row in the database.
910
+	 *
911
+	 * If the object is new, it inserts it; otherwise an update is performed.
912
+	 * All related objects are also updated in this method.
913
+	 *
914
+	 * @param      ConnectionInterface $con
915
+	 * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
916
+	 * @throws PropelException
917
+	 * @see save()
918
+	 */
919
+	protected function doSave(ConnectionInterface $con)
920
+	{
921
+		$affectedRows = 0; // initialize var to track total num of affected rows
922
+		if (!$this->alreadyInSave) {
923
+			$this->alreadyInSave = true;
924
+
925
+			// We call the save method on the following object(s) if they
926
+			// were passed to this object by their corresponding set
927
+			// method.  This object relates to these object(s) by a
928
+			// foreign key reference.
929
+
930
+			if ($this->aInstance !== null) {
931
+				if ($this->aInstance->isModified() || $this->aInstance->isNew()) {
932
+					$affectedRows += $this->aInstance->save($con);
933
+				}
934
+				$this->setInstance($this->aInstance);
935
+			}
936
+
937
+			if ($this->aUser !== null) {
938
+				if ($this->aUser->isModified() || $this->aUser->isNew()) {
939
+					$affectedRows += $this->aUser->save($con);
940
+				}
941
+				$this->setUser($this->aUser);
942
+			}
943
+
944
+			if ($this->aChannel !== null) {
945
+				if ($this->aChannel->isModified() || $this->aChannel->isNew()) {
946
+					$affectedRows += $this->aChannel->save($con);
947
+				}
948
+				$this->setChannel($this->aChannel);
949
+			}
950
+
951
+			if ($this->isNew() || $this->isModified()) {
952
+				// persist changes
953
+				if ($this->isNew()) {
954
+					$this->doInsert($con);
955
+					$affectedRows += 1;
956
+				} else {
957
+					$affectedRows += $this->doUpdate($con);
958
+				}
959
+				$this->resetModified();
960
+			}
961
+
962
+			$this->alreadyInSave = false;
963
+
964
+		}
965
+
966
+		return $affectedRows;
967
+	} // doSave()
968
+
969
+	/**
970
+	 * Insert the row in the database.
971
+	 *
972
+	 * @param      ConnectionInterface $con
973
+	 *
974
+	 * @throws PropelException
975
+	 * @see doSave()
976
+	 */
977
+	protected function doInsert(ConnectionInterface $con)
978
+	{
979
+		$modifiedColumns = array();
980
+		$index = 0;
981
+
982
+		$this->modifiedColumns[SubscriptionTableMap::COL_ID] = true;
983
+		if (null !== $this->id) {
984
+			throw new PropelException('Cannot insert a value for auto-increment primary key (' . SubscriptionTableMap::COL_ID . ')');
985
+		}
986
+
987
+		 // check the columns in natural order for more readable SQL queries
988
+		if ($this->isColumnModified(SubscriptionTableMap::COL_ID)) {
989
+			$modifiedColumns[':p' . $index++]  = 'id';
990
+		}
991
+		if ($this->isColumnModified(SubscriptionTableMap::COL_INSTANCE_NAME)) {
992
+			$modifiedColumns[':p' . $index++]  = 'instance_name';
993
+		}
994
+		if ($this->isColumnModified(SubscriptionTableMap::COL_USER_ID)) {
995
+			$modifiedColumns[':p' . $index++]  = 'user_id';
996
+		}
997
+		if ($this->isColumnModified(SubscriptionTableMap::COL_CHANNEL_ID)) {
998
+			$modifiedColumns[':p' . $index++]  = 'channel_id';
999
+		}
1000
+		if ($this->isColumnModified(SubscriptionTableMap::COL_SUBSCRIPTION_ID)) {
1001
+			$modifiedColumns[':p' . $index++]  = 'subscription_id';
1002
+		}
1003
+		if ($this->isColumnModified(SubscriptionTableMap::COL_STARTED)) {
1004
+			$modifiedColumns[':p' . $index++]  = 'started';
1005
+		}
1006
+		if ($this->isColumnModified(SubscriptionTableMap::COL_STOPPED)) {
1007
+			$modifiedColumns[':p' . $index++]  = 'stopped';
1008
+		}
1009
+		if ($this->isColumnModified(SubscriptionTableMap::COL_TITLE)) {
1010
+			$modifiedColumns[':p' . $index++]  = 'title';
1011
+		}
1012
+		if ($this->isColumnModified(SubscriptionTableMap::COL_SERVICE)) {
1013
+			$modifiedColumns[':p' . $index++]  = 'service';
1014
+		}
1015
+
1016
+		$sql = sprintf(
1017
+			'INSERT INTO subscription (%s) VALUES (%s)',
1018
+			implode(', ', $modifiedColumns),
1019
+			implode(', ', array_keys($modifiedColumns))
1020
+		);
1021
+
1022
+		try {
1023
+			$stmt = $con->prepare($sql);
1024
+			foreach ($modifiedColumns as $identifier => $columnName) {
1025
+				switch ($columnName) {
1026
+					case 'id':
1027
+						$stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
1028
+						break;
1029
+					case 'instance_name':
1030
+						$stmt->bindValue($identifier, $this->instance_name, PDO::PARAM_STR);
1031
+						break;
1032
+					case 'user_id':
1033
+						$stmt->bindValue($identifier, $this->user_id, PDO::PARAM_INT);
1034
+						break;
1035
+					case 'channel_id':
1036
+						$stmt->bindValue($identifier, $this->channel_id, PDO::PARAM_INT);
1037
+						break;
1038
+					case 'subscription_id':
1039
+						$stmt->bindValue($identifier, $this->subscription_id, PDO::PARAM_INT);
1040
+						break;
1041
+					case 'started':
1042
+						$stmt->bindValue($identifier, $this->started ? $this->started->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
1043
+						break;
1044
+					case 'stopped':
1045
+						$stmt->bindValue($identifier, $this->stopped ? $this->stopped->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
1046
+						break;
1047
+					case 'title':
1048
+						$stmt->bindValue($identifier, $this->title, PDO::PARAM_STR);
1049
+						break;
1050
+					case 'service':
1051
+						$stmt->bindValue($identifier, $this->service, PDO::PARAM_STR);
1052
+						break;
1053
+				}
1054
+			}
1055
+			$stmt->execute();
1056
+		} catch (Exception $e) {
1057
+			Propel::log($e->getMessage(), Propel::LOG_ERR);
1058
+			throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
1059
+		}
1060
+
1061
+		try {
1062
+			$pk = $con->lastInsertId();
1063
+		} catch (Exception $e) {
1064
+			throw new PropelException('Unable to get autoincrement id.', 0, $e);
1065
+		}
1066
+		$this->setId($pk);
1067
+
1068
+		$this->setNew(false);
1069
+	}
1070
+
1071
+	/**
1072
+	 * Update the row in the database.
1073
+	 *
1074
+	 * @param      ConnectionInterface $con
1075
+	 *
1076
+	 * @return Integer Number of updated rows
1077
+	 * @see doSave()
1078
+	 */
1079
+	protected function doUpdate(ConnectionInterface $con)
1080
+	{
1081
+		$selectCriteria = $this->buildPkeyCriteria();
1082
+		$valuesCriteria = $this->buildCriteria();
1083
+
1084
+		return $selectCriteria->doUpdate($valuesCriteria, $con);
1085
+	}
1086
+
1087
+	/**
1088
+	 * Retrieves a field from the object by name passed in as a string.
1089
+	 *
1090
+	 * @param      string $name name
1091
+	 * @param      string $type The type of fieldname the $name is of:
1092
+	 *                     one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
1093
+	 *                     TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1094
+	 *                     Defaults to TableMap::TYPE_PHPNAME.
1095
+	 * @return mixed Value of field.
1096
+	 */
1097
+	public function getByName($name, $type = TableMap::TYPE_PHPNAME)
1098
+	{
1099
+		$pos = SubscriptionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
1100
+		$field = $this->getByPosition($pos);
1101
+
1102
+		return $field;
1103
+	}
1104
+
1105
+	/**
1106
+	 * Retrieves a field from the object by Position as specified in the xml schema.
1107
+	 * Zero-based.
1108
+	 *
1109
+	 * @param      int $pos position in xml schema
1110
+	 * @return mixed Value of field at $pos
1111
+	 */
1112
+	public function getByPosition($pos)
1113
+	{
1114
+		switch ($pos) {
1115
+			case 0:
1116
+				return $this->getId();
1117
+				break;
1118
+			case 1:
1119
+				return $this->getInstanceName();
1120
+				break;
1121
+			case 2:
1122
+				return $this->getUserId();
1123
+				break;
1124
+			case 3:
1125
+				return $this->getChannelId();
1126
+				break;
1127
+			case 4:
1128
+				return $this->getSubscriptionId();
1129
+				break;
1130
+			case 5:
1131
+				return $this->getStarted();
1132
+				break;
1133
+			case 6:
1134
+				return $this->getStopped();
1135
+				break;
1136
+			case 7:
1137
+				return $this->getTitle();
1138
+				break;
1139
+			case 8:
1140
+				return $this->getService();
1141
+				break;
1142
+			default:
1143
+				return null;
1144
+				break;
1145
+		} // switch()
1146
+	}
1147
+
1148
+	/**
1149
+	 * Exports the object as an array.
1150
+	 *
1151
+	 * You can specify the key type of the array by passing one of the class
1152
+	 * type constants.
1153
+	 *
1154
+	 * @param     string  $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
1155
+	 *                    TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1156
+	 *                    Defaults to TableMap::TYPE_PHPNAME.
1157
+	 * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
1158
+	 * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
1159
+	 * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
1160
+	 *
1161
+	 * @return array an associative array containing the field names (as keys) and field values
1162
+	 */
1163
+	public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
1164
+	{
1165
+
1166
+		if (isset($alreadyDumpedObjects['Subscription'][$this->hashCode()])) {
1167
+			return '*RECURSION*';
1168
+		}
1169
+		$alreadyDumpedObjects['Subscription'][$this->hashCode()] = true;
1170
+		$keys = SubscriptionTableMap::getFieldNames($keyType);
1171
+		$result = array(
1172
+			$keys[0] => $this->getId(),
1173
+			$keys[1] => $this->getInstanceName(),
1174
+			$keys[2] => $this->getUserId(),
1175
+			$keys[3] => $this->getChannelId(),
1176
+			$keys[4] => $this->getSubscriptionId(),
1177
+			$keys[5] => $this->getStarted(),
1178
+			$keys[6] => $this->getStopped(),
1179
+			$keys[7] => $this->getTitle(),
1180
+			$keys[8] => $this->getService(),
1181
+		);
1182
+		if ($result[$keys[5]] instanceof \DateTime) {
1183
+			$result[$keys[5]] = $result[$keys[5]]->format('c');
1184
+		}
1185
+
1186
+		if ($result[$keys[6]] instanceof \DateTime) {
1187
+			$result[$keys[6]] = $result[$keys[6]]->format('c');
1188
+		}
1189
+
1190
+		$virtualColumns = $this->virtualColumns;
1191
+		foreach ($virtualColumns as $key => $virtualColumn) {
1192
+			$result[$key] = $virtualColumn;
1193
+		}
1194
+
1195
+		if ($includeForeignObjects) {
1196
+			if (null !== $this->aInstance) {
1197
+
1198
+				switch ($keyType) {
1199
+					case TableMap::TYPE_CAMELNAME:
1200
+						$key = 'instance';
1201
+						break;
1202
+					case TableMap::TYPE_FIELDNAME:
1203
+						$key = 'instance';
1204
+						break;
1205
+					default:
1206
+						$key = 'Instance';
1207
+				}
1208
+
1209
+				$result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1210
+			}
1211
+			if (null !== $this->aUser) {
1212
+
1213
+				switch ($keyType) {
1214
+					case TableMap::TYPE_CAMELNAME:
1215
+						$key = 'user';
1216
+						break;
1217
+					case TableMap::TYPE_FIELDNAME:
1218
+						$key = 'user';
1219
+						break;
1220
+					default:
1221
+						$key = 'User';
1222
+				}
1223
+
1224
+				$result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1225
+			}
1226
+			if (null !== $this->aChannel) {
1227
+
1228
+				switch ($keyType) {
1229
+					case TableMap::TYPE_CAMELNAME:
1230
+						$key = 'channel';
1231
+						break;
1232
+					case TableMap::TYPE_FIELDNAME:
1233
+						$key = 'channel';
1234
+						break;
1235
+					default:
1236
+						$key = 'Channel';
1237
+				}
1238
+
1239
+				$result[$key] = $this->aChannel->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1240
+			}
1241
+		}
1242
+
1243
+		return $result;
1244
+	}
1245
+
1246
+	/**
1247
+	 * Sets a field from the object by name passed in as a string.
1248
+	 *
1249
+	 * @param  string $name
1250
+	 * @param  mixed  $value field value
1251
+	 * @param  string $type The type of fieldname the $name is of:
1252
+	 *                one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
1253
+	 *                TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1254
+	 *                Defaults to TableMap::TYPE_PHPNAME.
1255
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription
1256
+	 */
1257
+	public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)
1258
+	{
1259
+		$pos = SubscriptionTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM);
1260
+
1261
+		return $this->setByPosition($pos, $value);
1262
+	}
1263
+
1264
+	/**
1265
+	 * Sets a field from the object by Position as specified in the xml schema.
1266
+	 * Zero-based.
1267
+	 *
1268
+	 * @param  int $pos position in xml schema
1269
+	 * @param  mixed $value field value
1270
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription
1271
+	 */
1272
+	public function setByPosition($pos, $value)
1273
+	{
1274
+		switch ($pos) {
1275
+			case 0:
1276
+				$this->setId($value);
1277
+				break;
1278
+			case 1:
1279
+				$this->setInstanceName($value);
1280
+				break;
1281
+			case 2:
1282
+				$this->setUserId($value);
1283
+				break;
1284
+			case 3:
1285
+				$this->setChannelId($value);
1286
+				break;
1287
+			case 4:
1288
+				$this->setSubscriptionId($value);
1289
+				break;
1290
+			case 5:
1291
+				$this->setStarted($value);
1292
+				break;
1293
+			case 6:
1294
+				$this->setStopped($value);
1295
+				break;
1296
+			case 7:
1297
+				$this->setTitle($value);
1298
+				break;
1299
+			case 8:
1300
+				$this->setService($value);
1301
+				break;
1302
+		} // switch()
1303
+
1304
+		return $this;
1305
+	}
1306
+
1307
+	/**
1308
+	 * Populates the object using an array.
1309
+	 *
1310
+	 * This is particularly useful when populating an object from one of the
1311
+	 * request arrays (e.g. $_POST).  This method goes through the column
1312
+	 * names, checking to see whether a matching key exists in populated
1313
+	 * array. If so the setByName() method is called for that column.
1314
+	 *
1315
+	 * You can specify the key type of the array by additionally passing one
1316
+	 * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
1317
+	 * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1318
+	 * The default key type is the column's TableMap::TYPE_PHPNAME.
1319
+	 *
1320
+	 * @param      array  $arr     An array to populate the object from.
1321
+	 * @param      string $keyType The type of keys the array uses.
1322
+	 * @return void
1323
+	 */
1324
+	public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)
1325
+	{
1326
+		$keys = SubscriptionTableMap::getFieldNames($keyType);
1327
+
1328
+		if (array_key_exists($keys[0], $arr)) {
1329
+			$this->setId($arr[$keys[0]]);
1330
+		}
1331
+		if (array_key_exists($keys[1], $arr)) {
1332
+			$this->setInstanceName($arr[$keys[1]]);
1333
+		}
1334
+		if (array_key_exists($keys[2], $arr)) {
1335
+			$this->setUserId($arr[$keys[2]]);
1336
+		}
1337
+		if (array_key_exists($keys[3], $arr)) {
1338
+			$this->setChannelId($arr[$keys[3]]);
1339
+		}
1340
+		if (array_key_exists($keys[4], $arr)) {
1341
+			$this->setSubscriptionId($arr[$keys[4]]);
1342
+		}
1343
+		if (array_key_exists($keys[5], $arr)) {
1344
+			$this->setStarted($arr[$keys[5]]);
1345
+		}
1346
+		if (array_key_exists($keys[6], $arr)) {
1347
+			$this->setStopped($arr[$keys[6]]);
1348
+		}
1349
+		if (array_key_exists($keys[7], $arr)) {
1350
+			$this->setTitle($arr[$keys[7]]);
1351
+		}
1352
+		if (array_key_exists($keys[8], $arr)) {
1353
+			$this->setService($arr[$keys[8]]);
1354
+		}
1355
+	}
1356
+
1357
+	 /**
1358
+	  * Populate the current object from a string, using a given parser format
1359
+	  * <code>
1360
+	  * $book = new Book();
1361
+	  * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');
1362
+	  * </code>
1363
+	  *
1364
+	  * You can specify the key type of the array by additionally passing one
1365
+	  * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,
1366
+	  * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1367
+	  * The default key type is the column's TableMap::TYPE_PHPNAME.
1368
+	  *
1369
+	  * @param mixed $parser A AbstractParser instance,
1370
+	  *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
1371
+	  * @param string $data The source data to import from
1372
+	  * @param string $keyType The type of keys the array uses.
1373
+	  *
1374
+	  * @return $this|\Jalle19\StatusManager\Database\Subscription The current object, for fluid interface
1375
+	  */
1376
+	public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME)
1377
+	{
1378
+		if (!$parser instanceof AbstractParser) {
1379
+			$parser = AbstractParser::getParser($parser);
1380
+		}
1381
+
1382
+		$this->fromArray($parser->toArray($data), $keyType);
1383
+
1384
+		return $this;
1385
+	}
1386
+
1387
+	/**
1388
+	 * Build a Criteria object containing the values of all modified columns in this object.
1389
+	 *
1390
+	 * @return Criteria The Criteria object containing all modified values.
1391
+	 */
1392
+	public function buildCriteria()
1393
+	{
1394
+		$criteria = new Criteria(SubscriptionTableMap::DATABASE_NAME);
1395
+
1396
+		if ($this->isColumnModified(SubscriptionTableMap::COL_ID)) {
1397
+			$criteria->add(SubscriptionTableMap::COL_ID, $this->id);
1398
+		}
1399
+		if ($this->isColumnModified(SubscriptionTableMap::COL_INSTANCE_NAME)) {
1400
+			$criteria->add(SubscriptionTableMap::COL_INSTANCE_NAME, $this->instance_name);
1401
+		}
1402
+		if ($this->isColumnModified(SubscriptionTableMap::COL_USER_ID)) {
1403
+			$criteria->add(SubscriptionTableMap::COL_USER_ID, $this->user_id);
1404
+		}
1405
+		if ($this->isColumnModified(SubscriptionTableMap::COL_CHANNEL_ID)) {
1406
+			$criteria->add(SubscriptionTableMap::COL_CHANNEL_ID, $this->channel_id);
1407
+		}
1408
+		if ($this->isColumnModified(SubscriptionTableMap::COL_SUBSCRIPTION_ID)) {
1409
+			$criteria->add(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $this->subscription_id);
1410
+		}
1411
+		if ($this->isColumnModified(SubscriptionTableMap::COL_STARTED)) {
1412
+			$criteria->add(SubscriptionTableMap::COL_STARTED, $this->started);
1413
+		}
1414
+		if ($this->isColumnModified(SubscriptionTableMap::COL_STOPPED)) {
1415
+			$criteria->add(SubscriptionTableMap::COL_STOPPED, $this->stopped);
1416
+		}
1417
+		if ($this->isColumnModified(SubscriptionTableMap::COL_TITLE)) {
1418
+			$criteria->add(SubscriptionTableMap::COL_TITLE, $this->title);
1419
+		}
1420
+		if ($this->isColumnModified(SubscriptionTableMap::COL_SERVICE)) {
1421
+			$criteria->add(SubscriptionTableMap::COL_SERVICE, $this->service);
1422
+		}
1423
+
1424
+		return $criteria;
1425
+	}
1426
+
1427
+	/**
1428
+	 * Builds a Criteria object containing the primary key for this object.
1429
+	 *
1430
+	 * Unlike buildCriteria() this method includes the primary key values regardless
1431
+	 * of whether or not they have been modified.
1432
+	 *
1433
+	 * @throws LogicException if no primary key is defined
1434
+	 *
1435
+	 * @return Criteria The Criteria object containing value(s) for primary key(s).
1436
+	 */
1437
+	public function buildPkeyCriteria()
1438
+	{
1439
+		$criteria = ChildSubscriptionQuery::create();
1440
+		$criteria->add(SubscriptionTableMap::COL_ID, $this->id);
1441
+
1442
+		return $criteria;
1443
+	}
1444
+
1445
+	/**
1446
+	 * If the primary key is not null, return the hashcode of the
1447
+	 * primary key. Otherwise, return the hash code of the object.
1448
+	 *
1449
+	 * @return int Hashcode
1450
+	 */
1451
+	public function hashCode()
1452
+	{
1453
+		$validPk = null !== $this->getId();
1454
+
1455
+		$validPrimaryKeyFKs = 0;
1456
+		$primaryKeyFKs = [];
1457
+
1458
+		if ($validPk) {
1459
+			return crc32(json_encode($this->getPrimaryKey(), JSON_UNESCAPED_UNICODE));
1460
+		} elseif ($validPrimaryKeyFKs) {
1461
+			return crc32(json_encode($primaryKeyFKs, JSON_UNESCAPED_UNICODE));
1462
+		}
1463
+
1464
+		return spl_object_hash($this);
1465
+	}
1466
+
1467
+	/**
1468
+	 * Returns the primary key for this object (row).
1469
+	 * @return int
1470
+	 */
1471
+	public function getPrimaryKey()
1472
+	{
1473
+		return $this->getId();
1474
+	}
1475
+
1476
+	/**
1477
+	 * Generic method to set the primary key (id column).
1478
+	 *
1479
+	 * @param       int $key Primary key.
1480
+	 * @return void
1481
+	 */
1482
+	public function setPrimaryKey($key)
1483
+	{
1484
+		$this->setId($key);
1485
+	}
1486
+
1487
+	/**
1488
+	 * Returns true if the primary key for this object is null.
1489
+	 * @return boolean
1490
+	 */
1491
+	public function isPrimaryKeyNull()
1492
+	{
1493
+		return null === $this->getId();
1494
+	}
1495
+
1496
+	/**
1497
+	 * Sets contents of passed object to values from current object.
1498
+	 *
1499
+	 * If desired, this method can also make copies of all associated (fkey referrers)
1500
+	 * objects.
1501
+	 *
1502
+	 * @param      object $copyObj An object of \Jalle19\StatusManager\Database\Subscription (or compatible) type.
1503
+	 * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1504
+	 * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
1505
+	 * @throws PropelException
1506
+	 */
1507
+	public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
1508
+	{
1509
+		$copyObj->setInstanceName($this->getInstanceName());
1510
+		$copyObj->setUserId($this->getUserId());
1511
+		$copyObj->setChannelId($this->getChannelId());
1512
+		$copyObj->setSubscriptionId($this->getSubscriptionId());
1513
+		$copyObj->setStarted($this->getStarted());
1514
+		$copyObj->setStopped($this->getStopped());
1515
+		$copyObj->setTitle($this->getTitle());
1516
+		$copyObj->setService($this->getService());
1517
+		if ($makeNew) {
1518
+			$copyObj->setNew(true);
1519
+			$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
1520
+		}
1521
+	}
1522
+
1523
+	/**
1524
+	 * Makes a copy of this object that will be inserted as a new row in table when saved.
1525
+	 * It creates a new object filling in the simple attributes, but skipping any primary
1526
+	 * keys that are defined for the table.
1527
+	 *
1528
+	 * If desired, this method can also make copies of all associated (fkey referrers)
1529
+	 * objects.
1530
+	 *
1531
+	 * @param  boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
1532
+	 * @return \Jalle19\StatusManager\Database\Subscription Clone of current object.
1533
+	 * @throws PropelException
1534
+	 */
1535
+	public function copy($deepCopy = false)
1536
+	{
1537
+		// we use get_class(), because this might be a subclass
1538
+		$clazz = get_class($this);
1539
+		$copyObj = new $clazz();
1540
+		$this->copyInto($copyObj, $deepCopy);
1541
+
1542
+		return $copyObj;
1543
+	}
1544
+
1545
+	/**
1546
+	 * Declares an association between this object and a ChildInstance object.
1547
+	 *
1548
+	 * @param  ChildInstance $v
1549
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
1550
+	 * @throws PropelException
1551
+	 */
1552
+	public function setInstance(ChildInstance $v = null)
1553
+	{
1554
+		if ($v === null) {
1555
+			$this->setInstanceName(NULL);
1556
+		} else {
1557
+			$this->setInstanceName($v->getName());
1558
+		}
1559
+
1560
+		$this->aInstance = $v;
1561
+
1562
+		// Add binding for other direction of this n:n relationship.
1563
+		// If this object has already been added to the ChildInstance object, it will not be re-added.
1564
+		if ($v !== null) {
1565
+			$v->addSubscription($this);
1566
+		}
1567
+
1568
+
1569
+		return $this;
1570
+	}
1571
+
1572
+
1573
+	/**
1574
+	 * Get the associated ChildInstance object
1575
+	 *
1576
+	 * @param  ConnectionInterface $con Optional Connection object.
1577
+	 * @return ChildInstance The associated ChildInstance object.
1578
+	 * @throws PropelException
1579
+	 */
1580
+	public function getInstance(ConnectionInterface $con = null)
1581
+	{
1582
+		if ($this->aInstance === null && (($this->instance_name !== "" && $this->instance_name !== null))) {
1583
+			$this->aInstance = ChildInstanceQuery::create()->findPk($this->instance_name, $con);
1584
+			/* The following can be used additionally to
1585 1585
                 guarantee the related object contains a reference
1586 1586
                 to this object.  This level of coupling may, however, be
1587 1587
                 undesirable since it could result in an only partially populated collection
1588 1588
                 in the referenced object.
1589 1589
                 $this->aInstance->addSubscriptions($this);
1590 1590
              */
1591
-        }
1592
-
1593
-        return $this->aInstance;
1594
-    }
1595
-
1596
-    /**
1597
-     * Declares an association between this object and a ChildUser object.
1598
-     *
1599
-     * @param  ChildUser $v
1600
-     * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
1601
-     * @throws PropelException
1602
-     */
1603
-    public function setUser(ChildUser $v = null)
1604
-    {
1605
-        if ($v === null) {
1606
-            $this->setUserId(NULL);
1607
-        } else {
1608
-            $this->setUserId($v->getId());
1609
-        }
1610
-
1611
-        $this->aUser = $v;
1612
-
1613
-        // Add binding for other direction of this n:n relationship.
1614
-        // If this object has already been added to the ChildUser object, it will not be re-added.
1615
-        if ($v !== null) {
1616
-            $v->addSubscription($this);
1617
-        }
1618
-
1619
-
1620
-        return $this;
1621
-    }
1622
-
1623
-
1624
-    /**
1625
-     * Get the associated ChildUser object
1626
-     *
1627
-     * @param  ConnectionInterface $con Optional Connection object.
1628
-     * @return ChildUser The associated ChildUser object.
1629
-     * @throws PropelException
1630
-     */
1631
-    public function getUser(ConnectionInterface $con = null)
1632
-    {
1633
-        if ($this->aUser === null && ($this->user_id !== null)) {
1634
-            $this->aUser = ChildUserQuery::create()->findPk($this->user_id, $con);
1635
-            /* The following can be used additionally to
1591
+		}
1592
+
1593
+		return $this->aInstance;
1594
+	}
1595
+
1596
+	/**
1597
+	 * Declares an association between this object and a ChildUser object.
1598
+	 *
1599
+	 * @param  ChildUser $v
1600
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
1601
+	 * @throws PropelException
1602
+	 */
1603
+	public function setUser(ChildUser $v = null)
1604
+	{
1605
+		if ($v === null) {
1606
+			$this->setUserId(NULL);
1607
+		} else {
1608
+			$this->setUserId($v->getId());
1609
+		}
1610
+
1611
+		$this->aUser = $v;
1612
+
1613
+		// Add binding for other direction of this n:n relationship.
1614
+		// If this object has already been added to the ChildUser object, it will not be re-added.
1615
+		if ($v !== null) {
1616
+			$v->addSubscription($this);
1617
+		}
1618
+
1619
+
1620
+		return $this;
1621
+	}
1622
+
1623
+
1624
+	/**
1625
+	 * Get the associated ChildUser object
1626
+	 *
1627
+	 * @param  ConnectionInterface $con Optional Connection object.
1628
+	 * @return ChildUser The associated ChildUser object.
1629
+	 * @throws PropelException
1630
+	 */
1631
+	public function getUser(ConnectionInterface $con = null)
1632
+	{
1633
+		if ($this->aUser === null && ($this->user_id !== null)) {
1634
+			$this->aUser = ChildUserQuery::create()->findPk($this->user_id, $con);
1635
+			/* The following can be used additionally to
1636 1636
                 guarantee the related object contains a reference
1637 1637
                 to this object.  This level of coupling may, however, be
1638 1638
                 undesirable since it could result in an only partially populated collection
1639 1639
                 in the referenced object.
1640 1640
                 $this->aUser->addSubscriptions($this);
1641 1641
              */
1642
-        }
1643
-
1644
-        return $this->aUser;
1645
-    }
1646
-
1647
-    /**
1648
-     * Declares an association between this object and a ChildChannel object.
1649
-     *
1650
-     * @param  ChildChannel $v
1651
-     * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
1652
-     * @throws PropelException
1653
-     */
1654
-    public function setChannel(ChildChannel $v = null)
1655
-    {
1656
-        if ($v === null) {
1657
-            $this->setChannelId(NULL);
1658
-        } else {
1659
-            $this->setChannelId($v->getId());
1660
-        }
1661
-
1662
-        $this->aChannel = $v;
1663
-
1664
-        // Add binding for other direction of this n:n relationship.
1665
-        // If this object has already been added to the ChildChannel object, it will not be re-added.
1666
-        if ($v !== null) {
1667
-            $v->addSubscription($this);
1668
-        }
1669
-
1670
-
1671
-        return $this;
1672
-    }
1673
-
1674
-
1675
-    /**
1676
-     * Get the associated ChildChannel object
1677
-     *
1678
-     * @param  ConnectionInterface $con Optional Connection object.
1679
-     * @return ChildChannel The associated ChildChannel object.
1680
-     * @throws PropelException
1681
-     */
1682
-    public function getChannel(ConnectionInterface $con = null)
1683
-    {
1684
-        if ($this->aChannel === null && ($this->channel_id !== null)) {
1685
-            $this->aChannel = ChildChannelQuery::create()->findPk($this->channel_id, $con);
1686
-            /* The following can be used additionally to
1642
+		}
1643
+
1644
+		return $this->aUser;
1645
+	}
1646
+
1647
+	/**
1648
+	 * Declares an association between this object and a ChildChannel object.
1649
+	 *
1650
+	 * @param  ChildChannel $v
1651
+	 * @return $this|\Jalle19\StatusManager\Database\Subscription The current object (for fluent API support)
1652
+	 * @throws PropelException
1653
+	 */
1654
+	public function setChannel(ChildChannel $v = null)
1655
+	{
1656
+		if ($v === null) {
1657
+			$this->setChannelId(NULL);
1658
+		} else {
1659
+			$this->setChannelId($v->getId());
1660
+		}
1661
+
1662
+		$this->aChannel = $v;
1663
+
1664
+		// Add binding for other direction of this n:n relationship.
1665
+		// If this object has already been added to the ChildChannel object, it will not be re-added.
1666
+		if ($v !== null) {
1667
+			$v->addSubscription($this);
1668
+		}
1669
+
1670
+
1671
+		return $this;
1672
+	}
1673
+
1674
+
1675
+	/**
1676
+	 * Get the associated ChildChannel object
1677
+	 *
1678
+	 * @param  ConnectionInterface $con Optional Connection object.
1679
+	 * @return ChildChannel The associated ChildChannel object.
1680
+	 * @throws PropelException
1681
+	 */
1682
+	public function getChannel(ConnectionInterface $con = null)
1683
+	{
1684
+		if ($this->aChannel === null && ($this->channel_id !== null)) {
1685
+			$this->aChannel = ChildChannelQuery::create()->findPk($this->channel_id, $con);
1686
+			/* The following can be used additionally to
1687 1687
                 guarantee the related object contains a reference
1688 1688
                 to this object.  This level of coupling may, however, be
1689 1689
                 undesirable since it could result in an only partially populated collection
1690 1690
                 in the referenced object.
1691 1691
                 $this->aChannel->addSubscriptions($this);
1692 1692
              */
1693
-        }
1694
-
1695
-        return $this->aChannel;
1696
-    }
1697
-
1698
-    /**
1699
-     * Clears the current object, sets all attributes to their default values and removes
1700
-     * outgoing references as well as back-references (from other objects to this one. Results probably in a database
1701
-     * change of those foreign objects when you call `save` there).
1702
-     */
1703
-    public function clear()
1704
-    {
1705
-        if (null !== $this->aInstance) {
1706
-            $this->aInstance->removeSubscription($this);
1707
-        }
1708
-        if (null !== $this->aUser) {
1709
-            $this->aUser->removeSubscription($this);
1710
-        }
1711
-        if (null !== $this->aChannel) {
1712
-            $this->aChannel->removeSubscription($this);
1713
-        }
1714
-        $this->id = null;
1715
-        $this->instance_name = null;
1716
-        $this->user_id = null;
1717
-        $this->channel_id = null;
1718
-        $this->subscription_id = null;
1719
-        $this->started = null;
1720
-        $this->stopped = null;
1721
-        $this->title = null;
1722
-        $this->service = null;
1723
-        $this->alreadyInSave = false;
1724
-        $this->clearAllReferences();
1725
-        $this->resetModified();
1726
-        $this->setNew(true);
1727
-        $this->setDeleted(false);
1728
-    }
1729
-
1730
-    /**
1731
-     * Resets all references and back-references to other model objects or collections of model objects.
1732
-     *
1733
-     * This method is used to reset all php object references (not the actual reference in the database).
1734
-     * Necessary for object serialisation.
1735
-     *
1736
-     * @param      boolean $deep Whether to also clear the references on all referrer objects.
1737
-     */
1738
-    public function clearAllReferences($deep = false)
1739
-    {
1740
-        if ($deep) {
1741
-        } // if ($deep)
1742
-
1743
-        $this->aInstance = null;
1744
-        $this->aUser = null;
1745
-        $this->aChannel = null;
1746
-    }
1747
-
1748
-    /**
1749
-     * Return the string representation of this object
1750
-     *
1751
-     * @return string
1752
-     */
1753
-    public function __toString()
1754
-    {
1755
-        return (string) $this->exportTo(SubscriptionTableMap::DEFAULT_STRING_FORMAT);
1756
-    }
1757
-
1758
-    /**
1759
-     * Code to be run before persisting the object
1760
-     * @param  ConnectionInterface $con
1761
-     * @return boolean
1762
-     */
1763
-    public function preSave(ConnectionInterface $con = null)
1764
-    {
1765
-        return true;
1766
-    }
1767
-
1768
-    /**
1769
-     * Code to be run after persisting the object
1770
-     * @param ConnectionInterface $con
1771
-     */
1772
-    public function postSave(ConnectionInterface $con = null)
1773
-    {
1774
-
1775
-    }
1776
-
1777
-    /**
1778
-     * Code to be run before inserting to database
1779
-     * @param  ConnectionInterface $con
1780
-     * @return boolean
1781
-     */
1782
-    public function preInsert(ConnectionInterface $con = null)
1783
-    {
1784
-        return true;
1785
-    }
1786
-
1787
-    /**
1788
-     * Code to be run after inserting to database
1789
-     * @param ConnectionInterface $con
1790
-     */
1791
-    public function postInsert(ConnectionInterface $con = null)
1792
-    {
1793
-
1794
-    }
1795
-
1796
-    /**
1797
-     * Code to be run before updating the object in database
1798
-     * @param  ConnectionInterface $con
1799
-     * @return boolean
1800
-     */
1801
-    public function preUpdate(ConnectionInterface $con = null)
1802
-    {
1803
-        return true;
1804
-    }
1805
-
1806
-    /**
1807
-     * Code to be run after updating the object in database
1808
-     * @param ConnectionInterface $con
1809
-     */
1810
-    public function postUpdate(ConnectionInterface $con = null)
1811
-    {
1812
-
1813
-    }
1814
-
1815
-    /**
1816
-     * Code to be run before deleting the object in database
1817
-     * @param  ConnectionInterface $con
1818
-     * @return boolean
1819
-     */
1820
-    public function preDelete(ConnectionInterface $con = null)
1821
-    {
1822
-        return true;
1823
-    }
1824
-
1825
-    /**
1826
-     * Code to be run after deleting the object in database
1827
-     * @param ConnectionInterface $con
1828
-     */
1829
-    public function postDelete(ConnectionInterface $con = null)
1830
-    {
1831
-
1832
-    }
1833
-
1834
-
1835
-    /**
1836
-     * Derived method to catches calls to undefined methods.
1837
-     *
1838
-     * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
1839
-     * Allows to define default __call() behavior if you overwrite __call()
1840
-     *
1841
-     * @param string $name
1842
-     * @param mixed  $params
1843
-     *
1844
-     * @return array|string
1845
-     */
1846
-    public function __call($name, $params)
1847
-    {
1848
-        if (0 === strpos($name, 'get')) {
1849
-            $virtualColumn = substr($name, 3);
1850
-            if ($this->hasVirtualColumn($virtualColumn)) {
1851
-                return $this->getVirtualColumn($virtualColumn);
1852
-            }
1853
-
1854
-            $virtualColumn = lcfirst($virtualColumn);
1855
-            if ($this->hasVirtualColumn($virtualColumn)) {
1856
-                return $this->getVirtualColumn($virtualColumn);
1857
-            }
1858
-        }
1859
-
1860
-        if (0 === strpos($name, 'from')) {
1861
-            $format = substr($name, 4);
1862
-
1863
-            return $this->importFrom($format, reset($params));
1864
-        }
1865
-
1866
-        if (0 === strpos($name, 'to')) {
1867
-            $format = substr($name, 2);
1868
-            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1869
-
1870
-            return $this->exportTo($format, $includeLazyLoadColumns);
1871
-        }
1872
-
1873
-        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1874
-    }
1693
+		}
1694
+
1695
+		return $this->aChannel;
1696
+	}
1697
+
1698
+	/**
1699
+	 * Clears the current object, sets all attributes to their default values and removes
1700
+	 * outgoing references as well as back-references (from other objects to this one. Results probably in a database
1701
+	 * change of those foreign objects when you call `save` there).
1702
+	 */
1703
+	public function clear()
1704
+	{
1705
+		if (null !== $this->aInstance) {
1706
+			$this->aInstance->removeSubscription($this);
1707
+		}
1708
+		if (null !== $this->aUser) {
1709
+			$this->aUser->removeSubscription($this);
1710
+		}
1711
+		if (null !== $this->aChannel) {
1712
+			$this->aChannel->removeSubscription($this);
1713
+		}
1714
+		$this->id = null;
1715
+		$this->instance_name = null;
1716
+		$this->user_id = null;
1717
+		$this->channel_id = null;
1718
+		$this->subscription_id = null;
1719
+		$this->started = null;
1720
+		$this->stopped = null;
1721
+		$this->title = null;
1722
+		$this->service = null;
1723
+		$this->alreadyInSave = false;
1724
+		$this->clearAllReferences();
1725
+		$this->resetModified();
1726
+		$this->setNew(true);
1727
+		$this->setDeleted(false);
1728
+	}
1729
+
1730
+	/**
1731
+	 * Resets all references and back-references to other model objects or collections of model objects.
1732
+	 *
1733
+	 * This method is used to reset all php object references (not the actual reference in the database).
1734
+	 * Necessary for object serialisation.
1735
+	 *
1736
+	 * @param      boolean $deep Whether to also clear the references on all referrer objects.
1737
+	 */
1738
+	public function clearAllReferences($deep = false)
1739
+	{
1740
+		if ($deep) {
1741
+		} // if ($deep)
1742
+
1743
+		$this->aInstance = null;
1744
+		$this->aUser = null;
1745
+		$this->aChannel = null;
1746
+	}
1747
+
1748
+	/**
1749
+	 * Return the string representation of this object
1750
+	 *
1751
+	 * @return string
1752
+	 */
1753
+	public function __toString()
1754
+	{
1755
+		return (string) $this->exportTo(SubscriptionTableMap::DEFAULT_STRING_FORMAT);
1756
+	}
1757
+
1758
+	/**
1759
+	 * Code to be run before persisting the object
1760
+	 * @param  ConnectionInterface $con
1761
+	 * @return boolean
1762
+	 */
1763
+	public function preSave(ConnectionInterface $con = null)
1764
+	{
1765
+		return true;
1766
+	}
1767
+
1768
+	/**
1769
+	 * Code to be run after persisting the object
1770
+	 * @param ConnectionInterface $con
1771
+	 */
1772
+	public function postSave(ConnectionInterface $con = null)
1773
+	{
1774
+
1775
+	}
1776
+
1777
+	/**
1778
+	 * Code to be run before inserting to database
1779
+	 * @param  ConnectionInterface $con
1780
+	 * @return boolean
1781
+	 */
1782
+	public function preInsert(ConnectionInterface $con = null)
1783
+	{
1784
+		return true;
1785
+	}
1786
+
1787
+	/**
1788
+	 * Code to be run after inserting to database
1789
+	 * @param ConnectionInterface $con
1790
+	 */
1791
+	public function postInsert(ConnectionInterface $con = null)
1792
+	{
1793
+
1794
+	}
1795
+
1796
+	/**
1797
+	 * Code to be run before updating the object in database
1798
+	 * @param  ConnectionInterface $con
1799
+	 * @return boolean
1800
+	 */
1801
+	public function preUpdate(ConnectionInterface $con = null)
1802
+	{
1803
+		return true;
1804
+	}
1805
+
1806
+	/**
1807
+	 * Code to be run after updating the object in database
1808
+	 * @param ConnectionInterface $con
1809
+	 */
1810
+	public function postUpdate(ConnectionInterface $con = null)
1811
+	{
1812
+
1813
+	}
1814
+
1815
+	/**
1816
+	 * Code to be run before deleting the object in database
1817
+	 * @param  ConnectionInterface $con
1818
+	 * @return boolean
1819
+	 */
1820
+	public function preDelete(ConnectionInterface $con = null)
1821
+	{
1822
+		return true;
1823
+	}
1824
+
1825
+	/**
1826
+	 * Code to be run after deleting the object in database
1827
+	 * @param ConnectionInterface $con
1828
+	 */
1829
+	public function postDelete(ConnectionInterface $con = null)
1830
+	{
1831
+
1832
+	}
1833
+
1834
+
1835
+	/**
1836
+	 * Derived method to catches calls to undefined methods.
1837
+	 *
1838
+	 * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
1839
+	 * Allows to define default __call() behavior if you overwrite __call()
1840
+	 *
1841
+	 * @param string $name
1842
+	 * @param mixed  $params
1843
+	 *
1844
+	 * @return array|string
1845
+	 */
1846
+	public function __call($name, $params)
1847
+	{
1848
+		if (0 === strpos($name, 'get')) {
1849
+			$virtualColumn = substr($name, 3);
1850
+			if ($this->hasVirtualColumn($virtualColumn)) {
1851
+				return $this->getVirtualColumn($virtualColumn);
1852
+			}
1853
+
1854
+			$virtualColumn = lcfirst($virtualColumn);
1855
+			if ($this->hasVirtualColumn($virtualColumn)) {
1856
+				return $this->getVirtualColumn($virtualColumn);
1857
+			}
1858
+		}
1859
+
1860
+		if (0 === strpos($name, 'from')) {
1861
+			$format = substr($name, 4);
1862
+
1863
+			return $this->importFrom($format, reset($params));
1864
+		}
1865
+
1866
+		if (0 === strpos($name, 'to')) {
1867
+			$format = substr($name, 2);
1868
+			$includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1869
+
1870
+			return $this->exportTo($format, $includeLazyLoadColumns);
1871
+		}
1872
+
1873
+		throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1874
+	}
1875 1875
 
1876 1876
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         $propertyNames = [];
372 372
         $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
373 373
 
374
-        foreach($serializableProperties as $property) {
374
+        foreach ($serializableProperties as $property) {
375 375
             $propertyNames[] = $property->getName();
376 376
         }
377 377
 
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
             $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
846 846
         }
847 847
 
848
-        $con->transaction(function () use ($con) {
848
+        $con->transaction(function() use ($con) {
849 849
             $deleteQuery = ChildSubscriptionQuery::create()
850 850
                 ->filterByPrimaryKey($this->getPrimaryKey());
851 851
             $ret = $this->preDelete($con);
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
             $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
881 881
         }
882 882
 
883
-        return $con->transaction(function () use ($con) {
883
+        return $con->transaction(function() use ($con) {
884 884
             $isInsert = $this->isNew();
885 885
             $ret = $this->preSave($con);
886 886
             if ($isInsert) {
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
                         $key = 'Instance';
1207 1207
                 }
1208 1208
 
1209
-                $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1209
+                $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1210 1210
             }
1211 1211
             if (null !== $this->aUser) {
1212 1212
 
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
                         $key = 'User';
1222 1222
                 }
1223 1223
 
1224
-                $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1224
+                $result[$key] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1225 1225
             }
1226 1226
             if (null !== $this->aChannel) {
1227 1227
 
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
                         $key = 'Channel';
1237 1237
                 }
1238 1238
 
1239
-                $result[$key] = $this->aChannel->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
1239
+                $result[$key] = $this->aChannel->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
1240 1240
             }
1241 1241
         }
1242 1242
 
Please login to merge, or discard this patch.
src/cli/Database/Base/SubscriptionQuery.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
      * $query->filterBySubscriptionId(array('min' => 12)); // WHERE subscription_id > 12
465 465
      * </code>
466 466
      *
467
-     * @param     mixed $subscriptionId The value to use as filter.
467
+     * @param     integer $subscriptionId The value to use as filter.
468 468
      *              Use scalar values for equality.
469 469
      *              Use array values for in_array() equivalent.
470 470
      *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
      * $query->filterByStarted(array('max' => 'yesterday')); // WHERE started > '2011-03-13'
506 506
      * </code>
507 507
      *
508
-     * @param     mixed $started The value to use as filter.
508
+     * @param     integer $started The value to use as filter.
509 509
      *              Values can be integers (unix timestamps), DateTime objects, or strings.
510 510
      *              Empty strings are treated as NULL.
511 511
      *              Use scalar values for equality.
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
     /**
643 643
      * Filter the query by a related \Jalle19\StatusManager\Database\Instance object
644 644
      *
645
-     * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter
645
+     * @param Instance $instance The related object(s) to use as filter
646 646
      * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
647 647
      *
648 648
      * @throws \Propel\Runtime\Exception\PropelException
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
     /**
720 720
      * Filter the query by a related \Jalle19\StatusManager\Database\User object
721 721
      *
722
-     * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user The related object(s) to use as filter
722
+     * @param User $user The related object(s) to use as filter
723 723
      * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
724 724
      *
725 725
      * @throws \Propel\Runtime\Exception\PropelException
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
     /**
797 797
      * Filter the query by a related \Jalle19\StatusManager\Database\Channel object
798 798
      *
799
-     * @param \Jalle19\StatusManager\Database\Channel|ObjectCollection $channel The related object(s) to use as filter
799
+     * @param Channel $channel The related object(s) to use as filter
800 800
      * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
801 801
      *
802 802
      * @throws \Propel\Runtime\Exception\PropelException
Please login to merge, or discard this patch.
Indentation   +825 added lines, -826 removed lines patch added patch discarded remove patch
@@ -92,7 +92,6 @@  discard block
 block discarded – undo
92 92
  * @method     ChildSubscription findOneByStopped(string $stopped) Return the first ChildSubscription filtered by the stopped column
93 93
  * @method     ChildSubscription findOneByTitle(string $title) Return the first ChildSubscription filtered by the title column
94 94
  * @method     ChildSubscription findOneByService(string $service) Return the first ChildSubscription filtered by the service column *
95
-
96 95
  * @method     ChildSubscription requirePk($key, ConnectionInterface $con = null) Return the ChildSubscription by primary key and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
97 96
  * @method     ChildSubscription requireOne(ConnectionInterface $con = null) Return the first ChildSubscription matching the query and throws \Propel\Runtime\Exception\EntityNotFoundException when not found
98 97
  *
@@ -121,830 +120,830 @@  discard block
 block discarded – undo
121 120
  */
122 121
 abstract class SubscriptionQuery extends ModelCriteria
123 122
 {
124
-    protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException';
125
-
126
-    /**
127
-     * Initializes internal state of \Jalle19\StatusManager\Database\Base\SubscriptionQuery object.
128
-     *
129
-     * @param     string $dbName The database name
130
-     * @param     string $modelName The phpName of a model, e.g. 'Book'
131
-     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
132
-     */
133
-    public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Subscription', $modelAlias = null)
134
-    {
135
-        parent::__construct($dbName, $modelName, $modelAlias);
136
-    }
137
-
138
-    /**
139
-     * Returns a new ChildSubscriptionQuery object.
140
-     *
141
-     * @param     string $modelAlias The alias of a model in the query
142
-     * @param     Criteria $criteria Optional Criteria to build the query from
143
-     *
144
-     * @return ChildSubscriptionQuery
145
-     */
146
-    public static function create($modelAlias = null, Criteria $criteria = null)
147
-    {
148
-        if ($criteria instanceof ChildSubscriptionQuery) {
149
-            return $criteria;
150
-        }
151
-        $query = new ChildSubscriptionQuery();
152
-        if (null !== $modelAlias) {
153
-            $query->setModelAlias($modelAlias);
154
-        }
155
-        if ($criteria instanceof Criteria) {
156
-            $query->mergeWith($criteria);
157
-        }
158
-
159
-        return $query;
160
-    }
161
-
162
-    /**
163
-     * Find object by primary key.
164
-     * Propel uses the instance pool to skip the database if the object exists.
165
-     * Go fast if the query is untouched.
166
-     *
167
-     * <code>
168
-     * $obj  = $c->findPk(12, $con);
169
-     * </code>
170
-     *
171
-     * @param mixed $key Primary key to use for the query
172
-     * @param ConnectionInterface $con an optional connection object
173
-     *
174
-     * @return ChildSubscription|array|mixed the result, formatted by the current formatter
175
-     */
176
-    public function findPk($key, ConnectionInterface $con = null)
177
-    {
178
-        if ($key === null) {
179
-            return null;
180
-        }
181
-        if ((null !== ($obj = SubscriptionTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) {
182
-            // the object is already in the instance pool
183
-            return $obj;
184
-        }
185
-        if ($con === null) {
186
-            $con = Propel::getServiceContainer()->getReadConnection(SubscriptionTableMap::DATABASE_NAME);
187
-        }
188
-        $this->basePreSelect($con);
189
-        if ($this->formatter || $this->modelAlias || $this->with || $this->select
190
-         || $this->selectColumns || $this->asColumns || $this->selectModifiers
191
-         || $this->map || $this->having || $this->joins) {
192
-            return $this->findPkComplex($key, $con);
193
-        } else {
194
-            return $this->findPkSimple($key, $con);
195
-        }
196
-    }
197
-
198
-    /**
199
-     * Find object by primary key using raw SQL to go fast.
200
-     * Bypass doSelect() and the object formatter by using generated code.
201
-     *
202
-     * @param     mixed $key Primary key to use for the query
203
-     * @param     ConnectionInterface $con A connection object
204
-     *
205
-     * @throws \Propel\Runtime\Exception\PropelException
206
-     *
207
-     * @return ChildSubscription A model object, or null if the key is not found
208
-     */
209
-    protected function findPkSimple($key, ConnectionInterface $con)
210
-    {
211
-        $sql = 'SELECT id, instance_name, user_id, channel_id, subscription_id, started, stopped, title, service FROM subscription WHERE id = :p0';
212
-        try {
213
-            $stmt = $con->prepare($sql);
214
-            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
215
-            $stmt->execute();
216
-        } catch (Exception $e) {
217
-            Propel::log($e->getMessage(), Propel::LOG_ERR);
218
-            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
219
-        }
220
-        $obj = null;
221
-        if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
222
-            /** @var ChildSubscription $obj */
223
-            $obj = new ChildSubscription();
224
-            $obj->hydrate($row);
225
-            SubscriptionTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
226
-        }
227
-        $stmt->closeCursor();
228
-
229
-        return $obj;
230
-    }
231
-
232
-    /**
233
-     * Find object by primary key.
234
-     *
235
-     * @param     mixed $key Primary key to use for the query
236
-     * @param     ConnectionInterface $con A connection object
237
-     *
238
-     * @return ChildSubscription|array|mixed the result, formatted by the current formatter
239
-     */
240
-    protected function findPkComplex($key, ConnectionInterface $con)
241
-    {
242
-        // As the query uses a PK condition, no limit(1) is necessary.
243
-        $criteria = $this->isKeepQuery() ? clone $this : $this;
244
-        $dataFetcher = $criteria
245
-            ->filterByPrimaryKey($key)
246
-            ->doSelect($con);
247
-
248
-        return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
249
-    }
250
-
251
-    /**
252
-     * Find objects by primary key
253
-     * <code>
254
-     * $objs = $c->findPks(array(12, 56, 832), $con);
255
-     * </code>
256
-     * @param     array $keys Primary keys to use for the query
257
-     * @param     ConnectionInterface $con an optional connection object
258
-     *
259
-     * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
260
-     */
261
-    public function findPks($keys, ConnectionInterface $con = null)
262
-    {
263
-        if (null === $con) {
264
-            $con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
265
-        }
266
-        $this->basePreSelect($con);
267
-        $criteria = $this->isKeepQuery() ? clone $this : $this;
268
-        $dataFetcher = $criteria
269
-            ->filterByPrimaryKeys($keys)
270
-            ->doSelect($con);
271
-
272
-        return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
273
-    }
274
-
275
-    /**
276
-     * Filter the query by primary key
277
-     *
278
-     * @param     mixed $key Primary key to use for the query
279
-     *
280
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
281
-     */
282
-    public function filterByPrimaryKey($key)
283
-    {
284
-
285
-        return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $key, Criteria::EQUAL);
286
-    }
287
-
288
-    /**
289
-     * Filter the query by a list of primary keys
290
-     *
291
-     * @param     array $keys The list of primary key to use for the query
292
-     *
293
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
294
-     */
295
-    public function filterByPrimaryKeys($keys)
296
-    {
297
-
298
-        return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $keys, Criteria::IN);
299
-    }
300
-
301
-    /**
302
-     * Filter the query on the id column
303
-     *
304
-     * Example usage:
305
-     * <code>
306
-     * $query->filterById(1234); // WHERE id = 1234
307
-     * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
308
-     * $query->filterById(array('min' => 12)); // WHERE id > 12
309
-     * </code>
310
-     *
311
-     * @param     mixed $id The value to use as filter.
312
-     *              Use scalar values for equality.
313
-     *              Use array values for in_array() equivalent.
314
-     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
315
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
316
-     *
317
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
318
-     */
319
-    public function filterById($id = null, $comparison = null)
320
-    {
321
-        if (is_array($id)) {
322
-            $useMinMax = false;
323
-            if (isset($id['min'])) {
324
-                $this->addUsingAlias(SubscriptionTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL);
325
-                $useMinMax = true;
326
-            }
327
-            if (isset($id['max'])) {
328
-                $this->addUsingAlias(SubscriptionTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL);
329
-                $useMinMax = true;
330
-            }
331
-            if ($useMinMax) {
332
-                return $this;
333
-            }
334
-            if (null === $comparison) {
335
-                $comparison = Criteria::IN;
336
-            }
337
-        }
338
-
339
-        return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $id, $comparison);
340
-    }
341
-
342
-    /**
343
-     * Filter the query on the instance_name column
344
-     *
345
-     * Example usage:
346
-     * <code>
347
-     * $query->filterByInstanceName('fooValue');   // WHERE instance_name = 'fooValue'
348
-     * $query->filterByInstanceName('%fooValue%'); // WHERE instance_name LIKE '%fooValue%'
349
-     * </code>
350
-     *
351
-     * @param     string $instanceName The value to use as filter.
352
-     *              Accepts wildcards (* and % trigger a LIKE)
353
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
354
-     *
355
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
356
-     */
357
-    public function filterByInstanceName($instanceName = null, $comparison = null)
358
-    {
359
-        if (null === $comparison) {
360
-            if (is_array($instanceName)) {
361
-                $comparison = Criteria::IN;
362
-            } elseif (preg_match('/[\%\*]/', $instanceName)) {
363
-                $instanceName = str_replace('*', '%', $instanceName);
364
-                $comparison = Criteria::LIKE;
365
-            }
366
-        }
367
-
368
-        return $this->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instanceName, $comparison);
369
-    }
370
-
371
-    /**
372
-     * Filter the query on the user_id column
373
-     *
374
-     * Example usage:
375
-     * <code>
376
-     * $query->filterByUserId(1234); // WHERE user_id = 1234
377
-     * $query->filterByUserId(array(12, 34)); // WHERE user_id IN (12, 34)
378
-     * $query->filterByUserId(array('min' => 12)); // WHERE user_id > 12
379
-     * </code>
380
-     *
381
-     * @see       filterByUser()
382
-     *
383
-     * @param     mixed $userId The value to use as filter.
384
-     *              Use scalar values for equality.
385
-     *              Use array values for in_array() equivalent.
386
-     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
387
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
388
-     *
389
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
390
-     */
391
-    public function filterByUserId($userId = null, $comparison = null)
392
-    {
393
-        if (is_array($userId)) {
394
-            $useMinMax = false;
395
-            if (isset($userId['min'])) {
396
-                $this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId['min'], Criteria::GREATER_EQUAL);
397
-                $useMinMax = true;
398
-            }
399
-            if (isset($userId['max'])) {
400
-                $this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId['max'], Criteria::LESS_EQUAL);
401
-                $useMinMax = true;
402
-            }
403
-            if ($useMinMax) {
404
-                return $this;
405
-            }
406
-            if (null === $comparison) {
407
-                $comparison = Criteria::IN;
408
-            }
409
-        }
410
-
411
-        return $this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId, $comparison);
412
-    }
413
-
414
-    /**
415
-     * Filter the query on the channel_id column
416
-     *
417
-     * Example usage:
418
-     * <code>
419
-     * $query->filterByChannelId(1234); // WHERE channel_id = 1234
420
-     * $query->filterByChannelId(array(12, 34)); // WHERE channel_id IN (12, 34)
421
-     * $query->filterByChannelId(array('min' => 12)); // WHERE channel_id > 12
422
-     * </code>
423
-     *
424
-     * @see       filterByChannel()
425
-     *
426
-     * @param     mixed $channelId The value to use as filter.
427
-     *              Use scalar values for equality.
428
-     *              Use array values for in_array() equivalent.
429
-     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
430
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
431
-     *
432
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
433
-     */
434
-    public function filterByChannelId($channelId = null, $comparison = null)
435
-    {
436
-        if (is_array($channelId)) {
437
-            $useMinMax = false;
438
-            if (isset($channelId['min'])) {
439
-                $this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId['min'], Criteria::GREATER_EQUAL);
440
-                $useMinMax = true;
441
-            }
442
-            if (isset($channelId['max'])) {
443
-                $this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId['max'], Criteria::LESS_EQUAL);
444
-                $useMinMax = true;
445
-            }
446
-            if ($useMinMax) {
447
-                return $this;
448
-            }
449
-            if (null === $comparison) {
450
-                $comparison = Criteria::IN;
451
-            }
452
-        }
453
-
454
-        return $this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId, $comparison);
455
-    }
456
-
457
-    /**
458
-     * Filter the query on the subscription_id column
459
-     *
460
-     * Example usage:
461
-     * <code>
462
-     * $query->filterBySubscriptionId(1234); // WHERE subscription_id = 1234
463
-     * $query->filterBySubscriptionId(array(12, 34)); // WHERE subscription_id IN (12, 34)
464
-     * $query->filterBySubscriptionId(array('min' => 12)); // WHERE subscription_id > 12
465
-     * </code>
466
-     *
467
-     * @param     mixed $subscriptionId The value to use as filter.
468
-     *              Use scalar values for equality.
469
-     *              Use array values for in_array() equivalent.
470
-     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
471
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
472
-     *
473
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
474
-     */
475
-    public function filterBySubscriptionId($subscriptionId = null, $comparison = null)
476
-    {
477
-        if (is_array($subscriptionId)) {
478
-            $useMinMax = false;
479
-            if (isset($subscriptionId['min'])) {
480
-                $this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId['min'], Criteria::GREATER_EQUAL);
481
-                $useMinMax = true;
482
-            }
483
-            if (isset($subscriptionId['max'])) {
484
-                $this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId['max'], Criteria::LESS_EQUAL);
485
-                $useMinMax = true;
486
-            }
487
-            if ($useMinMax) {
488
-                return $this;
489
-            }
490
-            if (null === $comparison) {
491
-                $comparison = Criteria::IN;
492
-            }
493
-        }
494
-
495
-        return $this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId, $comparison);
496
-    }
497
-
498
-    /**
499
-     * Filter the query on the started column
500
-     *
501
-     * Example usage:
502
-     * <code>
503
-     * $query->filterByStarted('2011-03-14'); // WHERE started = '2011-03-14'
504
-     * $query->filterByStarted('now'); // WHERE started = '2011-03-14'
505
-     * $query->filterByStarted(array('max' => 'yesterday')); // WHERE started > '2011-03-13'
506
-     * </code>
507
-     *
508
-     * @param     mixed $started The value to use as filter.
509
-     *              Values can be integers (unix timestamps), DateTime objects, or strings.
510
-     *              Empty strings are treated as NULL.
511
-     *              Use scalar values for equality.
512
-     *              Use array values for in_array() equivalent.
513
-     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
514
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
515
-     *
516
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
517
-     */
518
-    public function filterByStarted($started = null, $comparison = null)
519
-    {
520
-        if (is_array($started)) {
521
-            $useMinMax = false;
522
-            if (isset($started['min'])) {
523
-                $this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started['min'], Criteria::GREATER_EQUAL);
524
-                $useMinMax = true;
525
-            }
526
-            if (isset($started['max'])) {
527
-                $this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started['max'], Criteria::LESS_EQUAL);
528
-                $useMinMax = true;
529
-            }
530
-            if ($useMinMax) {
531
-                return $this;
532
-            }
533
-            if (null === $comparison) {
534
-                $comparison = Criteria::IN;
535
-            }
536
-        }
537
-
538
-        return $this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started, $comparison);
539
-    }
540
-
541
-    /**
542
-     * Filter the query on the stopped column
543
-     *
544
-     * Example usage:
545
-     * <code>
546
-     * $query->filterByStopped('2011-03-14'); // WHERE stopped = '2011-03-14'
547
-     * $query->filterByStopped('now'); // WHERE stopped = '2011-03-14'
548
-     * $query->filterByStopped(array('max' => 'yesterday')); // WHERE stopped > '2011-03-13'
549
-     * </code>
550
-     *
551
-     * @param     mixed $stopped The value to use as filter.
552
-     *              Values can be integers (unix timestamps), DateTime objects, or strings.
553
-     *              Empty strings are treated as NULL.
554
-     *              Use scalar values for equality.
555
-     *              Use array values for in_array() equivalent.
556
-     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
557
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
558
-     *
559
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
560
-     */
561
-    public function filterByStopped($stopped = null, $comparison = null)
562
-    {
563
-        if (is_array($stopped)) {
564
-            $useMinMax = false;
565
-            if (isset($stopped['min'])) {
566
-                $this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped['min'], Criteria::GREATER_EQUAL);
567
-                $useMinMax = true;
568
-            }
569
-            if (isset($stopped['max'])) {
570
-                $this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped['max'], Criteria::LESS_EQUAL);
571
-                $useMinMax = true;
572
-            }
573
-            if ($useMinMax) {
574
-                return $this;
575
-            }
576
-            if (null === $comparison) {
577
-                $comparison = Criteria::IN;
578
-            }
579
-        }
580
-
581
-        return $this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped, $comparison);
582
-    }
583
-
584
-    /**
585
-     * Filter the query on the title column
586
-     *
587
-     * Example usage:
588
-     * <code>
589
-     * $query->filterByTitle('fooValue');   // WHERE title = 'fooValue'
590
-     * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
591
-     * </code>
592
-     *
593
-     * @param     string $title The value to use as filter.
594
-     *              Accepts wildcards (* and % trigger a LIKE)
595
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
596
-     *
597
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
598
-     */
599
-    public function filterByTitle($title = null, $comparison = null)
600
-    {
601
-        if (null === $comparison) {
602
-            if (is_array($title)) {
603
-                $comparison = Criteria::IN;
604
-            } elseif (preg_match('/[\%\*]/', $title)) {
605
-                $title = str_replace('*', '%', $title);
606
-                $comparison = Criteria::LIKE;
607
-            }
608
-        }
609
-
610
-        return $this->addUsingAlias(SubscriptionTableMap::COL_TITLE, $title, $comparison);
611
-    }
612
-
613
-    /**
614
-     * Filter the query on the service column
615
-     *
616
-     * Example usage:
617
-     * <code>
618
-     * $query->filterByService('fooValue');   // WHERE service = 'fooValue'
619
-     * $query->filterByService('%fooValue%'); // WHERE service LIKE '%fooValue%'
620
-     * </code>
621
-     *
622
-     * @param     string $service The value to use as filter.
623
-     *              Accepts wildcards (* and % trigger a LIKE)
624
-     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
625
-     *
626
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
627
-     */
628
-    public function filterByService($service = null, $comparison = null)
629
-    {
630
-        if (null === $comparison) {
631
-            if (is_array($service)) {
632
-                $comparison = Criteria::IN;
633
-            } elseif (preg_match('/[\%\*]/', $service)) {
634
-                $service = str_replace('*', '%', $service);
635
-                $comparison = Criteria::LIKE;
636
-            }
637
-        }
638
-
639
-        return $this->addUsingAlias(SubscriptionTableMap::COL_SERVICE, $service, $comparison);
640
-    }
641
-
642
-    /**
643
-     * Filter the query by a related \Jalle19\StatusManager\Database\Instance object
644
-     *
645
-     * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter
646
-     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
647
-     *
648
-     * @throws \Propel\Runtime\Exception\PropelException
649
-     *
650
-     * @return ChildSubscriptionQuery The current query, for fluid interface
651
-     */
652
-    public function filterByInstance($instance, $comparison = null)
653
-    {
654
-        if ($instance instanceof \Jalle19\StatusManager\Database\Instance) {
655
-            return $this
656
-                ->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instance->getName(), $comparison);
657
-        } elseif ($instance instanceof ObjectCollection) {
658
-            if (null === $comparison) {
659
-                $comparison = Criteria::IN;
660
-            }
661
-
662
-            return $this
663
-                ->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instance->toKeyValue('PrimaryKey', 'Name'), $comparison);
664
-        } else {
665
-            throw new PropelException('filterByInstance() only accepts arguments of type \Jalle19\StatusManager\Database\Instance or Collection');
666
-        }
667
-    }
668
-
669
-    /**
670
-     * Adds a JOIN clause to the query using the Instance relation
671
-     *
672
-     * @param     string $relationAlias optional alias for the relation
673
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
674
-     *
675
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
676
-     */
677
-    public function joinInstance($relationAlias = null, $joinType = Criteria::INNER_JOIN)
678
-    {
679
-        $tableMap = $this->getTableMap();
680
-        $relationMap = $tableMap->getRelation('Instance');
681
-
682
-        // create a ModelJoin object for this join
683
-        $join = new ModelJoin();
684
-        $join->setJoinType($joinType);
685
-        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
686
-        if ($previousJoin = $this->getPreviousJoin()) {
687
-            $join->setPreviousJoin($previousJoin);
688
-        }
689
-
690
-        // add the ModelJoin to the current object
691
-        if ($relationAlias) {
692
-            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
693
-            $this->addJoinObject($join, $relationAlias);
694
-        } else {
695
-            $this->addJoinObject($join, 'Instance');
696
-        }
697
-
698
-        return $this;
699
-    }
700
-
701
-    /**
702
-     * Use the Instance relation Instance object
703
-     *
704
-     * @see useQuery()
705
-     *
706
-     * @param     string $relationAlias optional alias for the relation,
707
-     *                                   to be used as main alias in the secondary query
708
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
709
-     *
710
-     * @return \Jalle19\StatusManager\Database\InstanceQuery A secondary query class using the current class as primary query
711
-     */
712
-    public function useInstanceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
713
-    {
714
-        return $this
715
-            ->joinInstance($relationAlias, $joinType)
716
-            ->useQuery($relationAlias ? $relationAlias : 'Instance', '\Jalle19\StatusManager\Database\InstanceQuery');
717
-    }
718
-
719
-    /**
720
-     * Filter the query by a related \Jalle19\StatusManager\Database\User object
721
-     *
722
-     * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user The related object(s) to use as filter
723
-     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
724
-     *
725
-     * @throws \Propel\Runtime\Exception\PropelException
726
-     *
727
-     * @return ChildSubscriptionQuery The current query, for fluid interface
728
-     */
729
-    public function filterByUser($user, $comparison = null)
730
-    {
731
-        if ($user instanceof \Jalle19\StatusManager\Database\User) {
732
-            return $this
733
-                ->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $user->getId(), $comparison);
734
-        } elseif ($user instanceof ObjectCollection) {
735
-            if (null === $comparison) {
736
-                $comparison = Criteria::IN;
737
-            }
738
-
739
-            return $this
740
-                ->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison);
741
-        } else {
742
-            throw new PropelException('filterByUser() only accepts arguments of type \Jalle19\StatusManager\Database\User or Collection');
743
-        }
744
-    }
745
-
746
-    /**
747
-     * Adds a JOIN clause to the query using the User relation
748
-     *
749
-     * @param     string $relationAlias optional alias for the relation
750
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
751
-     *
752
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
753
-     */
754
-    public function joinUser($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
755
-    {
756
-        $tableMap = $this->getTableMap();
757
-        $relationMap = $tableMap->getRelation('User');
758
-
759
-        // create a ModelJoin object for this join
760
-        $join = new ModelJoin();
761
-        $join->setJoinType($joinType);
762
-        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
763
-        if ($previousJoin = $this->getPreviousJoin()) {
764
-            $join->setPreviousJoin($previousJoin);
765
-        }
766
-
767
-        // add the ModelJoin to the current object
768
-        if ($relationAlias) {
769
-            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
770
-            $this->addJoinObject($join, $relationAlias);
771
-        } else {
772
-            $this->addJoinObject($join, 'User');
773
-        }
774
-
775
-        return $this;
776
-    }
777
-
778
-    /**
779
-     * Use the User relation User object
780
-     *
781
-     * @see useQuery()
782
-     *
783
-     * @param     string $relationAlias optional alias for the relation,
784
-     *                                   to be used as main alias in the secondary query
785
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
786
-     *
787
-     * @return \Jalle19\StatusManager\Database\UserQuery A secondary query class using the current class as primary query
788
-     */
789
-    public function useUserQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
790
-    {
791
-        return $this
792
-            ->joinUser($relationAlias, $joinType)
793
-            ->useQuery($relationAlias ? $relationAlias : 'User', '\Jalle19\StatusManager\Database\UserQuery');
794
-    }
795
-
796
-    /**
797
-     * Filter the query by a related \Jalle19\StatusManager\Database\Channel object
798
-     *
799
-     * @param \Jalle19\StatusManager\Database\Channel|ObjectCollection $channel The related object(s) to use as filter
800
-     * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
801
-     *
802
-     * @throws \Propel\Runtime\Exception\PropelException
803
-     *
804
-     * @return ChildSubscriptionQuery The current query, for fluid interface
805
-     */
806
-    public function filterByChannel($channel, $comparison = null)
807
-    {
808
-        if ($channel instanceof \Jalle19\StatusManager\Database\Channel) {
809
-            return $this
810
-                ->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channel->getId(), $comparison);
811
-        } elseif ($channel instanceof ObjectCollection) {
812
-            if (null === $comparison) {
813
-                $comparison = Criteria::IN;
814
-            }
815
-
816
-            return $this
817
-                ->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channel->toKeyValue('PrimaryKey', 'Id'), $comparison);
818
-        } else {
819
-            throw new PropelException('filterByChannel() only accepts arguments of type \Jalle19\StatusManager\Database\Channel or Collection');
820
-        }
821
-    }
822
-
823
-    /**
824
-     * Adds a JOIN clause to the query using the Channel relation
825
-     *
826
-     * @param     string $relationAlias optional alias for the relation
827
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
828
-     *
829
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
830
-     */
831
-    public function joinChannel($relationAlias = null, $joinType = Criteria::INNER_JOIN)
832
-    {
833
-        $tableMap = $this->getTableMap();
834
-        $relationMap = $tableMap->getRelation('Channel');
835
-
836
-        // create a ModelJoin object for this join
837
-        $join = new ModelJoin();
838
-        $join->setJoinType($joinType);
839
-        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
840
-        if ($previousJoin = $this->getPreviousJoin()) {
841
-            $join->setPreviousJoin($previousJoin);
842
-        }
843
-
844
-        // add the ModelJoin to the current object
845
-        if ($relationAlias) {
846
-            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
847
-            $this->addJoinObject($join, $relationAlias);
848
-        } else {
849
-            $this->addJoinObject($join, 'Channel');
850
-        }
851
-
852
-        return $this;
853
-    }
854
-
855
-    /**
856
-     * Use the Channel relation Channel object
857
-     *
858
-     * @see useQuery()
859
-     *
860
-     * @param     string $relationAlias optional alias for the relation,
861
-     *                                   to be used as main alias in the secondary query
862
-     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
863
-     *
864
-     * @return \Jalle19\StatusManager\Database\ChannelQuery A secondary query class using the current class as primary query
865
-     */
866
-    public function useChannelQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
867
-    {
868
-        return $this
869
-            ->joinChannel($relationAlias, $joinType)
870
-            ->useQuery($relationAlias ? $relationAlias : 'Channel', '\Jalle19\StatusManager\Database\ChannelQuery');
871
-    }
872
-
873
-    /**
874
-     * Exclude object from result
875
-     *
876
-     * @param   ChildSubscription $subscription Object to remove from the list of results
877
-     *
878
-     * @return $this|ChildSubscriptionQuery The current query, for fluid interface
879
-     */
880
-    public function prune($subscription = null)
881
-    {
882
-        if ($subscription) {
883
-            $this->addUsingAlias(SubscriptionTableMap::COL_ID, $subscription->getId(), Criteria::NOT_EQUAL);
884
-        }
885
-
886
-        return $this;
887
-    }
888
-
889
-    /**
890
-     * Deletes all rows from the subscription table.
891
-     *
892
-     * @param ConnectionInterface $con the connection to use
893
-     * @return int The number of affected rows (if supported by underlying database driver).
894
-     */
895
-    public function doDeleteAll(ConnectionInterface $con = null)
896
-    {
897
-        if (null === $con) {
898
-            $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
899
-        }
900
-
901
-        // use transaction because $criteria could contain info
902
-        // for more than one table or we could emulating ON DELETE CASCADE, etc.
903
-        return $con->transaction(function () use ($con) {
904
-            $affectedRows = 0; // initialize var to track total num of affected rows
905
-            $affectedRows += parent::doDeleteAll($con);
906
-            // Because this db requires some delete cascade/set null emulation, we have to
907
-            // clear the cached instance *after* the emulation has happened (since
908
-            // instances get re-added by the select statement contained therein).
909
-            SubscriptionTableMap::clearInstancePool();
910
-            SubscriptionTableMap::clearRelatedInstancePool();
911
-
912
-            return $affectedRows;
913
-        });
914
-    }
915
-
916
-    /**
917
-     * Performs a DELETE on the database based on the current ModelCriteria
918
-     *
919
-     * @param ConnectionInterface $con the connection to use
920
-     * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
921
-     *                         if supported by native driver or if emulated using Propel.
922
-     * @throws PropelException Any exceptions caught during processing will be
923
-     *                         rethrown wrapped into a PropelException.
924
-     */
925
-    public function delete(ConnectionInterface $con = null)
926
-    {
927
-        if (null === $con) {
928
-            $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
929
-        }
930
-
931
-        $criteria = $this;
932
-
933
-        // Set the correct dbName
934
-        $criteria->setDbName(SubscriptionTableMap::DATABASE_NAME);
935
-
936
-        // use transaction because $criteria could contain info
937
-        // for more than one table or we could emulating ON DELETE CASCADE, etc.
938
-        return $con->transaction(function () use ($con, $criteria) {
939
-            $affectedRows = 0; // initialize var to track total num of affected rows
940
-
941
-            SubscriptionTableMap::removeInstanceFromPool($criteria);
942
-
943
-            $affectedRows += ModelCriteria::delete($con);
944
-            SubscriptionTableMap::clearRelatedInstancePool();
945
-
946
-            return $affectedRows;
947
-        });
948
-    }
123
+	protected $entityNotFoundExceptionClass = '\\Propel\\Runtime\\Exception\\EntityNotFoundException';
124
+
125
+	/**
126
+	 * Initializes internal state of \Jalle19\StatusManager\Database\Base\SubscriptionQuery object.
127
+	 *
128
+	 * @param     string $dbName The database name
129
+	 * @param     string $modelName The phpName of a model, e.g. 'Book'
130
+	 * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
131
+	 */
132
+	public function __construct($dbName = 'tvheadend_status_manager', $modelName = '\\Jalle19\\StatusManager\\Database\\Subscription', $modelAlias = null)
133
+	{
134
+		parent::__construct($dbName, $modelName, $modelAlias);
135
+	}
136
+
137
+	/**
138
+	 * Returns a new ChildSubscriptionQuery object.
139
+	 *
140
+	 * @param     string $modelAlias The alias of a model in the query
141
+	 * @param     Criteria $criteria Optional Criteria to build the query from
142
+	 *
143
+	 * @return ChildSubscriptionQuery
144
+	 */
145
+	public static function create($modelAlias = null, Criteria $criteria = null)
146
+	{
147
+		if ($criteria instanceof ChildSubscriptionQuery) {
148
+			return $criteria;
149
+		}
150
+		$query = new ChildSubscriptionQuery();
151
+		if (null !== $modelAlias) {
152
+			$query->setModelAlias($modelAlias);
153
+		}
154
+		if ($criteria instanceof Criteria) {
155
+			$query->mergeWith($criteria);
156
+		}
157
+
158
+		return $query;
159
+	}
160
+
161
+	/**
162
+	 * Find object by primary key.
163
+	 * Propel uses the instance pool to skip the database if the object exists.
164
+	 * Go fast if the query is untouched.
165
+	 *
166
+	 * <code>
167
+	 * $obj  = $c->findPk(12, $con);
168
+	 * </code>
169
+	 *
170
+	 * @param mixed $key Primary key to use for the query
171
+	 * @param ConnectionInterface $con an optional connection object
172
+	 *
173
+	 * @return ChildSubscription|array|mixed the result, formatted by the current formatter
174
+	 */
175
+	public function findPk($key, ConnectionInterface $con = null)
176
+	{
177
+		if ($key === null) {
178
+			return null;
179
+		}
180
+		if ((null !== ($obj = SubscriptionTableMap::getInstanceFromPool(null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key))) && !$this->formatter) {
181
+			// the object is already in the instance pool
182
+			return $obj;
183
+		}
184
+		if ($con === null) {
185
+			$con = Propel::getServiceContainer()->getReadConnection(SubscriptionTableMap::DATABASE_NAME);
186
+		}
187
+		$this->basePreSelect($con);
188
+		if ($this->formatter || $this->modelAlias || $this->with || $this->select
189
+		 || $this->selectColumns || $this->asColumns || $this->selectModifiers
190
+		 || $this->map || $this->having || $this->joins) {
191
+			return $this->findPkComplex($key, $con);
192
+		} else {
193
+			return $this->findPkSimple($key, $con);
194
+		}
195
+	}
196
+
197
+	/**
198
+	 * Find object by primary key using raw SQL to go fast.
199
+	 * Bypass doSelect() and the object formatter by using generated code.
200
+	 *
201
+	 * @param     mixed $key Primary key to use for the query
202
+	 * @param     ConnectionInterface $con A connection object
203
+	 *
204
+	 * @throws \Propel\Runtime\Exception\PropelException
205
+	 *
206
+	 * @return ChildSubscription A model object, or null if the key is not found
207
+	 */
208
+	protected function findPkSimple($key, ConnectionInterface $con)
209
+	{
210
+		$sql = 'SELECT id, instance_name, user_id, channel_id, subscription_id, started, stopped, title, service FROM subscription WHERE id = :p0';
211
+		try {
212
+			$stmt = $con->prepare($sql);
213
+			$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
214
+			$stmt->execute();
215
+		} catch (Exception $e) {
216
+			Propel::log($e->getMessage(), Propel::LOG_ERR);
217
+			throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e);
218
+		}
219
+		$obj = null;
220
+		if ($row = $stmt->fetch(\PDO::FETCH_NUM)) {
221
+			/** @var ChildSubscription $obj */
222
+			$obj = new ChildSubscription();
223
+			$obj->hydrate($row);
224
+			SubscriptionTableMap::addInstanceToPool($obj, null === $key || is_scalar($key) || is_callable([$key, '__toString']) ? (string) $key : $key);
225
+		}
226
+		$stmt->closeCursor();
227
+
228
+		return $obj;
229
+	}
230
+
231
+	/**
232
+	 * Find object by primary key.
233
+	 *
234
+	 * @param     mixed $key Primary key to use for the query
235
+	 * @param     ConnectionInterface $con A connection object
236
+	 *
237
+	 * @return ChildSubscription|array|mixed the result, formatted by the current formatter
238
+	 */
239
+	protected function findPkComplex($key, ConnectionInterface $con)
240
+	{
241
+		// As the query uses a PK condition, no limit(1) is necessary.
242
+		$criteria = $this->isKeepQuery() ? clone $this : $this;
243
+		$dataFetcher = $criteria
244
+			->filterByPrimaryKey($key)
245
+			->doSelect($con);
246
+
247
+		return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher);
248
+	}
249
+
250
+	/**
251
+	 * Find objects by primary key
252
+	 * <code>
253
+	 * $objs = $c->findPks(array(12, 56, 832), $con);
254
+	 * </code>
255
+	 * @param     array $keys Primary keys to use for the query
256
+	 * @param     ConnectionInterface $con an optional connection object
257
+	 *
258
+	 * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter
259
+	 */
260
+	public function findPks($keys, ConnectionInterface $con = null)
261
+	{
262
+		if (null === $con) {
263
+			$con = Propel::getServiceContainer()->getReadConnection($this->getDbName());
264
+		}
265
+		$this->basePreSelect($con);
266
+		$criteria = $this->isKeepQuery() ? clone $this : $this;
267
+		$dataFetcher = $criteria
268
+			->filterByPrimaryKeys($keys)
269
+			->doSelect($con);
270
+
271
+		return $criteria->getFormatter()->init($criteria)->format($dataFetcher);
272
+	}
273
+
274
+	/**
275
+	 * Filter the query by primary key
276
+	 *
277
+	 * @param     mixed $key Primary key to use for the query
278
+	 *
279
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
280
+	 */
281
+	public function filterByPrimaryKey($key)
282
+	{
283
+
284
+		return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $key, Criteria::EQUAL);
285
+	}
286
+
287
+	/**
288
+	 * Filter the query by a list of primary keys
289
+	 *
290
+	 * @param     array $keys The list of primary key to use for the query
291
+	 *
292
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
293
+	 */
294
+	public function filterByPrimaryKeys($keys)
295
+	{
296
+
297
+		return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $keys, Criteria::IN);
298
+	}
299
+
300
+	/**
301
+	 * Filter the query on the id column
302
+	 *
303
+	 * Example usage:
304
+	 * <code>
305
+	 * $query->filterById(1234); // WHERE id = 1234
306
+	 * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
307
+	 * $query->filterById(array('min' => 12)); // WHERE id > 12
308
+	 * </code>
309
+	 *
310
+	 * @param     mixed $id The value to use as filter.
311
+	 *              Use scalar values for equality.
312
+	 *              Use array values for in_array() equivalent.
313
+	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
314
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
315
+	 *
316
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
317
+	 */
318
+	public function filterById($id = null, $comparison = null)
319
+	{
320
+		if (is_array($id)) {
321
+			$useMinMax = false;
322
+			if (isset($id['min'])) {
323
+				$this->addUsingAlias(SubscriptionTableMap::COL_ID, $id['min'], Criteria::GREATER_EQUAL);
324
+				$useMinMax = true;
325
+			}
326
+			if (isset($id['max'])) {
327
+				$this->addUsingAlias(SubscriptionTableMap::COL_ID, $id['max'], Criteria::LESS_EQUAL);
328
+				$useMinMax = true;
329
+			}
330
+			if ($useMinMax) {
331
+				return $this;
332
+			}
333
+			if (null === $comparison) {
334
+				$comparison = Criteria::IN;
335
+			}
336
+		}
337
+
338
+		return $this->addUsingAlias(SubscriptionTableMap::COL_ID, $id, $comparison);
339
+	}
340
+
341
+	/**
342
+	 * Filter the query on the instance_name column
343
+	 *
344
+	 * Example usage:
345
+	 * <code>
346
+	 * $query->filterByInstanceName('fooValue');   // WHERE instance_name = 'fooValue'
347
+	 * $query->filterByInstanceName('%fooValue%'); // WHERE instance_name LIKE '%fooValue%'
348
+	 * </code>
349
+	 *
350
+	 * @param     string $instanceName The value to use as filter.
351
+	 *              Accepts wildcards (* and % trigger a LIKE)
352
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
353
+	 *
354
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
355
+	 */
356
+	public function filterByInstanceName($instanceName = null, $comparison = null)
357
+	{
358
+		if (null === $comparison) {
359
+			if (is_array($instanceName)) {
360
+				$comparison = Criteria::IN;
361
+			} elseif (preg_match('/[\%\*]/', $instanceName)) {
362
+				$instanceName = str_replace('*', '%', $instanceName);
363
+				$comparison = Criteria::LIKE;
364
+			}
365
+		}
366
+
367
+		return $this->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instanceName, $comparison);
368
+	}
369
+
370
+	/**
371
+	 * Filter the query on the user_id column
372
+	 *
373
+	 * Example usage:
374
+	 * <code>
375
+	 * $query->filterByUserId(1234); // WHERE user_id = 1234
376
+	 * $query->filterByUserId(array(12, 34)); // WHERE user_id IN (12, 34)
377
+	 * $query->filterByUserId(array('min' => 12)); // WHERE user_id > 12
378
+	 * </code>
379
+	 *
380
+	 * @see       filterByUser()
381
+	 *
382
+	 * @param     mixed $userId The value to use as filter.
383
+	 *              Use scalar values for equality.
384
+	 *              Use array values for in_array() equivalent.
385
+	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
386
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
387
+	 *
388
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
389
+	 */
390
+	public function filterByUserId($userId = null, $comparison = null)
391
+	{
392
+		if (is_array($userId)) {
393
+			$useMinMax = false;
394
+			if (isset($userId['min'])) {
395
+				$this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId['min'], Criteria::GREATER_EQUAL);
396
+				$useMinMax = true;
397
+			}
398
+			if (isset($userId['max'])) {
399
+				$this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId['max'], Criteria::LESS_EQUAL);
400
+				$useMinMax = true;
401
+			}
402
+			if ($useMinMax) {
403
+				return $this;
404
+			}
405
+			if (null === $comparison) {
406
+				$comparison = Criteria::IN;
407
+			}
408
+		}
409
+
410
+		return $this->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $userId, $comparison);
411
+	}
412
+
413
+	/**
414
+	 * Filter the query on the channel_id column
415
+	 *
416
+	 * Example usage:
417
+	 * <code>
418
+	 * $query->filterByChannelId(1234); // WHERE channel_id = 1234
419
+	 * $query->filterByChannelId(array(12, 34)); // WHERE channel_id IN (12, 34)
420
+	 * $query->filterByChannelId(array('min' => 12)); // WHERE channel_id > 12
421
+	 * </code>
422
+	 *
423
+	 * @see       filterByChannel()
424
+	 *
425
+	 * @param     mixed $channelId The value to use as filter.
426
+	 *              Use scalar values for equality.
427
+	 *              Use array values for in_array() equivalent.
428
+	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
429
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
430
+	 *
431
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
432
+	 */
433
+	public function filterByChannelId($channelId = null, $comparison = null)
434
+	{
435
+		if (is_array($channelId)) {
436
+			$useMinMax = false;
437
+			if (isset($channelId['min'])) {
438
+				$this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId['min'], Criteria::GREATER_EQUAL);
439
+				$useMinMax = true;
440
+			}
441
+			if (isset($channelId['max'])) {
442
+				$this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId['max'], Criteria::LESS_EQUAL);
443
+				$useMinMax = true;
444
+			}
445
+			if ($useMinMax) {
446
+				return $this;
447
+			}
448
+			if (null === $comparison) {
449
+				$comparison = Criteria::IN;
450
+			}
451
+		}
452
+
453
+		return $this->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channelId, $comparison);
454
+	}
455
+
456
+	/**
457
+	 * Filter the query on the subscription_id column
458
+	 *
459
+	 * Example usage:
460
+	 * <code>
461
+	 * $query->filterBySubscriptionId(1234); // WHERE subscription_id = 1234
462
+	 * $query->filterBySubscriptionId(array(12, 34)); // WHERE subscription_id IN (12, 34)
463
+	 * $query->filterBySubscriptionId(array('min' => 12)); // WHERE subscription_id > 12
464
+	 * </code>
465
+	 *
466
+	 * @param     mixed $subscriptionId The value to use as filter.
467
+	 *              Use scalar values for equality.
468
+	 *              Use array values for in_array() equivalent.
469
+	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
470
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
471
+	 *
472
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
473
+	 */
474
+	public function filterBySubscriptionId($subscriptionId = null, $comparison = null)
475
+	{
476
+		if (is_array($subscriptionId)) {
477
+			$useMinMax = false;
478
+			if (isset($subscriptionId['min'])) {
479
+				$this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId['min'], Criteria::GREATER_EQUAL);
480
+				$useMinMax = true;
481
+			}
482
+			if (isset($subscriptionId['max'])) {
483
+				$this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId['max'], Criteria::LESS_EQUAL);
484
+				$useMinMax = true;
485
+			}
486
+			if ($useMinMax) {
487
+				return $this;
488
+			}
489
+			if (null === $comparison) {
490
+				$comparison = Criteria::IN;
491
+			}
492
+		}
493
+
494
+		return $this->addUsingAlias(SubscriptionTableMap::COL_SUBSCRIPTION_ID, $subscriptionId, $comparison);
495
+	}
496
+
497
+	/**
498
+	 * Filter the query on the started column
499
+	 *
500
+	 * Example usage:
501
+	 * <code>
502
+	 * $query->filterByStarted('2011-03-14'); // WHERE started = '2011-03-14'
503
+	 * $query->filterByStarted('now'); // WHERE started = '2011-03-14'
504
+	 * $query->filterByStarted(array('max' => 'yesterday')); // WHERE started > '2011-03-13'
505
+	 * </code>
506
+	 *
507
+	 * @param     mixed $started The value to use as filter.
508
+	 *              Values can be integers (unix timestamps), DateTime objects, or strings.
509
+	 *              Empty strings are treated as NULL.
510
+	 *              Use scalar values for equality.
511
+	 *              Use array values for in_array() equivalent.
512
+	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
513
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
514
+	 *
515
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
516
+	 */
517
+	public function filterByStarted($started = null, $comparison = null)
518
+	{
519
+		if (is_array($started)) {
520
+			$useMinMax = false;
521
+			if (isset($started['min'])) {
522
+				$this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started['min'], Criteria::GREATER_EQUAL);
523
+				$useMinMax = true;
524
+			}
525
+			if (isset($started['max'])) {
526
+				$this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started['max'], Criteria::LESS_EQUAL);
527
+				$useMinMax = true;
528
+			}
529
+			if ($useMinMax) {
530
+				return $this;
531
+			}
532
+			if (null === $comparison) {
533
+				$comparison = Criteria::IN;
534
+			}
535
+		}
536
+
537
+		return $this->addUsingAlias(SubscriptionTableMap::COL_STARTED, $started, $comparison);
538
+	}
539
+
540
+	/**
541
+	 * Filter the query on the stopped column
542
+	 *
543
+	 * Example usage:
544
+	 * <code>
545
+	 * $query->filterByStopped('2011-03-14'); // WHERE stopped = '2011-03-14'
546
+	 * $query->filterByStopped('now'); // WHERE stopped = '2011-03-14'
547
+	 * $query->filterByStopped(array('max' => 'yesterday')); // WHERE stopped > '2011-03-13'
548
+	 * </code>
549
+	 *
550
+	 * @param     mixed $stopped The value to use as filter.
551
+	 *              Values can be integers (unix timestamps), DateTime objects, or strings.
552
+	 *              Empty strings are treated as NULL.
553
+	 *              Use scalar values for equality.
554
+	 *              Use array values for in_array() equivalent.
555
+	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
556
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
557
+	 *
558
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
559
+	 */
560
+	public function filterByStopped($stopped = null, $comparison = null)
561
+	{
562
+		if (is_array($stopped)) {
563
+			$useMinMax = false;
564
+			if (isset($stopped['min'])) {
565
+				$this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped['min'], Criteria::GREATER_EQUAL);
566
+				$useMinMax = true;
567
+			}
568
+			if (isset($stopped['max'])) {
569
+				$this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped['max'], Criteria::LESS_EQUAL);
570
+				$useMinMax = true;
571
+			}
572
+			if ($useMinMax) {
573
+				return $this;
574
+			}
575
+			if (null === $comparison) {
576
+				$comparison = Criteria::IN;
577
+			}
578
+		}
579
+
580
+		return $this->addUsingAlias(SubscriptionTableMap::COL_STOPPED, $stopped, $comparison);
581
+	}
582
+
583
+	/**
584
+	 * Filter the query on the title column
585
+	 *
586
+	 * Example usage:
587
+	 * <code>
588
+	 * $query->filterByTitle('fooValue');   // WHERE title = 'fooValue'
589
+	 * $query->filterByTitle('%fooValue%'); // WHERE title LIKE '%fooValue%'
590
+	 * </code>
591
+	 *
592
+	 * @param     string $title The value to use as filter.
593
+	 *              Accepts wildcards (* and % trigger a LIKE)
594
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
595
+	 *
596
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
597
+	 */
598
+	public function filterByTitle($title = null, $comparison = null)
599
+	{
600
+		if (null === $comparison) {
601
+			if (is_array($title)) {
602
+				$comparison = Criteria::IN;
603
+			} elseif (preg_match('/[\%\*]/', $title)) {
604
+				$title = str_replace('*', '%', $title);
605
+				$comparison = Criteria::LIKE;
606
+			}
607
+		}
608
+
609
+		return $this->addUsingAlias(SubscriptionTableMap::COL_TITLE, $title, $comparison);
610
+	}
611
+
612
+	/**
613
+	 * Filter the query on the service column
614
+	 *
615
+	 * Example usage:
616
+	 * <code>
617
+	 * $query->filterByService('fooValue');   // WHERE service = 'fooValue'
618
+	 * $query->filterByService('%fooValue%'); // WHERE service LIKE '%fooValue%'
619
+	 * </code>
620
+	 *
621
+	 * @param     string $service The value to use as filter.
622
+	 *              Accepts wildcards (* and % trigger a LIKE)
623
+	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
624
+	 *
625
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
626
+	 */
627
+	public function filterByService($service = null, $comparison = null)
628
+	{
629
+		if (null === $comparison) {
630
+			if (is_array($service)) {
631
+				$comparison = Criteria::IN;
632
+			} elseif (preg_match('/[\%\*]/', $service)) {
633
+				$service = str_replace('*', '%', $service);
634
+				$comparison = Criteria::LIKE;
635
+			}
636
+		}
637
+
638
+		return $this->addUsingAlias(SubscriptionTableMap::COL_SERVICE, $service, $comparison);
639
+	}
640
+
641
+	/**
642
+	 * Filter the query by a related \Jalle19\StatusManager\Database\Instance object
643
+	 *
644
+	 * @param \Jalle19\StatusManager\Database\Instance|ObjectCollection $instance The related object(s) to use as filter
645
+	 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
646
+	 *
647
+	 * @throws \Propel\Runtime\Exception\PropelException
648
+	 *
649
+	 * @return ChildSubscriptionQuery The current query, for fluid interface
650
+	 */
651
+	public function filterByInstance($instance, $comparison = null)
652
+	{
653
+		if ($instance instanceof \Jalle19\StatusManager\Database\Instance) {
654
+			return $this
655
+				->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instance->getName(), $comparison);
656
+		} elseif ($instance instanceof ObjectCollection) {
657
+			if (null === $comparison) {
658
+				$comparison = Criteria::IN;
659
+			}
660
+
661
+			return $this
662
+				->addUsingAlias(SubscriptionTableMap::COL_INSTANCE_NAME, $instance->toKeyValue('PrimaryKey', 'Name'), $comparison);
663
+		} else {
664
+			throw new PropelException('filterByInstance() only accepts arguments of type \Jalle19\StatusManager\Database\Instance or Collection');
665
+		}
666
+	}
667
+
668
+	/**
669
+	 * Adds a JOIN clause to the query using the Instance relation
670
+	 *
671
+	 * @param     string $relationAlias optional alias for the relation
672
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
673
+	 *
674
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
675
+	 */
676
+	public function joinInstance($relationAlias = null, $joinType = Criteria::INNER_JOIN)
677
+	{
678
+		$tableMap = $this->getTableMap();
679
+		$relationMap = $tableMap->getRelation('Instance');
680
+
681
+		// create a ModelJoin object for this join
682
+		$join = new ModelJoin();
683
+		$join->setJoinType($joinType);
684
+		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
685
+		if ($previousJoin = $this->getPreviousJoin()) {
686
+			$join->setPreviousJoin($previousJoin);
687
+		}
688
+
689
+		// add the ModelJoin to the current object
690
+		if ($relationAlias) {
691
+			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
692
+			$this->addJoinObject($join, $relationAlias);
693
+		} else {
694
+			$this->addJoinObject($join, 'Instance');
695
+		}
696
+
697
+		return $this;
698
+	}
699
+
700
+	/**
701
+	 * Use the Instance relation Instance object
702
+	 *
703
+	 * @see useQuery()
704
+	 *
705
+	 * @param     string $relationAlias optional alias for the relation,
706
+	 *                                   to be used as main alias in the secondary query
707
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
708
+	 *
709
+	 * @return \Jalle19\StatusManager\Database\InstanceQuery A secondary query class using the current class as primary query
710
+	 */
711
+	public function useInstanceQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
712
+	{
713
+		return $this
714
+			->joinInstance($relationAlias, $joinType)
715
+			->useQuery($relationAlias ? $relationAlias : 'Instance', '\Jalle19\StatusManager\Database\InstanceQuery');
716
+	}
717
+
718
+	/**
719
+	 * Filter the query by a related \Jalle19\StatusManager\Database\User object
720
+	 *
721
+	 * @param \Jalle19\StatusManager\Database\User|ObjectCollection $user The related object(s) to use as filter
722
+	 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
723
+	 *
724
+	 * @throws \Propel\Runtime\Exception\PropelException
725
+	 *
726
+	 * @return ChildSubscriptionQuery The current query, for fluid interface
727
+	 */
728
+	public function filterByUser($user, $comparison = null)
729
+	{
730
+		if ($user instanceof \Jalle19\StatusManager\Database\User) {
731
+			return $this
732
+				->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $user->getId(), $comparison);
733
+		} elseif ($user instanceof ObjectCollection) {
734
+			if (null === $comparison) {
735
+				$comparison = Criteria::IN;
736
+			}
737
+
738
+			return $this
739
+				->addUsingAlias(SubscriptionTableMap::COL_USER_ID, $user->toKeyValue('PrimaryKey', 'Id'), $comparison);
740
+		} else {
741
+			throw new PropelException('filterByUser() only accepts arguments of type \Jalle19\StatusManager\Database\User or Collection');
742
+		}
743
+	}
744
+
745
+	/**
746
+	 * Adds a JOIN clause to the query using the User relation
747
+	 *
748
+	 * @param     string $relationAlias optional alias for the relation
749
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
750
+	 *
751
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
752
+	 */
753
+	public function joinUser($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
754
+	{
755
+		$tableMap = $this->getTableMap();
756
+		$relationMap = $tableMap->getRelation('User');
757
+
758
+		// create a ModelJoin object for this join
759
+		$join = new ModelJoin();
760
+		$join->setJoinType($joinType);
761
+		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
762
+		if ($previousJoin = $this->getPreviousJoin()) {
763
+			$join->setPreviousJoin($previousJoin);
764
+		}
765
+
766
+		// add the ModelJoin to the current object
767
+		if ($relationAlias) {
768
+			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
769
+			$this->addJoinObject($join, $relationAlias);
770
+		} else {
771
+			$this->addJoinObject($join, 'User');
772
+		}
773
+
774
+		return $this;
775
+	}
776
+
777
+	/**
778
+	 * Use the User relation User object
779
+	 *
780
+	 * @see useQuery()
781
+	 *
782
+	 * @param     string $relationAlias optional alias for the relation,
783
+	 *                                   to be used as main alias in the secondary query
784
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
785
+	 *
786
+	 * @return \Jalle19\StatusManager\Database\UserQuery A secondary query class using the current class as primary query
787
+	 */
788
+	public function useUserQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
789
+	{
790
+		return $this
791
+			->joinUser($relationAlias, $joinType)
792
+			->useQuery($relationAlias ? $relationAlias : 'User', '\Jalle19\StatusManager\Database\UserQuery');
793
+	}
794
+
795
+	/**
796
+	 * Filter the query by a related \Jalle19\StatusManager\Database\Channel object
797
+	 *
798
+	 * @param \Jalle19\StatusManager\Database\Channel|ObjectCollection $channel The related object(s) to use as filter
799
+	 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
800
+	 *
801
+	 * @throws \Propel\Runtime\Exception\PropelException
802
+	 *
803
+	 * @return ChildSubscriptionQuery The current query, for fluid interface
804
+	 */
805
+	public function filterByChannel($channel, $comparison = null)
806
+	{
807
+		if ($channel instanceof \Jalle19\StatusManager\Database\Channel) {
808
+			return $this
809
+				->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channel->getId(), $comparison);
810
+		} elseif ($channel instanceof ObjectCollection) {
811
+			if (null === $comparison) {
812
+				$comparison = Criteria::IN;
813
+			}
814
+
815
+			return $this
816
+				->addUsingAlias(SubscriptionTableMap::COL_CHANNEL_ID, $channel->toKeyValue('PrimaryKey', 'Id'), $comparison);
817
+		} else {
818
+			throw new PropelException('filterByChannel() only accepts arguments of type \Jalle19\StatusManager\Database\Channel or Collection');
819
+		}
820
+	}
821
+
822
+	/**
823
+	 * Adds a JOIN clause to the query using the Channel relation
824
+	 *
825
+	 * @param     string $relationAlias optional alias for the relation
826
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
827
+	 *
828
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
829
+	 */
830
+	public function joinChannel($relationAlias = null, $joinType = Criteria::INNER_JOIN)
831
+	{
832
+		$tableMap = $this->getTableMap();
833
+		$relationMap = $tableMap->getRelation('Channel');
834
+
835
+		// create a ModelJoin object for this join
836
+		$join = new ModelJoin();
837
+		$join->setJoinType($joinType);
838
+		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
839
+		if ($previousJoin = $this->getPreviousJoin()) {
840
+			$join->setPreviousJoin($previousJoin);
841
+		}
842
+
843
+		// add the ModelJoin to the current object
844
+		if ($relationAlias) {
845
+			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
846
+			$this->addJoinObject($join, $relationAlias);
847
+		} else {
848
+			$this->addJoinObject($join, 'Channel');
849
+		}
850
+
851
+		return $this;
852
+	}
853
+
854
+	/**
855
+	 * Use the Channel relation Channel object
856
+	 *
857
+	 * @see useQuery()
858
+	 *
859
+	 * @param     string $relationAlias optional alias for the relation,
860
+	 *                                   to be used as main alias in the secondary query
861
+	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
862
+	 *
863
+	 * @return \Jalle19\StatusManager\Database\ChannelQuery A secondary query class using the current class as primary query
864
+	 */
865
+	public function useChannelQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
866
+	{
867
+		return $this
868
+			->joinChannel($relationAlias, $joinType)
869
+			->useQuery($relationAlias ? $relationAlias : 'Channel', '\Jalle19\StatusManager\Database\ChannelQuery');
870
+	}
871
+
872
+	/**
873
+	 * Exclude object from result
874
+	 *
875
+	 * @param   ChildSubscription $subscription Object to remove from the list of results
876
+	 *
877
+	 * @return $this|ChildSubscriptionQuery The current query, for fluid interface
878
+	 */
879
+	public function prune($subscription = null)
880
+	{
881
+		if ($subscription) {
882
+			$this->addUsingAlias(SubscriptionTableMap::COL_ID, $subscription->getId(), Criteria::NOT_EQUAL);
883
+		}
884
+
885
+		return $this;
886
+	}
887
+
888
+	/**
889
+	 * Deletes all rows from the subscription table.
890
+	 *
891
+	 * @param ConnectionInterface $con the connection to use
892
+	 * @return int The number of affected rows (if supported by underlying database driver).
893
+	 */
894
+	public function doDeleteAll(ConnectionInterface $con = null)
895
+	{
896
+		if (null === $con) {
897
+			$con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
898
+		}
899
+
900
+		// use transaction because $criteria could contain info
901
+		// for more than one table or we could emulating ON DELETE CASCADE, etc.
902
+		return $con->transaction(function () use ($con) {
903
+			$affectedRows = 0; // initialize var to track total num of affected rows
904
+			$affectedRows += parent::doDeleteAll($con);
905
+			// Because this db requires some delete cascade/set null emulation, we have to
906
+			// clear the cached instance *after* the emulation has happened (since
907
+			// instances get re-added by the select statement contained therein).
908
+			SubscriptionTableMap::clearInstancePool();
909
+			SubscriptionTableMap::clearRelatedInstancePool();
910
+
911
+			return $affectedRows;
912
+		});
913
+	}
914
+
915
+	/**
916
+	 * Performs a DELETE on the database based on the current ModelCriteria
917
+	 *
918
+	 * @param ConnectionInterface $con the connection to use
919
+	 * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
920
+	 *                         if supported by native driver or if emulated using Propel.
921
+	 * @throws PropelException Any exceptions caught during processing will be
922
+	 *                         rethrown wrapped into a PropelException.
923
+	 */
924
+	public function delete(ConnectionInterface $con = null)
925
+	{
926
+		if (null === $con) {
927
+			$con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
928
+		}
929
+
930
+		$criteria = $this;
931
+
932
+		// Set the correct dbName
933
+		$criteria->setDbName(SubscriptionTableMap::DATABASE_NAME);
934
+
935
+		// use transaction because $criteria could contain info
936
+		// for more than one table or we could emulating ON DELETE CASCADE, etc.
937
+		return $con->transaction(function () use ($con, $criteria) {
938
+			$affectedRows = 0; // initialize var to track total num of affected rows
939
+
940
+			SubscriptionTableMap::removeInstanceFromPool($criteria);
941
+
942
+			$affectedRows += ModelCriteria::delete($con);
943
+			SubscriptionTableMap::clearRelatedInstancePool();
944
+
945
+			return $affectedRows;
946
+		});
947
+	}
949 948
 
950 949
 } // SubscriptionQuery
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 
621 621
         // use transaction because $criteria could contain info
622 622
         // for more than one table or we could emulating ON DELETE CASCADE, etc.
623
-        return $con->transaction(function () use ($con) {
623
+        return $con->transaction(function() use ($con) {
624 624
             $affectedRows = 0; // initialize var to track total num of affected rows
625 625
             $affectedRows += parent::doDeleteAll($con);
626 626
             // Because this db requires some delete cascade/set null emulation, we have to
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 
656 656
         // use transaction because $criteria could contain info
657 657
         // for more than one table or we could emulating ON DELETE CASCADE, etc.
658
-        return $con->transaction(function () use ($con, $criteria) {
658
+        return $con->transaction(function() use ($con, $criteria) {
659 659
             $affectedRows = 0; // initialize var to track total num of affected rows
660 660
 
661 661
             UserTableMap::removeInstanceFromPool($criteria);
Please login to merge, or discard this patch.
src/cli/Database/Base/User.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      *
306 306
      * @param  string  $msg
307 307
      * @param  int     $priority One of the Propel::LOG_* logging levels
308
-     * @return boolean
308
+     * @return boolean|null
309 309
      */
310 310
     protected function log($msg, $priority = Propel::LOG_INFO)
311 311
     {
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
      * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
1029 1029
      * The default key type is the column's TableMap::TYPE_PHPNAME.
1030 1030
      *
1031
-     * @param mixed $parser A AbstractParser instance,
1031
+     * @param string $parser A AbstractParser instance,
1032 1032
      *                       or a format name ('XML', 'YAML', 'JSON', 'CSV')
1033 1033
      * @param string $data The source data to import from
1034 1034
      * @param string $keyType The type of keys the array uses.
Please login to merge, or discard this patch.
Indentation   +1926 added lines, -1926 removed lines patch added patch discarded remove patch
@@ -37,1938 +37,1938 @@
 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 getSubscriptionsJoinChannel(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1791
-    {
1792
-        $query = ChildSubscriptionQuery::create(null, $criteria);
1793
-        $query->joinWith('Channel', $joinBehavior);
1794
-
1795
-        return $this->getSubscriptions($query, $con);
1796
-    }
1797
-
1798
-    /**
1799
-     * Clears the current object, sets all attributes to their default values and removes
1800
-     * outgoing references as well as back-references (from other objects to this one. Results probably in a database
1801
-     * change of those foreign objects when you call `save` there).
1802
-     */
1803
-    public function clear()
1804
-    {
1805
-        if (null !== $this->aInstance) {
1806
-            $this->aInstance->removeUser($this);
1807
-        }
1808
-        $this->id = null;
1809
-        $this->instance_name = null;
1810
-        $this->name = null;
1811
-        $this->alreadyInSave = false;
1812
-        $this->clearAllReferences();
1813
-        $this->resetModified();
1814
-        $this->setNew(true);
1815
-        $this->setDeleted(false);
1816
-    }
1817
-
1818
-    /**
1819
-     * Resets all references and back-references to other model objects or collections of model objects.
1820
-     *
1821
-     * This method is used to reset all php object references (not the actual reference in the database).
1822
-     * Necessary for object serialisation.
1823
-     *
1824
-     * @param      boolean $deep Whether to also clear the references on all referrer objects.
1825
-     */
1826
-    public function clearAllReferences($deep = false)
1827
-    {
1828
-        if ($deep) {
1829
-            if ($this->collConnections) {
1830
-                foreach ($this->collConnections as $o) {
1831
-                    $o->clearAllReferences($deep);
1832
-                }
1833
-            }
1834
-            if ($this->collSubscriptions) {
1835
-                foreach ($this->collSubscriptions as $o) {
1836
-                    $o->clearAllReferences($deep);
1837
-                }
1838
-            }
1839
-        } // if ($deep)
1840
-
1841
-        $this->collConnections = null;
1842
-        $this->collSubscriptions = null;
1843
-        $this->aInstance = null;
1844
-    }
1845
-
1846
-    /**
1847
-     * Return the string representation of this object
1848
-     *
1849
-     * @return string
1850
-     */
1851
-    public function __toString()
1852
-    {
1853
-        return (string) $this->exportTo(UserTableMap::DEFAULT_STRING_FORMAT);
1854
-    }
1855
-
1856
-    /**
1857
-     * Code to be run before persisting the object
1858
-     * @param  ConnectionInterface $con
1859
-     * @return boolean
1860
-     */
1861
-    public function preSave(ConnectionInterface $con = null)
1862
-    {
1863
-        return true;
1864
-    }
1865
-
1866
-    /**
1867
-     * Code to be run after persisting the object
1868
-     * @param ConnectionInterface $con
1869
-     */
1870
-    public function postSave(ConnectionInterface $con = null)
1871
-    {
1872
-
1873
-    }
1874
-
1875
-    /**
1876
-     * Code to be run before inserting to database
1877
-     * @param  ConnectionInterface $con
1878
-     * @return boolean
1879
-     */
1880
-    public function preInsert(ConnectionInterface $con = null)
1881
-    {
1882
-        return true;
1883
-    }
1884
-
1885
-    /**
1886
-     * Code to be run after inserting to database
1887
-     * @param ConnectionInterface $con
1888
-     */
1889
-    public function postInsert(ConnectionInterface $con = null)
1890
-    {
1891
-
1892
-    }
1893
-
1894
-    /**
1895
-     * Code to be run before updating the object in database
1896
-     * @param  ConnectionInterface $con
1897
-     * @return boolean
1898
-     */
1899
-    public function preUpdate(ConnectionInterface $con = null)
1900
-    {
1901
-        return true;
1902
-    }
1903
-
1904
-    /**
1905
-     * Code to be run after updating the object in database
1906
-     * @param ConnectionInterface $con
1907
-     */
1908
-    public function postUpdate(ConnectionInterface $con = null)
1909
-    {
1910
-
1911
-    }
1912
-
1913
-    /**
1914
-     * Code to be run before deleting the object in database
1915
-     * @param  ConnectionInterface $con
1916
-     * @return boolean
1917
-     */
1918
-    public function preDelete(ConnectionInterface $con = null)
1919
-    {
1920
-        return true;
1921
-    }
1922
-
1923
-    /**
1924
-     * Code to be run after deleting the object in database
1925
-     * @param ConnectionInterface $con
1926
-     */
1927
-    public function postDelete(ConnectionInterface $con = null)
1928
-    {
1929
-
1930
-    }
1931
-
1932
-
1933
-    /**
1934
-     * Derived method to catches calls to undefined methods.
1935
-     *
1936
-     * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
1937
-     * Allows to define default __call() behavior if you overwrite __call()
1938
-     *
1939
-     * @param string $name
1940
-     * @param mixed  $params
1941
-     *
1942
-     * @return array|string
1943
-     */
1944
-    public function __call($name, $params)
1945
-    {
1946
-        if (0 === strpos($name, 'get')) {
1947
-            $virtualColumn = substr($name, 3);
1948
-            if ($this->hasVirtualColumn($virtualColumn)) {
1949
-                return $this->getVirtualColumn($virtualColumn);
1950
-            }
1951
-
1952
-            $virtualColumn = lcfirst($virtualColumn);
1953
-            if ($this->hasVirtualColumn($virtualColumn)) {
1954
-                return $this->getVirtualColumn($virtualColumn);
1955
-            }
1956
-        }
1957
-
1958
-        if (0 === strpos($name, 'from')) {
1959
-            $format = substr($name, 4);
1960
-
1961
-            return $this->importFrom($format, reset($params));
1962
-        }
1963
-
1964
-        if (0 === strpos($name, 'to')) {
1965
-            $format = substr($name, 2);
1966
-            $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1967
-
1968
-            return $this->exportTo($format, $includeLazyLoadColumns);
1969
-        }
1970
-
1971
-        throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1972
-    }
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 getSubscriptionsJoinChannel(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)
1791
+	{
1792
+		$query = ChildSubscriptionQuery::create(null, $criteria);
1793
+		$query->joinWith('Channel', $joinBehavior);
1794
+
1795
+		return $this->getSubscriptions($query, $con);
1796
+	}
1797
+
1798
+	/**
1799
+	 * Clears the current object, sets all attributes to their default values and removes
1800
+	 * outgoing references as well as back-references (from other objects to this one. Results probably in a database
1801
+	 * change of those foreign objects when you call `save` there).
1802
+	 */
1803
+	public function clear()
1804
+	{
1805
+		if (null !== $this->aInstance) {
1806
+			$this->aInstance->removeUser($this);
1807
+		}
1808
+		$this->id = null;
1809
+		$this->instance_name = null;
1810
+		$this->name = null;
1811
+		$this->alreadyInSave = false;
1812
+		$this->clearAllReferences();
1813
+		$this->resetModified();
1814
+		$this->setNew(true);
1815
+		$this->setDeleted(false);
1816
+	}
1817
+
1818
+	/**
1819
+	 * Resets all references and back-references to other model objects or collections of model objects.
1820
+	 *
1821
+	 * This method is used to reset all php object references (not the actual reference in the database).
1822
+	 * Necessary for object serialisation.
1823
+	 *
1824
+	 * @param      boolean $deep Whether to also clear the references on all referrer objects.
1825
+	 */
1826
+	public function clearAllReferences($deep = false)
1827
+	{
1828
+		if ($deep) {
1829
+			if ($this->collConnections) {
1830
+				foreach ($this->collConnections as $o) {
1831
+					$o->clearAllReferences($deep);
1832
+				}
1833
+			}
1834
+			if ($this->collSubscriptions) {
1835
+				foreach ($this->collSubscriptions as $o) {
1836
+					$o->clearAllReferences($deep);
1837
+				}
1838
+			}
1839
+		} // if ($deep)
1840
+
1841
+		$this->collConnections = null;
1842
+		$this->collSubscriptions = null;
1843
+		$this->aInstance = null;
1844
+	}
1845
+
1846
+	/**
1847
+	 * Return the string representation of this object
1848
+	 *
1849
+	 * @return string
1850
+	 */
1851
+	public function __toString()
1852
+	{
1853
+		return (string) $this->exportTo(UserTableMap::DEFAULT_STRING_FORMAT);
1854
+	}
1855
+
1856
+	/**
1857
+	 * Code to be run before persisting the object
1858
+	 * @param  ConnectionInterface $con
1859
+	 * @return boolean
1860
+	 */
1861
+	public function preSave(ConnectionInterface $con = null)
1862
+	{
1863
+		return true;
1864
+	}
1865
+
1866
+	/**
1867
+	 * Code to be run after persisting the object
1868
+	 * @param ConnectionInterface $con
1869
+	 */
1870
+	public function postSave(ConnectionInterface $con = null)
1871
+	{
1872
+
1873
+	}
1874
+
1875
+	/**
1876
+	 * Code to be run before inserting to database
1877
+	 * @param  ConnectionInterface $con
1878
+	 * @return boolean
1879
+	 */
1880
+	public function preInsert(ConnectionInterface $con = null)
1881
+	{
1882
+		return true;
1883
+	}
1884
+
1885
+	/**
1886
+	 * Code to be run after inserting to database
1887
+	 * @param ConnectionInterface $con
1888
+	 */
1889
+	public function postInsert(ConnectionInterface $con = null)
1890
+	{
1891
+
1892
+	}
1893
+
1894
+	/**
1895
+	 * Code to be run before updating the object in database
1896
+	 * @param  ConnectionInterface $con
1897
+	 * @return boolean
1898
+	 */
1899
+	public function preUpdate(ConnectionInterface $con = null)
1900
+	{
1901
+		return true;
1902
+	}
1903
+
1904
+	/**
1905
+	 * Code to be run after updating the object in database
1906
+	 * @param ConnectionInterface $con
1907
+	 */
1908
+	public function postUpdate(ConnectionInterface $con = null)
1909
+	{
1910
+
1911
+	}
1912
+
1913
+	/**
1914
+	 * Code to be run before deleting the object in database
1915
+	 * @param  ConnectionInterface $con
1916
+	 * @return boolean
1917
+	 */
1918
+	public function preDelete(ConnectionInterface $con = null)
1919
+	{
1920
+		return true;
1921
+	}
1922
+
1923
+	/**
1924
+	 * Code to be run after deleting the object in database
1925
+	 * @param ConnectionInterface $con
1926
+	 */
1927
+	public function postDelete(ConnectionInterface $con = null)
1928
+	{
1929
+
1930
+	}
1931
+
1932
+
1933
+	/**
1934
+	 * Derived method to catches calls to undefined methods.
1935
+	 *
1936
+	 * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
1937
+	 * Allows to define default __call() behavior if you overwrite __call()
1938
+	 *
1939
+	 * @param string $name
1940
+	 * @param mixed  $params
1941
+	 *
1942
+	 * @return array|string
1943
+	 */
1944
+	public function __call($name, $params)
1945
+	{
1946
+		if (0 === strpos($name, 'get')) {
1947
+			$virtualColumn = substr($name, 3);
1948
+			if ($this->hasVirtualColumn($virtualColumn)) {
1949
+				return $this->getVirtualColumn($virtualColumn);
1950
+			}
1951
+
1952
+			$virtualColumn = lcfirst($virtualColumn);
1953
+			if ($this->hasVirtualColumn($virtualColumn)) {
1954
+				return $this->getVirtualColumn($virtualColumn);
1955
+			}
1956
+		}
1957
+
1958
+		if (0 === strpos($name, 'from')) {
1959
+			$format = substr($name, 4);
1960
+
1961
+			return $this->importFrom($format, reset($params));
1962
+		}
1963
+
1964
+		if (0 === strpos($name, 'to')) {
1965
+			$format = substr($name, 2);
1966
+			$includeLazyLoadColumns = isset($params[0]) ? $params[0] : true;
1967
+
1968
+			return $this->exportTo($format, $includeLazyLoadColumns);
1969
+		}
1970
+
1971
+		throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name));
1972
+	}
1973 1973
 
1974 1974
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
         $propertyNames = [];
346 346
         $serializableProperties = array_diff($cls->getProperties(), $cls->getProperties(\ReflectionProperty::IS_STATIC));
347 347
 
348
-        foreach($serializableProperties as $property) {
348
+        foreach ($serializableProperties as $property) {
349 349
             $propertyNames[] = $property->getName();
350 350
         }
351 351
 
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
             $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME);
590 590
         }
591 591
 
592
-        $con->transaction(function () use ($con) {
592
+        $con->transaction(function() use ($con) {
593 593
             $deleteQuery = ChildUserQuery::create()
594 594
                 ->filterByPrimaryKey($this->getPrimaryKey());
595 595
             $ret = $this->preDelete($con);
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
             $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME);
625 625
         }
626 626
 
627
-        return $con->transaction(function () use ($con) {
627
+        return $con->transaction(function() use ($con) {
628 628
             $isInsert = $this->isNew();
629 629
             $ret = $this->preSave($con);
630 630
             if ($isInsert) {
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
                         $key = 'Instance';
905 905
                 }
906 906
 
907
-                $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns,  $alreadyDumpedObjects, true);
907
+                $result[$key] = $this->aInstance->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
908 908
             }
909 909
             if (null !== $this->collConnections) {
910 910
 
@@ -1333,7 +1333,7 @@  discard block
 block discarded – undo
1333 1333
     public function getConnections(Criteria $criteria = null, ConnectionInterface $con = null)
1334 1334
     {
1335 1335
         $partial = $this->collConnectionsPartial && !$this->isNew();
1336
-        if (null === $this->collConnections || null !== $criteria  || $partial) {
1336
+        if (null === $this->collConnections || null !== $criteria || $partial) {
1337 1337
             if ($this->isNew() && null === $this->collConnections) {
1338 1338
                 // return empty collection
1339 1339
                 $this->initConnections();
@@ -1471,7 +1471,7 @@  discard block
 block discarded – undo
1471 1471
      */
1472 1472
     protected function doAddConnection(ChildConnection $connection)
1473 1473
     {
1474
-        $this->collConnections[]= $connection;
1474
+        $this->collConnections[] = $connection;
1475 1475
         $connection->setUser($this);
1476 1476
     }
1477 1477
 
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
                 $this->connectionsScheduledForDeletion = clone $this->collConnections;
1489 1489
                 $this->connectionsScheduledForDeletion->clear();
1490 1490
             }
1491
-            $this->connectionsScheduledForDeletion[]= $connection;
1491
+            $this->connectionsScheduledForDeletion[] = $connection;
1492 1492
             $connection->setUser(null);
1493 1493
         }
1494 1494
 
@@ -1583,7 +1583,7 @@  discard block
 block discarded – undo
1583 1583
     public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null)
1584 1584
     {
1585 1585
         $partial = $this->collSubscriptionsPartial && !$this->isNew();
1586
-        if (null === $this->collSubscriptions || null !== $criteria  || $partial) {
1586
+        if (null === $this->collSubscriptions || null !== $criteria || $partial) {
1587 1587
             if ($this->isNew() && null === $this->collSubscriptions) {
1588 1588
                 // return empty collection
1589 1589
                 $this->initSubscriptions();
@@ -1721,7 +1721,7 @@  discard block
 block discarded – undo
1721 1721
      */
1722 1722
     protected function doAddSubscription(ChildSubscription $subscription)
1723 1723
     {
1724
-        $this->collSubscriptions[]= $subscription;
1724
+        $this->collSubscriptions[] = $subscription;
1725 1725
         $subscription->setUser($this);
1726 1726
     }
1727 1727
 
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
                 $this->subscriptionsScheduledForDeletion = clone $this->collSubscriptions;
1739 1739
                 $this->subscriptionsScheduledForDeletion->clear();
1740 1740
             }
1741
-            $this->subscriptionsScheduledForDeletion[]= $subscription;
1741
+            $this->subscriptionsScheduledForDeletion[] = $subscription;
1742 1742
             $subscription->setUser(null);
1743 1743
         }
1744 1744
 
Please login to merge, or discard this patch.