Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Instance often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Instance, and based on these observations, apply Extract Interface, too.
| 1 | <?php  | 
            ||
| 42 | abstract class Instance implements ActiveRecordInterface  | 
            ||
| 43 | { | 
            ||
| 44 | /**  | 
            ||
| 45 | * TableMap class name  | 
            ||
| 46 | */  | 
            ||
| 47 | const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\InstanceTableMap';  | 
            ||
| 48 | |||
| 49 | |||
| 50 | /**  | 
            ||
| 51 | * attribute to determine if this object has previously been saved.  | 
            ||
| 52 | * @var boolean  | 
            ||
| 53 | */  | 
            ||
| 54 | protected $new = true;  | 
            ||
| 55 | |||
| 56 | /**  | 
            ||
| 57 | * attribute to determine whether this object has been deleted.  | 
            ||
| 58 | * @var boolean  | 
            ||
| 59 | */  | 
            ||
| 60 | protected $deleted = false;  | 
            ||
| 61 | |||
| 62 | /**  | 
            ||
| 63 | * The columns that have been modified in current object.  | 
            ||
| 64 | * Tracking modified columns allows us to only update modified columns.  | 
            ||
| 65 | * @var array  | 
            ||
| 66 | */  | 
            ||
| 67 | protected $modifiedColumns = array();  | 
            ||
| 68 | |||
| 69 | /**  | 
            ||
| 70 | * The (virtual) columns that are added at runtime  | 
            ||
| 71 | * The formatters can add supplementary columns based on a resultset  | 
            ||
| 72 | * @var array  | 
            ||
| 73 | */  | 
            ||
| 74 | protected $virtualColumns = array();  | 
            ||
| 75 | |||
| 76 | /**  | 
            ||
| 77 | * The value for the name field.  | 
            ||
| 78 | *  | 
            ||
| 79 | * @var string  | 
            ||
| 80 | */  | 
            ||
| 81 | protected $name;  | 
            ||
| 82 | |||
| 83 | /**  | 
            ||
| 84 | * @var ObjectCollection|ChildUser[] Collection to store aggregation of ChildUser objects.  | 
            ||
| 85 | */  | 
            ||
| 86 | protected $collUsers;  | 
            ||
| 87 | protected $collUsersPartial;  | 
            ||
| 88 | |||
| 89 | /**  | 
            ||
| 90 | * @var ObjectCollection|ChildConnection[] Collection to store aggregation of ChildConnection objects.  | 
            ||
| 91 | */  | 
            ||
| 92 | protected $collConnections;  | 
            ||
| 93 | protected $collConnectionsPartial;  | 
            ||
| 94 | |||
| 95 | /**  | 
            ||
| 96 | * @var ObjectCollection|ChildChannel[] Collection to store aggregation of ChildChannel objects.  | 
            ||
| 97 | */  | 
            ||
| 98 | protected $collChannels;  | 
            ||
| 99 | protected $collChannelsPartial;  | 
            ||
| 100 | |||
| 101 | /**  | 
            ||
| 102 | * @var ObjectCollection|ChildSubscription[] Collection to store aggregation of ChildSubscription objects.  | 
            ||
| 103 | */  | 
            ||
| 104 | protected $collSubscriptions;  | 
            ||
| 105 | protected $collSubscriptionsPartial;  | 
            ||
| 106 | |||
| 107 | /**  | 
            ||
| 108 | * Flag to prevent endless save loop, if this object is referenced  | 
            ||
| 109 | * by another object which falls in this transaction.  | 
            ||
| 110 | *  | 
            ||
| 111 | * @var boolean  | 
            ||
| 112 | */  | 
            ||
| 113 | protected $alreadyInSave = false;  | 
            ||
| 114 | |||
| 115 | /**  | 
            ||
| 116 | * An array of objects scheduled for deletion.  | 
            ||
| 117 | * @var ObjectCollection|ChildUser[]  | 
            ||
| 118 | */  | 
            ||
| 119 | protected $usersScheduledForDeletion = null;  | 
            ||
| 120 | |||
| 121 | /**  | 
            ||
| 122 | * An array of objects scheduled for deletion.  | 
            ||
| 123 | * @var ObjectCollection|ChildConnection[]  | 
            ||
| 124 | */  | 
            ||
| 125 | protected $connectionsScheduledForDeletion = null;  | 
            ||
| 126 | |||
| 127 | /**  | 
            ||
| 128 | * An array of objects scheduled for deletion.  | 
            ||
| 129 | * @var ObjectCollection|ChildChannel[]  | 
            ||
| 130 | */  | 
            ||
| 131 | protected $channelsScheduledForDeletion = null;  | 
            ||
| 132 | |||
| 133 | /**  | 
            ||
| 134 | * An array of objects scheduled for deletion.  | 
            ||
| 135 | * @var ObjectCollection|ChildSubscription[]  | 
            ||
| 136 | */  | 
            ||
| 137 | protected $subscriptionsScheduledForDeletion = null;  | 
            ||
| 138 | |||
| 139 | /**  | 
            ||
| 140 | * Initializes internal state of Jalle19\StatusManager\Database\Base\Instance object.  | 
            ||
| 141 | */  | 
            ||
| 142 | public function __construct()  | 
            ||
| 145 | |||
| 146 | /**  | 
            ||
| 147 | * Returns whether the object has been modified.  | 
            ||
| 148 | *  | 
            ||
| 149 | * @return boolean True if the object has been modified.  | 
            ||
| 150 | */  | 
            ||
| 151 | public function isModified()  | 
            ||
| 155 | |||
| 156 | /**  | 
            ||
| 157 | * Has specified column been modified?  | 
            ||
| 158 | *  | 
            ||
| 159 | * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID  | 
            ||
| 160 | * @return boolean True if $col has been modified.  | 
            ||
| 161 | */  | 
            ||
| 162 | public function isColumnModified($col)  | 
            ||
| 166 | |||
| 167 | /**  | 
            ||
| 168 | * Get the columns that have been modified in this object.  | 
            ||
| 169 | * @return array A unique list of the modified column names for this object.  | 
            ||
| 170 | */  | 
            ||
| 171 | public function getModifiedColumns()  | 
            ||
| 175 | |||
| 176 | /**  | 
            ||
| 177 | * Returns whether the object has ever been saved. This will  | 
            ||
| 178 | * be false, if the object was retrieved from storage or was created  | 
            ||
| 179 | * and then saved.  | 
            ||
| 180 | *  | 
            ||
| 181 | * @return boolean true, if the object has never been persisted.  | 
            ||
| 182 | */  | 
            ||
| 183 | public function isNew()  | 
            ||
| 187 | |||
| 188 | /**  | 
            ||
| 189 | * Setter for the isNew attribute. This method will be called  | 
            ||
| 190 | * by Propel-generated children and objects.  | 
            ||
| 191 | *  | 
            ||
| 192 | * @param boolean $b the state of the object.  | 
            ||
| 193 | */  | 
            ||
| 194 | public function setNew($b)  | 
            ||
| 198 | |||
| 199 | /**  | 
            ||
| 200 | * Whether this object has been deleted.  | 
            ||
| 201 | * @return boolean The deleted state of this object.  | 
            ||
| 202 | */  | 
            ||
| 203 | public function isDeleted()  | 
            ||
| 207 | |||
| 208 | /**  | 
            ||
| 209 | * Specify whether this object has been deleted.  | 
            ||
| 210 | * @param boolean $b The deleted state of this object.  | 
            ||
| 211 | * @return void  | 
            ||
| 212 | */  | 
            ||
| 213 | public function setDeleted($b)  | 
            ||
| 217 | |||
| 218 | /**  | 
            ||
| 219 | * Sets the modified state for the object to be false.  | 
            ||
| 220 | * @param string $col If supplied, only the specified column is reset.  | 
            ||
| 221 | * @return void  | 
            ||
| 222 | */  | 
            ||
| 223 | View Code Duplication | public function resetModified($col = null)  | 
            |
| 233 | |||
| 234 | /**  | 
            ||
| 235 | * Compares this with another <code>Instance</code> instance. If  | 
            ||
| 236 | * <code>obj</code> is an instance of <code>Instance</code>, delegates to  | 
            ||
| 237 | * <code>equals(Instance)</code>. Otherwise, returns <code>false</code>.  | 
            ||
| 238 | *  | 
            ||
| 239 | * @param mixed $obj The object to compare to.  | 
            ||
| 240 | * @return boolean Whether equal to the object specified.  | 
            ||
| 241 | */  | 
            ||
| 242 | View Code Duplication | public function equals($obj)  | 
            |
| 258 | |||
| 259 | /**  | 
            ||
| 260 | * Get the associative array of the virtual columns in this object  | 
            ||
| 261 | *  | 
            ||
| 262 | * @return array  | 
            ||
| 263 | */  | 
            ||
| 264 | public function getVirtualColumns()  | 
            ||
| 268 | |||
| 269 | /**  | 
            ||
| 270 | * Checks the existence of a virtual column in this object  | 
            ||
| 271 | *  | 
            ||
| 272 | * @param string $name The virtual column name  | 
            ||
| 273 | * @return boolean  | 
            ||
| 274 | */  | 
            ||
| 275 | public function hasVirtualColumn($name)  | 
            ||
| 279 | |||
| 280 | /**  | 
            ||
| 281 | * Get the value of a virtual column in this object  | 
            ||
| 282 | *  | 
            ||
| 283 | * @param string $name The virtual column name  | 
            ||
| 284 | * @return mixed  | 
            ||
| 285 | *  | 
            ||
| 286 | * @throws PropelException  | 
            ||
| 287 | */  | 
            ||
| 288 | View Code Duplication | public function getVirtualColumn($name)  | 
            |
| 296 | |||
| 297 | /**  | 
            ||
| 298 | * Set the value of a virtual column in this object  | 
            ||
| 299 | *  | 
            ||
| 300 | * @param string $name The virtual column name  | 
            ||
| 301 | * @param mixed $value The value to give to the virtual column  | 
            ||
| 302 | *  | 
            ||
| 303 | * @return $this|Instance The current object, for fluid interface  | 
            ||
| 304 | */  | 
            ||
| 305 | public function setVirtualColumn($name, $value)  | 
            ||
| 311 | |||
| 312 | /**  | 
            ||
| 313 | * Logs a message using Propel::log().  | 
            ||
| 314 | *  | 
            ||
| 315 | * @param string $msg  | 
            ||
| 316 | * @param int $priority One of the Propel::LOG_* logging levels  | 
            ||
| 317 | * @return boolean  | 
            ||
| 318 | */  | 
            ||
| 319 | protected function log($msg, $priority = Propel::LOG_INFO)  | 
            ||
| 323 | |||
| 324 | /**  | 
            ||
| 325 | * Export the current object properties to a string, using a given parser format  | 
            ||
| 326 | * <code>  | 
            ||
| 327 | * $book = BookQuery::create()->findPk(9012);  | 
            ||
| 328 |      * echo $book->exportTo('JSON'); | 
            ||
| 329 |      *  => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); | 
            ||
| 330 | * </code>  | 
            ||
| 331 | *  | 
            ||
| 332 |      * @param  mixed   $parser                 A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') | 
            ||
| 333 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.  | 
            ||
| 334 | * @return string The exported data  | 
            ||
| 335 | */  | 
            ||
| 336 | View Code Duplication | public function exportTo($parser, $includeLazyLoadColumns = true)  | 
            |
| 344 | |||
| 345 | /**  | 
            ||
| 346 | * Clean up internal collections prior to serializing  | 
            ||
| 347 | * Avoids recursive loops that turn into segmentation faults when serializing  | 
            ||
| 348 | */  | 
            ||
| 349 | View Code Duplication | public function __sleep()  | 
            |
| 363 | |||
| 364 | /**  | 
            ||
| 365 | * Get the [name] column value.  | 
            ||
| 366 | *  | 
            ||
| 367 | * @return string  | 
            ||
| 368 | */  | 
            ||
| 369 | public function getName()  | 
            ||
| 373 | |||
| 374 | /**  | 
            ||
| 375 | * Set the value of [name] column.  | 
            ||
| 376 | *  | 
            ||
| 377 | * @param string $v new value  | 
            ||
| 378 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)  | 
            ||
| 379 | */  | 
            ||
| 380 | public function setName($v)  | 
            ||
| 393 | |||
| 394 | /**  | 
            ||
| 395 | * Indicates whether the columns in this object are only set to default values.  | 
            ||
| 396 | *  | 
            ||
| 397 | * This method can be used in conjunction with isModified() to indicate whether an object is both  | 
            ||
| 398 | * modified _and_ has some values set which are non-default.  | 
            ||
| 399 | *  | 
            ||
| 400 | * @return boolean Whether the columns in this object are only been set with default values.  | 
            ||
| 401 | */  | 
            ||
| 402 | public function hasOnlyDefaultValues()  | 
            ||
| 407 | |||
| 408 | /**  | 
            ||
| 409 | * Hydrates (populates) the object variables with values from the database resultset.  | 
            ||
| 410 | *  | 
            ||
| 411 | * An offset (0-based "start column") is specified so that objects can be hydrated  | 
            ||
| 412 | * with a subset of the columns in the resultset rows. This is needed, for example,  | 
            ||
| 413 | * for results of JOIN queries where the resultset row includes columns from two or  | 
            ||
| 414 | * more tables.  | 
            ||
| 415 | *  | 
            ||
| 416 | * @param array $row The row returned by DataFetcher->fetch().  | 
            ||
| 417 | * @param int $startcol 0-based offset column which indicates which restultset column to start with.  | 
            ||
| 418 | * @param boolean $rehydrate Whether this object is being re-hydrated from the database.  | 
            ||
| 419 | * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().  | 
            ||
| 420 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME  | 
            ||
| 421 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.  | 
            ||
| 422 | *  | 
            ||
| 423 | * @return int next starting column  | 
            ||
| 424 | * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.  | 
            ||
| 425 | */  | 
            ||
| 426 | public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM)  | 
            ||
| 446 | |||
| 447 | /**  | 
            ||
| 448 | * Checks and repairs the internal consistency of the object.  | 
            ||
| 449 | *  | 
            ||
| 450 | * This method is executed after an already-instantiated object is re-hydrated  | 
            ||
| 451 | * from the database. It exists to check any foreign keys to make sure that  | 
            ||
| 452 | * the objects related to the current object are correct based on foreign key.  | 
            ||
| 453 | *  | 
            ||
| 454 | * You can override this method in the stub class, but you should always invoke  | 
            ||
| 455 | * the base method from the overridden method (i.e. parent::ensureConsistency()),  | 
            ||
| 456 | * in case your model changes.  | 
            ||
| 457 | *  | 
            ||
| 458 | * @throws PropelException  | 
            ||
| 459 | */  | 
            ||
| 460 | public function ensureConsistency()  | 
            ||
| 463 | |||
| 464 | /**  | 
            ||
| 465 | * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.  | 
            ||
| 466 | *  | 
            ||
| 467 | * This will only work if the object has been saved and has a valid primary key set.  | 
            ||
| 468 | *  | 
            ||
| 469 | * @param boolean $deep (optional) Whether to also de-associated any related objects.  | 
            ||
| 470 | * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use.  | 
            ||
| 471 | * @return void  | 
            ||
| 472 | * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db  | 
            ||
| 473 | */  | 
            ||
| 474 | View Code Duplication | public function reload($deep = false, ConnectionInterface $con = null)  | 
            |
| 511 | |||
| 512 | /**  | 
            ||
| 513 | * Removes this object from datastore and sets delete attribute.  | 
            ||
| 514 | *  | 
            ||
| 515 | * @param ConnectionInterface $con  | 
            ||
| 516 | * @return void  | 
            ||
| 517 | * @throws PropelException  | 
            ||
| 518 | * @see Instance::setDeleted()  | 
            ||
| 519 | * @see Instance::isDeleted()  | 
            ||
| 520 | */  | 
            ||
| 521 | View Code Duplication | public function delete(ConnectionInterface $con = null)  | 
            |
| 542 | |||
| 543 | /**  | 
            ||
| 544 | * Persists this object to the database.  | 
            ||
| 545 | *  | 
            ||
| 546 | * If the object is new, it inserts it; otherwise an update is performed.  | 
            ||
| 547 | * All modified related objects will also be persisted in the doSave()  | 
            ||
| 548 | * method. This method wraps all precipitate database operations in a  | 
            ||
| 549 | * single transaction.  | 
            ||
| 550 | *  | 
            ||
| 551 | * @param ConnectionInterface $con  | 
            ||
| 552 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.  | 
            ||
| 553 | * @throws PropelException  | 
            ||
| 554 | * @see doSave()  | 
            ||
| 555 | */  | 
            ||
| 556 | View Code Duplication | public function save(ConnectionInterface $con = null)  | 
            |
| 590 | |||
| 591 | /**  | 
            ||
| 592 | * Performs the work of inserting or updating the row in the database.  | 
            ||
| 593 | *  | 
            ||
| 594 | * If the object is new, it inserts it; otherwise an update is performed.  | 
            ||
| 595 | * All related objects are also updated in this method.  | 
            ||
| 596 | *  | 
            ||
| 597 | * @param ConnectionInterface $con  | 
            ||
| 598 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.  | 
            ||
| 599 | * @throws PropelException  | 
            ||
| 600 | * @see save()  | 
            ||
| 601 | */  | 
            ||
| 602 | protected function doSave(ConnectionInterface $con)  | 
            ||
| 693 | |||
| 694 | /**  | 
            ||
| 695 | * Insert the row in the database.  | 
            ||
| 696 | *  | 
            ||
| 697 | * @param ConnectionInterface $con  | 
            ||
| 698 | *  | 
            ||
| 699 | * @throws PropelException  | 
            ||
| 700 | * @see doSave()  | 
            ||
| 701 | */  | 
            ||
| 702 | protected function doInsert(ConnectionInterface $con)  | 
            ||
| 736 | |||
| 737 | /**  | 
            ||
| 738 | * Update the row in the database.  | 
            ||
| 739 | *  | 
            ||
| 740 | * @param ConnectionInterface $con  | 
            ||
| 741 | *  | 
            ||
| 742 | * @return Integer Number of updated rows  | 
            ||
| 743 | * @see doSave()  | 
            ||
| 744 | */  | 
            ||
| 745 | protected function doUpdate(ConnectionInterface $con)  | 
            ||
| 752 | |||
| 753 | /**  | 
            ||
| 754 | * Retrieves a field from the object by name passed in as a string.  | 
            ||
| 755 | *  | 
            ||
| 756 | * @param string $name name  | 
            ||
| 757 | * @param string $type The type of fieldname the $name is of:  | 
            ||
| 758 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME  | 
            ||
| 759 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.  | 
            ||
| 760 | * Defaults to TableMap::TYPE_PHPNAME.  | 
            ||
| 761 | * @return mixed Value of field.  | 
            ||
| 762 | */  | 
            ||
| 763 | View Code Duplication | public function getByName($name, $type = TableMap::TYPE_PHPNAME)  | 
            |
| 770 | |||
| 771 | /**  | 
            ||
| 772 | * Retrieves a field from the object by Position as specified in the xml schema.  | 
            ||
| 773 | * Zero-based.  | 
            ||
| 774 | *  | 
            ||
| 775 | * @param int $pos position in xml schema  | 
            ||
| 776 | * @return mixed Value of field at $pos  | 
            ||
| 777 | */  | 
            ||
| 778 | public function getByPosition($pos)  | 
            ||
| 789 | |||
| 790 | /**  | 
            ||
| 791 | * Exports the object as an array.  | 
            ||
| 792 | *  | 
            ||
| 793 | * You can specify the key type of the array by passing one of the class  | 
            ||
| 794 | * type constants.  | 
            ||
| 795 | *  | 
            ||
| 796 | * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,  | 
            ||
| 797 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.  | 
            ||
| 798 | * Defaults to TableMap::TYPE_PHPNAME.  | 
            ||
| 799 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.  | 
            ||
| 800 | * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion  | 
            ||
| 801 | * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.  | 
            ||
| 802 | *  | 
            ||
| 803 | * @return array an associative array containing the field names (as keys) and field values  | 
            ||
| 804 | */  | 
            ||
| 805 | public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)  | 
            ||
| 886 | |||
| 887 | /**  | 
            ||
| 888 | * Sets a field from the object by name passed in as a string.  | 
            ||
| 889 | *  | 
            ||
| 890 | * @param string $name  | 
            ||
| 891 | * @param mixed $value field value  | 
            ||
| 892 | * @param string $type The type of fieldname the $name is of:  | 
            ||
| 893 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME  | 
            ||
| 894 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.  | 
            ||
| 895 | * Defaults to TableMap::TYPE_PHPNAME.  | 
            ||
| 896 | * @return $this|\Jalle19\StatusManager\Database\Instance  | 
            ||
| 897 | */  | 
            ||
| 898 | public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME)  | 
            ||
| 904 | |||
| 905 | /**  | 
            ||
| 906 | * Sets a field from the object by Position as specified in the xml schema.  | 
            ||
| 907 | * Zero-based.  | 
            ||
| 908 | *  | 
            ||
| 909 | * @param int $pos position in xml schema  | 
            ||
| 910 | * @param mixed $value field value  | 
            ||
| 911 | * @return $this|\Jalle19\StatusManager\Database\Instance  | 
            ||
| 912 | */  | 
            ||
| 913 | public function setByPosition($pos, $value)  | 
            ||
| 923 | |||
| 924 | /**  | 
            ||
| 925 | * Populates the object using an array.  | 
            ||
| 926 | *  | 
            ||
| 927 | * This is particularly useful when populating an object from one of the  | 
            ||
| 928 | * request arrays (e.g. $_POST). This method goes through the column  | 
            ||
| 929 | * names, checking to see whether a matching key exists in populated  | 
            ||
| 930 | * array. If so the setByName() method is called for that column.  | 
            ||
| 931 | *  | 
            ||
| 932 | * You can specify the key type of the array by additionally passing one  | 
            ||
| 933 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,  | 
            ||
| 934 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.  | 
            ||
| 935 | * The default key type is the column's TableMap::TYPE_PHPNAME.  | 
            ||
| 936 | *  | 
            ||
| 937 | * @param array $arr An array to populate the object from.  | 
            ||
| 938 | * @param string $keyType The type of keys the array uses.  | 
            ||
| 939 | * @return void  | 
            ||
| 940 | */  | 
            ||
| 941 | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME)  | 
            ||
| 949 | |||
| 950 | /**  | 
            ||
| 951 | * Populate the current object from a string, using a given parser format  | 
            ||
| 952 | * <code>  | 
            ||
| 953 | * $book = new Book();  | 
            ||
| 954 |      * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); | 
            ||
| 955 | * </code>  | 
            ||
| 956 | *  | 
            ||
| 957 | * You can specify the key type of the array by additionally passing one  | 
            ||
| 958 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME,  | 
            ||
| 959 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.  | 
            ||
| 960 | * The default key type is the column's TableMap::TYPE_PHPNAME.  | 
            ||
| 961 | *  | 
            ||
| 962 | * @param mixed $parser A AbstractParser instance,  | 
            ||
| 963 |      *                       or a format name ('XML', 'YAML', 'JSON', 'CSV') | 
            ||
| 964 | * @param string $data The source data to import from  | 
            ||
| 965 | * @param string $keyType The type of keys the array uses.  | 
            ||
| 966 | *  | 
            ||
| 967 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object, for fluid interface  | 
            ||
| 968 | */  | 
            ||
| 969 | View Code Duplication | public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME)  | 
            |
| 979 | |||
| 980 | /**  | 
            ||
| 981 | * Build a Criteria object containing the values of all modified columns in this object.  | 
            ||
| 982 | *  | 
            ||
| 983 | * @return Criteria The Criteria object containing all modified values.  | 
            ||
| 984 | */  | 
            ||
| 985 | public function buildCriteria()  | 
            ||
| 995 | |||
| 996 | /**  | 
            ||
| 997 | * Builds a Criteria object containing the primary key for this object.  | 
            ||
| 998 | *  | 
            ||
| 999 | * Unlike buildCriteria() this method includes the primary key values regardless  | 
            ||
| 1000 | * of whether or not they have been modified.  | 
            ||
| 1001 | *  | 
            ||
| 1002 | * @throws LogicException if no primary key is defined  | 
            ||
| 1003 | *  | 
            ||
| 1004 | * @return Criteria The Criteria object containing value(s) for primary key(s).  | 
            ||
| 1005 | */  | 
            ||
| 1006 | public function buildPkeyCriteria()  | 
            ||
| 1013 | |||
| 1014 | /**  | 
            ||
| 1015 | * If the primary key is not null, return the hashcode of the  | 
            ||
| 1016 | * primary key. Otherwise, return the hash code of the object.  | 
            ||
| 1017 | *  | 
            ||
| 1018 | * @return int Hashcode  | 
            ||
| 1019 | */  | 
            ||
| 1020 | View Code Duplication | public function hashCode()  | 
            |
| 1035 | |||
| 1036 | /**  | 
            ||
| 1037 | * Returns the primary key for this object (row).  | 
            ||
| 1038 | * @return string  | 
            ||
| 1039 | */  | 
            ||
| 1040 | public function getPrimaryKey()  | 
            ||
| 1044 | |||
| 1045 | /**  | 
            ||
| 1046 | * Generic method to set the primary key (name column).  | 
            ||
| 1047 | *  | 
            ||
| 1048 | * @param string $key Primary key.  | 
            ||
| 1049 | * @return void  | 
            ||
| 1050 | */  | 
            ||
| 1051 | public function setPrimaryKey($key)  | 
            ||
| 1055 | |||
| 1056 | /**  | 
            ||
| 1057 | * Returns true if the primary key for this object is null.  | 
            ||
| 1058 | * @return boolean  | 
            ||
| 1059 | */  | 
            ||
| 1060 | public function isPrimaryKeyNull()  | 
            ||
| 1064 | |||
| 1065 | /**  | 
            ||
| 1066 | * Sets contents of passed object to values from current object.  | 
            ||
| 1067 | *  | 
            ||
| 1068 | * If desired, this method can also make copies of all associated (fkey referrers)  | 
            ||
| 1069 | * objects.  | 
            ||
| 1070 | *  | 
            ||
| 1071 | * @param object $copyObj An object of \Jalle19\StatusManager\Database\Instance (or compatible) type.  | 
            ||
| 1072 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.  | 
            ||
| 1073 | * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.  | 
            ||
| 1074 | * @throws PropelException  | 
            ||
| 1075 | */  | 
            ||
| 1076 | public function copyInto($copyObj, $deepCopy = false, $makeNew = true)  | 
            ||
| 1115 | |||
| 1116 | /**  | 
            ||
| 1117 | * Makes a copy of this object that will be inserted as a new row in table when saved.  | 
            ||
| 1118 | * It creates a new object filling in the simple attributes, but skipping any primary  | 
            ||
| 1119 | * keys that are defined for the table.  | 
            ||
| 1120 | *  | 
            ||
| 1121 | * If desired, this method can also make copies of all associated (fkey referrers)  | 
            ||
| 1122 | * objects.  | 
            ||
| 1123 | *  | 
            ||
| 1124 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.  | 
            ||
| 1125 | * @return \Jalle19\StatusManager\Database\Instance Clone of current object.  | 
            ||
| 1126 | * @throws PropelException  | 
            ||
| 1127 | */  | 
            ||
| 1128 | View Code Duplication | public function copy($deepCopy = false)  | 
            |
| 1137 | |||
| 1138 | |||
| 1139 | /**  | 
            ||
| 1140 | * Initializes a collection based on the name of a relation.  | 
            ||
| 1141 | * Avoids crafting an 'init[$relationName]s' method name  | 
            ||
| 1142 | * that wouldn't work when StandardEnglishPluralizer is used.  | 
            ||
| 1143 | *  | 
            ||
| 1144 | * @param string $relationName The name of the relation to initialize  | 
            ||
| 1145 | * @return void  | 
            ||
| 1146 | */  | 
            ||
| 1147 | public function initRelation($relationName)  | 
            ||
| 1162 | |||
| 1163 | /**  | 
            ||
| 1164 | * Clears out the collUsers collection  | 
            ||
| 1165 | *  | 
            ||
| 1166 | * This does not modify the database; however, it will remove any associated objects, causing  | 
            ||
| 1167 | * them to be refetched by subsequent calls to accessor method.  | 
            ||
| 1168 | *  | 
            ||
| 1169 | * @return void  | 
            ||
| 1170 | * @see addUsers()  | 
            ||
| 1171 | */  | 
            ||
| 1172 | public function clearUsers()  | 
            ||
| 1176 | |||
| 1177 | /**  | 
            ||
| 1178 | * Reset is the collUsers collection loaded partially.  | 
            ||
| 1179 | */  | 
            ||
| 1180 | public function resetPartialUsers($v = true)  | 
            ||
| 1184 | |||
| 1185 | /**  | 
            ||
| 1186 | * Initializes the collUsers collection.  | 
            ||
| 1187 | *  | 
            ||
| 1188 | * By default this just sets the collUsers collection to an empty array (like clearcollUsers());  | 
            ||
| 1189 | * however, you may wish to override this method in your stub class to provide setting appropriate  | 
            ||
| 1190 | * to your application -- for example, setting the initial array to the values stored in database.  | 
            ||
| 1191 | *  | 
            ||
| 1192 | * @param boolean $overrideExisting If set to true, the method call initializes  | 
            ||
| 1193 | * the collection even if it is not empty  | 
            ||
| 1194 | *  | 
            ||
| 1195 | * @return void  | 
            ||
| 1196 | */  | 
            ||
| 1197 | View Code Duplication | public function initUsers($overrideExisting = true)  | 
            |
| 1208 | |||
| 1209 | /**  | 
            ||
| 1210 | * Gets an array of ChildUser objects which contain a foreign key that references this object.  | 
            ||
| 1211 | *  | 
            ||
| 1212 | * If the $criteria is not null, it is used to always fetch the results from the database.  | 
            ||
| 1213 | * Otherwise the results are fetched from the database the first time, then cached.  | 
            ||
| 1214 | * Next time the same method is called without $criteria, the cached collection is returned.  | 
            ||
| 1215 | * If this ChildInstance is new, it will return  | 
            ||
| 1216 | * an empty collection or the current collection; the criteria is ignored on a new object.  | 
            ||
| 1217 | *  | 
            ||
| 1218 | * @param Criteria $criteria optional Criteria object to narrow the query  | 
            ||
| 1219 | * @param ConnectionInterface $con optional connection object  | 
            ||
| 1220 | * @return ObjectCollection|ChildUser[] List of ChildUser objects  | 
            ||
| 1221 | * @throws PropelException  | 
            ||
| 1222 | */  | 
            ||
| 1223 | View Code Duplication | public function getUsers(Criteria $criteria = null, ConnectionInterface $con = null)  | 
            |
| 1266 | |||
| 1267 | /**  | 
            ||
| 1268 | * Sets a collection of ChildUser objects related by a one-to-many relationship  | 
            ||
| 1269 | * to the current object.  | 
            ||
| 1270 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted)  | 
            ||
| 1271 | * and new objects from the given Propel collection.  | 
            ||
| 1272 | *  | 
            ||
| 1273 | * @param Collection $users A Propel collection.  | 
            ||
| 1274 | * @param ConnectionInterface $con Optional connection object  | 
            ||
| 1275 | * @return $this|ChildInstance The current object (for fluent API support)  | 
            ||
| 1276 | */  | 
            ||
| 1277 | public function setUsers(Collection $users, ConnectionInterface $con = null)  | 
            ||
| 1299 | |||
| 1300 | /**  | 
            ||
| 1301 | * Returns the number of related User objects.  | 
            ||
| 1302 | *  | 
            ||
| 1303 | * @param Criteria $criteria  | 
            ||
| 1304 | * @param boolean $distinct  | 
            ||
| 1305 | * @param ConnectionInterface $con  | 
            ||
| 1306 | * @return int Count of related User objects.  | 
            ||
| 1307 | * @throws PropelException  | 
            ||
| 1308 | */  | 
            ||
| 1309 | View Code Duplication | public function countUsers(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)  | 
            |
| 1333 | |||
| 1334 | /**  | 
            ||
| 1335 | * Method called to associate a ChildUser object to this object  | 
            ||
| 1336 | * through the ChildUser foreign key attribute.  | 
            ||
| 1337 | *  | 
            ||
| 1338 | * @param ChildUser $l ChildUser  | 
            ||
| 1339 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)  | 
            ||
| 1340 | */  | 
            ||
| 1341 | public function addUser(ChildUser $l)  | 
            ||
| 1358 | |||
| 1359 | /**  | 
            ||
| 1360 | * @param ChildUser $user The ChildUser object to add.  | 
            ||
| 1361 | */  | 
            ||
| 1362 | protected function doAddUser(ChildUser $user)  | 
            ||
| 1367 | |||
| 1368 | /**  | 
            ||
| 1369 | * @param ChildUser $user The ChildUser object to remove.  | 
            ||
| 1370 | * @return $this|ChildInstance The current object (for fluent API support)  | 
            ||
| 1371 | */  | 
            ||
| 1372 | public function removeUser(ChildUser $user)  | 
            ||
| 1387 | |||
| 1388 | /**  | 
            ||
| 1389 | * Clears out the collConnections collection  | 
            ||
| 1390 | *  | 
            ||
| 1391 | * This does not modify the database; however, it will remove any associated objects, causing  | 
            ||
| 1392 | * them to be refetched by subsequent calls to accessor method.  | 
            ||
| 1393 | *  | 
            ||
| 1394 | * @return void  | 
            ||
| 1395 | * @see addConnections()  | 
            ||
| 1396 | */  | 
            ||
| 1397 | public function clearConnections()  | 
            ||
| 1401 | |||
| 1402 | /**  | 
            ||
| 1403 | * Reset is the collConnections collection loaded partially.  | 
            ||
| 1404 | */  | 
            ||
| 1405 | public function resetPartialConnections($v = true)  | 
            ||
| 1409 | |||
| 1410 | /**  | 
            ||
| 1411 | * Initializes the collConnections collection.  | 
            ||
| 1412 | *  | 
            ||
| 1413 | * By default this just sets the collConnections collection to an empty array (like clearcollConnections());  | 
            ||
| 1414 | * however, you may wish to override this method in your stub class to provide setting appropriate  | 
            ||
| 1415 | * to your application -- for example, setting the initial array to the values stored in database.  | 
            ||
| 1416 | *  | 
            ||
| 1417 | * @param boolean $overrideExisting If set to true, the method call initializes  | 
            ||
| 1418 | * the collection even if it is not empty  | 
            ||
| 1419 | *  | 
            ||
| 1420 | * @return void  | 
            ||
| 1421 | */  | 
            ||
| 1422 | View Code Duplication | public function initConnections($overrideExisting = true)  | 
            |
| 1433 | |||
| 1434 | /**  | 
            ||
| 1435 | * Gets an array of ChildConnection objects which contain a foreign key that references this object.  | 
            ||
| 1436 | *  | 
            ||
| 1437 | * If the $criteria is not null, it is used to always fetch the results from the database.  | 
            ||
| 1438 | * Otherwise the results are fetched from the database the first time, then cached.  | 
            ||
| 1439 | * Next time the same method is called without $criteria, the cached collection is returned.  | 
            ||
| 1440 | * If this ChildInstance is new, it will return  | 
            ||
| 1441 | * an empty collection or the current collection; the criteria is ignored on a new object.  | 
            ||
| 1442 | *  | 
            ||
| 1443 | * @param Criteria $criteria optional Criteria object to narrow the query  | 
            ||
| 1444 | * @param ConnectionInterface $con optional connection object  | 
            ||
| 1445 | * @return ObjectCollection|ChildConnection[] List of ChildConnection objects  | 
            ||
| 1446 | * @throws PropelException  | 
            ||
| 1447 | */  | 
            ||
| 1448 | View Code Duplication | public function getConnections(Criteria $criteria = null, ConnectionInterface $con = null)  | 
            |
| 1491 | |||
| 1492 | /**  | 
            ||
| 1493 | * Sets a collection of ChildConnection objects related by a one-to-many relationship  | 
            ||
| 1494 | * to the current object.  | 
            ||
| 1495 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted)  | 
            ||
| 1496 | * and new objects from the given Propel collection.  | 
            ||
| 1497 | *  | 
            ||
| 1498 | * @param Collection $connections A Propel collection.  | 
            ||
| 1499 | * @param ConnectionInterface $con Optional connection object  | 
            ||
| 1500 | * @return $this|ChildInstance The current object (for fluent API support)  | 
            ||
| 1501 | */  | 
            ||
| 1502 | View Code Duplication | public function setConnections(Collection $connections, ConnectionInterface $con = null)  | 
            |
| 1524 | |||
| 1525 | /**  | 
            ||
| 1526 | * Returns the number of related Connection objects.  | 
            ||
| 1527 | *  | 
            ||
| 1528 | * @param Criteria $criteria  | 
            ||
| 1529 | * @param boolean $distinct  | 
            ||
| 1530 | * @param ConnectionInterface $con  | 
            ||
| 1531 | * @return int Count of related Connection objects.  | 
            ||
| 1532 | * @throws PropelException  | 
            ||
| 1533 | */  | 
            ||
| 1534 | View Code Duplication | public function countConnections(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)  | 
            |
| 1558 | |||
| 1559 | /**  | 
            ||
| 1560 | * Method called to associate a ChildConnection object to this object  | 
            ||
| 1561 | * through the ChildConnection foreign key attribute.  | 
            ||
| 1562 | *  | 
            ||
| 1563 | * @param ChildConnection $l ChildConnection  | 
            ||
| 1564 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)  | 
            ||
| 1565 | */  | 
            ||
| 1566 | View Code Duplication | public function addConnection(ChildConnection $l)  | 
            |
| 1583 | |||
| 1584 | /**  | 
            ||
| 1585 | * @param ChildConnection $connection The ChildConnection object to add.  | 
            ||
| 1586 | */  | 
            ||
| 1587 | protected function doAddConnection(ChildConnection $connection)  | 
            ||
| 1592 | |||
| 1593 | /**  | 
            ||
| 1594 | * @param ChildConnection $connection The ChildConnection object to remove.  | 
            ||
| 1595 | * @return $this|ChildInstance The current object (for fluent API support)  | 
            ||
| 1596 | */  | 
            ||
| 1597 | View Code Duplication | public function removeConnection(ChildConnection $connection)  | 
            |
| 1612 | |||
| 1613 | |||
| 1614 | /**  | 
            ||
| 1615 | * If this collection has already been initialized with  | 
            ||
| 1616 | * an identical criteria, it returns the collection.  | 
            ||
| 1617 | * Otherwise if this Instance is new, it will return  | 
            ||
| 1618 | * an empty collection; or if this Instance has previously  | 
            ||
| 1619 | * been saved, it will retrieve related Connections from storage.  | 
            ||
| 1620 | *  | 
            ||
| 1621 | * This method is protected by default in order to keep the public  | 
            ||
| 1622 | * api reasonable. You can provide public methods for those you  | 
            ||
| 1623 | * actually need in Instance.  | 
            ||
| 1624 | *  | 
            ||
| 1625 | * @param Criteria $criteria optional Criteria object to narrow the query  | 
            ||
| 1626 | * @param ConnectionInterface $con optional connection object  | 
            ||
| 1627 | * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)  | 
            ||
| 1628 | * @return ObjectCollection|ChildConnection[] List of ChildConnection objects  | 
            ||
| 1629 | */  | 
            ||
| 1630 | View Code Duplication | public function getConnectionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)  | 
            |
| 1637 | |||
| 1638 | /**  | 
            ||
| 1639 | * Clears out the collChannels collection  | 
            ||
| 1640 | *  | 
            ||
| 1641 | * This does not modify the database; however, it will remove any associated objects, causing  | 
            ||
| 1642 | * them to be refetched by subsequent calls to accessor method.  | 
            ||
| 1643 | *  | 
            ||
| 1644 | * @return void  | 
            ||
| 1645 | * @see addChannels()  | 
            ||
| 1646 | */  | 
            ||
| 1647 | public function clearChannels()  | 
            ||
| 1651 | |||
| 1652 | /**  | 
            ||
| 1653 | * Reset is the collChannels collection loaded partially.  | 
            ||
| 1654 | */  | 
            ||
| 1655 | public function resetPartialChannels($v = true)  | 
            ||
| 1659 | |||
| 1660 | /**  | 
            ||
| 1661 | * Initializes the collChannels collection.  | 
            ||
| 1662 | *  | 
            ||
| 1663 | * By default this just sets the collChannels collection to an empty array (like clearcollChannels());  | 
            ||
| 1664 | * however, you may wish to override this method in your stub class to provide setting appropriate  | 
            ||
| 1665 | * to your application -- for example, setting the initial array to the values stored in database.  | 
            ||
| 1666 | *  | 
            ||
| 1667 | * @param boolean $overrideExisting If set to true, the method call initializes  | 
            ||
| 1668 | * the collection even if it is not empty  | 
            ||
| 1669 | *  | 
            ||
| 1670 | * @return void  | 
            ||
| 1671 | */  | 
            ||
| 1672 | View Code Duplication | public function initChannels($overrideExisting = true)  | 
            |
| 1683 | |||
| 1684 | /**  | 
            ||
| 1685 | * Gets an array of ChildChannel objects which contain a foreign key that references this object.  | 
            ||
| 1686 | *  | 
            ||
| 1687 | * If the $criteria is not null, it is used to always fetch the results from the database.  | 
            ||
| 1688 | * Otherwise the results are fetched from the database the first time, then cached.  | 
            ||
| 1689 | * Next time the same method is called without $criteria, the cached collection is returned.  | 
            ||
| 1690 | * If this ChildInstance is new, it will return  | 
            ||
| 1691 | * an empty collection or the current collection; the criteria is ignored on a new object.  | 
            ||
| 1692 | *  | 
            ||
| 1693 | * @param Criteria $criteria optional Criteria object to narrow the query  | 
            ||
| 1694 | * @param ConnectionInterface $con optional connection object  | 
            ||
| 1695 | * @return ObjectCollection|ChildChannel[] List of ChildChannel objects  | 
            ||
| 1696 | * @throws PropelException  | 
            ||
| 1697 | */  | 
            ||
| 1698 | View Code Duplication | public function getChannels(Criteria $criteria = null, ConnectionInterface $con = null)  | 
            |
| 1741 | |||
| 1742 | /**  | 
            ||
| 1743 | * Sets a collection of ChildChannel objects related by a one-to-many relationship  | 
            ||
| 1744 | * to the current object.  | 
            ||
| 1745 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted)  | 
            ||
| 1746 | * and new objects from the given Propel collection.  | 
            ||
| 1747 | *  | 
            ||
| 1748 | * @param Collection $channels A Propel collection.  | 
            ||
| 1749 | * @param ConnectionInterface $con Optional connection object  | 
            ||
| 1750 | * @return $this|ChildInstance The current object (for fluent API support)  | 
            ||
| 1751 | */  | 
            ||
| 1752 | public function setChannels(Collection $channels, ConnectionInterface $con = null)  | 
            ||
| 1774 | |||
| 1775 | /**  | 
            ||
| 1776 | * Returns the number of related Channel objects.  | 
            ||
| 1777 | *  | 
            ||
| 1778 | * @param Criteria $criteria  | 
            ||
| 1779 | * @param boolean $distinct  | 
            ||
| 1780 | * @param ConnectionInterface $con  | 
            ||
| 1781 | * @return int Count of related Channel objects.  | 
            ||
| 1782 | * @throws PropelException  | 
            ||
| 1783 | */  | 
            ||
| 1784 | View Code Duplication | public function countChannels(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)  | 
            |
| 1808 | |||
| 1809 | /**  | 
            ||
| 1810 | * Method called to associate a ChildChannel object to this object  | 
            ||
| 1811 | * through the ChildChannel foreign key attribute.  | 
            ||
| 1812 | *  | 
            ||
| 1813 | * @param ChildChannel $l ChildChannel  | 
            ||
| 1814 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)  | 
            ||
| 1815 | */  | 
            ||
| 1816 | public function addChannel(ChildChannel $l)  | 
            ||
| 1833 | |||
| 1834 | /**  | 
            ||
| 1835 | * @param ChildChannel $channel The ChildChannel object to add.  | 
            ||
| 1836 | */  | 
            ||
| 1837 | protected function doAddChannel(ChildChannel $channel)  | 
            ||
| 1842 | |||
| 1843 | /**  | 
            ||
| 1844 | * @param ChildChannel $channel The ChildChannel object to remove.  | 
            ||
| 1845 | * @return $this|ChildInstance The current object (for fluent API support)  | 
            ||
| 1846 | */  | 
            ||
| 1847 | public function removeChannel(ChildChannel $channel)  | 
            ||
| 1862 | |||
| 1863 | /**  | 
            ||
| 1864 | * Clears out the collSubscriptions collection  | 
            ||
| 1865 | *  | 
            ||
| 1866 | * This does not modify the database; however, it will remove any associated objects, causing  | 
            ||
| 1867 | * them to be refetched by subsequent calls to accessor method.  | 
            ||
| 1868 | *  | 
            ||
| 1869 | * @return void  | 
            ||
| 1870 | * @see addSubscriptions()  | 
            ||
| 1871 | */  | 
            ||
| 1872 | public function clearSubscriptions()  | 
            ||
| 1876 | |||
| 1877 | /**  | 
            ||
| 1878 | * Reset is the collSubscriptions collection loaded partially.  | 
            ||
| 1879 | */  | 
            ||
| 1880 | public function resetPartialSubscriptions($v = true)  | 
            ||
| 1884 | |||
| 1885 | /**  | 
            ||
| 1886 | * Initializes the collSubscriptions collection.  | 
            ||
| 1887 | *  | 
            ||
| 1888 | * By default this just sets the collSubscriptions collection to an empty array (like clearcollSubscriptions());  | 
            ||
| 1889 | * however, you may wish to override this method in your stub class to provide setting appropriate  | 
            ||
| 1890 | * to your application -- for example, setting the initial array to the values stored in database.  | 
            ||
| 1891 | *  | 
            ||
| 1892 | * @param boolean $overrideExisting If set to true, the method call initializes  | 
            ||
| 1893 | * the collection even if it is not empty  | 
            ||
| 1894 | *  | 
            ||
| 1895 | * @return void  | 
            ||
| 1896 | */  | 
            ||
| 1897 | View Code Duplication | public function initSubscriptions($overrideExisting = true)  | 
            |
| 1908 | |||
| 1909 | /**  | 
            ||
| 1910 | * Gets an array of ChildSubscription objects which contain a foreign key that references this object.  | 
            ||
| 1911 | *  | 
            ||
| 1912 | * If the $criteria is not null, it is used to always fetch the results from the database.  | 
            ||
| 1913 | * Otherwise the results are fetched from the database the first time, then cached.  | 
            ||
| 1914 | * Next time the same method is called without $criteria, the cached collection is returned.  | 
            ||
| 1915 | * If this ChildInstance is new, it will return  | 
            ||
| 1916 | * an empty collection or the current collection; the criteria is ignored on a new object.  | 
            ||
| 1917 | *  | 
            ||
| 1918 | * @param Criteria $criteria optional Criteria object to narrow the query  | 
            ||
| 1919 | * @param ConnectionInterface $con optional connection object  | 
            ||
| 1920 | * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects  | 
            ||
| 1921 | * @throws PropelException  | 
            ||
| 1922 | */  | 
            ||
| 1923 | View Code Duplication | public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null)  | 
            |
| 1966 | |||
| 1967 | /**  | 
            ||
| 1968 | * Sets a collection of ChildSubscription objects related by a one-to-many relationship  | 
            ||
| 1969 | * to the current object.  | 
            ||
| 1970 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted)  | 
            ||
| 1971 | * and new objects from the given Propel collection.  | 
            ||
| 1972 | *  | 
            ||
| 1973 | * @param Collection $subscriptions A Propel collection.  | 
            ||
| 1974 | * @param ConnectionInterface $con Optional connection object  | 
            ||
| 1975 | * @return $this|ChildInstance The current object (for fluent API support)  | 
            ||
| 1976 | */  | 
            ||
| 1977 | public function setSubscriptions(Collection $subscriptions, ConnectionInterface $con = null)  | 
            ||
| 1999 | |||
| 2000 | /**  | 
            ||
| 2001 | * Returns the number of related Subscription objects.  | 
            ||
| 2002 | *  | 
            ||
| 2003 | * @param Criteria $criteria  | 
            ||
| 2004 | * @param boolean $distinct  | 
            ||
| 2005 | * @param ConnectionInterface $con  | 
            ||
| 2006 | * @return int Count of related Subscription objects.  | 
            ||
| 2007 | * @throws PropelException  | 
            ||
| 2008 | */  | 
            ||
| 2009 | View Code Duplication | public function countSubscriptions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)  | 
            |
| 2033 | |||
| 2034 | /**  | 
            ||
| 2035 | * Method called to associate a ChildSubscription object to this object  | 
            ||
| 2036 | * through the ChildSubscription foreign key attribute.  | 
            ||
| 2037 | *  | 
            ||
| 2038 | * @param ChildSubscription $l ChildSubscription  | 
            ||
| 2039 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support)  | 
            ||
| 2040 | */  | 
            ||
| 2041 | View Code Duplication | public function addSubscription(ChildSubscription $l)  | 
            |
| 2058 | |||
| 2059 | /**  | 
            ||
| 2060 | * @param ChildSubscription $subscription The ChildSubscription object to add.  | 
            ||
| 2061 | */  | 
            ||
| 2062 | protected function doAddSubscription(ChildSubscription $subscription)  | 
            ||
| 2067 | |||
| 2068 | /**  | 
            ||
| 2069 | * @param ChildSubscription $subscription The ChildSubscription object to remove.  | 
            ||
| 2070 | * @return $this|ChildInstance The current object (for fluent API support)  | 
            ||
| 2071 | */  | 
            ||
| 2072 | public function removeSubscription(ChildSubscription $subscription)  | 
            ||
| 2087 | |||
| 2088 | |||
| 2089 | /**  | 
            ||
| 2090 | * If this collection has already been initialized with  | 
            ||
| 2091 | * an identical criteria, it returns the collection.  | 
            ||
| 2092 | * Otherwise if this Instance is new, it will return  | 
            ||
| 2093 | * an empty collection; or if this Instance has previously  | 
            ||
| 2094 | * been saved, it will retrieve related Subscriptions from storage.  | 
            ||
| 2095 | *  | 
            ||
| 2096 | * This method is protected by default in order to keep the public  | 
            ||
| 2097 | * api reasonable. You can provide public methods for those you  | 
            ||
| 2098 | * actually need in Instance.  | 
            ||
| 2099 | *  | 
            ||
| 2100 | * @param Criteria $criteria optional Criteria object to narrow the query  | 
            ||
| 2101 | * @param ConnectionInterface $con optional connection object  | 
            ||
| 2102 | * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)  | 
            ||
| 2103 | * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects  | 
            ||
| 2104 | */  | 
            ||
| 2105 | View Code Duplication | public function getSubscriptionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)  | 
            |
| 2112 | |||
| 2113 | |||
| 2114 | /**  | 
            ||
| 2115 | * If this collection has already been initialized with  | 
            ||
| 2116 | * an identical criteria, it returns the collection.  | 
            ||
| 2117 | * Otherwise if this Instance is new, it will return  | 
            ||
| 2118 | * an empty collection; or if this Instance has previously  | 
            ||
| 2119 | * been saved, it will retrieve related Subscriptions from storage.  | 
            ||
| 2120 | *  | 
            ||
| 2121 | * This method is protected by default in order to keep the public  | 
            ||
| 2122 | * api reasonable. You can provide public methods for those you  | 
            ||
| 2123 | * actually need in Instance.  | 
            ||
| 2124 | *  | 
            ||
| 2125 | * @param Criteria $criteria optional Criteria object to narrow the query  | 
            ||
| 2126 | * @param ConnectionInterface $con optional connection object  | 
            ||
| 2127 | * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN)  | 
            ||
| 2128 | * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects  | 
            ||
| 2129 | */  | 
            ||
| 2130 | View Code Duplication | public function getSubscriptionsJoinChannel(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN)  | 
            |
| 2137 | |||
| 2138 | /**  | 
            ||
| 2139 | * Clears the current object, sets all attributes to their default values and removes  | 
            ||
| 2140 | * outgoing references as well as back-references (from other objects to this one. Results probably in a database  | 
            ||
| 2141 | * change of those foreign objects when you call `save` there).  | 
            ||
| 2142 | */  | 
            ||
| 2143 | public function clear()  | 
            ||
| 2152 | |||
| 2153 | /**  | 
            ||
| 2154 | * Resets all references and back-references to other model objects or collections of model objects.  | 
            ||
| 2155 | *  | 
            ||
| 2156 | * This method is used to reset all php object references (not the actual reference in the database).  | 
            ||
| 2157 | * Necessary for object serialisation.  | 
            ||
| 2158 | *  | 
            ||
| 2159 | * @param boolean $deep Whether to also clear the references on all referrer objects.  | 
            ||
| 2160 | */  | 
            ||
| 2161 | public function clearAllReferences($deep = false)  | 
            ||
| 2191 | |||
| 2192 | /**  | 
            ||
| 2193 | * Return the string representation of this object  | 
            ||
| 2194 | *  | 
            ||
| 2195 | * @return string  | 
            ||
| 2196 | */  | 
            ||
| 2197 | public function __toString()  | 
            ||
| 2201 | |||
| 2202 | /**  | 
            ||
| 2203 | * Code to be run before persisting the object  | 
            ||
| 2204 | * @param ConnectionInterface $con  | 
            ||
| 2205 | * @return boolean  | 
            ||
| 2206 | */  | 
            ||
| 2207 | public function preSave(ConnectionInterface $con = null)  | 
            ||
| 2211 | |||
| 2212 | /**  | 
            ||
| 2213 | * Code to be run after persisting the object  | 
            ||
| 2214 | * @param ConnectionInterface $con  | 
            ||
| 2215 | */  | 
            ||
| 2216 | public function postSave(ConnectionInterface $con = null)  | 
            ||
| 2220 | |||
| 2221 | /**  | 
            ||
| 2222 | * Code to be run before inserting to database  | 
            ||
| 2223 | * @param ConnectionInterface $con  | 
            ||
| 2224 | * @return boolean  | 
            ||
| 2225 | */  | 
            ||
| 2226 | public function preInsert(ConnectionInterface $con = null)  | 
            ||
| 2230 | |||
| 2231 | /**  | 
            ||
| 2232 | * Code to be run after inserting to database  | 
            ||
| 2233 | * @param ConnectionInterface $con  | 
            ||
| 2234 | */  | 
            ||
| 2235 | public function postInsert(ConnectionInterface $con = null)  | 
            ||
| 2239 | |||
| 2240 | /**  | 
            ||
| 2241 | * Code to be run before updating the object in database  | 
            ||
| 2242 | * @param ConnectionInterface $con  | 
            ||
| 2243 | * @return boolean  | 
            ||
| 2244 | */  | 
            ||
| 2245 | public function preUpdate(ConnectionInterface $con = null)  | 
            ||
| 2249 | |||
| 2250 | /**  | 
            ||
| 2251 | * Code to be run after updating the object in database  | 
            ||
| 2252 | * @param ConnectionInterface $con  | 
            ||
| 2253 | */  | 
            ||
| 2254 | public function postUpdate(ConnectionInterface $con = null)  | 
            ||
| 2258 | |||
| 2259 | /**  | 
            ||
| 2260 | * Code to be run before deleting the object in database  | 
            ||
| 2261 | * @param ConnectionInterface $con  | 
            ||
| 2262 | * @return boolean  | 
            ||
| 2263 | */  | 
            ||
| 2264 | public function preDelete(ConnectionInterface $con = null)  | 
            ||
| 2268 | |||
| 2269 | /**  | 
            ||
| 2270 | * Code to be run after deleting the object in database  | 
            ||
| 2271 | * @param ConnectionInterface $con  | 
            ||
| 2272 | */  | 
            ||
| 2273 | public function postDelete(ConnectionInterface $con = null)  | 
            ||
| 2277 | |||
| 2278 | |||
| 2279 | /**  | 
            ||
| 2280 | * Derived method to catches calls to undefined methods.  | 
            ||
| 2281 | *  | 
            ||
| 2282 | * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).  | 
            ||
| 2283 | * Allows to define default __call() behavior if you overwrite __call()  | 
            ||
| 2284 | *  | 
            ||
| 2285 | * @param string $name  | 
            ||
| 2286 | * @param mixed $params  | 
            ||
| 2287 | *  | 
            ||
| 2288 | * @return array|string  | 
            ||
| 2289 | */  | 
            ||
| 2290 | View Code Duplication | public function __call($name, $params)  | 
            |
| 2319 | |||
| 2320 | }  | 
            ||
| 2321 | 
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.