Completed
Push — master ( e4db9d...bdef63 )
by Sam
04:28 queued 01:37
created
src/cli/Jalle19/StatusManager/Database/Base/Channel.php 3 patches
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.
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.
src/cli/Jalle19/StatusManager/Database/Base/ChannelQuery.php 3 patches
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.
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.
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/Jalle19/StatusManager/Database/Base/Connection.php 4 patches
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.
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.
src/cli/Jalle19/StatusManager/Database/Map/ChannelTableMap.php 2 patches
Indentation   +386 added lines, -386 removed lines patch added patch discarded remove patch
@@ -28,401 +28,401 @@
 block discarded – undo
28 28
  */
29 29
 class ChannelTableMap extends TableMap
30 30
 {
31
-    use InstancePoolTrait;
32
-    use TableMapTrait;
33
-
34
-    /**
35
-     * The (dot-path) name of this class
36
-     */
37
-    const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.ChannelTableMap';
38
-
39
-    /**
40
-     * The default database name for this class
41
-     */
42
-    const DATABASE_NAME = 'tvheadend_status_manager';
43
-
44
-    /**
45
-     * The table name for this class
46
-     */
47
-    const TABLE_NAME = 'channel';
48
-
49
-    /**
50
-     * The related Propel class for this table
51
-     */
52
-    const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Channel';
53
-
54
-    /**
55
-     * A class that can be returned by this tableMap
56
-     */
57
-    const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Channel';
58
-
59
-    /**
60
-     * The total number of columns
61
-     */
62
-    const NUM_COLUMNS = 3;
63
-
64
-    /**
65
-     * The number of lazy-loaded columns
66
-     */
67
-    const NUM_LAZY_LOAD_COLUMNS = 0;
68
-
69
-    /**
70
-     * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
71
-     */
72
-    const NUM_HYDRATE_COLUMNS = 3;
73
-
74
-    /**
75
-     * the column name for the id field
76
-     */
77
-    const COL_ID = 'channel.id';
78
-
79
-    /**
80
-     * the column name for the instance_name field
81
-     */
82
-    const COL_INSTANCE_NAME = 'channel.instance_name';
83
-
84
-    /**
85
-     * the column name for the name field
86
-     */
87
-    const COL_NAME = 'channel.name';
88
-
89
-    /**
90
-     * The default string format for model objects of the related table
91
-     */
92
-    const DEFAULT_STRING_FORMAT = 'YAML';
93
-
94
-    /**
95
-     * holds an array of fieldnames
96
-     *
97
-     * first dimension keys are the type constants
98
-     * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
99
-     */
100
-    protected static $fieldNames = array (
101
-        self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'Name', ),
102
-        self::TYPE_CAMELNAME     => array('id', 'instanceName', 'name', ),
103
-        self::TYPE_COLNAME       => array(ChannelTableMap::COL_ID, ChannelTableMap::COL_INSTANCE_NAME, ChannelTableMap::COL_NAME, ),
104
-        self::TYPE_FIELDNAME     => array('id', 'instance_name', 'name', ),
105
-        self::TYPE_NUM           => array(0, 1, 2, )
106
-    );
107
-
108
-    /**
109
-     * holds an array of keys for quick access to the fieldnames array
110
-     *
111
-     * first dimension keys are the type constants
112
-     * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
113
-     */
114
-    protected static $fieldKeys = array (
115
-        self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2, ),
116
-        self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'name' => 2, ),
117
-        self::TYPE_COLNAME       => array(ChannelTableMap::COL_ID => 0, ChannelTableMap::COL_INSTANCE_NAME => 1, ChannelTableMap::COL_NAME => 2, ),
118
-        self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'name' => 2, ),
119
-        self::TYPE_NUM           => array(0, 1, 2, )
120
-    );
121
-
122
-    /**
123
-     * Initialize the table attributes and columns
124
-     * Relations are not initialized by this method since they are lazy loaded
125
-     *
126
-     * @return void
127
-     * @throws PropelException
128
-     */
129
-    public function initialize()
130
-    {
131
-        // attributes
132
-        $this->setName('channel');
133
-        $this->setPhpName('Channel');
134
-        $this->setIdentifierQuoting(false);
135
-        $this->setClassName('\\Jalle19\\StatusManager\\Database\\Channel');
136
-        $this->setPackage('Jalle19.StatusManager.Database');
137
-        $this->setUseIdGenerator(true);
138
-        // columns
139
-        $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
140
-        $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null);
141
-        $this->addColumn('name', 'Name', 'VARCHAR', true, 255, null);
142
-    } // initialize()
143
-
144
-    /**
145
-     * Build the RelationMap objects for this table relationships
146
-     */
147
-    public function buildRelations()
148
-    {
149
-        $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array (
31
+	use InstancePoolTrait;
32
+	use TableMapTrait;
33
+
34
+	/**
35
+	 * The (dot-path) name of this class
36
+	 */
37
+	const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.ChannelTableMap';
38
+
39
+	/**
40
+	 * The default database name for this class
41
+	 */
42
+	const DATABASE_NAME = 'tvheadend_status_manager';
43
+
44
+	/**
45
+	 * The table name for this class
46
+	 */
47
+	const TABLE_NAME = 'channel';
48
+
49
+	/**
50
+	 * The related Propel class for this table
51
+	 */
52
+	const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Channel';
53
+
54
+	/**
55
+	 * A class that can be returned by this tableMap
56
+	 */
57
+	const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Channel';
58
+
59
+	/**
60
+	 * The total number of columns
61
+	 */
62
+	const NUM_COLUMNS = 3;
63
+
64
+	/**
65
+	 * The number of lazy-loaded columns
66
+	 */
67
+	const NUM_LAZY_LOAD_COLUMNS = 0;
68
+
69
+	/**
70
+	 * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
71
+	 */
72
+	const NUM_HYDRATE_COLUMNS = 3;
73
+
74
+	/**
75
+	 * the column name for the id field
76
+	 */
77
+	const COL_ID = 'channel.id';
78
+
79
+	/**
80
+	 * the column name for the instance_name field
81
+	 */
82
+	const COL_INSTANCE_NAME = 'channel.instance_name';
83
+
84
+	/**
85
+	 * the column name for the name field
86
+	 */
87
+	const COL_NAME = 'channel.name';
88
+
89
+	/**
90
+	 * The default string format for model objects of the related table
91
+	 */
92
+	const DEFAULT_STRING_FORMAT = 'YAML';
93
+
94
+	/**
95
+	 * holds an array of fieldnames
96
+	 *
97
+	 * first dimension keys are the type constants
98
+	 * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
99
+	 */
100
+	protected static $fieldNames = array (
101
+		self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'Name', ),
102
+		self::TYPE_CAMELNAME     => array('id', 'instanceName', 'name', ),
103
+		self::TYPE_COLNAME       => array(ChannelTableMap::COL_ID, ChannelTableMap::COL_INSTANCE_NAME, ChannelTableMap::COL_NAME, ),
104
+		self::TYPE_FIELDNAME     => array('id', 'instance_name', 'name', ),
105
+		self::TYPE_NUM           => array(0, 1, 2, )
106
+	);
107
+
108
+	/**
109
+	 * holds an array of keys for quick access to the fieldnames array
110
+	 *
111
+	 * first dimension keys are the type constants
112
+	 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
113
+	 */
114
+	protected static $fieldKeys = array (
115
+		self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2, ),
116
+		self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'name' => 2, ),
117
+		self::TYPE_COLNAME       => array(ChannelTableMap::COL_ID => 0, ChannelTableMap::COL_INSTANCE_NAME => 1, ChannelTableMap::COL_NAME => 2, ),
118
+		self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'name' => 2, ),
119
+		self::TYPE_NUM           => array(0, 1, 2, )
120
+	);
121
+
122
+	/**
123
+	 * Initialize the table attributes and columns
124
+	 * Relations are not initialized by this method since they are lazy loaded
125
+	 *
126
+	 * @return void
127
+	 * @throws PropelException
128
+	 */
129
+	public function initialize()
130
+	{
131
+		// attributes
132
+		$this->setName('channel');
133
+		$this->setPhpName('Channel');
134
+		$this->setIdentifierQuoting(false);
135
+		$this->setClassName('\\Jalle19\\StatusManager\\Database\\Channel');
136
+		$this->setPackage('Jalle19.StatusManager.Database');
137
+		$this->setUseIdGenerator(true);
138
+		// columns
139
+		$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
140
+		$this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null);
141
+		$this->addColumn('name', 'Name', 'VARCHAR', true, 255, null);
142
+	} // initialize()
143
+
144
+	/**
145
+	 * Build the RelationMap objects for this table relationships
146
+	 */
147
+	public function buildRelations()
148
+	{
149
+		$this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array (
150 150
   0 =>
151 151
   array (
152
-    0 => ':instance_name',
153
-    1 => ':name',
152
+	0 => ':instance_name',
153
+	1 => ':name',
154 154
   ),
155 155
 ), null, null, null, false);
156
-        $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array (
156
+		$this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array (
157 157
   0 =>
158 158
   array (
159
-    0 => ':channel_id',
160
-    1 => ':id',
159
+	0 => ':channel_id',
160
+	1 => ':id',
161 161
   ),
162 162
 ), null, null, 'Subscriptions', false);
163
-    } // buildRelations()
164
-
165
-    /**
166
-     * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
167
-     *
168
-     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
169
-     * a multi-column primary key, a serialize()d version of the primary key will be returned.
170
-     *
171
-     * @param array  $row       resultset row.
172
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
173
-     * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
174
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
175
-     *
176
-     * @return string The primary key hash of the row
177
-     */
178
-    public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
179
-    {
180
-        // If the PK cannot be derived from the row, return NULL.
181
-        if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
182
-            return null;
183
-        }
184
-
185
-        return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
186
-    }
187
-
188
-    /**
189
-     * Retrieves the primary key from the DB resultset row
190
-     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
191
-     * a multi-column primary key, an array of the primary key columns will be returned.
192
-     *
193
-     * @param array  $row       resultset row.
194
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
195
-     * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
196
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
197
-     *
198
-     * @return mixed The primary key of the row
199
-     */
200
-    public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
201
-    {
202
-        return (int) $row[
203
-            $indexType == TableMap::TYPE_NUM
204
-                ? 0 + $offset
205
-                : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
206
-        ];
207
-    }
208
-
209
-    /**
210
-     * The class that the tableMap will make instances of.
211
-     *
212
-     * If $withPrefix is true, the returned path
213
-     * uses a dot-path notation which is translated into a path
214
-     * relative to a location on the PHP include_path.
215
-     * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
216
-     *
217
-     * @param boolean $withPrefix Whether or not to return the path with the class name
218
-     * @return string path.to.ClassName
219
-     */
220
-    public static function getOMClass($withPrefix = true)
221
-    {
222
-        return $withPrefix ? ChannelTableMap::CLASS_DEFAULT : ChannelTableMap::OM_CLASS;
223
-    }
224
-
225
-    /**
226
-     * Populates an object of the default type or an object that inherit from the default.
227
-     *
228
-     * @param array  $row       row returned by DataFetcher->fetch().
229
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
230
-     * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
163
+	} // buildRelations()
164
+
165
+	/**
166
+	 * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
167
+	 *
168
+	 * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
169
+	 * a multi-column primary key, a serialize()d version of the primary key will be returned.
170
+	 *
171
+	 * @param array  $row       resultset row.
172
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
173
+	 * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
174
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
175
+	 *
176
+	 * @return string The primary key hash of the row
177
+	 */
178
+	public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
179
+	{
180
+		// If the PK cannot be derived from the row, return NULL.
181
+		if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
182
+			return null;
183
+		}
184
+
185
+		return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
186
+	}
187
+
188
+	/**
189
+	 * Retrieves the primary key from the DB resultset row
190
+	 * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
191
+	 * a multi-column primary key, an array of the primary key columns will be returned.
192
+	 *
193
+	 * @param array  $row       resultset row.
194
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
195
+	 * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
196
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
197
+	 *
198
+	 * @return mixed The primary key of the row
199
+	 */
200
+	public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
201
+	{
202
+		return (int) $row[
203
+			$indexType == TableMap::TYPE_NUM
204
+				? 0 + $offset
205
+				: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
206
+		];
207
+	}
208
+
209
+	/**
210
+	 * The class that the tableMap will make instances of.
211
+	 *
212
+	 * If $withPrefix is true, the returned path
213
+	 * uses a dot-path notation which is translated into a path
214
+	 * relative to a location on the PHP include_path.
215
+	 * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
216
+	 *
217
+	 * @param boolean $withPrefix Whether or not to return the path with the class name
218
+	 * @return string path.to.ClassName
219
+	 */
220
+	public static function getOMClass($withPrefix = true)
221
+	{
222
+		return $withPrefix ? ChannelTableMap::CLASS_DEFAULT : ChannelTableMap::OM_CLASS;
223
+	}
224
+
225
+	/**
226
+	 * Populates an object of the default type or an object that inherit from the default.
227
+	 *
228
+	 * @param array  $row       row returned by DataFetcher->fetch().
229
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
230
+	 * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
231 231
                                  One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
232
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
233
-     *
234
-     * @throws PropelException Any exceptions caught during processing will be
235
-     *                         rethrown wrapped into a PropelException.
236
-     * @return array           (Channel object, last column rank)
237
-     */
238
-    public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
239
-    {
240
-        $key = ChannelTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
241
-        if (null !== ($obj = ChannelTableMap::getInstanceFromPool($key))) {
242
-            // We no longer rehydrate the object, since this can cause data loss.
243
-            // See http://www.propelorm.org/ticket/509
244
-            // $obj->hydrate($row, $offset, true); // rehydrate
245
-            $col = $offset + ChannelTableMap::NUM_HYDRATE_COLUMNS;
246
-        } else {
247
-            $cls = ChannelTableMap::OM_CLASS;
248
-            /** @var Channel $obj */
249
-            $obj = new $cls();
250
-            $col = $obj->hydrate($row, $offset, false, $indexType);
251
-            ChannelTableMap::addInstanceToPool($obj, $key);
252
-        }
253
-
254
-        return array($obj, $col);
255
-    }
256
-
257
-    /**
258
-     * The returned array will contain objects of the default type or
259
-     * objects that inherit from the default.
260
-     *
261
-     * @param DataFetcherInterface $dataFetcher
262
-     * @return array
263
-     * @throws PropelException Any exceptions caught during processing will be
264
-     *                         rethrown wrapped into a PropelException.
265
-     */
266
-    public static function populateObjects(DataFetcherInterface $dataFetcher)
267
-    {
268
-        $results = array();
269
-
270
-        // set the class once to avoid overhead in the loop
271
-        $cls = static::getOMClass(false);
272
-        // populate the object(s)
273
-        while ($row = $dataFetcher->fetch()) {
274
-            $key = ChannelTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
275
-            if (null !== ($obj = ChannelTableMap::getInstanceFromPool($key))) {
276
-                // We no longer rehydrate the object, since this can cause data loss.
277
-                // See http://www.propelorm.org/ticket/509
278
-                // $obj->hydrate($row, 0, true); // rehydrate
279
-                $results[] = $obj;
280
-            } else {
281
-                /** @var Channel $obj */
282
-                $obj = new $cls();
283
-                $obj->hydrate($row);
284
-                $results[] = $obj;
285
-                ChannelTableMap::addInstanceToPool($obj, $key);
286
-            } // if key exists
287
-        }
288
-
289
-        return $results;
290
-    }
291
-    /**
292
-     * Add all the columns needed to create a new object.
293
-     *
294
-     * Note: any columns that were marked with lazyLoad="true" in the
295
-     * XML schema will not be added to the select list and only loaded
296
-     * on demand.
297
-     *
298
-     * @param Criteria $criteria object containing the columns to add.
299
-     * @param string   $alias    optional table alias
300
-     * @throws PropelException Any exceptions caught during processing will be
301
-     *                         rethrown wrapped into a PropelException.
302
-     */
303
-    public static function addSelectColumns(Criteria $criteria, $alias = null)
304
-    {
305
-        if (null === $alias) {
306
-            $criteria->addSelectColumn(ChannelTableMap::COL_ID);
307
-            $criteria->addSelectColumn(ChannelTableMap::COL_INSTANCE_NAME);
308
-            $criteria->addSelectColumn(ChannelTableMap::COL_NAME);
309
-        } else {
310
-            $criteria->addSelectColumn($alias . '.id');
311
-            $criteria->addSelectColumn($alias . '.instance_name');
312
-            $criteria->addSelectColumn($alias . '.name');
313
-        }
314
-    }
315
-
316
-    /**
317
-     * Returns the TableMap related to this object.
318
-     * This method is not needed for general use but a specific application could have a need.
319
-     * @return TableMap
320
-     * @throws PropelException Any exceptions caught during processing will be
321
-     *                         rethrown wrapped into a PropelException.
322
-     */
323
-    public static function getTableMap()
324
-    {
325
-        return Propel::getServiceContainer()->getDatabaseMap(ChannelTableMap::DATABASE_NAME)->getTable(ChannelTableMap::TABLE_NAME);
326
-    }
327
-
328
-    /**
329
-     * Add a TableMap instance to the database for this tableMap class.
330
-     */
331
-    public static function buildTableMap()
332
-    {
333
-        $dbMap = Propel::getServiceContainer()->getDatabaseMap(ChannelTableMap::DATABASE_NAME);
334
-        if (!$dbMap->hasTable(ChannelTableMap::TABLE_NAME)) {
335
-            $dbMap->addTableObject(new ChannelTableMap());
336
-        }
337
-    }
338
-
339
-    /**
340
-     * Performs a DELETE on the database, given a Channel or Criteria object OR a primary key value.
341
-     *
342
-     * @param mixed               $values Criteria or Channel object or primary key or array of primary keys
343
-     *              which is used to create the DELETE statement
344
-     * @param  ConnectionInterface $con the connection to use
345
-     * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
346
-     *                         if supported by native driver or if emulated using Propel.
347
-     * @throws PropelException Any exceptions caught during processing will be
348
-     *                         rethrown wrapped into a PropelException.
349
-     */
350
-     public static function doDelete($values, ConnectionInterface $con = null)
351
-     {
352
-        if (null === $con) {
353
-            $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
354
-        }
355
-
356
-        if ($values instanceof Criteria) {
357
-            // rename for clarity
358
-            $criteria = $values;
359
-        } elseif ($values instanceof \Jalle19\StatusManager\Database\Channel) { // it's a model object
360
-            // create criteria based on pk values
361
-            $criteria = $values->buildPkeyCriteria();
362
-        } else { // it's a primary key, or an array of pks
363
-            $criteria = new Criteria(ChannelTableMap::DATABASE_NAME);
364
-            $criteria->add(ChannelTableMap::COL_ID, (array) $values, Criteria::IN);
365
-        }
366
-
367
-        $query = ChannelQuery::create()->mergeWith($criteria);
368
-
369
-        if ($values instanceof Criteria) {
370
-            ChannelTableMap::clearInstancePool();
371
-        } elseif (!is_object($values)) { // it's a primary key, or an array of pks
372
-            foreach ((array) $values as $singleval) {
373
-                ChannelTableMap::removeInstanceFromPool($singleval);
374
-            }
375
-        }
376
-
377
-        return $query->delete($con);
378
-    }
379
-
380
-    /**
381
-     * Deletes all rows from the channel table.
382
-     *
383
-     * @param ConnectionInterface $con the connection to use
384
-     * @return int The number of affected rows (if supported by underlying database driver).
385
-     */
386
-    public static function doDeleteAll(ConnectionInterface $con = null)
387
-    {
388
-        return ChannelQuery::create()->doDeleteAll($con);
389
-    }
390
-
391
-    /**
392
-     * Performs an INSERT on the database, given a Channel or Criteria object.
393
-     *
394
-     * @param mixed               $criteria Criteria or Channel object containing data that is used to create the INSERT statement.
395
-     * @param ConnectionInterface $con the ConnectionInterface connection to use
396
-     * @return mixed           The new primary key.
397
-     * @throws PropelException Any exceptions caught during processing will be
398
-     *                         rethrown wrapped into a PropelException.
399
-     */
400
-    public static function doInsert($criteria, ConnectionInterface $con = null)
401
-    {
402
-        if (null === $con) {
403
-            $con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
404
-        }
405
-
406
-        if ($criteria instanceof Criteria) {
407
-            $criteria = clone $criteria; // rename for clarity
408
-        } else {
409
-            $criteria = $criteria->buildCriteria(); // build Criteria from Channel object
410
-        }
411
-
412
-        if ($criteria->containsKey(ChannelTableMap::COL_ID) && $criteria->keyContainsValue(ChannelTableMap::COL_ID) ) {
413
-            throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChannelTableMap::COL_ID.')');
414
-        }
415
-
416
-
417
-        // Set the correct dbName
418
-        $query = ChannelQuery::create()->mergeWith($criteria);
419
-
420
-        // use transaction because $criteria could contain info
421
-        // for more than one table (I guess, conceivably)
422
-        return $con->transaction(function () use ($con, $query) {
423
-            return $query->doInsert($con);
424
-        });
425
-    }
232
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
233
+	 *
234
+	 * @throws PropelException Any exceptions caught during processing will be
235
+	 *                         rethrown wrapped into a PropelException.
236
+	 * @return array           (Channel object, last column rank)
237
+	 */
238
+	public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
239
+	{
240
+		$key = ChannelTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
241
+		if (null !== ($obj = ChannelTableMap::getInstanceFromPool($key))) {
242
+			// We no longer rehydrate the object, since this can cause data loss.
243
+			// See http://www.propelorm.org/ticket/509
244
+			// $obj->hydrate($row, $offset, true); // rehydrate
245
+			$col = $offset + ChannelTableMap::NUM_HYDRATE_COLUMNS;
246
+		} else {
247
+			$cls = ChannelTableMap::OM_CLASS;
248
+			/** @var Channel $obj */
249
+			$obj = new $cls();
250
+			$col = $obj->hydrate($row, $offset, false, $indexType);
251
+			ChannelTableMap::addInstanceToPool($obj, $key);
252
+		}
253
+
254
+		return array($obj, $col);
255
+	}
256
+
257
+	/**
258
+	 * The returned array will contain objects of the default type or
259
+	 * objects that inherit from the default.
260
+	 *
261
+	 * @param DataFetcherInterface $dataFetcher
262
+	 * @return array
263
+	 * @throws PropelException Any exceptions caught during processing will be
264
+	 *                         rethrown wrapped into a PropelException.
265
+	 */
266
+	public static function populateObjects(DataFetcherInterface $dataFetcher)
267
+	{
268
+		$results = array();
269
+
270
+		// set the class once to avoid overhead in the loop
271
+		$cls = static::getOMClass(false);
272
+		// populate the object(s)
273
+		while ($row = $dataFetcher->fetch()) {
274
+			$key = ChannelTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
275
+			if (null !== ($obj = ChannelTableMap::getInstanceFromPool($key))) {
276
+				// We no longer rehydrate the object, since this can cause data loss.
277
+				// See http://www.propelorm.org/ticket/509
278
+				// $obj->hydrate($row, 0, true); // rehydrate
279
+				$results[] = $obj;
280
+			} else {
281
+				/** @var Channel $obj */
282
+				$obj = new $cls();
283
+				$obj->hydrate($row);
284
+				$results[] = $obj;
285
+				ChannelTableMap::addInstanceToPool($obj, $key);
286
+			} // if key exists
287
+		}
288
+
289
+		return $results;
290
+	}
291
+	/**
292
+	 * Add all the columns needed to create a new object.
293
+	 *
294
+	 * Note: any columns that were marked with lazyLoad="true" in the
295
+	 * XML schema will not be added to the select list and only loaded
296
+	 * on demand.
297
+	 *
298
+	 * @param Criteria $criteria object containing the columns to add.
299
+	 * @param string   $alias    optional table alias
300
+	 * @throws PropelException Any exceptions caught during processing will be
301
+	 *                         rethrown wrapped into a PropelException.
302
+	 */
303
+	public static function addSelectColumns(Criteria $criteria, $alias = null)
304
+	{
305
+		if (null === $alias) {
306
+			$criteria->addSelectColumn(ChannelTableMap::COL_ID);
307
+			$criteria->addSelectColumn(ChannelTableMap::COL_INSTANCE_NAME);
308
+			$criteria->addSelectColumn(ChannelTableMap::COL_NAME);
309
+		} else {
310
+			$criteria->addSelectColumn($alias . '.id');
311
+			$criteria->addSelectColumn($alias . '.instance_name');
312
+			$criteria->addSelectColumn($alias . '.name');
313
+		}
314
+	}
315
+
316
+	/**
317
+	 * Returns the TableMap related to this object.
318
+	 * This method is not needed for general use but a specific application could have a need.
319
+	 * @return TableMap
320
+	 * @throws PropelException Any exceptions caught during processing will be
321
+	 *                         rethrown wrapped into a PropelException.
322
+	 */
323
+	public static function getTableMap()
324
+	{
325
+		return Propel::getServiceContainer()->getDatabaseMap(ChannelTableMap::DATABASE_NAME)->getTable(ChannelTableMap::TABLE_NAME);
326
+	}
327
+
328
+	/**
329
+	 * Add a TableMap instance to the database for this tableMap class.
330
+	 */
331
+	public static function buildTableMap()
332
+	{
333
+		$dbMap = Propel::getServiceContainer()->getDatabaseMap(ChannelTableMap::DATABASE_NAME);
334
+		if (!$dbMap->hasTable(ChannelTableMap::TABLE_NAME)) {
335
+			$dbMap->addTableObject(new ChannelTableMap());
336
+		}
337
+	}
338
+
339
+	/**
340
+	 * Performs a DELETE on the database, given a Channel or Criteria object OR a primary key value.
341
+	 *
342
+	 * @param mixed               $values Criteria or Channel object or primary key or array of primary keys
343
+	 *              which is used to create the DELETE statement
344
+	 * @param  ConnectionInterface $con the connection to use
345
+	 * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
346
+	 *                         if supported by native driver or if emulated using Propel.
347
+	 * @throws PropelException Any exceptions caught during processing will be
348
+	 *                         rethrown wrapped into a PropelException.
349
+	 */
350
+	 public static function doDelete($values, ConnectionInterface $con = null)
351
+	 {
352
+		if (null === $con) {
353
+			$con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
354
+		}
355
+
356
+		if ($values instanceof Criteria) {
357
+			// rename for clarity
358
+			$criteria = $values;
359
+		} elseif ($values instanceof \Jalle19\StatusManager\Database\Channel) { // it's a model object
360
+			// create criteria based on pk values
361
+			$criteria = $values->buildPkeyCriteria();
362
+		} else { // it's a primary key, or an array of pks
363
+			$criteria = new Criteria(ChannelTableMap::DATABASE_NAME);
364
+			$criteria->add(ChannelTableMap::COL_ID, (array) $values, Criteria::IN);
365
+		}
366
+
367
+		$query = ChannelQuery::create()->mergeWith($criteria);
368
+
369
+		if ($values instanceof Criteria) {
370
+			ChannelTableMap::clearInstancePool();
371
+		} elseif (!is_object($values)) { // it's a primary key, or an array of pks
372
+			foreach ((array) $values as $singleval) {
373
+				ChannelTableMap::removeInstanceFromPool($singleval);
374
+			}
375
+		}
376
+
377
+		return $query->delete($con);
378
+	}
379
+
380
+	/**
381
+	 * Deletes all rows from the channel table.
382
+	 *
383
+	 * @param ConnectionInterface $con the connection to use
384
+	 * @return int The number of affected rows (if supported by underlying database driver).
385
+	 */
386
+	public static function doDeleteAll(ConnectionInterface $con = null)
387
+	{
388
+		return ChannelQuery::create()->doDeleteAll($con);
389
+	}
390
+
391
+	/**
392
+	 * Performs an INSERT on the database, given a Channel or Criteria object.
393
+	 *
394
+	 * @param mixed               $criteria Criteria or Channel object containing data that is used to create the INSERT statement.
395
+	 * @param ConnectionInterface $con the ConnectionInterface connection to use
396
+	 * @return mixed           The new primary key.
397
+	 * @throws PropelException Any exceptions caught during processing will be
398
+	 *                         rethrown wrapped into a PropelException.
399
+	 */
400
+	public static function doInsert($criteria, ConnectionInterface $con = null)
401
+	{
402
+		if (null === $con) {
403
+			$con = Propel::getServiceContainer()->getWriteConnection(ChannelTableMap::DATABASE_NAME);
404
+		}
405
+
406
+		if ($criteria instanceof Criteria) {
407
+			$criteria = clone $criteria; // rename for clarity
408
+		} else {
409
+			$criteria = $criteria->buildCriteria(); // build Criteria from Channel object
410
+		}
411
+
412
+		if ($criteria->containsKey(ChannelTableMap::COL_ID) && $criteria->keyContainsValue(ChannelTableMap::COL_ID) ) {
413
+			throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChannelTableMap::COL_ID.')');
414
+		}
415
+
416
+
417
+		// Set the correct dbName
418
+		$query = ChannelQuery::create()->mergeWith($criteria);
419
+
420
+		// use transaction because $criteria could contain info
421
+		// for more than one table (I guess, conceivably)
422
+		return $con->transaction(function () use ($con, $query) {
423
+			return $query->doInsert($con);
424
+		});
425
+	}
426 426
 
427 427
 } // ChannelTableMap
428 428
 // This is the static code needed to register the TableMap for this table with the main Propel class.
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
      * first dimension keys are the type constants
98 98
      * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
99 99
      */
100
-    protected static $fieldNames = array (
101
-        self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'Name', ),
102
-        self::TYPE_CAMELNAME     => array('id', 'instanceName', 'name', ),
103
-        self::TYPE_COLNAME       => array(ChannelTableMap::COL_ID, ChannelTableMap::COL_INSTANCE_NAME, ChannelTableMap::COL_NAME, ),
104
-        self::TYPE_FIELDNAME     => array('id', 'instance_name', 'name', ),
105
-        self::TYPE_NUM           => array(0, 1, 2, )
100
+    protected static $fieldNames = array(
101
+        self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'Name',),
102
+        self::TYPE_CAMELNAME     => array('id', 'instanceName', 'name',),
103
+        self::TYPE_COLNAME       => array(ChannelTableMap::COL_ID, ChannelTableMap::COL_INSTANCE_NAME, ChannelTableMap::COL_NAME,),
104
+        self::TYPE_FIELDNAME     => array('id', 'instance_name', 'name',),
105
+        self::TYPE_NUM           => array(0, 1, 2,)
106 106
     );
107 107
 
108 108
     /**
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
      * first dimension keys are the type constants
112 112
      * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
113 113
      */
114
-    protected static $fieldKeys = array (
115
-        self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2, ),
116
-        self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'name' => 2, ),
117
-        self::TYPE_COLNAME       => array(ChannelTableMap::COL_ID => 0, ChannelTableMap::COL_INSTANCE_NAME => 1, ChannelTableMap::COL_NAME => 2, ),
118
-        self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'name' => 2, ),
119
-        self::TYPE_NUM           => array(0, 1, 2, )
114
+    protected static $fieldKeys = array(
115
+        self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2,),
116
+        self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'name' => 2,),
117
+        self::TYPE_COLNAME       => array(ChannelTableMap::COL_ID => 0, ChannelTableMap::COL_INSTANCE_NAME => 1, ChannelTableMap::COL_NAME => 2,),
118
+        self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'name' => 2,),
119
+        self::TYPE_NUM           => array(0, 1, 2,)
120 120
     );
121 121
 
122 122
     /**
@@ -146,16 +146,16 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function buildRelations()
148 148
     {
149
-        $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array (
149
+        $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array(
150 150
   0 =>
151
-  array (
151
+  array(
152 152
     0 => ':instance_name',
153 153
     1 => ':name',
154 154
   ),
155 155
 ), null, null, null, false);
156
-        $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array (
156
+        $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array(
157 157
   0 =>
158
-  array (
158
+  array(
159 159
     0 => ':channel_id',
160 160
     1 => ':id',
161 161
   ),
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
             $criteria = $criteria->buildCriteria(); // build Criteria from Channel object
410 410
         }
411 411
 
412
-        if ($criteria->containsKey(ChannelTableMap::COL_ID) && $criteria->keyContainsValue(ChannelTableMap::COL_ID) ) {
413
-            throw new PropelException('Cannot insert a value for auto-increment primary key ('.ChannelTableMap::COL_ID.')');
412
+        if ($criteria->containsKey(ChannelTableMap::COL_ID) && $criteria->keyContainsValue(ChannelTableMap::COL_ID)) {
413
+            throw new PropelException('Cannot insert a value for auto-increment primary key (' . ChannelTableMap::COL_ID . ')');
414 414
         }
415 415
 
416 416
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 
420 420
         // use transaction because $criteria could contain info
421 421
         // for more than one table (I guess, conceivably)
422
-        return $con->transaction(function () use ($con, $query) {
422
+        return $con->transaction(function() use ($con, $query) {
423 423
             return $query->doInsert($con);
424 424
         });
425 425
     }
Please login to merge, or discard this patch.
src/cli/Jalle19/StatusManager/Database/Map/ConnectionTableMap.php 2 patches
Indentation   +410 added lines, -410 removed lines patch added patch discarded remove patch
@@ -28,425 +28,425 @@
 block discarded – undo
28 28
  */
29 29
 class ConnectionTableMap extends TableMap
30 30
 {
31
-    use InstancePoolTrait;
32
-    use TableMapTrait;
33
-
34
-    /**
35
-     * The (dot-path) name of this class
36
-     */
37
-    const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.ConnectionTableMap';
38
-
39
-    /**
40
-     * The default database name for this class
41
-     */
42
-    const DATABASE_NAME = 'tvheadend_status_manager';
43
-
44
-    /**
45
-     * The table name for this class
46
-     */
47
-    const TABLE_NAME = 'connection';
48
-
49
-    /**
50
-     * The related Propel class for this table
51
-     */
52
-    const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Connection';
53
-
54
-    /**
55
-     * A class that can be returned by this tableMap
56
-     */
57
-    const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Connection';
58
-
59
-    /**
60
-     * The total number of columns
61
-     */
62
-    const NUM_COLUMNS = 6;
63
-
64
-    /**
65
-     * The number of lazy-loaded columns
66
-     */
67
-    const NUM_LAZY_LOAD_COLUMNS = 0;
68
-
69
-    /**
70
-     * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
71
-     */
72
-    const NUM_HYDRATE_COLUMNS = 6;
73
-
74
-    /**
75
-     * the column name for the id field
76
-     */
77
-    const COL_ID = 'connection.id';
78
-
79
-    /**
80
-     * the column name for the instance_name field
81
-     */
82
-    const COL_INSTANCE_NAME = 'connection.instance_name';
83
-
84
-    /**
85
-     * the column name for the user_id field
86
-     */
87
-    const COL_USER_ID = 'connection.user_id';
88
-
89
-    /**
90
-     * the column name for the peer field
91
-     */
92
-    const COL_PEER = 'connection.peer';
93
-
94
-    /**
95
-     * the column name for the started field
96
-     */
97
-    const COL_STARTED = 'connection.started';
98
-
99
-    /**
100
-     * the column name for the type field
101
-     */
102
-    const COL_TYPE = 'connection.type';
103
-
104
-    /**
105
-     * The default string format for model objects of the related table
106
-     */
107
-    const DEFAULT_STRING_FORMAT = 'YAML';
108
-
109
-    /**
110
-     * holds an array of fieldnames
111
-     *
112
-     * first dimension keys are the type constants
113
-     * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
114
-     */
115
-    protected static $fieldNames = array (
116
-        self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'UserId', 'Peer', 'Started', 'Type', ),
117
-        self::TYPE_CAMELNAME     => array('id', 'instanceName', 'userId', 'peer', 'started', 'type', ),
118
-        self::TYPE_COLNAME       => array(ConnectionTableMap::COL_ID, ConnectionTableMap::COL_INSTANCE_NAME, ConnectionTableMap::COL_USER_ID, ConnectionTableMap::COL_PEER, ConnectionTableMap::COL_STARTED, ConnectionTableMap::COL_TYPE, ),
119
-        self::TYPE_FIELDNAME     => array('id', 'instance_name', 'user_id', 'peer', 'started', 'type', ),
120
-        self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, )
121
-    );
122
-
123
-    /**
124
-     * holds an array of keys for quick access to the fieldnames array
125
-     *
126
-     * first dimension keys are the type constants
127
-     * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
128
-     */
129
-    protected static $fieldKeys = array (
130
-        self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'UserId' => 2, 'Peer' => 3, 'Started' => 4, 'Type' => 5, ),
131
-        self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'userId' => 2, 'peer' => 3, 'started' => 4, 'type' => 5, ),
132
-        self::TYPE_COLNAME       => array(ConnectionTableMap::COL_ID => 0, ConnectionTableMap::COL_INSTANCE_NAME => 1, ConnectionTableMap::COL_USER_ID => 2, ConnectionTableMap::COL_PEER => 3, ConnectionTableMap::COL_STARTED => 4, ConnectionTableMap::COL_TYPE => 5, ),
133
-        self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'user_id' => 2, 'peer' => 3, 'started' => 4, 'type' => 5, ),
134
-        self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, )
135
-    );
136
-
137
-    /**
138
-     * Initialize the table attributes and columns
139
-     * Relations are not initialized by this method since they are lazy loaded
140
-     *
141
-     * @return void
142
-     * @throws PropelException
143
-     */
144
-    public function initialize()
145
-    {
146
-        // attributes
147
-        $this->setName('connection');
148
-        $this->setPhpName('Connection');
149
-        $this->setIdentifierQuoting(false);
150
-        $this->setClassName('\\Jalle19\\StatusManager\\Database\\Connection');
151
-        $this->setPackage('Jalle19.StatusManager.Database');
152
-        $this->setUseIdGenerator(true);
153
-        // columns
154
-        $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
155
-        $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null);
156
-        $this->addForeignKey('user_id', 'UserId', 'INTEGER', 'user', 'id', false, null, null);
157
-        $this->addColumn('peer', 'Peer', 'VARCHAR', true, 255, null);
158
-        $this->addColumn('started', 'Started', 'TIMESTAMP', true, null, null);
159
-        $this->addColumn('type', 'Type', 'VARCHAR', true, 255, null);
160
-    } // initialize()
161
-
162
-    /**
163
-     * Build the RelationMap objects for this table relationships
164
-     */
165
-    public function buildRelations()
166
-    {
167
-        $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array (
31
+	use InstancePoolTrait;
32
+	use TableMapTrait;
33
+
34
+	/**
35
+	 * The (dot-path) name of this class
36
+	 */
37
+	const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.ConnectionTableMap';
38
+
39
+	/**
40
+	 * The default database name for this class
41
+	 */
42
+	const DATABASE_NAME = 'tvheadend_status_manager';
43
+
44
+	/**
45
+	 * The table name for this class
46
+	 */
47
+	const TABLE_NAME = 'connection';
48
+
49
+	/**
50
+	 * The related Propel class for this table
51
+	 */
52
+	const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Connection';
53
+
54
+	/**
55
+	 * A class that can be returned by this tableMap
56
+	 */
57
+	const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Connection';
58
+
59
+	/**
60
+	 * The total number of columns
61
+	 */
62
+	const NUM_COLUMNS = 6;
63
+
64
+	/**
65
+	 * The number of lazy-loaded columns
66
+	 */
67
+	const NUM_LAZY_LOAD_COLUMNS = 0;
68
+
69
+	/**
70
+	 * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
71
+	 */
72
+	const NUM_HYDRATE_COLUMNS = 6;
73
+
74
+	/**
75
+	 * the column name for the id field
76
+	 */
77
+	const COL_ID = 'connection.id';
78
+
79
+	/**
80
+	 * the column name for the instance_name field
81
+	 */
82
+	const COL_INSTANCE_NAME = 'connection.instance_name';
83
+
84
+	/**
85
+	 * the column name for the user_id field
86
+	 */
87
+	const COL_USER_ID = 'connection.user_id';
88
+
89
+	/**
90
+	 * the column name for the peer field
91
+	 */
92
+	const COL_PEER = 'connection.peer';
93
+
94
+	/**
95
+	 * the column name for the started field
96
+	 */
97
+	const COL_STARTED = 'connection.started';
98
+
99
+	/**
100
+	 * the column name for the type field
101
+	 */
102
+	const COL_TYPE = 'connection.type';
103
+
104
+	/**
105
+	 * The default string format for model objects of the related table
106
+	 */
107
+	const DEFAULT_STRING_FORMAT = 'YAML';
108
+
109
+	/**
110
+	 * holds an array of fieldnames
111
+	 *
112
+	 * first dimension keys are the type constants
113
+	 * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
114
+	 */
115
+	protected static $fieldNames = array (
116
+		self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'UserId', 'Peer', 'Started', 'Type', ),
117
+		self::TYPE_CAMELNAME     => array('id', 'instanceName', 'userId', 'peer', 'started', 'type', ),
118
+		self::TYPE_COLNAME       => array(ConnectionTableMap::COL_ID, ConnectionTableMap::COL_INSTANCE_NAME, ConnectionTableMap::COL_USER_ID, ConnectionTableMap::COL_PEER, ConnectionTableMap::COL_STARTED, ConnectionTableMap::COL_TYPE, ),
119
+		self::TYPE_FIELDNAME     => array('id', 'instance_name', 'user_id', 'peer', 'started', 'type', ),
120
+		self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, )
121
+	);
122
+
123
+	/**
124
+	 * holds an array of keys for quick access to the fieldnames array
125
+	 *
126
+	 * first dimension keys are the type constants
127
+	 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
128
+	 */
129
+	protected static $fieldKeys = array (
130
+		self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'UserId' => 2, 'Peer' => 3, 'Started' => 4, 'Type' => 5, ),
131
+		self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'userId' => 2, 'peer' => 3, 'started' => 4, 'type' => 5, ),
132
+		self::TYPE_COLNAME       => array(ConnectionTableMap::COL_ID => 0, ConnectionTableMap::COL_INSTANCE_NAME => 1, ConnectionTableMap::COL_USER_ID => 2, ConnectionTableMap::COL_PEER => 3, ConnectionTableMap::COL_STARTED => 4, ConnectionTableMap::COL_TYPE => 5, ),
133
+		self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'user_id' => 2, 'peer' => 3, 'started' => 4, 'type' => 5, ),
134
+		self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, )
135
+	);
136
+
137
+	/**
138
+	 * Initialize the table attributes and columns
139
+	 * Relations are not initialized by this method since they are lazy loaded
140
+	 *
141
+	 * @return void
142
+	 * @throws PropelException
143
+	 */
144
+	public function initialize()
145
+	{
146
+		// attributes
147
+		$this->setName('connection');
148
+		$this->setPhpName('Connection');
149
+		$this->setIdentifierQuoting(false);
150
+		$this->setClassName('\\Jalle19\\StatusManager\\Database\\Connection');
151
+		$this->setPackage('Jalle19.StatusManager.Database');
152
+		$this->setUseIdGenerator(true);
153
+		// columns
154
+		$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
155
+		$this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null);
156
+		$this->addForeignKey('user_id', 'UserId', 'INTEGER', 'user', 'id', false, null, null);
157
+		$this->addColumn('peer', 'Peer', 'VARCHAR', true, 255, null);
158
+		$this->addColumn('started', 'Started', 'TIMESTAMP', true, null, null);
159
+		$this->addColumn('type', 'Type', 'VARCHAR', true, 255, null);
160
+	} // initialize()
161
+
162
+	/**
163
+	 * Build the RelationMap objects for this table relationships
164
+	 */
165
+	public function buildRelations()
166
+	{
167
+		$this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array (
168 168
   0 =>
169 169
   array (
170
-    0 => ':instance_name',
171
-    1 => ':name',
170
+	0 => ':instance_name',
171
+	1 => ':name',
172 172
   ),
173 173
 ), null, null, null, false);
174
-        $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array (
174
+		$this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array (
175 175
   0 =>
176 176
   array (
177
-    0 => ':user_id',
178
-    1 => ':id',
177
+	0 => ':user_id',
178
+	1 => ':id',
179 179
   ),
180 180
 ), null, null, null, false);
181
-    } // buildRelations()
182
-
183
-    /**
184
-     * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
185
-     *
186
-     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
187
-     * a multi-column primary key, a serialize()d version of the primary key will be returned.
188
-     *
189
-     * @param array  $row       resultset row.
190
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
191
-     * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
192
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
193
-     *
194
-     * @return string The primary key hash of the row
195
-     */
196
-    public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
197
-    {
198
-        // If the PK cannot be derived from the row, return NULL.
199
-        if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
200
-            return null;
201
-        }
202
-
203
-        return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
204
-    }
205
-
206
-    /**
207
-     * Retrieves the primary key from the DB resultset row
208
-     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
209
-     * a multi-column primary key, an array of the primary key columns will be returned.
210
-     *
211
-     * @param array  $row       resultset row.
212
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
213
-     * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
214
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
215
-     *
216
-     * @return mixed The primary key of the row
217
-     */
218
-    public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
219
-    {
220
-        return (int) $row[
221
-            $indexType == TableMap::TYPE_NUM
222
-                ? 0 + $offset
223
-                : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
224
-        ];
225
-    }
226
-
227
-    /**
228
-     * The class that the tableMap will make instances of.
229
-     *
230
-     * If $withPrefix is true, the returned path
231
-     * uses a dot-path notation which is translated into a path
232
-     * relative to a location on the PHP include_path.
233
-     * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
234
-     *
235
-     * @param boolean $withPrefix Whether or not to return the path with the class name
236
-     * @return string path.to.ClassName
237
-     */
238
-    public static function getOMClass($withPrefix = true)
239
-    {
240
-        return $withPrefix ? ConnectionTableMap::CLASS_DEFAULT : ConnectionTableMap::OM_CLASS;
241
-    }
242
-
243
-    /**
244
-     * Populates an object of the default type or an object that inherit from the default.
245
-     *
246
-     * @param array  $row       row returned by DataFetcher->fetch().
247
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
248
-     * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
181
+	} // buildRelations()
182
+
183
+	/**
184
+	 * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
185
+	 *
186
+	 * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
187
+	 * a multi-column primary key, a serialize()d version of the primary key will be returned.
188
+	 *
189
+	 * @param array  $row       resultset row.
190
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
191
+	 * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
192
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
193
+	 *
194
+	 * @return string The primary key hash of the row
195
+	 */
196
+	public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
197
+	{
198
+		// If the PK cannot be derived from the row, return NULL.
199
+		if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
200
+			return null;
201
+		}
202
+
203
+		return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
204
+	}
205
+
206
+	/**
207
+	 * Retrieves the primary key from the DB resultset row
208
+	 * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
209
+	 * a multi-column primary key, an array of the primary key columns will be returned.
210
+	 *
211
+	 * @param array  $row       resultset row.
212
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
213
+	 * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
214
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
215
+	 *
216
+	 * @return mixed The primary key of the row
217
+	 */
218
+	public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
219
+	{
220
+		return (int) $row[
221
+			$indexType == TableMap::TYPE_NUM
222
+				? 0 + $offset
223
+				: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
224
+		];
225
+	}
226
+
227
+	/**
228
+	 * The class that the tableMap will make instances of.
229
+	 *
230
+	 * If $withPrefix is true, the returned path
231
+	 * uses a dot-path notation which is translated into a path
232
+	 * relative to a location on the PHP include_path.
233
+	 * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
234
+	 *
235
+	 * @param boolean $withPrefix Whether or not to return the path with the class name
236
+	 * @return string path.to.ClassName
237
+	 */
238
+	public static function getOMClass($withPrefix = true)
239
+	{
240
+		return $withPrefix ? ConnectionTableMap::CLASS_DEFAULT : ConnectionTableMap::OM_CLASS;
241
+	}
242
+
243
+	/**
244
+	 * Populates an object of the default type or an object that inherit from the default.
245
+	 *
246
+	 * @param array  $row       row returned by DataFetcher->fetch().
247
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
248
+	 * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
249 249
                                  One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
250
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
251
-     *
252
-     * @throws PropelException Any exceptions caught during processing will be
253
-     *                         rethrown wrapped into a PropelException.
254
-     * @return array           (Connection object, last column rank)
255
-     */
256
-    public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
257
-    {
258
-        $key = ConnectionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
259
-        if (null !== ($obj = ConnectionTableMap::getInstanceFromPool($key))) {
260
-            // We no longer rehydrate the object, since this can cause data loss.
261
-            // See http://www.propelorm.org/ticket/509
262
-            // $obj->hydrate($row, $offset, true); // rehydrate
263
-            $col = $offset + ConnectionTableMap::NUM_HYDRATE_COLUMNS;
264
-        } else {
265
-            $cls = ConnectionTableMap::OM_CLASS;
266
-            /** @var Connection $obj */
267
-            $obj = new $cls();
268
-            $col = $obj->hydrate($row, $offset, false, $indexType);
269
-            ConnectionTableMap::addInstanceToPool($obj, $key);
270
-        }
271
-
272
-        return array($obj, $col);
273
-    }
274
-
275
-    /**
276
-     * The returned array will contain objects of the default type or
277
-     * objects that inherit from the default.
278
-     *
279
-     * @param DataFetcherInterface $dataFetcher
280
-     * @return array
281
-     * @throws PropelException Any exceptions caught during processing will be
282
-     *                         rethrown wrapped into a PropelException.
283
-     */
284
-    public static function populateObjects(DataFetcherInterface $dataFetcher)
285
-    {
286
-        $results = array();
287
-
288
-        // set the class once to avoid overhead in the loop
289
-        $cls = static::getOMClass(false);
290
-        // populate the object(s)
291
-        while ($row = $dataFetcher->fetch()) {
292
-            $key = ConnectionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
293
-            if (null !== ($obj = ConnectionTableMap::getInstanceFromPool($key))) {
294
-                // We no longer rehydrate the object, since this can cause data loss.
295
-                // See http://www.propelorm.org/ticket/509
296
-                // $obj->hydrate($row, 0, true); // rehydrate
297
-                $results[] = $obj;
298
-            } else {
299
-                /** @var Connection $obj */
300
-                $obj = new $cls();
301
-                $obj->hydrate($row);
302
-                $results[] = $obj;
303
-                ConnectionTableMap::addInstanceToPool($obj, $key);
304
-            } // if key exists
305
-        }
306
-
307
-        return $results;
308
-    }
309
-    /**
310
-     * Add all the columns needed to create a new object.
311
-     *
312
-     * Note: any columns that were marked with lazyLoad="true" in the
313
-     * XML schema will not be added to the select list and only loaded
314
-     * on demand.
315
-     *
316
-     * @param Criteria $criteria object containing the columns to add.
317
-     * @param string   $alias    optional table alias
318
-     * @throws PropelException Any exceptions caught during processing will be
319
-     *                         rethrown wrapped into a PropelException.
320
-     */
321
-    public static function addSelectColumns(Criteria $criteria, $alias = null)
322
-    {
323
-        if (null === $alias) {
324
-            $criteria->addSelectColumn(ConnectionTableMap::COL_ID);
325
-            $criteria->addSelectColumn(ConnectionTableMap::COL_INSTANCE_NAME);
326
-            $criteria->addSelectColumn(ConnectionTableMap::COL_USER_ID);
327
-            $criteria->addSelectColumn(ConnectionTableMap::COL_PEER);
328
-            $criteria->addSelectColumn(ConnectionTableMap::COL_STARTED);
329
-            $criteria->addSelectColumn(ConnectionTableMap::COL_TYPE);
330
-        } else {
331
-            $criteria->addSelectColumn($alias . '.id');
332
-            $criteria->addSelectColumn($alias . '.instance_name');
333
-            $criteria->addSelectColumn($alias . '.user_id');
334
-            $criteria->addSelectColumn($alias . '.peer');
335
-            $criteria->addSelectColumn($alias . '.started');
336
-            $criteria->addSelectColumn($alias . '.type');
337
-        }
338
-    }
339
-
340
-    /**
341
-     * Returns the TableMap related to this object.
342
-     * This method is not needed for general use but a specific application could have a need.
343
-     * @return TableMap
344
-     * @throws PropelException Any exceptions caught during processing will be
345
-     *                         rethrown wrapped into a PropelException.
346
-     */
347
-    public static function getTableMap()
348
-    {
349
-        return Propel::getServiceContainer()->getDatabaseMap(ConnectionTableMap::DATABASE_NAME)->getTable(ConnectionTableMap::TABLE_NAME);
350
-    }
351
-
352
-    /**
353
-     * Add a TableMap instance to the database for this tableMap class.
354
-     */
355
-    public static function buildTableMap()
356
-    {
357
-        $dbMap = Propel::getServiceContainer()->getDatabaseMap(ConnectionTableMap::DATABASE_NAME);
358
-        if (!$dbMap->hasTable(ConnectionTableMap::TABLE_NAME)) {
359
-            $dbMap->addTableObject(new ConnectionTableMap());
360
-        }
361
-    }
362
-
363
-    /**
364
-     * Performs a DELETE on the database, given a Connection or Criteria object OR a primary key value.
365
-     *
366
-     * @param mixed               $values Criteria or Connection object or primary key or array of primary keys
367
-     *              which is used to create the DELETE statement
368
-     * @param  ConnectionInterface $con the connection to use
369
-     * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
370
-     *                         if supported by native driver or if emulated using Propel.
371
-     * @throws PropelException Any exceptions caught during processing will be
372
-     *                         rethrown wrapped into a PropelException.
373
-     */
374
-     public static function doDelete($values, ConnectionInterface $con = null)
375
-     {
376
-        if (null === $con) {
377
-            $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
378
-        }
379
-
380
-        if ($values instanceof Criteria) {
381
-            // rename for clarity
382
-            $criteria = $values;
383
-        } elseif ($values instanceof \Jalle19\StatusManager\Database\Connection) { // it's a model object
384
-            // create criteria based on pk values
385
-            $criteria = $values->buildPkeyCriteria();
386
-        } else { // it's a primary key, or an array of pks
387
-            $criteria = new Criteria(ConnectionTableMap::DATABASE_NAME);
388
-            $criteria->add(ConnectionTableMap::COL_ID, (array) $values, Criteria::IN);
389
-        }
390
-
391
-        $query = ConnectionQuery::create()->mergeWith($criteria);
392
-
393
-        if ($values instanceof Criteria) {
394
-            ConnectionTableMap::clearInstancePool();
395
-        } elseif (!is_object($values)) { // it's a primary key, or an array of pks
396
-            foreach ((array) $values as $singleval) {
397
-                ConnectionTableMap::removeInstanceFromPool($singleval);
398
-            }
399
-        }
400
-
401
-        return $query->delete($con);
402
-    }
403
-
404
-    /**
405
-     * Deletes all rows from the connection table.
406
-     *
407
-     * @param ConnectionInterface $con the connection to use
408
-     * @return int The number of affected rows (if supported by underlying database driver).
409
-     */
410
-    public static function doDeleteAll(ConnectionInterface $con = null)
411
-    {
412
-        return ConnectionQuery::create()->doDeleteAll($con);
413
-    }
414
-
415
-    /**
416
-     * Performs an INSERT on the database, given a Connection or Criteria object.
417
-     *
418
-     * @param mixed               $criteria Criteria or Connection object containing data that is used to create the INSERT statement.
419
-     * @param ConnectionInterface $con the ConnectionInterface connection to use
420
-     * @return mixed           The new primary key.
421
-     * @throws PropelException Any exceptions caught during processing will be
422
-     *                         rethrown wrapped into a PropelException.
423
-     */
424
-    public static function doInsert($criteria, ConnectionInterface $con = null)
425
-    {
426
-        if (null === $con) {
427
-            $con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
428
-        }
429
-
430
-        if ($criteria instanceof Criteria) {
431
-            $criteria = clone $criteria; // rename for clarity
432
-        } else {
433
-            $criteria = $criteria->buildCriteria(); // build Criteria from Connection object
434
-        }
435
-
436
-        if ($criteria->containsKey(ConnectionTableMap::COL_ID) && $criteria->keyContainsValue(ConnectionTableMap::COL_ID) ) {
437
-            throw new PropelException('Cannot insert a value for auto-increment primary key ('.ConnectionTableMap::COL_ID.')');
438
-        }
439
-
440
-
441
-        // Set the correct dbName
442
-        $query = ConnectionQuery::create()->mergeWith($criteria);
443
-
444
-        // use transaction because $criteria could contain info
445
-        // for more than one table (I guess, conceivably)
446
-        return $con->transaction(function () use ($con, $query) {
447
-            return $query->doInsert($con);
448
-        });
449
-    }
250
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
251
+	 *
252
+	 * @throws PropelException Any exceptions caught during processing will be
253
+	 *                         rethrown wrapped into a PropelException.
254
+	 * @return array           (Connection object, last column rank)
255
+	 */
256
+	public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
257
+	{
258
+		$key = ConnectionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
259
+		if (null !== ($obj = ConnectionTableMap::getInstanceFromPool($key))) {
260
+			// We no longer rehydrate the object, since this can cause data loss.
261
+			// See http://www.propelorm.org/ticket/509
262
+			// $obj->hydrate($row, $offset, true); // rehydrate
263
+			$col = $offset + ConnectionTableMap::NUM_HYDRATE_COLUMNS;
264
+		} else {
265
+			$cls = ConnectionTableMap::OM_CLASS;
266
+			/** @var Connection $obj */
267
+			$obj = new $cls();
268
+			$col = $obj->hydrate($row, $offset, false, $indexType);
269
+			ConnectionTableMap::addInstanceToPool($obj, $key);
270
+		}
271
+
272
+		return array($obj, $col);
273
+	}
274
+
275
+	/**
276
+	 * The returned array will contain objects of the default type or
277
+	 * objects that inherit from the default.
278
+	 *
279
+	 * @param DataFetcherInterface $dataFetcher
280
+	 * @return array
281
+	 * @throws PropelException Any exceptions caught during processing will be
282
+	 *                         rethrown wrapped into a PropelException.
283
+	 */
284
+	public static function populateObjects(DataFetcherInterface $dataFetcher)
285
+	{
286
+		$results = array();
287
+
288
+		// set the class once to avoid overhead in the loop
289
+		$cls = static::getOMClass(false);
290
+		// populate the object(s)
291
+		while ($row = $dataFetcher->fetch()) {
292
+			$key = ConnectionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
293
+			if (null !== ($obj = ConnectionTableMap::getInstanceFromPool($key))) {
294
+				// We no longer rehydrate the object, since this can cause data loss.
295
+				// See http://www.propelorm.org/ticket/509
296
+				// $obj->hydrate($row, 0, true); // rehydrate
297
+				$results[] = $obj;
298
+			} else {
299
+				/** @var Connection $obj */
300
+				$obj = new $cls();
301
+				$obj->hydrate($row);
302
+				$results[] = $obj;
303
+				ConnectionTableMap::addInstanceToPool($obj, $key);
304
+			} // if key exists
305
+		}
306
+
307
+		return $results;
308
+	}
309
+	/**
310
+	 * Add all the columns needed to create a new object.
311
+	 *
312
+	 * Note: any columns that were marked with lazyLoad="true" in the
313
+	 * XML schema will not be added to the select list and only loaded
314
+	 * on demand.
315
+	 *
316
+	 * @param Criteria $criteria object containing the columns to add.
317
+	 * @param string   $alias    optional table alias
318
+	 * @throws PropelException Any exceptions caught during processing will be
319
+	 *                         rethrown wrapped into a PropelException.
320
+	 */
321
+	public static function addSelectColumns(Criteria $criteria, $alias = null)
322
+	{
323
+		if (null === $alias) {
324
+			$criteria->addSelectColumn(ConnectionTableMap::COL_ID);
325
+			$criteria->addSelectColumn(ConnectionTableMap::COL_INSTANCE_NAME);
326
+			$criteria->addSelectColumn(ConnectionTableMap::COL_USER_ID);
327
+			$criteria->addSelectColumn(ConnectionTableMap::COL_PEER);
328
+			$criteria->addSelectColumn(ConnectionTableMap::COL_STARTED);
329
+			$criteria->addSelectColumn(ConnectionTableMap::COL_TYPE);
330
+		} else {
331
+			$criteria->addSelectColumn($alias . '.id');
332
+			$criteria->addSelectColumn($alias . '.instance_name');
333
+			$criteria->addSelectColumn($alias . '.user_id');
334
+			$criteria->addSelectColumn($alias . '.peer');
335
+			$criteria->addSelectColumn($alias . '.started');
336
+			$criteria->addSelectColumn($alias . '.type');
337
+		}
338
+	}
339
+
340
+	/**
341
+	 * Returns the TableMap related to this object.
342
+	 * This method is not needed for general use but a specific application could have a need.
343
+	 * @return TableMap
344
+	 * @throws PropelException Any exceptions caught during processing will be
345
+	 *                         rethrown wrapped into a PropelException.
346
+	 */
347
+	public static function getTableMap()
348
+	{
349
+		return Propel::getServiceContainer()->getDatabaseMap(ConnectionTableMap::DATABASE_NAME)->getTable(ConnectionTableMap::TABLE_NAME);
350
+	}
351
+
352
+	/**
353
+	 * Add a TableMap instance to the database for this tableMap class.
354
+	 */
355
+	public static function buildTableMap()
356
+	{
357
+		$dbMap = Propel::getServiceContainer()->getDatabaseMap(ConnectionTableMap::DATABASE_NAME);
358
+		if (!$dbMap->hasTable(ConnectionTableMap::TABLE_NAME)) {
359
+			$dbMap->addTableObject(new ConnectionTableMap());
360
+		}
361
+	}
362
+
363
+	/**
364
+	 * Performs a DELETE on the database, given a Connection or Criteria object OR a primary key value.
365
+	 *
366
+	 * @param mixed               $values Criteria or Connection object or primary key or array of primary keys
367
+	 *              which is used to create the DELETE statement
368
+	 * @param  ConnectionInterface $con the connection to use
369
+	 * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
370
+	 *                         if supported by native driver or if emulated using Propel.
371
+	 * @throws PropelException Any exceptions caught during processing will be
372
+	 *                         rethrown wrapped into a PropelException.
373
+	 */
374
+	 public static function doDelete($values, ConnectionInterface $con = null)
375
+	 {
376
+		if (null === $con) {
377
+			$con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
378
+		}
379
+
380
+		if ($values instanceof Criteria) {
381
+			// rename for clarity
382
+			$criteria = $values;
383
+		} elseif ($values instanceof \Jalle19\StatusManager\Database\Connection) { // it's a model object
384
+			// create criteria based on pk values
385
+			$criteria = $values->buildPkeyCriteria();
386
+		} else { // it's a primary key, or an array of pks
387
+			$criteria = new Criteria(ConnectionTableMap::DATABASE_NAME);
388
+			$criteria->add(ConnectionTableMap::COL_ID, (array) $values, Criteria::IN);
389
+		}
390
+
391
+		$query = ConnectionQuery::create()->mergeWith($criteria);
392
+
393
+		if ($values instanceof Criteria) {
394
+			ConnectionTableMap::clearInstancePool();
395
+		} elseif (!is_object($values)) { // it's a primary key, or an array of pks
396
+			foreach ((array) $values as $singleval) {
397
+				ConnectionTableMap::removeInstanceFromPool($singleval);
398
+			}
399
+		}
400
+
401
+		return $query->delete($con);
402
+	}
403
+
404
+	/**
405
+	 * Deletes all rows from the connection table.
406
+	 *
407
+	 * @param ConnectionInterface $con the connection to use
408
+	 * @return int The number of affected rows (if supported by underlying database driver).
409
+	 */
410
+	public static function doDeleteAll(ConnectionInterface $con = null)
411
+	{
412
+		return ConnectionQuery::create()->doDeleteAll($con);
413
+	}
414
+
415
+	/**
416
+	 * Performs an INSERT on the database, given a Connection or Criteria object.
417
+	 *
418
+	 * @param mixed               $criteria Criteria or Connection object containing data that is used to create the INSERT statement.
419
+	 * @param ConnectionInterface $con the ConnectionInterface connection to use
420
+	 * @return mixed           The new primary key.
421
+	 * @throws PropelException Any exceptions caught during processing will be
422
+	 *                         rethrown wrapped into a PropelException.
423
+	 */
424
+	public static function doInsert($criteria, ConnectionInterface $con = null)
425
+	{
426
+		if (null === $con) {
427
+			$con = Propel::getServiceContainer()->getWriteConnection(ConnectionTableMap::DATABASE_NAME);
428
+		}
429
+
430
+		if ($criteria instanceof Criteria) {
431
+			$criteria = clone $criteria; // rename for clarity
432
+		} else {
433
+			$criteria = $criteria->buildCriteria(); // build Criteria from Connection object
434
+		}
435
+
436
+		if ($criteria->containsKey(ConnectionTableMap::COL_ID) && $criteria->keyContainsValue(ConnectionTableMap::COL_ID) ) {
437
+			throw new PropelException('Cannot insert a value for auto-increment primary key ('.ConnectionTableMap::COL_ID.')');
438
+		}
439
+
440
+
441
+		// Set the correct dbName
442
+		$query = ConnectionQuery::create()->mergeWith($criteria);
443
+
444
+		// use transaction because $criteria could contain info
445
+		// for more than one table (I guess, conceivably)
446
+		return $con->transaction(function () use ($con, $query) {
447
+			return $query->doInsert($con);
448
+		});
449
+	}
450 450
 
451 451
 } // ConnectionTableMap
452 452
 // This is the static code needed to register the TableMap for this table with the main Propel class.
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
      * first dimension keys are the type constants
113 113
      * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
114 114
      */
115
-    protected static $fieldNames = array (
116
-        self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'UserId', 'Peer', 'Started', 'Type', ),
117
-        self::TYPE_CAMELNAME     => array('id', 'instanceName', 'userId', 'peer', 'started', 'type', ),
118
-        self::TYPE_COLNAME       => array(ConnectionTableMap::COL_ID, ConnectionTableMap::COL_INSTANCE_NAME, ConnectionTableMap::COL_USER_ID, ConnectionTableMap::COL_PEER, ConnectionTableMap::COL_STARTED, ConnectionTableMap::COL_TYPE, ),
119
-        self::TYPE_FIELDNAME     => array('id', 'instance_name', 'user_id', 'peer', 'started', 'type', ),
120
-        self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, )
115
+    protected static $fieldNames = array(
116
+        self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'UserId', 'Peer', 'Started', 'Type',),
117
+        self::TYPE_CAMELNAME     => array('id', 'instanceName', 'userId', 'peer', 'started', 'type',),
118
+        self::TYPE_COLNAME       => array(ConnectionTableMap::COL_ID, ConnectionTableMap::COL_INSTANCE_NAME, ConnectionTableMap::COL_USER_ID, ConnectionTableMap::COL_PEER, ConnectionTableMap::COL_STARTED, ConnectionTableMap::COL_TYPE,),
119
+        self::TYPE_FIELDNAME     => array('id', 'instance_name', 'user_id', 'peer', 'started', 'type',),
120
+        self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5,)
121 121
     );
122 122
 
123 123
     /**
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
      * first dimension keys are the type constants
127 127
      * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
128 128
      */
129
-    protected static $fieldKeys = array (
130
-        self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'UserId' => 2, 'Peer' => 3, 'Started' => 4, 'Type' => 5, ),
131
-        self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'userId' => 2, 'peer' => 3, 'started' => 4, 'type' => 5, ),
132
-        self::TYPE_COLNAME       => array(ConnectionTableMap::COL_ID => 0, ConnectionTableMap::COL_INSTANCE_NAME => 1, ConnectionTableMap::COL_USER_ID => 2, ConnectionTableMap::COL_PEER => 3, ConnectionTableMap::COL_STARTED => 4, ConnectionTableMap::COL_TYPE => 5, ),
133
-        self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'user_id' => 2, 'peer' => 3, 'started' => 4, 'type' => 5, ),
134
-        self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, )
129
+    protected static $fieldKeys = array(
130
+        self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'UserId' => 2, 'Peer' => 3, 'Started' => 4, 'Type' => 5,),
131
+        self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'userId' => 2, 'peer' => 3, 'started' => 4, 'type' => 5,),
132
+        self::TYPE_COLNAME       => array(ConnectionTableMap::COL_ID => 0, ConnectionTableMap::COL_INSTANCE_NAME => 1, ConnectionTableMap::COL_USER_ID => 2, ConnectionTableMap::COL_PEER => 3, ConnectionTableMap::COL_STARTED => 4, ConnectionTableMap::COL_TYPE => 5,),
133
+        self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'user_id' => 2, 'peer' => 3, 'started' => 4, 'type' => 5,),
134
+        self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5,)
135 135
     );
136 136
 
137 137
     /**
@@ -164,16 +164,16 @@  discard block
 block discarded – undo
164 164
      */
165 165
     public function buildRelations()
166 166
     {
167
-        $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array (
167
+        $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array(
168 168
   0 =>
169
-  array (
169
+  array(
170 170
     0 => ':instance_name',
171 171
     1 => ':name',
172 172
   ),
173 173
 ), null, null, null, false);
174
-        $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array (
174
+        $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array(
175 175
   0 =>
176
-  array (
176
+  array(
177 177
     0 => ':user_id',
178 178
     1 => ':id',
179 179
   ),
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
             $criteria = $criteria->buildCriteria(); // build Criteria from Connection object
434 434
         }
435 435
 
436
-        if ($criteria->containsKey(ConnectionTableMap::COL_ID) && $criteria->keyContainsValue(ConnectionTableMap::COL_ID) ) {
437
-            throw new PropelException('Cannot insert a value for auto-increment primary key ('.ConnectionTableMap::COL_ID.')');
436
+        if ($criteria->containsKey(ConnectionTableMap::COL_ID) && $criteria->keyContainsValue(ConnectionTableMap::COL_ID)) {
437
+            throw new PropelException('Cannot insert a value for auto-increment primary key (' . ConnectionTableMap::COL_ID . ')');
438 438
         }
439 439
 
440 440
 
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 
444 444
         // use transaction because $criteria could contain info
445 445
         // for more than one table (I guess, conceivably)
446
-        return $con->transaction(function () use ($con, $query) {
446
+        return $con->transaction(function() use ($con, $query) {
447 447
             return $query->doInsert($con);
448 448
         });
449 449
     }
Please login to merge, or discard this patch.
src/cli/Jalle19/StatusManager/Database/Map/InstanceTableMap.php 2 patches
Indentation   +372 added lines, -372 removed lines patch added patch discarded remove patch
@@ -28,395 +28,395 @@
 block discarded – undo
28 28
  */
29 29
 class InstanceTableMap extends TableMap
30 30
 {
31
-    use InstancePoolTrait;
32
-    use TableMapTrait;
33
-
34
-    /**
35
-     * The (dot-path) name of this class
36
-     */
37
-    const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.InstanceTableMap';
38
-
39
-    /**
40
-     * The default database name for this class
41
-     */
42
-    const DATABASE_NAME = 'tvheadend_status_manager';
43
-
44
-    /**
45
-     * The table name for this class
46
-     */
47
-    const TABLE_NAME = 'instance';
48
-
49
-    /**
50
-     * The related Propel class for this table
51
-     */
52
-    const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Instance';
53
-
54
-    /**
55
-     * A class that can be returned by this tableMap
56
-     */
57
-    const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Instance';
58
-
59
-    /**
60
-     * The total number of columns
61
-     */
62
-    const NUM_COLUMNS = 1;
63
-
64
-    /**
65
-     * The number of lazy-loaded columns
66
-     */
67
-    const NUM_LAZY_LOAD_COLUMNS = 0;
68
-
69
-    /**
70
-     * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
71
-     */
72
-    const NUM_HYDRATE_COLUMNS = 1;
73
-
74
-    /**
75
-     * the column name for the name field
76
-     */
77
-    const COL_NAME = 'instance.name';
78
-
79
-    /**
80
-     * The default string format for model objects of the related table
81
-     */
82
-    const DEFAULT_STRING_FORMAT = 'YAML';
83
-
84
-    /**
85
-     * holds an array of fieldnames
86
-     *
87
-     * first dimension keys are the type constants
88
-     * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
89
-     */
90
-    protected static $fieldNames = array (
91
-        self::TYPE_PHPNAME       => array('Name', ),
92
-        self::TYPE_CAMELNAME     => array('name', ),
93
-        self::TYPE_COLNAME       => array(InstanceTableMap::COL_NAME, ),
94
-        self::TYPE_FIELDNAME     => array('name', ),
95
-        self::TYPE_NUM           => array(0, )
96
-    );
97
-
98
-    /**
99
-     * holds an array of keys for quick access to the fieldnames array
100
-     *
101
-     * first dimension keys are the type constants
102
-     * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
103
-     */
104
-    protected static $fieldKeys = array (
105
-        self::TYPE_PHPNAME       => array('Name' => 0, ),
106
-        self::TYPE_CAMELNAME     => array('name' => 0, ),
107
-        self::TYPE_COLNAME       => array(InstanceTableMap::COL_NAME => 0, ),
108
-        self::TYPE_FIELDNAME     => array('name' => 0, ),
109
-        self::TYPE_NUM           => array(0, )
110
-    );
111
-
112
-    /**
113
-     * Initialize the table attributes and columns
114
-     * Relations are not initialized by this method since they are lazy loaded
115
-     *
116
-     * @return void
117
-     * @throws PropelException
118
-     */
119
-    public function initialize()
120
-    {
121
-        // attributes
122
-        $this->setName('instance');
123
-        $this->setPhpName('Instance');
124
-        $this->setIdentifierQuoting(false);
125
-        $this->setClassName('\\Jalle19\\StatusManager\\Database\\Instance');
126
-        $this->setPackage('Jalle19.StatusManager.Database');
127
-        $this->setUseIdGenerator(false);
128
-        // columns
129
-        $this->addPrimaryKey('name', 'Name', 'VARCHAR', true, 255, null);
130
-    } // initialize()
131
-
132
-    /**
133
-     * Build the RelationMap objects for this table relationships
134
-     */
135
-    public function buildRelations()
136
-    {
137
-        $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::ONE_TO_MANY, array (
31
+	use InstancePoolTrait;
32
+	use TableMapTrait;
33
+
34
+	/**
35
+	 * The (dot-path) name of this class
36
+	 */
37
+	const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.InstanceTableMap';
38
+
39
+	/**
40
+	 * The default database name for this class
41
+	 */
42
+	const DATABASE_NAME = 'tvheadend_status_manager';
43
+
44
+	/**
45
+	 * The table name for this class
46
+	 */
47
+	const TABLE_NAME = 'instance';
48
+
49
+	/**
50
+	 * The related Propel class for this table
51
+	 */
52
+	const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Instance';
53
+
54
+	/**
55
+	 * A class that can be returned by this tableMap
56
+	 */
57
+	const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Instance';
58
+
59
+	/**
60
+	 * The total number of columns
61
+	 */
62
+	const NUM_COLUMNS = 1;
63
+
64
+	/**
65
+	 * The number of lazy-loaded columns
66
+	 */
67
+	const NUM_LAZY_LOAD_COLUMNS = 0;
68
+
69
+	/**
70
+	 * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
71
+	 */
72
+	const NUM_HYDRATE_COLUMNS = 1;
73
+
74
+	/**
75
+	 * the column name for the name field
76
+	 */
77
+	const COL_NAME = 'instance.name';
78
+
79
+	/**
80
+	 * The default string format for model objects of the related table
81
+	 */
82
+	const DEFAULT_STRING_FORMAT = 'YAML';
83
+
84
+	/**
85
+	 * holds an array of fieldnames
86
+	 *
87
+	 * first dimension keys are the type constants
88
+	 * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
89
+	 */
90
+	protected static $fieldNames = array (
91
+		self::TYPE_PHPNAME       => array('Name', ),
92
+		self::TYPE_CAMELNAME     => array('name', ),
93
+		self::TYPE_COLNAME       => array(InstanceTableMap::COL_NAME, ),
94
+		self::TYPE_FIELDNAME     => array('name', ),
95
+		self::TYPE_NUM           => array(0, )
96
+	);
97
+
98
+	/**
99
+	 * holds an array of keys for quick access to the fieldnames array
100
+	 *
101
+	 * first dimension keys are the type constants
102
+	 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
103
+	 */
104
+	protected static $fieldKeys = array (
105
+		self::TYPE_PHPNAME       => array('Name' => 0, ),
106
+		self::TYPE_CAMELNAME     => array('name' => 0, ),
107
+		self::TYPE_COLNAME       => array(InstanceTableMap::COL_NAME => 0, ),
108
+		self::TYPE_FIELDNAME     => array('name' => 0, ),
109
+		self::TYPE_NUM           => array(0, )
110
+	);
111
+
112
+	/**
113
+	 * Initialize the table attributes and columns
114
+	 * Relations are not initialized by this method since they are lazy loaded
115
+	 *
116
+	 * @return void
117
+	 * @throws PropelException
118
+	 */
119
+	public function initialize()
120
+	{
121
+		// attributes
122
+		$this->setName('instance');
123
+		$this->setPhpName('Instance');
124
+		$this->setIdentifierQuoting(false);
125
+		$this->setClassName('\\Jalle19\\StatusManager\\Database\\Instance');
126
+		$this->setPackage('Jalle19.StatusManager.Database');
127
+		$this->setUseIdGenerator(false);
128
+		// columns
129
+		$this->addPrimaryKey('name', 'Name', 'VARCHAR', true, 255, null);
130
+	} // initialize()
131
+
132
+	/**
133
+	 * Build the RelationMap objects for this table relationships
134
+	 */
135
+	public function buildRelations()
136
+	{
137
+		$this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::ONE_TO_MANY, array (
138 138
   0 =>
139 139
   array (
140
-    0 => ':instance_name',
141
-    1 => ':name',
140
+	0 => ':instance_name',
141
+	1 => ':name',
142 142
   ),
143 143
 ), null, null, 'Users', false);
144
-        $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array (
144
+		$this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array (
145 145
   0 =>
146 146
   array (
147
-    0 => ':instance_name',
148
-    1 => ':name',
147
+	0 => ':instance_name',
148
+	1 => ':name',
149 149
   ),
150 150
 ), null, null, 'Connections', false);
151
-        $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::ONE_TO_MANY, array (
151
+		$this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::ONE_TO_MANY, array (
152 152
   0 =>
153 153
   array (
154
-    0 => ':instance_name',
155
-    1 => ':name',
154
+	0 => ':instance_name',
155
+	1 => ':name',
156 156
   ),
157 157
 ), null, null, 'Channels', false);
158
-        $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array (
158
+		$this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array (
159 159
   0 =>
160 160
   array (
161
-    0 => ':instance_name',
162
-    1 => ':name',
161
+	0 => ':instance_name',
162
+	1 => ':name',
163 163
   ),
164 164
 ), null, null, 'Subscriptions', false);
165
-    } // buildRelations()
166
-
167
-    /**
168
-     * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
169
-     *
170
-     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
171
-     * a multi-column primary key, a serialize()d version of the primary key will be returned.
172
-     *
173
-     * @param array  $row       resultset row.
174
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
175
-     * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
176
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
177
-     *
178
-     * @return string The primary key hash of the row
179
-     */
180
-    public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
181
-    {
182
-        // If the PK cannot be derived from the row, return NULL.
183
-        if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)] === null) {
184
-            return null;
185
-        }
186
-
187
-        return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
188
-    }
189
-
190
-    /**
191
-     * Retrieves the primary key from the DB resultset row
192
-     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
193
-     * a multi-column primary key, an array of the primary key columns will be returned.
194
-     *
195
-     * @param array  $row       resultset row.
196
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
197
-     * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
198
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
199
-     *
200
-     * @return mixed The primary key of the row
201
-     */
202
-    public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
203
-    {
204
-        return (string) $row[
205
-            $indexType == TableMap::TYPE_NUM
206
-                ? 0 + $offset
207
-                : self::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)
208
-        ];
209
-    }
210
-
211
-    /**
212
-     * The class that the tableMap will make instances of.
213
-     *
214
-     * If $withPrefix is true, the returned path
215
-     * uses a dot-path notation which is translated into a path
216
-     * relative to a location on the PHP include_path.
217
-     * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
218
-     *
219
-     * @param boolean $withPrefix Whether or not to return the path with the class name
220
-     * @return string path.to.ClassName
221
-     */
222
-    public static function getOMClass($withPrefix = true)
223
-    {
224
-        return $withPrefix ? InstanceTableMap::CLASS_DEFAULT : InstanceTableMap::OM_CLASS;
225
-    }
226
-
227
-    /**
228
-     * Populates an object of the default type or an object that inherit from the default.
229
-     *
230
-     * @param array  $row       row returned by DataFetcher->fetch().
231
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
232
-     * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
165
+	} // buildRelations()
166
+
167
+	/**
168
+	 * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
169
+	 *
170
+	 * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
171
+	 * a multi-column primary key, a serialize()d version of the primary key will be returned.
172
+	 *
173
+	 * @param array  $row       resultset row.
174
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
175
+	 * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
176
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
177
+	 *
178
+	 * @return string The primary key hash of the row
179
+	 */
180
+	public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
181
+	{
182
+		// If the PK cannot be derived from the row, return NULL.
183
+		if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)] === null) {
184
+			return null;
185
+		}
186
+
187
+		return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)];
188
+	}
189
+
190
+	/**
191
+	 * Retrieves the primary key from the DB resultset row
192
+	 * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
193
+	 * a multi-column primary key, an array of the primary key columns will be returned.
194
+	 *
195
+	 * @param array  $row       resultset row.
196
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
197
+	 * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
198
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
199
+	 *
200
+	 * @return mixed The primary key of the row
201
+	 */
202
+	public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
203
+	{
204
+		return (string) $row[
205
+			$indexType == TableMap::TYPE_NUM
206
+				? 0 + $offset
207
+				: self::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)
208
+		];
209
+	}
210
+
211
+	/**
212
+	 * The class that the tableMap will make instances of.
213
+	 *
214
+	 * If $withPrefix is true, the returned path
215
+	 * uses a dot-path notation which is translated into a path
216
+	 * relative to a location on the PHP include_path.
217
+	 * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
218
+	 *
219
+	 * @param boolean $withPrefix Whether or not to return the path with the class name
220
+	 * @return string path.to.ClassName
221
+	 */
222
+	public static function getOMClass($withPrefix = true)
223
+	{
224
+		return $withPrefix ? InstanceTableMap::CLASS_DEFAULT : InstanceTableMap::OM_CLASS;
225
+	}
226
+
227
+	/**
228
+	 * Populates an object of the default type or an object that inherit from the default.
229
+	 *
230
+	 * @param array  $row       row returned by DataFetcher->fetch().
231
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
232
+	 * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
233 233
                                  One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
234
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
235
-     *
236
-     * @throws PropelException Any exceptions caught during processing will be
237
-     *                         rethrown wrapped into a PropelException.
238
-     * @return array           (Instance object, last column rank)
239
-     */
240
-    public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
241
-    {
242
-        $key = InstanceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
243
-        if (null !== ($obj = InstanceTableMap::getInstanceFromPool($key))) {
244
-            // We no longer rehydrate the object, since this can cause data loss.
245
-            // See http://www.propelorm.org/ticket/509
246
-            // $obj->hydrate($row, $offset, true); // rehydrate
247
-            $col = $offset + InstanceTableMap::NUM_HYDRATE_COLUMNS;
248
-        } else {
249
-            $cls = InstanceTableMap::OM_CLASS;
250
-            /** @var Instance $obj */
251
-            $obj = new $cls();
252
-            $col = $obj->hydrate($row, $offset, false, $indexType);
253
-            InstanceTableMap::addInstanceToPool($obj, $key);
254
-        }
255
-
256
-        return array($obj, $col);
257
-    }
258
-
259
-    /**
260
-     * The returned array will contain objects of the default type or
261
-     * objects that inherit from the default.
262
-     *
263
-     * @param DataFetcherInterface $dataFetcher
264
-     * @return array
265
-     * @throws PropelException Any exceptions caught during processing will be
266
-     *                         rethrown wrapped into a PropelException.
267
-     */
268
-    public static function populateObjects(DataFetcherInterface $dataFetcher)
269
-    {
270
-        $results = array();
271
-
272
-        // set the class once to avoid overhead in the loop
273
-        $cls = static::getOMClass(false);
274
-        // populate the object(s)
275
-        while ($row = $dataFetcher->fetch()) {
276
-            $key = InstanceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
277
-            if (null !== ($obj = InstanceTableMap::getInstanceFromPool($key))) {
278
-                // We no longer rehydrate the object, since this can cause data loss.
279
-                // See http://www.propelorm.org/ticket/509
280
-                // $obj->hydrate($row, 0, true); // rehydrate
281
-                $results[] = $obj;
282
-            } else {
283
-                /** @var Instance $obj */
284
-                $obj = new $cls();
285
-                $obj->hydrate($row);
286
-                $results[] = $obj;
287
-                InstanceTableMap::addInstanceToPool($obj, $key);
288
-            } // if key exists
289
-        }
290
-
291
-        return $results;
292
-    }
293
-    /**
294
-     * Add all the columns needed to create a new object.
295
-     *
296
-     * Note: any columns that were marked with lazyLoad="true" in the
297
-     * XML schema will not be added to the select list and only loaded
298
-     * on demand.
299
-     *
300
-     * @param Criteria $criteria object containing the columns to add.
301
-     * @param string   $alias    optional table alias
302
-     * @throws PropelException Any exceptions caught during processing will be
303
-     *                         rethrown wrapped into a PropelException.
304
-     */
305
-    public static function addSelectColumns(Criteria $criteria, $alias = null)
306
-    {
307
-        if (null === $alias) {
308
-            $criteria->addSelectColumn(InstanceTableMap::COL_NAME);
309
-        } else {
310
-            $criteria->addSelectColumn($alias . '.name');
311
-        }
312
-    }
313
-
314
-    /**
315
-     * Returns the TableMap related to this object.
316
-     * This method is not needed for general use but a specific application could have a need.
317
-     * @return TableMap
318
-     * @throws PropelException Any exceptions caught during processing will be
319
-     *                         rethrown wrapped into a PropelException.
320
-     */
321
-    public static function getTableMap()
322
-    {
323
-        return Propel::getServiceContainer()->getDatabaseMap(InstanceTableMap::DATABASE_NAME)->getTable(InstanceTableMap::TABLE_NAME);
324
-    }
325
-
326
-    /**
327
-     * Add a TableMap instance to the database for this tableMap class.
328
-     */
329
-    public static function buildTableMap()
330
-    {
331
-        $dbMap = Propel::getServiceContainer()->getDatabaseMap(InstanceTableMap::DATABASE_NAME);
332
-        if (!$dbMap->hasTable(InstanceTableMap::TABLE_NAME)) {
333
-            $dbMap->addTableObject(new InstanceTableMap());
334
-        }
335
-    }
336
-
337
-    /**
338
-     * Performs a DELETE on the database, given a Instance or Criteria object OR a primary key value.
339
-     *
340
-     * @param mixed               $values Criteria or Instance object or primary key or array of primary keys
341
-     *              which is used to create the DELETE statement
342
-     * @param  ConnectionInterface $con the connection to use
343
-     * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
344
-     *                         if supported by native driver or if emulated using Propel.
345
-     * @throws PropelException Any exceptions caught during processing will be
346
-     *                         rethrown wrapped into a PropelException.
347
-     */
348
-     public static function doDelete($values, ConnectionInterface $con = null)
349
-     {
350
-        if (null === $con) {
351
-            $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
352
-        }
353
-
354
-        if ($values instanceof Criteria) {
355
-            // rename for clarity
356
-            $criteria = $values;
357
-        } elseif ($values instanceof \Jalle19\StatusManager\Database\Instance) { // it's a model object
358
-            // create criteria based on pk values
359
-            $criteria = $values->buildPkeyCriteria();
360
-        } else { // it's a primary key, or an array of pks
361
-            $criteria = new Criteria(InstanceTableMap::DATABASE_NAME);
362
-            $criteria->add(InstanceTableMap::COL_NAME, (array) $values, Criteria::IN);
363
-        }
364
-
365
-        $query = InstanceQuery::create()->mergeWith($criteria);
366
-
367
-        if ($values instanceof Criteria) {
368
-            InstanceTableMap::clearInstancePool();
369
-        } elseif (!is_object($values)) { // it's a primary key, or an array of pks
370
-            foreach ((array) $values as $singleval) {
371
-                InstanceTableMap::removeInstanceFromPool($singleval);
372
-            }
373
-        }
374
-
375
-        return $query->delete($con);
376
-    }
377
-
378
-    /**
379
-     * Deletes all rows from the instance table.
380
-     *
381
-     * @param ConnectionInterface $con the connection to use
382
-     * @return int The number of affected rows (if supported by underlying database driver).
383
-     */
384
-    public static function doDeleteAll(ConnectionInterface $con = null)
385
-    {
386
-        return InstanceQuery::create()->doDeleteAll($con);
387
-    }
388
-
389
-    /**
390
-     * Performs an INSERT on the database, given a Instance or Criteria object.
391
-     *
392
-     * @param mixed               $criteria Criteria or Instance object containing data that is used to create the INSERT statement.
393
-     * @param ConnectionInterface $con the ConnectionInterface connection to use
394
-     * @return mixed           The new primary key.
395
-     * @throws PropelException Any exceptions caught during processing will be
396
-     *                         rethrown wrapped into a PropelException.
397
-     */
398
-    public static function doInsert($criteria, ConnectionInterface $con = null)
399
-    {
400
-        if (null === $con) {
401
-            $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
402
-        }
403
-
404
-        if ($criteria instanceof Criteria) {
405
-            $criteria = clone $criteria; // rename for clarity
406
-        } else {
407
-            $criteria = $criteria->buildCriteria(); // build Criteria from Instance object
408
-        }
409
-
410
-
411
-        // Set the correct dbName
412
-        $query = InstanceQuery::create()->mergeWith($criteria);
413
-
414
-        // use transaction because $criteria could contain info
415
-        // for more than one table (I guess, conceivably)
416
-        return $con->transaction(function () use ($con, $query) {
417
-            return $query->doInsert($con);
418
-        });
419
-    }
234
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
235
+	 *
236
+	 * @throws PropelException Any exceptions caught during processing will be
237
+	 *                         rethrown wrapped into a PropelException.
238
+	 * @return array           (Instance object, last column rank)
239
+	 */
240
+	public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
241
+	{
242
+		$key = InstanceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
243
+		if (null !== ($obj = InstanceTableMap::getInstanceFromPool($key))) {
244
+			// We no longer rehydrate the object, since this can cause data loss.
245
+			// See http://www.propelorm.org/ticket/509
246
+			// $obj->hydrate($row, $offset, true); // rehydrate
247
+			$col = $offset + InstanceTableMap::NUM_HYDRATE_COLUMNS;
248
+		} else {
249
+			$cls = InstanceTableMap::OM_CLASS;
250
+			/** @var Instance $obj */
251
+			$obj = new $cls();
252
+			$col = $obj->hydrate($row, $offset, false, $indexType);
253
+			InstanceTableMap::addInstanceToPool($obj, $key);
254
+		}
255
+
256
+		return array($obj, $col);
257
+	}
258
+
259
+	/**
260
+	 * The returned array will contain objects of the default type or
261
+	 * objects that inherit from the default.
262
+	 *
263
+	 * @param DataFetcherInterface $dataFetcher
264
+	 * @return array
265
+	 * @throws PropelException Any exceptions caught during processing will be
266
+	 *                         rethrown wrapped into a PropelException.
267
+	 */
268
+	public static function populateObjects(DataFetcherInterface $dataFetcher)
269
+	{
270
+		$results = array();
271
+
272
+		// set the class once to avoid overhead in the loop
273
+		$cls = static::getOMClass(false);
274
+		// populate the object(s)
275
+		while ($row = $dataFetcher->fetch()) {
276
+			$key = InstanceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
277
+			if (null !== ($obj = InstanceTableMap::getInstanceFromPool($key))) {
278
+				// We no longer rehydrate the object, since this can cause data loss.
279
+				// See http://www.propelorm.org/ticket/509
280
+				// $obj->hydrate($row, 0, true); // rehydrate
281
+				$results[] = $obj;
282
+			} else {
283
+				/** @var Instance $obj */
284
+				$obj = new $cls();
285
+				$obj->hydrate($row);
286
+				$results[] = $obj;
287
+				InstanceTableMap::addInstanceToPool($obj, $key);
288
+			} // if key exists
289
+		}
290
+
291
+		return $results;
292
+	}
293
+	/**
294
+	 * Add all the columns needed to create a new object.
295
+	 *
296
+	 * Note: any columns that were marked with lazyLoad="true" in the
297
+	 * XML schema will not be added to the select list and only loaded
298
+	 * on demand.
299
+	 *
300
+	 * @param Criteria $criteria object containing the columns to add.
301
+	 * @param string   $alias    optional table alias
302
+	 * @throws PropelException Any exceptions caught during processing will be
303
+	 *                         rethrown wrapped into a PropelException.
304
+	 */
305
+	public static function addSelectColumns(Criteria $criteria, $alias = null)
306
+	{
307
+		if (null === $alias) {
308
+			$criteria->addSelectColumn(InstanceTableMap::COL_NAME);
309
+		} else {
310
+			$criteria->addSelectColumn($alias . '.name');
311
+		}
312
+	}
313
+
314
+	/**
315
+	 * Returns the TableMap related to this object.
316
+	 * This method is not needed for general use but a specific application could have a need.
317
+	 * @return TableMap
318
+	 * @throws PropelException Any exceptions caught during processing will be
319
+	 *                         rethrown wrapped into a PropelException.
320
+	 */
321
+	public static function getTableMap()
322
+	{
323
+		return Propel::getServiceContainer()->getDatabaseMap(InstanceTableMap::DATABASE_NAME)->getTable(InstanceTableMap::TABLE_NAME);
324
+	}
325
+
326
+	/**
327
+	 * Add a TableMap instance to the database for this tableMap class.
328
+	 */
329
+	public static function buildTableMap()
330
+	{
331
+		$dbMap = Propel::getServiceContainer()->getDatabaseMap(InstanceTableMap::DATABASE_NAME);
332
+		if (!$dbMap->hasTable(InstanceTableMap::TABLE_NAME)) {
333
+			$dbMap->addTableObject(new InstanceTableMap());
334
+		}
335
+	}
336
+
337
+	/**
338
+	 * Performs a DELETE on the database, given a Instance or Criteria object OR a primary key value.
339
+	 *
340
+	 * @param mixed               $values Criteria or Instance object or primary key or array of primary keys
341
+	 *              which is used to create the DELETE statement
342
+	 * @param  ConnectionInterface $con the connection to use
343
+	 * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
344
+	 *                         if supported by native driver or if emulated using Propel.
345
+	 * @throws PropelException Any exceptions caught during processing will be
346
+	 *                         rethrown wrapped into a PropelException.
347
+	 */
348
+	 public static function doDelete($values, ConnectionInterface $con = null)
349
+	 {
350
+		if (null === $con) {
351
+			$con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
352
+		}
353
+
354
+		if ($values instanceof Criteria) {
355
+			// rename for clarity
356
+			$criteria = $values;
357
+		} elseif ($values instanceof \Jalle19\StatusManager\Database\Instance) { // it's a model object
358
+			// create criteria based on pk values
359
+			$criteria = $values->buildPkeyCriteria();
360
+		} else { // it's a primary key, or an array of pks
361
+			$criteria = new Criteria(InstanceTableMap::DATABASE_NAME);
362
+			$criteria->add(InstanceTableMap::COL_NAME, (array) $values, Criteria::IN);
363
+		}
364
+
365
+		$query = InstanceQuery::create()->mergeWith($criteria);
366
+
367
+		if ($values instanceof Criteria) {
368
+			InstanceTableMap::clearInstancePool();
369
+		} elseif (!is_object($values)) { // it's a primary key, or an array of pks
370
+			foreach ((array) $values as $singleval) {
371
+				InstanceTableMap::removeInstanceFromPool($singleval);
372
+			}
373
+		}
374
+
375
+		return $query->delete($con);
376
+	}
377
+
378
+	/**
379
+	 * Deletes all rows from the instance table.
380
+	 *
381
+	 * @param ConnectionInterface $con the connection to use
382
+	 * @return int The number of affected rows (if supported by underlying database driver).
383
+	 */
384
+	public static function doDeleteAll(ConnectionInterface $con = null)
385
+	{
386
+		return InstanceQuery::create()->doDeleteAll($con);
387
+	}
388
+
389
+	/**
390
+	 * Performs an INSERT on the database, given a Instance or Criteria object.
391
+	 *
392
+	 * @param mixed               $criteria Criteria or Instance object containing data that is used to create the INSERT statement.
393
+	 * @param ConnectionInterface $con the ConnectionInterface connection to use
394
+	 * @return mixed           The new primary key.
395
+	 * @throws PropelException Any exceptions caught during processing will be
396
+	 *                         rethrown wrapped into a PropelException.
397
+	 */
398
+	public static function doInsert($criteria, ConnectionInterface $con = null)
399
+	{
400
+		if (null === $con) {
401
+			$con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME);
402
+		}
403
+
404
+		if ($criteria instanceof Criteria) {
405
+			$criteria = clone $criteria; // rename for clarity
406
+		} else {
407
+			$criteria = $criteria->buildCriteria(); // build Criteria from Instance object
408
+		}
409
+
410
+
411
+		// Set the correct dbName
412
+		$query = InstanceQuery::create()->mergeWith($criteria);
413
+
414
+		// use transaction because $criteria could contain info
415
+		// for more than one table (I guess, conceivably)
416
+		return $con->transaction(function () use ($con, $query) {
417
+			return $query->doInsert($con);
418
+		});
419
+	}
420 420
 
421 421
 } // InstanceTableMap
422 422
 // This is the static code needed to register the TableMap for this table with the main Propel class.
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
      * first dimension keys are the type constants
88 88
      * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
89 89
      */
90
-    protected static $fieldNames = array (
91
-        self::TYPE_PHPNAME       => array('Name', ),
92
-        self::TYPE_CAMELNAME     => array('name', ),
93
-        self::TYPE_COLNAME       => array(InstanceTableMap::COL_NAME, ),
94
-        self::TYPE_FIELDNAME     => array('name', ),
95
-        self::TYPE_NUM           => array(0, )
90
+    protected static $fieldNames = array(
91
+        self::TYPE_PHPNAME       => array('Name',),
92
+        self::TYPE_CAMELNAME     => array('name',),
93
+        self::TYPE_COLNAME       => array(InstanceTableMap::COL_NAME,),
94
+        self::TYPE_FIELDNAME     => array('name',),
95
+        self::TYPE_NUM           => array(0,)
96 96
     );
97 97
 
98 98
     /**
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
      * first dimension keys are the type constants
102 102
      * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
103 103
      */
104
-    protected static $fieldKeys = array (
105
-        self::TYPE_PHPNAME       => array('Name' => 0, ),
106
-        self::TYPE_CAMELNAME     => array('name' => 0, ),
107
-        self::TYPE_COLNAME       => array(InstanceTableMap::COL_NAME => 0, ),
108
-        self::TYPE_FIELDNAME     => array('name' => 0, ),
109
-        self::TYPE_NUM           => array(0, )
104
+    protected static $fieldKeys = array(
105
+        self::TYPE_PHPNAME       => array('Name' => 0,),
106
+        self::TYPE_CAMELNAME     => array('name' => 0,),
107
+        self::TYPE_COLNAME       => array(InstanceTableMap::COL_NAME => 0,),
108
+        self::TYPE_FIELDNAME     => array('name' => 0,),
109
+        self::TYPE_NUM           => array(0,)
110 110
     );
111 111
 
112 112
     /**
@@ -134,30 +134,30 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function buildRelations()
136 136
     {
137
-        $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::ONE_TO_MANY, array (
137
+        $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::ONE_TO_MANY, array(
138 138
   0 =>
139
-  array (
139
+  array(
140 140
     0 => ':instance_name',
141 141
     1 => ':name',
142 142
   ),
143 143
 ), null, null, 'Users', false);
144
-        $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array (
144
+        $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array(
145 145
   0 =>
146
-  array (
146
+  array(
147 147
     0 => ':instance_name',
148 148
     1 => ':name',
149 149
   ),
150 150
 ), null, null, 'Connections', false);
151
-        $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::ONE_TO_MANY, array (
151
+        $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::ONE_TO_MANY, array(
152 152
   0 =>
153
-  array (
153
+  array(
154 154
     0 => ':instance_name',
155 155
     1 => ':name',
156 156
   ),
157 157
 ), null, null, 'Channels', false);
158
-        $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array (
158
+        $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array(
159 159
   0 =>
160
-  array (
160
+  array(
161 161
     0 => ':instance_name',
162 162
     1 => ':name',
163 163
   ),
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
         // use transaction because $criteria could contain info
415 415
         // for more than one table (I guess, conceivably)
416
-        return $con->transaction(function () use ($con, $query) {
416
+        return $con->transaction(function() use ($con, $query) {
417 417
             return $query->doInsert($con);
418 418
         });
419 419
     }
Please login to merge, or discard this patch.
src/cli/Jalle19/StatusManager/Database/Map/SubscriptionTableMap.php 2 patches
Indentation   +437 added lines, -437 removed lines patch added patch discarded remove patch
@@ -28,456 +28,456 @@
 block discarded – undo
28 28
  */
29 29
 class SubscriptionTableMap extends TableMap
30 30
 {
31
-    use InstancePoolTrait;
32
-    use TableMapTrait;
33
-
34
-    /**
35
-     * The (dot-path) name of this class
36
-     */
37
-    const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.SubscriptionTableMap';
38
-
39
-    /**
40
-     * The default database name for this class
41
-     */
42
-    const DATABASE_NAME = 'tvheadend_status_manager';
43
-
44
-    /**
45
-     * The table name for this class
46
-     */
47
-    const TABLE_NAME = 'subscription';
48
-
49
-    /**
50
-     * The related Propel class for this table
51
-     */
52
-    const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Subscription';
53
-
54
-    /**
55
-     * A class that can be returned by this tableMap
56
-     */
57
-    const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Subscription';
58
-
59
-    /**
60
-     * The total number of columns
61
-     */
62
-    const NUM_COLUMNS = 9;
63
-
64
-    /**
65
-     * The number of lazy-loaded columns
66
-     */
67
-    const NUM_LAZY_LOAD_COLUMNS = 0;
68
-
69
-    /**
70
-     * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
71
-     */
72
-    const NUM_HYDRATE_COLUMNS = 9;
73
-
74
-    /**
75
-     * the column name for the id field
76
-     */
77
-    const COL_ID = 'subscription.id';
78
-
79
-    /**
80
-     * the column name for the instance_name field
81
-     */
82
-    const COL_INSTANCE_NAME = 'subscription.instance_name';
83
-
84
-    /**
85
-     * the column name for the user_id field
86
-     */
87
-    const COL_USER_ID = 'subscription.user_id';
88
-
89
-    /**
90
-     * the column name for the channel_id field
91
-     */
92
-    const COL_CHANNEL_ID = 'subscription.channel_id';
93
-
94
-    /**
95
-     * the column name for the subscription_id field
96
-     */
97
-    const COL_SUBSCRIPTION_ID = 'subscription.subscription_id';
98
-
99
-    /**
100
-     * the column name for the started field
101
-     */
102
-    const COL_STARTED = 'subscription.started';
103
-
104
-    /**
105
-     * the column name for the stopped field
106
-     */
107
-    const COL_STOPPED = 'subscription.stopped';
108
-
109
-    /**
110
-     * the column name for the title field
111
-     */
112
-    const COL_TITLE = 'subscription.title';
113
-
114
-    /**
115
-     * the column name for the service field
116
-     */
117
-    const COL_SERVICE = 'subscription.service';
118
-
119
-    /**
120
-     * The default string format for model objects of the related table
121
-     */
122
-    const DEFAULT_STRING_FORMAT = 'YAML';
123
-
124
-    /**
125
-     * holds an array of fieldnames
126
-     *
127
-     * first dimension keys are the type constants
128
-     * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
129
-     */
130
-    protected static $fieldNames = array (
131
-        self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'UserId', 'ChannelId', 'SubscriptionId', 'Started', 'Stopped', 'Title', 'Service', ),
132
-        self::TYPE_CAMELNAME     => array('id', 'instanceName', 'userId', 'channelId', 'subscriptionId', 'started', 'stopped', 'title', 'service', ),
133
-        self::TYPE_COLNAME       => array(SubscriptionTableMap::COL_ID, SubscriptionTableMap::COL_INSTANCE_NAME, SubscriptionTableMap::COL_USER_ID, SubscriptionTableMap::COL_CHANNEL_ID, SubscriptionTableMap::COL_SUBSCRIPTION_ID, SubscriptionTableMap::COL_STARTED, SubscriptionTableMap::COL_STOPPED, SubscriptionTableMap::COL_TITLE, SubscriptionTableMap::COL_SERVICE, ),
134
-        self::TYPE_FIELDNAME     => array('id', 'instance_name', 'user_id', 'channel_id', 'subscription_id', 'started', 'stopped', 'title', 'service', ),
135
-        self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
136
-    );
137
-
138
-    /**
139
-     * holds an array of keys for quick access to the fieldnames array
140
-     *
141
-     * first dimension keys are the type constants
142
-     * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
143
-     */
144
-    protected static $fieldKeys = array (
145
-        self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'UserId' => 2, 'ChannelId' => 3, 'SubscriptionId' => 4, 'Started' => 5, 'Stopped' => 6, 'Title' => 7, 'Service' => 8, ),
146
-        self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'userId' => 2, 'channelId' => 3, 'subscriptionId' => 4, 'started' => 5, 'stopped' => 6, 'title' => 7, 'service' => 8, ),
147
-        self::TYPE_COLNAME       => array(SubscriptionTableMap::COL_ID => 0, SubscriptionTableMap::COL_INSTANCE_NAME => 1, SubscriptionTableMap::COL_USER_ID => 2, SubscriptionTableMap::COL_CHANNEL_ID => 3, SubscriptionTableMap::COL_SUBSCRIPTION_ID => 4, SubscriptionTableMap::COL_STARTED => 5, SubscriptionTableMap::COL_STOPPED => 6, SubscriptionTableMap::COL_TITLE => 7, SubscriptionTableMap::COL_SERVICE => 8, ),
148
-        self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'user_id' => 2, 'channel_id' => 3, 'subscription_id' => 4, 'started' => 5, 'stopped' => 6, 'title' => 7, 'service' => 8, ),
149
-        self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
150
-    );
151
-
152
-    /**
153
-     * Initialize the table attributes and columns
154
-     * Relations are not initialized by this method since they are lazy loaded
155
-     *
156
-     * @return void
157
-     * @throws PropelException
158
-     */
159
-    public function initialize()
160
-    {
161
-        // attributes
162
-        $this->setName('subscription');
163
-        $this->setPhpName('Subscription');
164
-        $this->setIdentifierQuoting(false);
165
-        $this->setClassName('\\Jalle19\\StatusManager\\Database\\Subscription');
166
-        $this->setPackage('Jalle19.StatusManager.Database');
167
-        $this->setUseIdGenerator(true);
168
-        // columns
169
-        $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
170
-        $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null);
171
-        $this->addForeignKey('user_id', 'UserId', 'INTEGER', 'user', 'id', false, null, null);
172
-        $this->addForeignKey('channel_id', 'ChannelId', 'INTEGER', 'channel', 'id', true, null, null);
173
-        $this->addColumn('subscription_id', 'SubscriptionId', 'INTEGER', true, null, null);
174
-        $this->addColumn('started', 'Started', 'TIMESTAMP', true, null, null);
175
-        $this->addColumn('stopped', 'Stopped', 'TIMESTAMP', false, null, null);
176
-        $this->addColumn('title', 'Title', 'VARCHAR', true, 255, null);
177
-        $this->addColumn('service', 'Service', 'VARCHAR', true, 255, null);
178
-    } // initialize()
179
-
180
-    /**
181
-     * Build the RelationMap objects for this table relationships
182
-     */
183
-    public function buildRelations()
184
-    {
185
-        $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array (
31
+	use InstancePoolTrait;
32
+	use TableMapTrait;
33
+
34
+	/**
35
+	 * The (dot-path) name of this class
36
+	 */
37
+	const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.SubscriptionTableMap';
38
+
39
+	/**
40
+	 * The default database name for this class
41
+	 */
42
+	const DATABASE_NAME = 'tvheadend_status_manager';
43
+
44
+	/**
45
+	 * The table name for this class
46
+	 */
47
+	const TABLE_NAME = 'subscription';
48
+
49
+	/**
50
+	 * The related Propel class for this table
51
+	 */
52
+	const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Subscription';
53
+
54
+	/**
55
+	 * A class that can be returned by this tableMap
56
+	 */
57
+	const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Subscription';
58
+
59
+	/**
60
+	 * The total number of columns
61
+	 */
62
+	const NUM_COLUMNS = 9;
63
+
64
+	/**
65
+	 * The number of lazy-loaded columns
66
+	 */
67
+	const NUM_LAZY_LOAD_COLUMNS = 0;
68
+
69
+	/**
70
+	 * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
71
+	 */
72
+	const NUM_HYDRATE_COLUMNS = 9;
73
+
74
+	/**
75
+	 * the column name for the id field
76
+	 */
77
+	const COL_ID = 'subscription.id';
78
+
79
+	/**
80
+	 * the column name for the instance_name field
81
+	 */
82
+	const COL_INSTANCE_NAME = 'subscription.instance_name';
83
+
84
+	/**
85
+	 * the column name for the user_id field
86
+	 */
87
+	const COL_USER_ID = 'subscription.user_id';
88
+
89
+	/**
90
+	 * the column name for the channel_id field
91
+	 */
92
+	const COL_CHANNEL_ID = 'subscription.channel_id';
93
+
94
+	/**
95
+	 * the column name for the subscription_id field
96
+	 */
97
+	const COL_SUBSCRIPTION_ID = 'subscription.subscription_id';
98
+
99
+	/**
100
+	 * the column name for the started field
101
+	 */
102
+	const COL_STARTED = 'subscription.started';
103
+
104
+	/**
105
+	 * the column name for the stopped field
106
+	 */
107
+	const COL_STOPPED = 'subscription.stopped';
108
+
109
+	/**
110
+	 * the column name for the title field
111
+	 */
112
+	const COL_TITLE = 'subscription.title';
113
+
114
+	/**
115
+	 * the column name for the service field
116
+	 */
117
+	const COL_SERVICE = 'subscription.service';
118
+
119
+	/**
120
+	 * The default string format for model objects of the related table
121
+	 */
122
+	const DEFAULT_STRING_FORMAT = 'YAML';
123
+
124
+	/**
125
+	 * holds an array of fieldnames
126
+	 *
127
+	 * first dimension keys are the type constants
128
+	 * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
129
+	 */
130
+	protected static $fieldNames = array (
131
+		self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'UserId', 'ChannelId', 'SubscriptionId', 'Started', 'Stopped', 'Title', 'Service', ),
132
+		self::TYPE_CAMELNAME     => array('id', 'instanceName', 'userId', 'channelId', 'subscriptionId', 'started', 'stopped', 'title', 'service', ),
133
+		self::TYPE_COLNAME       => array(SubscriptionTableMap::COL_ID, SubscriptionTableMap::COL_INSTANCE_NAME, SubscriptionTableMap::COL_USER_ID, SubscriptionTableMap::COL_CHANNEL_ID, SubscriptionTableMap::COL_SUBSCRIPTION_ID, SubscriptionTableMap::COL_STARTED, SubscriptionTableMap::COL_STOPPED, SubscriptionTableMap::COL_TITLE, SubscriptionTableMap::COL_SERVICE, ),
134
+		self::TYPE_FIELDNAME     => array('id', 'instance_name', 'user_id', 'channel_id', 'subscription_id', 'started', 'stopped', 'title', 'service', ),
135
+		self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
136
+	);
137
+
138
+	/**
139
+	 * holds an array of keys for quick access to the fieldnames array
140
+	 *
141
+	 * first dimension keys are the type constants
142
+	 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
143
+	 */
144
+	protected static $fieldKeys = array (
145
+		self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'UserId' => 2, 'ChannelId' => 3, 'SubscriptionId' => 4, 'Started' => 5, 'Stopped' => 6, 'Title' => 7, 'Service' => 8, ),
146
+		self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'userId' => 2, 'channelId' => 3, 'subscriptionId' => 4, 'started' => 5, 'stopped' => 6, 'title' => 7, 'service' => 8, ),
147
+		self::TYPE_COLNAME       => array(SubscriptionTableMap::COL_ID => 0, SubscriptionTableMap::COL_INSTANCE_NAME => 1, SubscriptionTableMap::COL_USER_ID => 2, SubscriptionTableMap::COL_CHANNEL_ID => 3, SubscriptionTableMap::COL_SUBSCRIPTION_ID => 4, SubscriptionTableMap::COL_STARTED => 5, SubscriptionTableMap::COL_STOPPED => 6, SubscriptionTableMap::COL_TITLE => 7, SubscriptionTableMap::COL_SERVICE => 8, ),
148
+		self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'user_id' => 2, 'channel_id' => 3, 'subscription_id' => 4, 'started' => 5, 'stopped' => 6, 'title' => 7, 'service' => 8, ),
149
+		self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
150
+	);
151
+
152
+	/**
153
+	 * Initialize the table attributes and columns
154
+	 * Relations are not initialized by this method since they are lazy loaded
155
+	 *
156
+	 * @return void
157
+	 * @throws PropelException
158
+	 */
159
+	public function initialize()
160
+	{
161
+		// attributes
162
+		$this->setName('subscription');
163
+		$this->setPhpName('Subscription');
164
+		$this->setIdentifierQuoting(false);
165
+		$this->setClassName('\\Jalle19\\StatusManager\\Database\\Subscription');
166
+		$this->setPackage('Jalle19.StatusManager.Database');
167
+		$this->setUseIdGenerator(true);
168
+		// columns
169
+		$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
170
+		$this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null);
171
+		$this->addForeignKey('user_id', 'UserId', 'INTEGER', 'user', 'id', false, null, null);
172
+		$this->addForeignKey('channel_id', 'ChannelId', 'INTEGER', 'channel', 'id', true, null, null);
173
+		$this->addColumn('subscription_id', 'SubscriptionId', 'INTEGER', true, null, null);
174
+		$this->addColumn('started', 'Started', 'TIMESTAMP', true, null, null);
175
+		$this->addColumn('stopped', 'Stopped', 'TIMESTAMP', false, null, null);
176
+		$this->addColumn('title', 'Title', 'VARCHAR', true, 255, null);
177
+		$this->addColumn('service', 'Service', 'VARCHAR', true, 255, null);
178
+	} // initialize()
179
+
180
+	/**
181
+	 * Build the RelationMap objects for this table relationships
182
+	 */
183
+	public function buildRelations()
184
+	{
185
+		$this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array (
186 186
   0 =>
187 187
   array (
188
-    0 => ':instance_name',
189
-    1 => ':name',
188
+	0 => ':instance_name',
189
+	1 => ':name',
190 190
   ),
191 191
 ), null, null, null, false);
192
-        $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array (
192
+		$this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array (
193 193
   0 =>
194 194
   array (
195
-    0 => ':user_id',
196
-    1 => ':id',
195
+	0 => ':user_id',
196
+	1 => ':id',
197 197
   ),
198 198
 ), null, null, null, false);
199
-        $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::MANY_TO_ONE, array (
199
+		$this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::MANY_TO_ONE, array (
200 200
   0 =>
201 201
   array (
202
-    0 => ':channel_id',
203
-    1 => ':id',
202
+	0 => ':channel_id',
203
+	1 => ':id',
204 204
   ),
205 205
 ), null, null, null, false);
206
-    } // buildRelations()
207
-
208
-    /**
209
-     * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
210
-     *
211
-     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
212
-     * a multi-column primary key, a serialize()d version of the primary key will be returned.
213
-     *
214
-     * @param array  $row       resultset row.
215
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
216
-     * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
217
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
218
-     *
219
-     * @return string The primary key hash of the row
220
-     */
221
-    public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
222
-    {
223
-        // If the PK cannot be derived from the row, return NULL.
224
-        if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
225
-            return null;
226
-        }
227
-
228
-        return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
229
-    }
230
-
231
-    /**
232
-     * Retrieves the primary key from the DB resultset row
233
-     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
234
-     * a multi-column primary key, an array of the primary key columns will be returned.
235
-     *
236
-     * @param array  $row       resultset row.
237
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
238
-     * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
239
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
240
-     *
241
-     * @return mixed The primary key of the row
242
-     */
243
-    public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
244
-    {
245
-        return (int) $row[
246
-            $indexType == TableMap::TYPE_NUM
247
-                ? 0 + $offset
248
-                : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
249
-        ];
250
-    }
251
-
252
-    /**
253
-     * The class that the tableMap will make instances of.
254
-     *
255
-     * If $withPrefix is true, the returned path
256
-     * uses a dot-path notation which is translated into a path
257
-     * relative to a location on the PHP include_path.
258
-     * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
259
-     *
260
-     * @param boolean $withPrefix Whether or not to return the path with the class name
261
-     * @return string path.to.ClassName
262
-     */
263
-    public static function getOMClass($withPrefix = true)
264
-    {
265
-        return $withPrefix ? SubscriptionTableMap::CLASS_DEFAULT : SubscriptionTableMap::OM_CLASS;
266
-    }
267
-
268
-    /**
269
-     * Populates an object of the default type or an object that inherit from the default.
270
-     *
271
-     * @param array  $row       row returned by DataFetcher->fetch().
272
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
273
-     * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
206
+	} // buildRelations()
207
+
208
+	/**
209
+	 * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
210
+	 *
211
+	 * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
212
+	 * a multi-column primary key, a serialize()d version of the primary key will be returned.
213
+	 *
214
+	 * @param array  $row       resultset row.
215
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
216
+	 * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
217
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
218
+	 *
219
+	 * @return string The primary key hash of the row
220
+	 */
221
+	public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
222
+	{
223
+		// If the PK cannot be derived from the row, return NULL.
224
+		if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
225
+			return null;
226
+		}
227
+
228
+		return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
229
+	}
230
+
231
+	/**
232
+	 * Retrieves the primary key from the DB resultset row
233
+	 * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
234
+	 * a multi-column primary key, an array of the primary key columns will be returned.
235
+	 *
236
+	 * @param array  $row       resultset row.
237
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
238
+	 * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
239
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
240
+	 *
241
+	 * @return mixed The primary key of the row
242
+	 */
243
+	public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
244
+	{
245
+		return (int) $row[
246
+			$indexType == TableMap::TYPE_NUM
247
+				? 0 + $offset
248
+				: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
249
+		];
250
+	}
251
+
252
+	/**
253
+	 * The class that the tableMap will make instances of.
254
+	 *
255
+	 * If $withPrefix is true, the returned path
256
+	 * uses a dot-path notation which is translated into a path
257
+	 * relative to a location on the PHP include_path.
258
+	 * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
259
+	 *
260
+	 * @param boolean $withPrefix Whether or not to return the path with the class name
261
+	 * @return string path.to.ClassName
262
+	 */
263
+	public static function getOMClass($withPrefix = true)
264
+	{
265
+		return $withPrefix ? SubscriptionTableMap::CLASS_DEFAULT : SubscriptionTableMap::OM_CLASS;
266
+	}
267
+
268
+	/**
269
+	 * Populates an object of the default type or an object that inherit from the default.
270
+	 *
271
+	 * @param array  $row       row returned by DataFetcher->fetch().
272
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
273
+	 * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
274 274
                                  One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
275
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
276
-     *
277
-     * @throws PropelException Any exceptions caught during processing will be
278
-     *                         rethrown wrapped into a PropelException.
279
-     * @return array           (Subscription object, last column rank)
280
-     */
281
-    public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
282
-    {
283
-        $key = SubscriptionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
284
-        if (null !== ($obj = SubscriptionTableMap::getInstanceFromPool($key))) {
285
-            // We no longer rehydrate the object, since this can cause data loss.
286
-            // See http://www.propelorm.org/ticket/509
287
-            // $obj->hydrate($row, $offset, true); // rehydrate
288
-            $col = $offset + SubscriptionTableMap::NUM_HYDRATE_COLUMNS;
289
-        } else {
290
-            $cls = SubscriptionTableMap::OM_CLASS;
291
-            /** @var Subscription $obj */
292
-            $obj = new $cls();
293
-            $col = $obj->hydrate($row, $offset, false, $indexType);
294
-            SubscriptionTableMap::addInstanceToPool($obj, $key);
295
-        }
296
-
297
-        return array($obj, $col);
298
-    }
299
-
300
-    /**
301
-     * The returned array will contain objects of the default type or
302
-     * objects that inherit from the default.
303
-     *
304
-     * @param DataFetcherInterface $dataFetcher
305
-     * @return array
306
-     * @throws PropelException Any exceptions caught during processing will be
307
-     *                         rethrown wrapped into a PropelException.
308
-     */
309
-    public static function populateObjects(DataFetcherInterface $dataFetcher)
310
-    {
311
-        $results = array();
312
-
313
-        // set the class once to avoid overhead in the loop
314
-        $cls = static::getOMClass(false);
315
-        // populate the object(s)
316
-        while ($row = $dataFetcher->fetch()) {
317
-            $key = SubscriptionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
318
-            if (null !== ($obj = SubscriptionTableMap::getInstanceFromPool($key))) {
319
-                // We no longer rehydrate the object, since this can cause data loss.
320
-                // See http://www.propelorm.org/ticket/509
321
-                // $obj->hydrate($row, 0, true); // rehydrate
322
-                $results[] = $obj;
323
-            } else {
324
-                /** @var Subscription $obj */
325
-                $obj = new $cls();
326
-                $obj->hydrate($row);
327
-                $results[] = $obj;
328
-                SubscriptionTableMap::addInstanceToPool($obj, $key);
329
-            } // if key exists
330
-        }
331
-
332
-        return $results;
333
-    }
334
-    /**
335
-     * Add all the columns needed to create a new object.
336
-     *
337
-     * Note: any columns that were marked with lazyLoad="true" in the
338
-     * XML schema will not be added to the select list and only loaded
339
-     * on demand.
340
-     *
341
-     * @param Criteria $criteria object containing the columns to add.
342
-     * @param string   $alias    optional table alias
343
-     * @throws PropelException Any exceptions caught during processing will be
344
-     *                         rethrown wrapped into a PropelException.
345
-     */
346
-    public static function addSelectColumns(Criteria $criteria, $alias = null)
347
-    {
348
-        if (null === $alias) {
349
-            $criteria->addSelectColumn(SubscriptionTableMap::COL_ID);
350
-            $criteria->addSelectColumn(SubscriptionTableMap::COL_INSTANCE_NAME);
351
-            $criteria->addSelectColumn(SubscriptionTableMap::COL_USER_ID);
352
-            $criteria->addSelectColumn(SubscriptionTableMap::COL_CHANNEL_ID);
353
-            $criteria->addSelectColumn(SubscriptionTableMap::COL_SUBSCRIPTION_ID);
354
-            $criteria->addSelectColumn(SubscriptionTableMap::COL_STARTED);
355
-            $criteria->addSelectColumn(SubscriptionTableMap::COL_STOPPED);
356
-            $criteria->addSelectColumn(SubscriptionTableMap::COL_TITLE);
357
-            $criteria->addSelectColumn(SubscriptionTableMap::COL_SERVICE);
358
-        } else {
359
-            $criteria->addSelectColumn($alias . '.id');
360
-            $criteria->addSelectColumn($alias . '.instance_name');
361
-            $criteria->addSelectColumn($alias . '.user_id');
362
-            $criteria->addSelectColumn($alias . '.channel_id');
363
-            $criteria->addSelectColumn($alias . '.subscription_id');
364
-            $criteria->addSelectColumn($alias . '.started');
365
-            $criteria->addSelectColumn($alias . '.stopped');
366
-            $criteria->addSelectColumn($alias . '.title');
367
-            $criteria->addSelectColumn($alias . '.service');
368
-        }
369
-    }
370
-
371
-    /**
372
-     * Returns the TableMap related to this object.
373
-     * This method is not needed for general use but a specific application could have a need.
374
-     * @return TableMap
375
-     * @throws PropelException Any exceptions caught during processing will be
376
-     *                         rethrown wrapped into a PropelException.
377
-     */
378
-    public static function getTableMap()
379
-    {
380
-        return Propel::getServiceContainer()->getDatabaseMap(SubscriptionTableMap::DATABASE_NAME)->getTable(SubscriptionTableMap::TABLE_NAME);
381
-    }
382
-
383
-    /**
384
-     * Add a TableMap instance to the database for this tableMap class.
385
-     */
386
-    public static function buildTableMap()
387
-    {
388
-        $dbMap = Propel::getServiceContainer()->getDatabaseMap(SubscriptionTableMap::DATABASE_NAME);
389
-        if (!$dbMap->hasTable(SubscriptionTableMap::TABLE_NAME)) {
390
-            $dbMap->addTableObject(new SubscriptionTableMap());
391
-        }
392
-    }
393
-
394
-    /**
395
-     * Performs a DELETE on the database, given a Subscription or Criteria object OR a primary key value.
396
-     *
397
-     * @param mixed               $values Criteria or Subscription object or primary key or array of primary keys
398
-     *              which is used to create the DELETE statement
399
-     * @param  ConnectionInterface $con the connection to use
400
-     * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
401
-     *                         if supported by native driver or if emulated using Propel.
402
-     * @throws PropelException Any exceptions caught during processing will be
403
-     *                         rethrown wrapped into a PropelException.
404
-     */
405
-     public static function doDelete($values, ConnectionInterface $con = null)
406
-     {
407
-        if (null === $con) {
408
-            $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
409
-        }
410
-
411
-        if ($values instanceof Criteria) {
412
-            // rename for clarity
413
-            $criteria = $values;
414
-        } elseif ($values instanceof \Jalle19\StatusManager\Database\Subscription) { // it's a model object
415
-            // create criteria based on pk values
416
-            $criteria = $values->buildPkeyCriteria();
417
-        } else { // it's a primary key, or an array of pks
418
-            $criteria = new Criteria(SubscriptionTableMap::DATABASE_NAME);
419
-            $criteria->add(SubscriptionTableMap::COL_ID, (array) $values, Criteria::IN);
420
-        }
421
-
422
-        $query = SubscriptionQuery::create()->mergeWith($criteria);
423
-
424
-        if ($values instanceof Criteria) {
425
-            SubscriptionTableMap::clearInstancePool();
426
-        } elseif (!is_object($values)) { // it's a primary key, or an array of pks
427
-            foreach ((array) $values as $singleval) {
428
-                SubscriptionTableMap::removeInstanceFromPool($singleval);
429
-            }
430
-        }
431
-
432
-        return $query->delete($con);
433
-    }
434
-
435
-    /**
436
-     * Deletes all rows from the subscription table.
437
-     *
438
-     * @param ConnectionInterface $con the connection to use
439
-     * @return int The number of affected rows (if supported by underlying database driver).
440
-     */
441
-    public static function doDeleteAll(ConnectionInterface $con = null)
442
-    {
443
-        return SubscriptionQuery::create()->doDeleteAll($con);
444
-    }
445
-
446
-    /**
447
-     * Performs an INSERT on the database, given a Subscription or Criteria object.
448
-     *
449
-     * @param mixed               $criteria Criteria or Subscription object containing data that is used to create the INSERT statement.
450
-     * @param ConnectionInterface $con the ConnectionInterface connection to use
451
-     * @return mixed           The new primary key.
452
-     * @throws PropelException Any exceptions caught during processing will be
453
-     *                         rethrown wrapped into a PropelException.
454
-     */
455
-    public static function doInsert($criteria, ConnectionInterface $con = null)
456
-    {
457
-        if (null === $con) {
458
-            $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
459
-        }
460
-
461
-        if ($criteria instanceof Criteria) {
462
-            $criteria = clone $criteria; // rename for clarity
463
-        } else {
464
-            $criteria = $criteria->buildCriteria(); // build Criteria from Subscription object
465
-        }
466
-
467
-        if ($criteria->containsKey(SubscriptionTableMap::COL_ID) && $criteria->keyContainsValue(SubscriptionTableMap::COL_ID) ) {
468
-            throw new PropelException('Cannot insert a value for auto-increment primary key ('.SubscriptionTableMap::COL_ID.')');
469
-        }
470
-
471
-
472
-        // Set the correct dbName
473
-        $query = SubscriptionQuery::create()->mergeWith($criteria);
474
-
475
-        // use transaction because $criteria could contain info
476
-        // for more than one table (I guess, conceivably)
477
-        return $con->transaction(function () use ($con, $query) {
478
-            return $query->doInsert($con);
479
-        });
480
-    }
275
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
276
+	 *
277
+	 * @throws PropelException Any exceptions caught during processing will be
278
+	 *                         rethrown wrapped into a PropelException.
279
+	 * @return array           (Subscription object, last column rank)
280
+	 */
281
+	public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
282
+	{
283
+		$key = SubscriptionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
284
+		if (null !== ($obj = SubscriptionTableMap::getInstanceFromPool($key))) {
285
+			// We no longer rehydrate the object, since this can cause data loss.
286
+			// See http://www.propelorm.org/ticket/509
287
+			// $obj->hydrate($row, $offset, true); // rehydrate
288
+			$col = $offset + SubscriptionTableMap::NUM_HYDRATE_COLUMNS;
289
+		} else {
290
+			$cls = SubscriptionTableMap::OM_CLASS;
291
+			/** @var Subscription $obj */
292
+			$obj = new $cls();
293
+			$col = $obj->hydrate($row, $offset, false, $indexType);
294
+			SubscriptionTableMap::addInstanceToPool($obj, $key);
295
+		}
296
+
297
+		return array($obj, $col);
298
+	}
299
+
300
+	/**
301
+	 * The returned array will contain objects of the default type or
302
+	 * objects that inherit from the default.
303
+	 *
304
+	 * @param DataFetcherInterface $dataFetcher
305
+	 * @return array
306
+	 * @throws PropelException Any exceptions caught during processing will be
307
+	 *                         rethrown wrapped into a PropelException.
308
+	 */
309
+	public static function populateObjects(DataFetcherInterface $dataFetcher)
310
+	{
311
+		$results = array();
312
+
313
+		// set the class once to avoid overhead in the loop
314
+		$cls = static::getOMClass(false);
315
+		// populate the object(s)
316
+		while ($row = $dataFetcher->fetch()) {
317
+			$key = SubscriptionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
318
+			if (null !== ($obj = SubscriptionTableMap::getInstanceFromPool($key))) {
319
+				// We no longer rehydrate the object, since this can cause data loss.
320
+				// See http://www.propelorm.org/ticket/509
321
+				// $obj->hydrate($row, 0, true); // rehydrate
322
+				$results[] = $obj;
323
+			} else {
324
+				/** @var Subscription $obj */
325
+				$obj = new $cls();
326
+				$obj->hydrate($row);
327
+				$results[] = $obj;
328
+				SubscriptionTableMap::addInstanceToPool($obj, $key);
329
+			} // if key exists
330
+		}
331
+
332
+		return $results;
333
+	}
334
+	/**
335
+	 * Add all the columns needed to create a new object.
336
+	 *
337
+	 * Note: any columns that were marked with lazyLoad="true" in the
338
+	 * XML schema will not be added to the select list and only loaded
339
+	 * on demand.
340
+	 *
341
+	 * @param Criteria $criteria object containing the columns to add.
342
+	 * @param string   $alias    optional table alias
343
+	 * @throws PropelException Any exceptions caught during processing will be
344
+	 *                         rethrown wrapped into a PropelException.
345
+	 */
346
+	public static function addSelectColumns(Criteria $criteria, $alias = null)
347
+	{
348
+		if (null === $alias) {
349
+			$criteria->addSelectColumn(SubscriptionTableMap::COL_ID);
350
+			$criteria->addSelectColumn(SubscriptionTableMap::COL_INSTANCE_NAME);
351
+			$criteria->addSelectColumn(SubscriptionTableMap::COL_USER_ID);
352
+			$criteria->addSelectColumn(SubscriptionTableMap::COL_CHANNEL_ID);
353
+			$criteria->addSelectColumn(SubscriptionTableMap::COL_SUBSCRIPTION_ID);
354
+			$criteria->addSelectColumn(SubscriptionTableMap::COL_STARTED);
355
+			$criteria->addSelectColumn(SubscriptionTableMap::COL_STOPPED);
356
+			$criteria->addSelectColumn(SubscriptionTableMap::COL_TITLE);
357
+			$criteria->addSelectColumn(SubscriptionTableMap::COL_SERVICE);
358
+		} else {
359
+			$criteria->addSelectColumn($alias . '.id');
360
+			$criteria->addSelectColumn($alias . '.instance_name');
361
+			$criteria->addSelectColumn($alias . '.user_id');
362
+			$criteria->addSelectColumn($alias . '.channel_id');
363
+			$criteria->addSelectColumn($alias . '.subscription_id');
364
+			$criteria->addSelectColumn($alias . '.started');
365
+			$criteria->addSelectColumn($alias . '.stopped');
366
+			$criteria->addSelectColumn($alias . '.title');
367
+			$criteria->addSelectColumn($alias . '.service');
368
+		}
369
+	}
370
+
371
+	/**
372
+	 * Returns the TableMap related to this object.
373
+	 * This method is not needed for general use but a specific application could have a need.
374
+	 * @return TableMap
375
+	 * @throws PropelException Any exceptions caught during processing will be
376
+	 *                         rethrown wrapped into a PropelException.
377
+	 */
378
+	public static function getTableMap()
379
+	{
380
+		return Propel::getServiceContainer()->getDatabaseMap(SubscriptionTableMap::DATABASE_NAME)->getTable(SubscriptionTableMap::TABLE_NAME);
381
+	}
382
+
383
+	/**
384
+	 * Add a TableMap instance to the database for this tableMap class.
385
+	 */
386
+	public static function buildTableMap()
387
+	{
388
+		$dbMap = Propel::getServiceContainer()->getDatabaseMap(SubscriptionTableMap::DATABASE_NAME);
389
+		if (!$dbMap->hasTable(SubscriptionTableMap::TABLE_NAME)) {
390
+			$dbMap->addTableObject(new SubscriptionTableMap());
391
+		}
392
+	}
393
+
394
+	/**
395
+	 * Performs a DELETE on the database, given a Subscription or Criteria object OR a primary key value.
396
+	 *
397
+	 * @param mixed               $values Criteria or Subscription object or primary key or array of primary keys
398
+	 *              which is used to create the DELETE statement
399
+	 * @param  ConnectionInterface $con the connection to use
400
+	 * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
401
+	 *                         if supported by native driver or if emulated using Propel.
402
+	 * @throws PropelException Any exceptions caught during processing will be
403
+	 *                         rethrown wrapped into a PropelException.
404
+	 */
405
+	 public static function doDelete($values, ConnectionInterface $con = null)
406
+	 {
407
+		if (null === $con) {
408
+			$con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
409
+		}
410
+
411
+		if ($values instanceof Criteria) {
412
+			// rename for clarity
413
+			$criteria = $values;
414
+		} elseif ($values instanceof \Jalle19\StatusManager\Database\Subscription) { // it's a model object
415
+			// create criteria based on pk values
416
+			$criteria = $values->buildPkeyCriteria();
417
+		} else { // it's a primary key, or an array of pks
418
+			$criteria = new Criteria(SubscriptionTableMap::DATABASE_NAME);
419
+			$criteria->add(SubscriptionTableMap::COL_ID, (array) $values, Criteria::IN);
420
+		}
421
+
422
+		$query = SubscriptionQuery::create()->mergeWith($criteria);
423
+
424
+		if ($values instanceof Criteria) {
425
+			SubscriptionTableMap::clearInstancePool();
426
+		} elseif (!is_object($values)) { // it's a primary key, or an array of pks
427
+			foreach ((array) $values as $singleval) {
428
+				SubscriptionTableMap::removeInstanceFromPool($singleval);
429
+			}
430
+		}
431
+
432
+		return $query->delete($con);
433
+	}
434
+
435
+	/**
436
+	 * Deletes all rows from the subscription table.
437
+	 *
438
+	 * @param ConnectionInterface $con the connection to use
439
+	 * @return int The number of affected rows (if supported by underlying database driver).
440
+	 */
441
+	public static function doDeleteAll(ConnectionInterface $con = null)
442
+	{
443
+		return SubscriptionQuery::create()->doDeleteAll($con);
444
+	}
445
+
446
+	/**
447
+	 * Performs an INSERT on the database, given a Subscription or Criteria object.
448
+	 *
449
+	 * @param mixed               $criteria Criteria or Subscription object containing data that is used to create the INSERT statement.
450
+	 * @param ConnectionInterface $con the ConnectionInterface connection to use
451
+	 * @return mixed           The new primary key.
452
+	 * @throws PropelException Any exceptions caught during processing will be
453
+	 *                         rethrown wrapped into a PropelException.
454
+	 */
455
+	public static function doInsert($criteria, ConnectionInterface $con = null)
456
+	{
457
+		if (null === $con) {
458
+			$con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME);
459
+		}
460
+
461
+		if ($criteria instanceof Criteria) {
462
+			$criteria = clone $criteria; // rename for clarity
463
+		} else {
464
+			$criteria = $criteria->buildCriteria(); // build Criteria from Subscription object
465
+		}
466
+
467
+		if ($criteria->containsKey(SubscriptionTableMap::COL_ID) && $criteria->keyContainsValue(SubscriptionTableMap::COL_ID) ) {
468
+			throw new PropelException('Cannot insert a value for auto-increment primary key ('.SubscriptionTableMap::COL_ID.')');
469
+		}
470
+
471
+
472
+		// Set the correct dbName
473
+		$query = SubscriptionQuery::create()->mergeWith($criteria);
474
+
475
+		// use transaction because $criteria could contain info
476
+		// for more than one table (I guess, conceivably)
477
+		return $con->transaction(function () use ($con, $query) {
478
+			return $query->doInsert($con);
479
+		});
480
+	}
481 481
 
482 482
 } // SubscriptionTableMap
483 483
 // This is the static code needed to register the TableMap for this table with the main Propel class.
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
      * first dimension keys are the type constants
128 128
      * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
129 129
      */
130
-    protected static $fieldNames = array (
131
-        self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'UserId', 'ChannelId', 'SubscriptionId', 'Started', 'Stopped', 'Title', 'Service', ),
132
-        self::TYPE_CAMELNAME     => array('id', 'instanceName', 'userId', 'channelId', 'subscriptionId', 'started', 'stopped', 'title', 'service', ),
133
-        self::TYPE_COLNAME       => array(SubscriptionTableMap::COL_ID, SubscriptionTableMap::COL_INSTANCE_NAME, SubscriptionTableMap::COL_USER_ID, SubscriptionTableMap::COL_CHANNEL_ID, SubscriptionTableMap::COL_SUBSCRIPTION_ID, SubscriptionTableMap::COL_STARTED, SubscriptionTableMap::COL_STOPPED, SubscriptionTableMap::COL_TITLE, SubscriptionTableMap::COL_SERVICE, ),
134
-        self::TYPE_FIELDNAME     => array('id', 'instance_name', 'user_id', 'channel_id', 'subscription_id', 'started', 'stopped', 'title', 'service', ),
135
-        self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
130
+    protected static $fieldNames = array(
131
+        self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'UserId', 'ChannelId', 'SubscriptionId', 'Started', 'Stopped', 'Title', 'Service',),
132
+        self::TYPE_CAMELNAME     => array('id', 'instanceName', 'userId', 'channelId', 'subscriptionId', 'started', 'stopped', 'title', 'service',),
133
+        self::TYPE_COLNAME       => array(SubscriptionTableMap::COL_ID, SubscriptionTableMap::COL_INSTANCE_NAME, SubscriptionTableMap::COL_USER_ID, SubscriptionTableMap::COL_CHANNEL_ID, SubscriptionTableMap::COL_SUBSCRIPTION_ID, SubscriptionTableMap::COL_STARTED, SubscriptionTableMap::COL_STOPPED, SubscriptionTableMap::COL_TITLE, SubscriptionTableMap::COL_SERVICE,),
134
+        self::TYPE_FIELDNAME     => array('id', 'instance_name', 'user_id', 'channel_id', 'subscription_id', 'started', 'stopped', 'title', 'service',),
135
+        self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, 6, 7, 8,)
136 136
     );
137 137
 
138 138
     /**
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
      * first dimension keys are the type constants
142 142
      * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
143 143
      */
144
-    protected static $fieldKeys = array (
145
-        self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'UserId' => 2, 'ChannelId' => 3, 'SubscriptionId' => 4, 'Started' => 5, 'Stopped' => 6, 'Title' => 7, 'Service' => 8, ),
146
-        self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'userId' => 2, 'channelId' => 3, 'subscriptionId' => 4, 'started' => 5, 'stopped' => 6, 'title' => 7, 'service' => 8, ),
147
-        self::TYPE_COLNAME       => array(SubscriptionTableMap::COL_ID => 0, SubscriptionTableMap::COL_INSTANCE_NAME => 1, SubscriptionTableMap::COL_USER_ID => 2, SubscriptionTableMap::COL_CHANNEL_ID => 3, SubscriptionTableMap::COL_SUBSCRIPTION_ID => 4, SubscriptionTableMap::COL_STARTED => 5, SubscriptionTableMap::COL_STOPPED => 6, SubscriptionTableMap::COL_TITLE => 7, SubscriptionTableMap::COL_SERVICE => 8, ),
148
-        self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'user_id' => 2, 'channel_id' => 3, 'subscription_id' => 4, 'started' => 5, 'stopped' => 6, 'title' => 7, 'service' => 8, ),
149
-        self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
144
+    protected static $fieldKeys = array(
145
+        self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'UserId' => 2, 'ChannelId' => 3, 'SubscriptionId' => 4, 'Started' => 5, 'Stopped' => 6, 'Title' => 7, 'Service' => 8,),
146
+        self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'userId' => 2, 'channelId' => 3, 'subscriptionId' => 4, 'started' => 5, 'stopped' => 6, 'title' => 7, 'service' => 8,),
147
+        self::TYPE_COLNAME       => array(SubscriptionTableMap::COL_ID => 0, SubscriptionTableMap::COL_INSTANCE_NAME => 1, SubscriptionTableMap::COL_USER_ID => 2, SubscriptionTableMap::COL_CHANNEL_ID => 3, SubscriptionTableMap::COL_SUBSCRIPTION_ID => 4, SubscriptionTableMap::COL_STARTED => 5, SubscriptionTableMap::COL_STOPPED => 6, SubscriptionTableMap::COL_TITLE => 7, SubscriptionTableMap::COL_SERVICE => 8,),
148
+        self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'user_id' => 2, 'channel_id' => 3, 'subscription_id' => 4, 'started' => 5, 'stopped' => 6, 'title' => 7, 'service' => 8,),
149
+        self::TYPE_NUM           => array(0, 1, 2, 3, 4, 5, 6, 7, 8,)
150 150
     );
151 151
 
152 152
     /**
@@ -182,23 +182,23 @@  discard block
 block discarded – undo
182 182
      */
183 183
     public function buildRelations()
184 184
     {
185
-        $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array (
185
+        $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array(
186 186
   0 =>
187
-  array (
187
+  array(
188 188
     0 => ':instance_name',
189 189
     1 => ':name',
190 190
   ),
191 191
 ), null, null, null, false);
192
-        $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array (
192
+        $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array(
193 193
   0 =>
194
-  array (
194
+  array(
195 195
     0 => ':user_id',
196 196
     1 => ':id',
197 197
   ),
198 198
 ), null, null, null, false);
199
-        $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::MANY_TO_ONE, array (
199
+        $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::MANY_TO_ONE, array(
200 200
   0 =>
201
-  array (
201
+  array(
202 202
     0 => ':channel_id',
203 203
     1 => ':id',
204 204
   ),
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
             $criteria = $criteria->buildCriteria(); // build Criteria from Subscription object
465 465
         }
466 466
 
467
-        if ($criteria->containsKey(SubscriptionTableMap::COL_ID) && $criteria->keyContainsValue(SubscriptionTableMap::COL_ID) ) {
468
-            throw new PropelException('Cannot insert a value for auto-increment primary key ('.SubscriptionTableMap::COL_ID.')');
467
+        if ($criteria->containsKey(SubscriptionTableMap::COL_ID) && $criteria->keyContainsValue(SubscriptionTableMap::COL_ID)) {
468
+            throw new PropelException('Cannot insert a value for auto-increment primary key (' . SubscriptionTableMap::COL_ID . ')');
469 469
         }
470 470
 
471 471
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 
475 475
         // use transaction because $criteria could contain info
476 476
         // for more than one table (I guess, conceivably)
477
-        return $con->transaction(function () use ($con, $query) {
477
+        return $con->transaction(function() use ($con, $query) {
478 478
             return $query->doInsert($con);
479 479
         });
480 480
     }
Please login to merge, or discard this patch.
src/cli/Jalle19/StatusManager/Database/Map/UserTableMap.php 2 patches
Indentation   +389 added lines, -389 removed lines patch added patch discarded remove patch
@@ -28,408 +28,408 @@
 block discarded – undo
28 28
  */
29 29
 class UserTableMap extends TableMap
30 30
 {
31
-    use InstancePoolTrait;
32
-    use TableMapTrait;
33
-
34
-    /**
35
-     * The (dot-path) name of this class
36
-     */
37
-    const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.UserTableMap';
38
-
39
-    /**
40
-     * The default database name for this class
41
-     */
42
-    const DATABASE_NAME = 'tvheadend_status_manager';
43
-
44
-    /**
45
-     * The table name for this class
46
-     */
47
-    const TABLE_NAME = 'user';
48
-
49
-    /**
50
-     * The related Propel class for this table
51
-     */
52
-    const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\User';
53
-
54
-    /**
55
-     * A class that can be returned by this tableMap
56
-     */
57
-    const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.User';
58
-
59
-    /**
60
-     * The total number of columns
61
-     */
62
-    const NUM_COLUMNS = 3;
63
-
64
-    /**
65
-     * The number of lazy-loaded columns
66
-     */
67
-    const NUM_LAZY_LOAD_COLUMNS = 0;
68
-
69
-    /**
70
-     * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
71
-     */
72
-    const NUM_HYDRATE_COLUMNS = 3;
73
-
74
-    /**
75
-     * the column name for the id field
76
-     */
77
-    const COL_ID = 'user.id';
78
-
79
-    /**
80
-     * the column name for the instance_name field
81
-     */
82
-    const COL_INSTANCE_NAME = 'user.instance_name';
83
-
84
-    /**
85
-     * the column name for the name field
86
-     */
87
-    const COL_NAME = 'user.name';
88
-
89
-    /**
90
-     * The default string format for model objects of the related table
91
-     */
92
-    const DEFAULT_STRING_FORMAT = 'YAML';
93
-
94
-    /**
95
-     * holds an array of fieldnames
96
-     *
97
-     * first dimension keys are the type constants
98
-     * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
99
-     */
100
-    protected static $fieldNames = array (
101
-        self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'Name', ),
102
-        self::TYPE_CAMELNAME     => array('id', 'instanceName', 'name', ),
103
-        self::TYPE_COLNAME       => array(UserTableMap::COL_ID, UserTableMap::COL_INSTANCE_NAME, UserTableMap::COL_NAME, ),
104
-        self::TYPE_FIELDNAME     => array('id', 'instance_name', 'name', ),
105
-        self::TYPE_NUM           => array(0, 1, 2, )
106
-    );
107
-
108
-    /**
109
-     * holds an array of keys for quick access to the fieldnames array
110
-     *
111
-     * first dimension keys are the type constants
112
-     * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
113
-     */
114
-    protected static $fieldKeys = array (
115
-        self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2, ),
116
-        self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'name' => 2, ),
117
-        self::TYPE_COLNAME       => array(UserTableMap::COL_ID => 0, UserTableMap::COL_INSTANCE_NAME => 1, UserTableMap::COL_NAME => 2, ),
118
-        self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'name' => 2, ),
119
-        self::TYPE_NUM           => array(0, 1, 2, )
120
-    );
121
-
122
-    /**
123
-     * Initialize the table attributes and columns
124
-     * Relations are not initialized by this method since they are lazy loaded
125
-     *
126
-     * @return void
127
-     * @throws PropelException
128
-     */
129
-    public function initialize()
130
-    {
131
-        // attributes
132
-        $this->setName('user');
133
-        $this->setPhpName('User');
134
-        $this->setIdentifierQuoting(false);
135
-        $this->setClassName('\\Jalle19\\StatusManager\\Database\\User');
136
-        $this->setPackage('Jalle19.StatusManager.Database');
137
-        $this->setUseIdGenerator(true);
138
-        // columns
139
-        $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
140
-        $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null);
141
-        $this->addColumn('name', 'Name', 'VARCHAR', true, 255, null);
142
-    } // initialize()
143
-
144
-    /**
145
-     * Build the RelationMap objects for this table relationships
146
-     */
147
-    public function buildRelations()
148
-    {
149
-        $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array (
31
+	use InstancePoolTrait;
32
+	use TableMapTrait;
33
+
34
+	/**
35
+	 * The (dot-path) name of this class
36
+	 */
37
+	const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.UserTableMap';
38
+
39
+	/**
40
+	 * The default database name for this class
41
+	 */
42
+	const DATABASE_NAME = 'tvheadend_status_manager';
43
+
44
+	/**
45
+	 * The table name for this class
46
+	 */
47
+	const TABLE_NAME = 'user';
48
+
49
+	/**
50
+	 * The related Propel class for this table
51
+	 */
52
+	const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\User';
53
+
54
+	/**
55
+	 * A class that can be returned by this tableMap
56
+	 */
57
+	const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.User';
58
+
59
+	/**
60
+	 * The total number of columns
61
+	 */
62
+	const NUM_COLUMNS = 3;
63
+
64
+	/**
65
+	 * The number of lazy-loaded columns
66
+	 */
67
+	const NUM_LAZY_LOAD_COLUMNS = 0;
68
+
69
+	/**
70
+	 * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
71
+	 */
72
+	const NUM_HYDRATE_COLUMNS = 3;
73
+
74
+	/**
75
+	 * the column name for the id field
76
+	 */
77
+	const COL_ID = 'user.id';
78
+
79
+	/**
80
+	 * the column name for the instance_name field
81
+	 */
82
+	const COL_INSTANCE_NAME = 'user.instance_name';
83
+
84
+	/**
85
+	 * the column name for the name field
86
+	 */
87
+	const COL_NAME = 'user.name';
88
+
89
+	/**
90
+	 * The default string format for model objects of the related table
91
+	 */
92
+	const DEFAULT_STRING_FORMAT = 'YAML';
93
+
94
+	/**
95
+	 * holds an array of fieldnames
96
+	 *
97
+	 * first dimension keys are the type constants
98
+	 * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
99
+	 */
100
+	protected static $fieldNames = array (
101
+		self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'Name', ),
102
+		self::TYPE_CAMELNAME     => array('id', 'instanceName', 'name', ),
103
+		self::TYPE_COLNAME       => array(UserTableMap::COL_ID, UserTableMap::COL_INSTANCE_NAME, UserTableMap::COL_NAME, ),
104
+		self::TYPE_FIELDNAME     => array('id', 'instance_name', 'name', ),
105
+		self::TYPE_NUM           => array(0, 1, 2, )
106
+	);
107
+
108
+	/**
109
+	 * holds an array of keys for quick access to the fieldnames array
110
+	 *
111
+	 * first dimension keys are the type constants
112
+	 * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
113
+	 */
114
+	protected static $fieldKeys = array (
115
+		self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2, ),
116
+		self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'name' => 2, ),
117
+		self::TYPE_COLNAME       => array(UserTableMap::COL_ID => 0, UserTableMap::COL_INSTANCE_NAME => 1, UserTableMap::COL_NAME => 2, ),
118
+		self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'name' => 2, ),
119
+		self::TYPE_NUM           => array(0, 1, 2, )
120
+	);
121
+
122
+	/**
123
+	 * Initialize the table attributes and columns
124
+	 * Relations are not initialized by this method since they are lazy loaded
125
+	 *
126
+	 * @return void
127
+	 * @throws PropelException
128
+	 */
129
+	public function initialize()
130
+	{
131
+		// attributes
132
+		$this->setName('user');
133
+		$this->setPhpName('User');
134
+		$this->setIdentifierQuoting(false);
135
+		$this->setClassName('\\Jalle19\\StatusManager\\Database\\User');
136
+		$this->setPackage('Jalle19.StatusManager.Database');
137
+		$this->setUseIdGenerator(true);
138
+		// columns
139
+		$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
140
+		$this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null);
141
+		$this->addColumn('name', 'Name', 'VARCHAR', true, 255, null);
142
+	} // initialize()
143
+
144
+	/**
145
+	 * Build the RelationMap objects for this table relationships
146
+	 */
147
+	public function buildRelations()
148
+	{
149
+		$this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array (
150 150
   0 =>
151 151
   array (
152
-    0 => ':instance_name',
153
-    1 => ':name',
152
+	0 => ':instance_name',
153
+	1 => ':name',
154 154
   ),
155 155
 ), null, null, null, false);
156
-        $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array (
156
+		$this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array (
157 157
   0 =>
158 158
   array (
159
-    0 => ':user_id',
160
-    1 => ':id',
159
+	0 => ':user_id',
160
+	1 => ':id',
161 161
   ),
162 162
 ), null, null, 'Connections', false);
163
-        $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array (
163
+		$this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array (
164 164
   0 =>
165 165
   array (
166
-    0 => ':user_id',
167
-    1 => ':id',
166
+	0 => ':user_id',
167
+	1 => ':id',
168 168
   ),
169 169
 ), null, null, 'Subscriptions', false);
170
-    } // buildRelations()
171
-
172
-    /**
173
-     * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
174
-     *
175
-     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
176
-     * a multi-column primary key, a serialize()d version of the primary key will be returned.
177
-     *
178
-     * @param array  $row       resultset row.
179
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
180
-     * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
181
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
182
-     *
183
-     * @return string The primary key hash of the row
184
-     */
185
-    public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
186
-    {
187
-        // If the PK cannot be derived from the row, return NULL.
188
-        if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
189
-            return null;
190
-        }
191
-
192
-        return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
193
-    }
194
-
195
-    /**
196
-     * Retrieves the primary key from the DB resultset row
197
-     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
198
-     * a multi-column primary key, an array of the primary key columns will be returned.
199
-     *
200
-     * @param array  $row       resultset row.
201
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
202
-     * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
203
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
204
-     *
205
-     * @return mixed The primary key of the row
206
-     */
207
-    public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
208
-    {
209
-        return (int) $row[
210
-            $indexType == TableMap::TYPE_NUM
211
-                ? 0 + $offset
212
-                : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
213
-        ];
214
-    }
215
-
216
-    /**
217
-     * The class that the tableMap will make instances of.
218
-     *
219
-     * If $withPrefix is true, the returned path
220
-     * uses a dot-path notation which is translated into a path
221
-     * relative to a location on the PHP include_path.
222
-     * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
223
-     *
224
-     * @param boolean $withPrefix Whether or not to return the path with the class name
225
-     * @return string path.to.ClassName
226
-     */
227
-    public static function getOMClass($withPrefix = true)
228
-    {
229
-        return $withPrefix ? UserTableMap::CLASS_DEFAULT : UserTableMap::OM_CLASS;
230
-    }
231
-
232
-    /**
233
-     * Populates an object of the default type or an object that inherit from the default.
234
-     *
235
-     * @param array  $row       row returned by DataFetcher->fetch().
236
-     * @param int    $offset    The 0-based offset for reading from the resultset row.
237
-     * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
170
+	} // buildRelations()
171
+
172
+	/**
173
+	 * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
174
+	 *
175
+	 * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
176
+	 * a multi-column primary key, a serialize()d version of the primary key will be returned.
177
+	 *
178
+	 * @param array  $row       resultset row.
179
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
180
+	 * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
181
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
182
+	 *
183
+	 * @return string The primary key hash of the row
184
+	 */
185
+	public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
186
+	{
187
+		// If the PK cannot be derived from the row, return NULL.
188
+		if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
189
+			return null;
190
+		}
191
+
192
+		return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
193
+	}
194
+
195
+	/**
196
+	 * Retrieves the primary key from the DB resultset row
197
+	 * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
198
+	 * a multi-column primary key, an array of the primary key columns will be returned.
199
+	 *
200
+	 * @param array  $row       resultset row.
201
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
202
+	 * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
203
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
204
+	 *
205
+	 * @return mixed The primary key of the row
206
+	 */
207
+	public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
208
+	{
209
+		return (int) $row[
210
+			$indexType == TableMap::TYPE_NUM
211
+				? 0 + $offset
212
+				: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
213
+		];
214
+	}
215
+
216
+	/**
217
+	 * The class that the tableMap will make instances of.
218
+	 *
219
+	 * If $withPrefix is true, the returned path
220
+	 * uses a dot-path notation which is translated into a path
221
+	 * relative to a location on the PHP include_path.
222
+	 * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
223
+	 *
224
+	 * @param boolean $withPrefix Whether or not to return the path with the class name
225
+	 * @return string path.to.ClassName
226
+	 */
227
+	public static function getOMClass($withPrefix = true)
228
+	{
229
+		return $withPrefix ? UserTableMap::CLASS_DEFAULT : UserTableMap::OM_CLASS;
230
+	}
231
+
232
+	/**
233
+	 * Populates an object of the default type or an object that inherit from the default.
234
+	 *
235
+	 * @param array  $row       row returned by DataFetcher->fetch().
236
+	 * @param int    $offset    The 0-based offset for reading from the resultset row.
237
+	 * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
238 238
                                  One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
239
-     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
240
-     *
241
-     * @throws PropelException Any exceptions caught during processing will be
242
-     *                         rethrown wrapped into a PropelException.
243
-     * @return array           (User object, last column rank)
244
-     */
245
-    public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
246
-    {
247
-        $key = UserTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
248
-        if (null !== ($obj = UserTableMap::getInstanceFromPool($key))) {
249
-            // We no longer rehydrate the object, since this can cause data loss.
250
-            // See http://www.propelorm.org/ticket/509
251
-            // $obj->hydrate($row, $offset, true); // rehydrate
252
-            $col = $offset + UserTableMap::NUM_HYDRATE_COLUMNS;
253
-        } else {
254
-            $cls = UserTableMap::OM_CLASS;
255
-            /** @var User $obj */
256
-            $obj = new $cls();
257
-            $col = $obj->hydrate($row, $offset, false, $indexType);
258
-            UserTableMap::addInstanceToPool($obj, $key);
259
-        }
260
-
261
-        return array($obj, $col);
262
-    }
263
-
264
-    /**
265
-     * The returned array will contain objects of the default type or
266
-     * objects that inherit from the default.
267
-     *
268
-     * @param DataFetcherInterface $dataFetcher
269
-     * @return array
270
-     * @throws PropelException Any exceptions caught during processing will be
271
-     *                         rethrown wrapped into a PropelException.
272
-     */
273
-    public static function populateObjects(DataFetcherInterface $dataFetcher)
274
-    {
275
-        $results = array();
276
-
277
-        // set the class once to avoid overhead in the loop
278
-        $cls = static::getOMClass(false);
279
-        // populate the object(s)
280
-        while ($row = $dataFetcher->fetch()) {
281
-            $key = UserTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
282
-            if (null !== ($obj = UserTableMap::getInstanceFromPool($key))) {
283
-                // We no longer rehydrate the object, since this can cause data loss.
284
-                // See http://www.propelorm.org/ticket/509
285
-                // $obj->hydrate($row, 0, true); // rehydrate
286
-                $results[] = $obj;
287
-            } else {
288
-                /** @var User $obj */
289
-                $obj = new $cls();
290
-                $obj->hydrate($row);
291
-                $results[] = $obj;
292
-                UserTableMap::addInstanceToPool($obj, $key);
293
-            } // if key exists
294
-        }
295
-
296
-        return $results;
297
-    }
298
-    /**
299
-     * Add all the columns needed to create a new object.
300
-     *
301
-     * Note: any columns that were marked with lazyLoad="true" in the
302
-     * XML schema will not be added to the select list and only loaded
303
-     * on demand.
304
-     *
305
-     * @param Criteria $criteria object containing the columns to add.
306
-     * @param string   $alias    optional table alias
307
-     * @throws PropelException Any exceptions caught during processing will be
308
-     *                         rethrown wrapped into a PropelException.
309
-     */
310
-    public static function addSelectColumns(Criteria $criteria, $alias = null)
311
-    {
312
-        if (null === $alias) {
313
-            $criteria->addSelectColumn(UserTableMap::COL_ID);
314
-            $criteria->addSelectColumn(UserTableMap::COL_INSTANCE_NAME);
315
-            $criteria->addSelectColumn(UserTableMap::COL_NAME);
316
-        } else {
317
-            $criteria->addSelectColumn($alias . '.id');
318
-            $criteria->addSelectColumn($alias . '.instance_name');
319
-            $criteria->addSelectColumn($alias . '.name');
320
-        }
321
-    }
322
-
323
-    /**
324
-     * Returns the TableMap related to this object.
325
-     * This method is not needed for general use but a specific application could have a need.
326
-     * @return TableMap
327
-     * @throws PropelException Any exceptions caught during processing will be
328
-     *                         rethrown wrapped into a PropelException.
329
-     */
330
-    public static function getTableMap()
331
-    {
332
-        return Propel::getServiceContainer()->getDatabaseMap(UserTableMap::DATABASE_NAME)->getTable(UserTableMap::TABLE_NAME);
333
-    }
334
-
335
-    /**
336
-     * Add a TableMap instance to the database for this tableMap class.
337
-     */
338
-    public static function buildTableMap()
339
-    {
340
-        $dbMap = Propel::getServiceContainer()->getDatabaseMap(UserTableMap::DATABASE_NAME);
341
-        if (!$dbMap->hasTable(UserTableMap::TABLE_NAME)) {
342
-            $dbMap->addTableObject(new UserTableMap());
343
-        }
344
-    }
345
-
346
-    /**
347
-     * Performs a DELETE on the database, given a User or Criteria object OR a primary key value.
348
-     *
349
-     * @param mixed               $values Criteria or User object or primary key or array of primary keys
350
-     *              which is used to create the DELETE statement
351
-     * @param  ConnectionInterface $con the connection to use
352
-     * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
353
-     *                         if supported by native driver or if emulated using Propel.
354
-     * @throws PropelException Any exceptions caught during processing will be
355
-     *                         rethrown wrapped into a PropelException.
356
-     */
357
-     public static function doDelete($values, ConnectionInterface $con = null)
358
-     {
359
-        if (null === $con) {
360
-            $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME);
361
-        }
362
-
363
-        if ($values instanceof Criteria) {
364
-            // rename for clarity
365
-            $criteria = $values;
366
-        } elseif ($values instanceof \Jalle19\StatusManager\Database\User) { // it's a model object
367
-            // create criteria based on pk values
368
-            $criteria = $values->buildPkeyCriteria();
369
-        } else { // it's a primary key, or an array of pks
370
-            $criteria = new Criteria(UserTableMap::DATABASE_NAME);
371
-            $criteria->add(UserTableMap::COL_ID, (array) $values, Criteria::IN);
372
-        }
373
-
374
-        $query = UserQuery::create()->mergeWith($criteria);
375
-
376
-        if ($values instanceof Criteria) {
377
-            UserTableMap::clearInstancePool();
378
-        } elseif (!is_object($values)) { // it's a primary key, or an array of pks
379
-            foreach ((array) $values as $singleval) {
380
-                UserTableMap::removeInstanceFromPool($singleval);
381
-            }
382
-        }
383
-
384
-        return $query->delete($con);
385
-    }
386
-
387
-    /**
388
-     * Deletes all rows from the user table.
389
-     *
390
-     * @param ConnectionInterface $con the connection to use
391
-     * @return int The number of affected rows (if supported by underlying database driver).
392
-     */
393
-    public static function doDeleteAll(ConnectionInterface $con = null)
394
-    {
395
-        return UserQuery::create()->doDeleteAll($con);
396
-    }
397
-
398
-    /**
399
-     * Performs an INSERT on the database, given a User or Criteria object.
400
-     *
401
-     * @param mixed               $criteria Criteria or User object containing data that is used to create the INSERT statement.
402
-     * @param ConnectionInterface $con the ConnectionInterface connection to use
403
-     * @return mixed           The new primary key.
404
-     * @throws PropelException Any exceptions caught during processing will be
405
-     *                         rethrown wrapped into a PropelException.
406
-     */
407
-    public static function doInsert($criteria, ConnectionInterface $con = null)
408
-    {
409
-        if (null === $con) {
410
-            $con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME);
411
-        }
412
-
413
-        if ($criteria instanceof Criteria) {
414
-            $criteria = clone $criteria; // rename for clarity
415
-        } else {
416
-            $criteria = $criteria->buildCriteria(); // build Criteria from User object
417
-        }
418
-
419
-        if ($criteria->containsKey(UserTableMap::COL_ID) && $criteria->keyContainsValue(UserTableMap::COL_ID) ) {
420
-            throw new PropelException('Cannot insert a value for auto-increment primary key ('.UserTableMap::COL_ID.')');
421
-        }
422
-
423
-
424
-        // Set the correct dbName
425
-        $query = UserQuery::create()->mergeWith($criteria);
426
-
427
-        // use transaction because $criteria could contain info
428
-        // for more than one table (I guess, conceivably)
429
-        return $con->transaction(function () use ($con, $query) {
430
-            return $query->doInsert($con);
431
-        });
432
-    }
239
+	 *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
240
+	 *
241
+	 * @throws PropelException Any exceptions caught during processing will be
242
+	 *                         rethrown wrapped into a PropelException.
243
+	 * @return array           (User object, last column rank)
244
+	 */
245
+	public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
246
+	{
247
+		$key = UserTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
248
+		if (null !== ($obj = UserTableMap::getInstanceFromPool($key))) {
249
+			// We no longer rehydrate the object, since this can cause data loss.
250
+			// See http://www.propelorm.org/ticket/509
251
+			// $obj->hydrate($row, $offset, true); // rehydrate
252
+			$col = $offset + UserTableMap::NUM_HYDRATE_COLUMNS;
253
+		} else {
254
+			$cls = UserTableMap::OM_CLASS;
255
+			/** @var User $obj */
256
+			$obj = new $cls();
257
+			$col = $obj->hydrate($row, $offset, false, $indexType);
258
+			UserTableMap::addInstanceToPool($obj, $key);
259
+		}
260
+
261
+		return array($obj, $col);
262
+	}
263
+
264
+	/**
265
+	 * The returned array will contain objects of the default type or
266
+	 * objects that inherit from the default.
267
+	 *
268
+	 * @param DataFetcherInterface $dataFetcher
269
+	 * @return array
270
+	 * @throws PropelException Any exceptions caught during processing will be
271
+	 *                         rethrown wrapped into a PropelException.
272
+	 */
273
+	public static function populateObjects(DataFetcherInterface $dataFetcher)
274
+	{
275
+		$results = array();
276
+
277
+		// set the class once to avoid overhead in the loop
278
+		$cls = static::getOMClass(false);
279
+		// populate the object(s)
280
+		while ($row = $dataFetcher->fetch()) {
281
+			$key = UserTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
282
+			if (null !== ($obj = UserTableMap::getInstanceFromPool($key))) {
283
+				// We no longer rehydrate the object, since this can cause data loss.
284
+				// See http://www.propelorm.org/ticket/509
285
+				// $obj->hydrate($row, 0, true); // rehydrate
286
+				$results[] = $obj;
287
+			} else {
288
+				/** @var User $obj */
289
+				$obj = new $cls();
290
+				$obj->hydrate($row);
291
+				$results[] = $obj;
292
+				UserTableMap::addInstanceToPool($obj, $key);
293
+			} // if key exists
294
+		}
295
+
296
+		return $results;
297
+	}
298
+	/**
299
+	 * Add all the columns needed to create a new object.
300
+	 *
301
+	 * Note: any columns that were marked with lazyLoad="true" in the
302
+	 * XML schema will not be added to the select list and only loaded
303
+	 * on demand.
304
+	 *
305
+	 * @param Criteria $criteria object containing the columns to add.
306
+	 * @param string   $alias    optional table alias
307
+	 * @throws PropelException Any exceptions caught during processing will be
308
+	 *                         rethrown wrapped into a PropelException.
309
+	 */
310
+	public static function addSelectColumns(Criteria $criteria, $alias = null)
311
+	{
312
+		if (null === $alias) {
313
+			$criteria->addSelectColumn(UserTableMap::COL_ID);
314
+			$criteria->addSelectColumn(UserTableMap::COL_INSTANCE_NAME);
315
+			$criteria->addSelectColumn(UserTableMap::COL_NAME);
316
+		} else {
317
+			$criteria->addSelectColumn($alias . '.id');
318
+			$criteria->addSelectColumn($alias . '.instance_name');
319
+			$criteria->addSelectColumn($alias . '.name');
320
+		}
321
+	}
322
+
323
+	/**
324
+	 * Returns the TableMap related to this object.
325
+	 * This method is not needed for general use but a specific application could have a need.
326
+	 * @return TableMap
327
+	 * @throws PropelException Any exceptions caught during processing will be
328
+	 *                         rethrown wrapped into a PropelException.
329
+	 */
330
+	public static function getTableMap()
331
+	{
332
+		return Propel::getServiceContainer()->getDatabaseMap(UserTableMap::DATABASE_NAME)->getTable(UserTableMap::TABLE_NAME);
333
+	}
334
+
335
+	/**
336
+	 * Add a TableMap instance to the database for this tableMap class.
337
+	 */
338
+	public static function buildTableMap()
339
+	{
340
+		$dbMap = Propel::getServiceContainer()->getDatabaseMap(UserTableMap::DATABASE_NAME);
341
+		if (!$dbMap->hasTable(UserTableMap::TABLE_NAME)) {
342
+			$dbMap->addTableObject(new UserTableMap());
343
+		}
344
+	}
345
+
346
+	/**
347
+	 * Performs a DELETE on the database, given a User or Criteria object OR a primary key value.
348
+	 *
349
+	 * @param mixed               $values Criteria or User object or primary key or array of primary keys
350
+	 *              which is used to create the DELETE statement
351
+	 * @param  ConnectionInterface $con the connection to use
352
+	 * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
353
+	 *                         if supported by native driver or if emulated using Propel.
354
+	 * @throws PropelException Any exceptions caught during processing will be
355
+	 *                         rethrown wrapped into a PropelException.
356
+	 */
357
+	 public static function doDelete($values, ConnectionInterface $con = null)
358
+	 {
359
+		if (null === $con) {
360
+			$con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME);
361
+		}
362
+
363
+		if ($values instanceof Criteria) {
364
+			// rename for clarity
365
+			$criteria = $values;
366
+		} elseif ($values instanceof \Jalle19\StatusManager\Database\User) { // it's a model object
367
+			// create criteria based on pk values
368
+			$criteria = $values->buildPkeyCriteria();
369
+		} else { // it's a primary key, or an array of pks
370
+			$criteria = new Criteria(UserTableMap::DATABASE_NAME);
371
+			$criteria->add(UserTableMap::COL_ID, (array) $values, Criteria::IN);
372
+		}
373
+
374
+		$query = UserQuery::create()->mergeWith($criteria);
375
+
376
+		if ($values instanceof Criteria) {
377
+			UserTableMap::clearInstancePool();
378
+		} elseif (!is_object($values)) { // it's a primary key, or an array of pks
379
+			foreach ((array) $values as $singleval) {
380
+				UserTableMap::removeInstanceFromPool($singleval);
381
+			}
382
+		}
383
+
384
+		return $query->delete($con);
385
+	}
386
+
387
+	/**
388
+	 * Deletes all rows from the user table.
389
+	 *
390
+	 * @param ConnectionInterface $con the connection to use
391
+	 * @return int The number of affected rows (if supported by underlying database driver).
392
+	 */
393
+	public static function doDeleteAll(ConnectionInterface $con = null)
394
+	{
395
+		return UserQuery::create()->doDeleteAll($con);
396
+	}
397
+
398
+	/**
399
+	 * Performs an INSERT on the database, given a User or Criteria object.
400
+	 *
401
+	 * @param mixed               $criteria Criteria or User object containing data that is used to create the INSERT statement.
402
+	 * @param ConnectionInterface $con the ConnectionInterface connection to use
403
+	 * @return mixed           The new primary key.
404
+	 * @throws PropelException Any exceptions caught during processing will be
405
+	 *                         rethrown wrapped into a PropelException.
406
+	 */
407
+	public static function doInsert($criteria, ConnectionInterface $con = null)
408
+	{
409
+		if (null === $con) {
410
+			$con = Propel::getServiceContainer()->getWriteConnection(UserTableMap::DATABASE_NAME);
411
+		}
412
+
413
+		if ($criteria instanceof Criteria) {
414
+			$criteria = clone $criteria; // rename for clarity
415
+		} else {
416
+			$criteria = $criteria->buildCriteria(); // build Criteria from User object
417
+		}
418
+
419
+		if ($criteria->containsKey(UserTableMap::COL_ID) && $criteria->keyContainsValue(UserTableMap::COL_ID) ) {
420
+			throw new PropelException('Cannot insert a value for auto-increment primary key ('.UserTableMap::COL_ID.')');
421
+		}
422
+
423
+
424
+		// Set the correct dbName
425
+		$query = UserQuery::create()->mergeWith($criteria);
426
+
427
+		// use transaction because $criteria could contain info
428
+		// for more than one table (I guess, conceivably)
429
+		return $con->transaction(function () use ($con, $query) {
430
+			return $query->doInsert($con);
431
+		});
432
+	}
433 433
 
434 434
 } // UserTableMap
435 435
 // This is the static code needed to register the TableMap for this table with the main Propel class.
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
      * first dimension keys are the type constants
98 98
      * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
99 99
      */
100
-    protected static $fieldNames = array (
101
-        self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'Name', ),
102
-        self::TYPE_CAMELNAME     => array('id', 'instanceName', 'name', ),
103
-        self::TYPE_COLNAME       => array(UserTableMap::COL_ID, UserTableMap::COL_INSTANCE_NAME, UserTableMap::COL_NAME, ),
104
-        self::TYPE_FIELDNAME     => array('id', 'instance_name', 'name', ),
105
-        self::TYPE_NUM           => array(0, 1, 2, )
100
+    protected static $fieldNames = array(
101
+        self::TYPE_PHPNAME       => array('Id', 'InstanceName', 'Name',),
102
+        self::TYPE_CAMELNAME     => array('id', 'instanceName', 'name',),
103
+        self::TYPE_COLNAME       => array(UserTableMap::COL_ID, UserTableMap::COL_INSTANCE_NAME, UserTableMap::COL_NAME,),
104
+        self::TYPE_FIELDNAME     => array('id', 'instance_name', 'name',),
105
+        self::TYPE_NUM           => array(0, 1, 2,)
106 106
     );
107 107
 
108 108
     /**
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
      * first dimension keys are the type constants
112 112
      * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
113 113
      */
114
-    protected static $fieldKeys = array (
115
-        self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2, ),
116
-        self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'name' => 2, ),
117
-        self::TYPE_COLNAME       => array(UserTableMap::COL_ID => 0, UserTableMap::COL_INSTANCE_NAME => 1, UserTableMap::COL_NAME => 2, ),
118
-        self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'name' => 2, ),
119
-        self::TYPE_NUM           => array(0, 1, 2, )
114
+    protected static $fieldKeys = array(
115
+        self::TYPE_PHPNAME       => array('Id' => 0, 'InstanceName' => 1, 'Name' => 2,),
116
+        self::TYPE_CAMELNAME     => array('id' => 0, 'instanceName' => 1, 'name' => 2,),
117
+        self::TYPE_COLNAME       => array(UserTableMap::COL_ID => 0, UserTableMap::COL_INSTANCE_NAME => 1, UserTableMap::COL_NAME => 2,),
118
+        self::TYPE_FIELDNAME     => array('id' => 0, 'instance_name' => 1, 'name' => 2,),
119
+        self::TYPE_NUM           => array(0, 1, 2,)
120 120
     );
121 121
 
122 122
     /**
@@ -146,23 +146,23 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function buildRelations()
148 148
     {
149
-        $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array (
149
+        $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array(
150 150
   0 =>
151
-  array (
151
+  array(
152 152
     0 => ':instance_name',
153 153
     1 => ':name',
154 154
   ),
155 155
 ), null, null, null, false);
156
-        $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array (
156
+        $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array(
157 157
   0 =>
158
-  array (
158
+  array(
159 159
     0 => ':user_id',
160 160
     1 => ':id',
161 161
   ),
162 162
 ), null, null, 'Connections', false);
163
-        $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array (
163
+        $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array(
164 164
   0 =>
165
-  array (
165
+  array(
166 166
     0 => ':user_id',
167 167
     1 => ':id',
168 168
   ),
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
             $criteria = $criteria->buildCriteria(); // build Criteria from User object
417 417
         }
418 418
 
419
-        if ($criteria->containsKey(UserTableMap::COL_ID) && $criteria->keyContainsValue(UserTableMap::COL_ID) ) {
420
-            throw new PropelException('Cannot insert a value for auto-increment primary key ('.UserTableMap::COL_ID.')');
419
+        if ($criteria->containsKey(UserTableMap::COL_ID) && $criteria->keyContainsValue(UserTableMap::COL_ID)) {
420
+            throw new PropelException('Cannot insert a value for auto-increment primary key (' . UserTableMap::COL_ID . ')');
421 421
         }
422 422
 
423 423
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 
427 427
         // use transaction because $criteria could contain info
428 428
         // for more than one table (I guess, conceivably)
429
-        return $con->transaction(function () use ($con, $query) {
429
+        return $con->transaction(function() use ($con, $query) {
430 430
             return $query->doInsert($con);
431 431
         });
432 432
     }
Please login to merge, or discard this patch.
src/cli/Jalle19/StatusManager/StatusManager.php 1 patch
Braces   +16 added lines, -14 removed lines patch added patch discarded remove patch
@@ -70,8 +70,9 @@  discard block
 block discarded – undo
70 70
 		$this->_instances        = new \SplObjectStorage();
71 71
 
72 72
 		// Attach a state to each instance
73
-		foreach ($this->_configuration->getInstances() as $instance)
74
-			$this->_instances->attach($instance, new InstanceState());
73
+		foreach ($this->_configuration->getInstances() as $instance) {
74
+					$this->_instances->attach($instance, new InstanceState());
75
+		}
75 76
 
76 77
 		// Start the persistence manager
77 78
 		$this->_persistenceManager = new PersistenceManager($logger);
@@ -147,16 +148,19 @@  discard block
 block discarded – undo
147 148
 			]);
148 149
 
149 150
 			// Persist connections
150
-			foreach ($instanceStatus->getConnections() as $connection)
151
-				$this->_persistenceManager->onConnectionSeen($instanceName, $connection);
151
+			foreach ($instanceStatus->getConnections() as $connection) {
152
+							$this->_persistenceManager->onConnectionSeen($instanceName, $connection);
153
+			}
152 154
 
153 155
 			// Persist running subscriptions
154
-			foreach ($instanceStatus->getSubscriptions() as $subscription)
155
-				$this->_persistenceManager->onSubscriptionSeen($instanceName, $subscription);
156
+			foreach ($instanceStatus->getSubscriptions() as $subscription) {
157
+							$this->_persistenceManager->onSubscriptionSeen($instanceName, $subscription);
158
+			}
156 159
 
157 160
 			// Handle subscription state changes
158
-			foreach ($instanceStatus->getSubscriptionStateChanges() as $subscriptionStateChange)
159
-				$this->_persistenceManager->onSubscriptionStateChange($instanceName, $subscriptionStateChange);
161
+			foreach ($instanceStatus->getSubscriptionStateChanges() as $subscriptionStateChange) {
162
+							$this->_persistenceManager->onSubscriptionStateChange($instanceName, $subscriptionStateChange);
163
+			}
160 164
 		}
161 165
 
162 166
 		// Broadcast the status messages to all connected clients
@@ -204,8 +208,7 @@  discard block
 block discarded – undo
204 208
 
205 209
 						$instanceState->setReachability(InstanceState::REACHABLE);
206 210
 					}
207
-				}
208
-				catch (\Exception $e)
211
+				} catch (\Exception $e)
209 212
 				{
210 213
 					// Mark the instance as unreachable
211 214
 					$message = 'Instance {instanceName} not reachable, will wait for {cycles} cycles before retrying.
@@ -219,8 +222,7 @@  discard block
 block discarded – undo
219 222
 
220 223
 					$instanceState->setReachability(InstanceState::UNREACHABLE);
221 224
 				}
222
-			}
223
-			else
225
+			} else
224 226
 			{
225 227
 				// Wait for some cycles and then mark unreachable instances as maybe reachable
226 228
 				if ($instanceState->getRetryCount() === self::UNREACHABLE_CYCLES_UNTIL_RETRY - 1)
@@ -231,9 +233,9 @@  discard block
 block discarded – undo
231 233
 					$this->_logger->info('Retrying instance {instanceName} during next cycle', [
232 234
 						'instanceName' => $instanceName,
233 235
 					]);
236
+				} else {
237
+									$instanceState->incrementRetryCount();
234 238
 				}
235
-				else
236
-					$instanceState->incrementRetryCount();
237 239
 			}
238 240
 		}
239 241
 
Please login to merge, or discard this patch.