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 |
||
| 45 | abstract class Instance implements ActiveRecordInterface |
||
| 46 | { |
||
| 47 | /** |
||
| 48 | * TableMap class name |
||
| 49 | */ |
||
| 50 | const TABLE_MAP = '\\Jalle19\\StatusManager\\Database\\Map\\InstanceTableMap'; |
||
| 51 | |||
| 52 | |||
| 53 | /** |
||
| 54 | * attribute to determine if this object has previously been saved. |
||
| 55 | * @var boolean |
||
| 56 | */ |
||
| 57 | protected $new = true; |
||
| 58 | |||
| 59 | /** |
||
| 60 | * attribute to determine whether this object has been deleted. |
||
| 61 | * @var boolean |
||
| 62 | */ |
||
| 63 | protected $deleted = false; |
||
| 64 | |||
| 65 | /** |
||
| 66 | * The columns that have been modified in current object. |
||
| 67 | * Tracking modified columns allows us to only update modified columns. |
||
| 68 | * @var array |
||
| 69 | */ |
||
| 70 | protected $modifiedColumns = array(); |
||
| 71 | |||
| 72 | /** |
||
| 73 | * The (virtual) columns that are added at runtime |
||
| 74 | * The formatters can add supplementary columns based on a resultset |
||
| 75 | * @var array |
||
| 76 | */ |
||
| 77 | protected $virtualColumns = array(); |
||
| 78 | |||
| 79 | /** |
||
| 80 | * The value for the name field. |
||
| 81 | * |
||
| 82 | * @var string |
||
| 83 | */ |
||
| 84 | protected $name; |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @var ObjectCollection|ChildUser[] Collection to store aggregation of ChildUser objects. |
||
| 88 | */ |
||
| 89 | protected $collUsers; |
||
| 90 | protected $collUsersPartial; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @var ObjectCollection|ChildConnection[] Collection to store aggregation of ChildConnection objects. |
||
| 94 | */ |
||
| 95 | protected $collConnections; |
||
| 96 | protected $collConnectionsPartial; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @var ObjectCollection|ChildInput[] Collection to store aggregation of ChildInput objects. |
||
| 100 | */ |
||
| 101 | protected $collInputs; |
||
| 102 | protected $collInputsPartial; |
||
| 103 | |||
| 104 | /** |
||
| 105 | * @var ObjectCollection|ChildChannel[] Collection to store aggregation of ChildChannel objects. |
||
| 106 | */ |
||
| 107 | protected $collChannels; |
||
| 108 | protected $collChannelsPartial; |
||
| 109 | |||
| 110 | /** |
||
| 111 | * @var ObjectCollection|ChildSubscription[] Collection to store aggregation of ChildSubscription objects. |
||
| 112 | */ |
||
| 113 | protected $collSubscriptions; |
||
| 114 | protected $collSubscriptionsPartial; |
||
| 115 | |||
| 116 | /** |
||
| 117 | * Flag to prevent endless save loop, if this object is referenced |
||
| 118 | * by another object which falls in this transaction. |
||
| 119 | * |
||
| 120 | * @var boolean |
||
| 121 | */ |
||
| 122 | protected $alreadyInSave = false; |
||
| 123 | |||
| 124 | /** |
||
| 125 | * An array of objects scheduled for deletion. |
||
| 126 | * @var ObjectCollection|ChildUser[] |
||
| 127 | */ |
||
| 128 | protected $usersScheduledForDeletion = null; |
||
| 129 | |||
| 130 | /** |
||
| 131 | * An array of objects scheduled for deletion. |
||
| 132 | * @var ObjectCollection|ChildConnection[] |
||
| 133 | */ |
||
| 134 | protected $connectionsScheduledForDeletion = null; |
||
| 135 | |||
| 136 | /** |
||
| 137 | * An array of objects scheduled for deletion. |
||
| 138 | * @var ObjectCollection|ChildInput[] |
||
| 139 | */ |
||
| 140 | protected $inputsScheduledForDeletion = null; |
||
| 141 | |||
| 142 | /** |
||
| 143 | * An array of objects scheduled for deletion. |
||
| 144 | * @var ObjectCollection|ChildChannel[] |
||
| 145 | */ |
||
| 146 | protected $channelsScheduledForDeletion = null; |
||
| 147 | |||
| 148 | /** |
||
| 149 | * An array of objects scheduled for deletion. |
||
| 150 | * @var ObjectCollection|ChildSubscription[] |
||
| 151 | */ |
||
| 152 | protected $subscriptionsScheduledForDeletion = null; |
||
| 153 | |||
| 154 | /** |
||
| 155 | * Initializes internal state of Jalle19\StatusManager\Database\Base\Instance object. |
||
| 156 | */ |
||
| 157 | public function __construct() |
||
| 160 | |||
| 161 | /** |
||
| 162 | * Returns whether the object has been modified. |
||
| 163 | * |
||
| 164 | * @return boolean True if the object has been modified. |
||
| 165 | */ |
||
| 166 | public function isModified() |
||
| 170 | |||
| 171 | /** |
||
| 172 | * Has specified column been modified? |
||
| 173 | * |
||
| 174 | * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID |
||
| 175 | * @return boolean True if $col has been modified. |
||
| 176 | */ |
||
| 177 | public function isColumnModified($col) |
||
| 181 | |||
| 182 | /** |
||
| 183 | * Get the columns that have been modified in this object. |
||
| 184 | * @return array A unique list of the modified column names for this object. |
||
| 185 | */ |
||
| 186 | public function getModifiedColumns() |
||
| 190 | |||
| 191 | /** |
||
| 192 | * Returns whether the object has ever been saved. This will |
||
| 193 | * be false, if the object was retrieved from storage or was created |
||
| 194 | * and then saved. |
||
| 195 | * |
||
| 196 | * @return boolean true, if the object has never been persisted. |
||
| 197 | */ |
||
| 198 | public function isNew() |
||
| 202 | |||
| 203 | /** |
||
| 204 | * Setter for the isNew attribute. This method will be called |
||
| 205 | * by Propel-generated children and objects. |
||
| 206 | * |
||
| 207 | * @param boolean $b the state of the object. |
||
| 208 | */ |
||
| 209 | public function setNew($b) |
||
| 213 | |||
| 214 | /** |
||
| 215 | * Whether this object has been deleted. |
||
| 216 | * @return boolean The deleted state of this object. |
||
| 217 | */ |
||
| 218 | public function isDeleted() |
||
| 222 | |||
| 223 | /** |
||
| 224 | * Specify whether this object has been deleted. |
||
| 225 | * @param boolean $b The deleted state of this object. |
||
| 226 | * @return void |
||
| 227 | */ |
||
| 228 | public function setDeleted($b) |
||
| 232 | |||
| 233 | /** |
||
| 234 | * Sets the modified state for the object to be false. |
||
| 235 | * @param string $col If supplied, only the specified column is reset. |
||
| 236 | * @return void |
||
| 237 | */ |
||
| 238 | View Code Duplication | public function resetModified($col = null) |
|
| 248 | |||
| 249 | /** |
||
| 250 | * Compares this with another <code>Instance</code> instance. If |
||
| 251 | * <code>obj</code> is an instance of <code>Instance</code>, delegates to |
||
| 252 | * <code>equals(Instance)</code>. Otherwise, returns <code>false</code>. |
||
| 253 | * |
||
| 254 | * @param mixed $obj The object to compare to. |
||
| 255 | * @return boolean Whether equal to the object specified. |
||
| 256 | */ |
||
| 257 | View Code Duplication | public function equals($obj) |
|
| 273 | |||
| 274 | /** |
||
| 275 | * Get the associative array of the virtual columns in this object |
||
| 276 | * |
||
| 277 | * @return array |
||
| 278 | */ |
||
| 279 | public function getVirtualColumns() |
||
| 283 | |||
| 284 | /** |
||
| 285 | * Checks the existence of a virtual column in this object |
||
| 286 | * |
||
| 287 | * @param string $name The virtual column name |
||
| 288 | * @return boolean |
||
| 289 | */ |
||
| 290 | public function hasVirtualColumn($name) |
||
| 294 | |||
| 295 | /** |
||
| 296 | * Get the value of a virtual column in this object |
||
| 297 | * |
||
| 298 | * @param string $name The virtual column name |
||
| 299 | * @return mixed |
||
| 300 | * |
||
| 301 | * @throws PropelException |
||
| 302 | */ |
||
| 303 | View Code Duplication | public function getVirtualColumn($name) |
|
| 311 | |||
| 312 | /** |
||
| 313 | * Set the value of a virtual column in this object |
||
| 314 | * |
||
| 315 | * @param string $name The virtual column name |
||
| 316 | * @param mixed $value The value to give to the virtual column |
||
| 317 | * |
||
| 318 | * @return $this|Instance The current object, for fluid interface |
||
| 319 | */ |
||
| 320 | public function setVirtualColumn($name, $value) |
||
| 326 | |||
| 327 | /** |
||
| 328 | * Logs a message using Propel::log(). |
||
| 329 | * |
||
| 330 | * @param string $msg |
||
| 331 | * @param int $priority One of the Propel::LOG_* logging levels |
||
| 332 | * @return boolean |
||
| 333 | */ |
||
| 334 | protected function log($msg, $priority = Propel::LOG_INFO) |
||
| 338 | |||
| 339 | /** |
||
| 340 | * Export the current object properties to a string, using a given parser format |
||
| 341 | * <code> |
||
| 342 | * $book = BookQuery::create()->findPk(9012); |
||
| 343 | * echo $book->exportTo('JSON'); |
||
| 344 | * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
| 345 | * </code> |
||
| 346 | * |
||
| 347 | * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
| 348 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. |
||
| 349 | * @return string The exported data |
||
| 350 | */ |
||
| 351 | View Code Duplication | public function exportTo($parser, $includeLazyLoadColumns = true) |
|
| 359 | |||
| 360 | /** |
||
| 361 | * Clean up internal collections prior to serializing |
||
| 362 | * Avoids recursive loops that turn into segmentation faults when serializing |
||
| 363 | */ |
||
| 364 | View Code Duplication | public function __sleep() |
|
| 378 | |||
| 379 | /** |
||
| 380 | * Get the [name] column value. |
||
| 381 | * |
||
| 382 | * @return string |
||
| 383 | */ |
||
| 384 | public function getName() |
||
| 388 | |||
| 389 | /** |
||
| 390 | * Set the value of [name] column. |
||
| 391 | * |
||
| 392 | * @param string $v new value |
||
| 393 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support) |
||
| 394 | */ |
||
| 395 | public function setName($v) |
||
| 408 | |||
| 409 | /** |
||
| 410 | * Indicates whether the columns in this object are only set to default values. |
||
| 411 | * |
||
| 412 | * This method can be used in conjunction with isModified() to indicate whether an object is both |
||
| 413 | * modified _and_ has some values set which are non-default. |
||
| 414 | * |
||
| 415 | * @return boolean Whether the columns in this object are only been set with default values. |
||
| 416 | */ |
||
| 417 | public function hasOnlyDefaultValues() |
||
| 422 | |||
| 423 | /** |
||
| 424 | * Hydrates (populates) the object variables with values from the database resultset. |
||
| 425 | * |
||
| 426 | * An offset (0-based "start column") is specified so that objects can be hydrated |
||
| 427 | * with a subset of the columns in the resultset rows. This is needed, for example, |
||
| 428 | * for results of JOIN queries where the resultset row includes columns from two or |
||
| 429 | * more tables. |
||
| 430 | * |
||
| 431 | * @param array $row The row returned by DataFetcher->fetch(). |
||
| 432 | * @param int $startcol 0-based offset column which indicates which restultset column to start with. |
||
| 433 | * @param boolean $rehydrate Whether this object is being re-hydrated from the database. |
||
| 434 | * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
||
| 435 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 436 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 437 | * |
||
| 438 | * @return int next starting column |
||
| 439 | * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. |
||
| 440 | */ |
||
| 441 | public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) |
||
| 461 | |||
| 462 | /** |
||
| 463 | * Checks and repairs the internal consistency of the object. |
||
| 464 | * |
||
| 465 | * This method is executed after an already-instantiated object is re-hydrated |
||
| 466 | * from the database. It exists to check any foreign keys to make sure that |
||
| 467 | * the objects related to the current object are correct based on foreign key. |
||
| 468 | * |
||
| 469 | * You can override this method in the stub class, but you should always invoke |
||
| 470 | * the base method from the overridden method (i.e. parent::ensureConsistency()), |
||
| 471 | * in case your model changes. |
||
| 472 | * |
||
| 473 | * @throws PropelException |
||
| 474 | */ |
||
| 475 | public function ensureConsistency() |
||
| 478 | |||
| 479 | /** |
||
| 480 | * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. |
||
| 481 | * |
||
| 482 | * This will only work if the object has been saved and has a valid primary key set. |
||
| 483 | * |
||
| 484 | * @param boolean $deep (optional) Whether to also de-associated any related objects. |
||
| 485 | * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. |
||
| 486 | * @return void |
||
| 487 | * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db |
||
| 488 | */ |
||
| 489 | View Code Duplication | public function reload($deep = false, ConnectionInterface $con = null) |
|
| 528 | |||
| 529 | /** |
||
| 530 | * Removes this object from datastore and sets delete attribute. |
||
| 531 | * |
||
| 532 | * @param ConnectionInterface $con |
||
| 533 | * @return void |
||
| 534 | * @throws PropelException |
||
| 535 | * @see Instance::setDeleted() |
||
| 536 | * @see Instance::isDeleted() |
||
| 537 | */ |
||
| 538 | View Code Duplication | public function delete(ConnectionInterface $con = null) |
|
| 559 | |||
| 560 | /** |
||
| 561 | * Persists this object to the database. |
||
| 562 | * |
||
| 563 | * If the object is new, it inserts it; otherwise an update is performed. |
||
| 564 | * All modified related objects will also be persisted in the doSave() |
||
| 565 | * method. This method wraps all precipitate database operations in a |
||
| 566 | * single transaction. |
||
| 567 | * |
||
| 568 | * @param ConnectionInterface $con |
||
| 569 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
| 570 | * @throws PropelException |
||
| 571 | * @see doSave() |
||
| 572 | */ |
||
| 573 | View Code Duplication | public function save(ConnectionInterface $con = null) |
|
| 607 | |||
| 608 | /** |
||
| 609 | * Performs the work of inserting or updating the row in the database. |
||
| 610 | * |
||
| 611 | * If the object is new, it inserts it; otherwise an update is performed. |
||
| 612 | * All related objects are also updated in this method. |
||
| 613 | * |
||
| 614 | * @param ConnectionInterface $con |
||
| 615 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
| 616 | * @throws PropelException |
||
| 617 | * @see save() |
||
| 618 | */ |
||
| 619 | protected function doSave(ConnectionInterface $con) |
||
| 727 | |||
| 728 | /** |
||
| 729 | * Insert the row in the database. |
||
| 730 | * |
||
| 731 | * @param ConnectionInterface $con |
||
| 732 | * |
||
| 733 | * @throws PropelException |
||
| 734 | * @see doSave() |
||
| 735 | */ |
||
| 736 | protected function doInsert(ConnectionInterface $con) |
||
| 770 | |||
| 771 | /** |
||
| 772 | * Update the row in the database. |
||
| 773 | * |
||
| 774 | * @param ConnectionInterface $con |
||
| 775 | * |
||
| 776 | * @return Integer Number of updated rows |
||
| 777 | * @see doSave() |
||
| 778 | */ |
||
| 779 | protected function doUpdate(ConnectionInterface $con) |
||
| 786 | |||
| 787 | /** |
||
| 788 | * Retrieves a field from the object by name passed in as a string. |
||
| 789 | * |
||
| 790 | * @param string $name name |
||
| 791 | * @param string $type The type of fieldname the $name is of: |
||
| 792 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 793 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 794 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 795 | * @return mixed Value of field. |
||
| 796 | */ |
||
| 797 | View Code Duplication | public function getByName($name, $type = TableMap::TYPE_PHPNAME) |
|
| 804 | |||
| 805 | /** |
||
| 806 | * Retrieves a field from the object by Position as specified in the xml schema. |
||
| 807 | * Zero-based. |
||
| 808 | * |
||
| 809 | * @param int $pos position in xml schema |
||
| 810 | * @return mixed Value of field at $pos |
||
| 811 | */ |
||
| 812 | public function getByPosition($pos) |
||
| 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) |
||
| 935 | |||
| 936 | /** |
||
| 937 | * Sets a field from the object by name passed in as a string. |
||
| 938 | * |
||
| 939 | * @param string $name |
||
| 940 | * @param mixed $value field value |
||
| 941 | * @param string $type The type of fieldname the $name is of: |
||
| 942 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 943 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 944 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 945 | * @return $this|\Jalle19\StatusManager\Database\Instance |
||
| 946 | */ |
||
| 947 | public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) |
||
| 953 | |||
| 954 | /** |
||
| 955 | * Sets a field from the object by Position as specified in the xml schema. |
||
| 956 | * Zero-based. |
||
| 957 | * |
||
| 958 | * @param int $pos position in xml schema |
||
| 959 | * @param mixed $value field value |
||
| 960 | * @return $this|\Jalle19\StatusManager\Database\Instance |
||
| 961 | */ |
||
| 962 | public function setByPosition($pos, $value) |
||
| 972 | |||
| 973 | /** |
||
| 974 | * Populates the object using an array. |
||
| 975 | * |
||
| 976 | * This is particularly useful when populating an object from one of the |
||
| 977 | * request arrays (e.g. $_POST). This method goes through the column |
||
| 978 | * names, checking to see whether a matching key exists in populated |
||
| 979 | * array. If so the setByName() method is called for that column. |
||
| 980 | * |
||
| 981 | * You can specify the key type of the array by additionally passing one |
||
| 982 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 983 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 984 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
| 985 | * |
||
| 986 | * @param array $arr An array to populate the object from. |
||
| 987 | * @param string $keyType The type of keys the array uses. |
||
| 988 | * @return void |
||
| 989 | */ |
||
| 990 | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) |
||
| 998 | |||
| 999 | /** |
||
| 1000 | * Populate the current object from a string, using a given parser format |
||
| 1001 | * <code> |
||
| 1002 | * $book = new Book(); |
||
| 1003 | * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
| 1004 | * </code> |
||
| 1005 | * |
||
| 1006 | * You can specify the key type of the array by additionally passing one |
||
| 1007 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 1008 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 1009 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
| 1010 | * |
||
| 1011 | * @param mixed $parser A AbstractParser instance, |
||
| 1012 | * or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
| 1013 | * @param string $data The source data to import from |
||
| 1014 | * @param string $keyType The type of keys the array uses. |
||
| 1015 | * |
||
| 1016 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object, for fluid interface |
||
| 1017 | */ |
||
| 1018 | View Code Duplication | public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) |
|
| 1028 | |||
| 1029 | /** |
||
| 1030 | * Build a Criteria object containing the values of all modified columns in this object. |
||
| 1031 | * |
||
| 1032 | * @return Criteria The Criteria object containing all modified values. |
||
| 1033 | */ |
||
| 1034 | public function buildCriteria() |
||
| 1044 | |||
| 1045 | /** |
||
| 1046 | * Builds a Criteria object containing the primary key for this object. |
||
| 1047 | * |
||
| 1048 | * Unlike buildCriteria() this method includes the primary key values regardless |
||
| 1049 | * of whether or not they have been modified. |
||
| 1050 | * |
||
| 1051 | * @throws LogicException if no primary key is defined |
||
| 1052 | * |
||
| 1053 | * @return Criteria The Criteria object containing value(s) for primary key(s). |
||
| 1054 | */ |
||
| 1055 | public function buildPkeyCriteria() |
||
| 1062 | |||
| 1063 | /** |
||
| 1064 | * If the primary key is not null, return the hashcode of the |
||
| 1065 | * primary key. Otherwise, return the hash code of the object. |
||
| 1066 | * |
||
| 1067 | * @return int Hashcode |
||
| 1068 | */ |
||
| 1069 | View Code Duplication | public function hashCode() |
|
| 1084 | |||
| 1085 | /** |
||
| 1086 | * Returns the primary key for this object (row). |
||
| 1087 | * @return string |
||
| 1088 | */ |
||
| 1089 | public function getPrimaryKey() |
||
| 1093 | |||
| 1094 | /** |
||
| 1095 | * Generic method to set the primary key (name column). |
||
| 1096 | * |
||
| 1097 | * @param string $key Primary key. |
||
| 1098 | * @return void |
||
| 1099 | */ |
||
| 1100 | public function setPrimaryKey($key) |
||
| 1104 | |||
| 1105 | /** |
||
| 1106 | * Returns true if the primary key for this object is null. |
||
| 1107 | * @return boolean |
||
| 1108 | */ |
||
| 1109 | public function isPrimaryKeyNull() |
||
| 1113 | |||
| 1114 | /** |
||
| 1115 | * Sets contents of passed object to values from current object. |
||
| 1116 | * |
||
| 1117 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
| 1118 | * objects. |
||
| 1119 | * |
||
| 1120 | * @param object $copyObj An object of \Jalle19\StatusManager\Database\Instance (or compatible) type. |
||
| 1121 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
| 1122 | * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. |
||
| 1123 | * @throws PropelException |
||
| 1124 | */ |
||
| 1125 | public function copyInto($copyObj, $deepCopy = false, $makeNew = true) |
||
| 1170 | |||
| 1171 | /** |
||
| 1172 | * Makes a copy of this object that will be inserted as a new row in table when saved. |
||
| 1173 | * It creates a new object filling in the simple attributes, but skipping any primary |
||
| 1174 | * keys that are defined for the table. |
||
| 1175 | * |
||
| 1176 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
| 1177 | * objects. |
||
| 1178 | * |
||
| 1179 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
| 1180 | * @return \Jalle19\StatusManager\Database\Instance Clone of current object. |
||
| 1181 | * @throws PropelException |
||
| 1182 | */ |
||
| 1183 | View Code Duplication | public function copy($deepCopy = false) |
|
| 1192 | |||
| 1193 | |||
| 1194 | /** |
||
| 1195 | * Initializes a collection based on the name of a relation. |
||
| 1196 | * Avoids crafting an 'init[$relationName]s' method name |
||
| 1197 | * that wouldn't work when StandardEnglishPluralizer is used. |
||
| 1198 | * |
||
| 1199 | * @param string $relationName The name of the relation to initialize |
||
| 1200 | * @return void |
||
| 1201 | */ |
||
| 1202 | public function initRelation($relationName) |
||
| 1220 | |||
| 1221 | /** |
||
| 1222 | * Clears out the collUsers collection |
||
| 1223 | * |
||
| 1224 | * This does not modify the database; however, it will remove any associated objects, causing |
||
| 1225 | * them to be refetched by subsequent calls to accessor method. |
||
| 1226 | * |
||
| 1227 | * @return void |
||
| 1228 | * @see addUsers() |
||
| 1229 | */ |
||
| 1230 | public function clearUsers() |
||
| 1234 | |||
| 1235 | /** |
||
| 1236 | * Reset is the collUsers collection loaded partially. |
||
| 1237 | */ |
||
| 1238 | public function resetPartialUsers($v = true) |
||
| 1242 | |||
| 1243 | /** |
||
| 1244 | * Initializes the collUsers collection. |
||
| 1245 | * |
||
| 1246 | * By default this just sets the collUsers collection to an empty array (like clearcollUsers()); |
||
| 1247 | * however, you may wish to override this method in your stub class to provide setting appropriate |
||
| 1248 | * to your application -- for example, setting the initial array to the values stored in database. |
||
| 1249 | * |
||
| 1250 | * @param boolean $overrideExisting If set to true, the method call initializes |
||
| 1251 | * the collection even if it is not empty |
||
| 1252 | * |
||
| 1253 | * @return void |
||
| 1254 | */ |
||
| 1255 | View Code Duplication | public function initUsers($overrideExisting = true) |
|
| 1266 | |||
| 1267 | /** |
||
| 1268 | * Gets an array of ChildUser objects which contain a foreign key that references this object. |
||
| 1269 | * |
||
| 1270 | * If the $criteria is not null, it is used to always fetch the results from the database. |
||
| 1271 | * Otherwise the results are fetched from the database the first time, then cached. |
||
| 1272 | * Next time the same method is called without $criteria, the cached collection is returned. |
||
| 1273 | * If this ChildInstance is new, it will return |
||
| 1274 | * an empty collection or the current collection; the criteria is ignored on a new object. |
||
| 1275 | * |
||
| 1276 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
| 1277 | * @param ConnectionInterface $con optional connection object |
||
| 1278 | * @return ObjectCollection|ChildUser[] List of ChildUser objects |
||
| 1279 | * @throws PropelException |
||
| 1280 | */ |
||
| 1281 | View Code Duplication | public function getUsers(Criteria $criteria = null, ConnectionInterface $con = null) |
|
| 1324 | |||
| 1325 | /** |
||
| 1326 | * Sets a collection of ChildUser objects related by a one-to-many relationship |
||
| 1327 | * to the current object. |
||
| 1328 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted) |
||
| 1329 | * and new objects from the given Propel collection. |
||
| 1330 | * |
||
| 1331 | * @param Collection $users A Propel collection. |
||
| 1332 | * @param ConnectionInterface $con Optional connection object |
||
| 1333 | * @return $this|ChildInstance The current object (for fluent API support) |
||
| 1334 | */ |
||
| 1335 | public function setUsers(Collection $users, ConnectionInterface $con = null) |
||
| 1357 | |||
| 1358 | /** |
||
| 1359 | * Returns the number of related User objects. |
||
| 1360 | * |
||
| 1361 | * @param Criteria $criteria |
||
| 1362 | * @param boolean $distinct |
||
| 1363 | * @param ConnectionInterface $con |
||
| 1364 | * @return int Count of related User objects. |
||
| 1365 | * @throws PropelException |
||
| 1366 | */ |
||
| 1367 | View Code Duplication | public function countUsers(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) |
|
| 1391 | |||
| 1392 | /** |
||
| 1393 | * Method called to associate a ChildUser object to this object |
||
| 1394 | * through the ChildUser foreign key attribute. |
||
| 1395 | * |
||
| 1396 | * @param ChildUser $l ChildUser |
||
| 1397 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support) |
||
| 1398 | */ |
||
| 1399 | public function addUser(ChildUser $l) |
||
| 1416 | |||
| 1417 | /** |
||
| 1418 | * @param ChildUser $user The ChildUser object to add. |
||
| 1419 | */ |
||
| 1420 | protected function doAddUser(ChildUser $user) |
||
| 1425 | |||
| 1426 | /** |
||
| 1427 | * @param ChildUser $user The ChildUser object to remove. |
||
| 1428 | * @return $this|ChildInstance The current object (for fluent API support) |
||
| 1429 | */ |
||
| 1430 | public function removeUser(ChildUser $user) |
||
| 1445 | |||
| 1446 | /** |
||
| 1447 | * Clears out the collConnections collection |
||
| 1448 | * |
||
| 1449 | * This does not modify the database; however, it will remove any associated objects, causing |
||
| 1450 | * them to be refetched by subsequent calls to accessor method. |
||
| 1451 | * |
||
| 1452 | * @return void |
||
| 1453 | * @see addConnections() |
||
| 1454 | */ |
||
| 1455 | public function clearConnections() |
||
| 1459 | |||
| 1460 | /** |
||
| 1461 | * Reset is the collConnections collection loaded partially. |
||
| 1462 | */ |
||
| 1463 | public function resetPartialConnections($v = true) |
||
| 1467 | |||
| 1468 | /** |
||
| 1469 | * Initializes the collConnections collection. |
||
| 1470 | * |
||
| 1471 | * By default this just sets the collConnections collection to an empty array (like clearcollConnections()); |
||
| 1472 | * however, you may wish to override this method in your stub class to provide setting appropriate |
||
| 1473 | * to your application -- for example, setting the initial array to the values stored in database. |
||
| 1474 | * |
||
| 1475 | * @param boolean $overrideExisting If set to true, the method call initializes |
||
| 1476 | * the collection even if it is not empty |
||
| 1477 | * |
||
| 1478 | * @return void |
||
| 1479 | */ |
||
| 1480 | View Code Duplication | public function initConnections($overrideExisting = true) |
|
| 1491 | |||
| 1492 | /** |
||
| 1493 | * Gets an array of ChildConnection objects which contain a foreign key that references this object. |
||
| 1494 | * |
||
| 1495 | * If the $criteria is not null, it is used to always fetch the results from the database. |
||
| 1496 | * Otherwise the results are fetched from the database the first time, then cached. |
||
| 1497 | * Next time the same method is called without $criteria, the cached collection is returned. |
||
| 1498 | * If this ChildInstance is new, it will return |
||
| 1499 | * an empty collection or the current collection; the criteria is ignored on a new object. |
||
| 1500 | * |
||
| 1501 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
| 1502 | * @param ConnectionInterface $con optional connection object |
||
| 1503 | * @return ObjectCollection|ChildConnection[] List of ChildConnection objects |
||
| 1504 | * @throws PropelException |
||
| 1505 | */ |
||
| 1506 | View Code Duplication | public function getConnections(Criteria $criteria = null, ConnectionInterface $con = null) |
|
| 1549 | |||
| 1550 | /** |
||
| 1551 | * Sets a collection of ChildConnection objects related by a one-to-many relationship |
||
| 1552 | * to the current object. |
||
| 1553 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted) |
||
| 1554 | * and new objects from the given Propel collection. |
||
| 1555 | * |
||
| 1556 | * @param Collection $connections A Propel collection. |
||
| 1557 | * @param ConnectionInterface $con Optional connection object |
||
| 1558 | * @return $this|ChildInstance The current object (for fluent API support) |
||
| 1559 | */ |
||
| 1560 | View Code Duplication | public function setConnections(Collection $connections, ConnectionInterface $con = null) |
|
| 1582 | |||
| 1583 | /** |
||
| 1584 | * Returns the number of related Connection objects. |
||
| 1585 | * |
||
| 1586 | * @param Criteria $criteria |
||
| 1587 | * @param boolean $distinct |
||
| 1588 | * @param ConnectionInterface $con |
||
| 1589 | * @return int Count of related Connection objects. |
||
| 1590 | * @throws PropelException |
||
| 1591 | */ |
||
| 1592 | View Code Duplication | public function countConnections(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) |
|
| 1616 | |||
| 1617 | /** |
||
| 1618 | * Method called to associate a ChildConnection object to this object |
||
| 1619 | * through the ChildConnection foreign key attribute. |
||
| 1620 | * |
||
| 1621 | * @param ChildConnection $l ChildConnection |
||
| 1622 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support) |
||
| 1623 | */ |
||
| 1624 | View Code Duplication | public function addConnection(ChildConnection $l) |
|
| 1641 | |||
| 1642 | /** |
||
| 1643 | * @param ChildConnection $connection The ChildConnection object to add. |
||
| 1644 | */ |
||
| 1645 | protected function doAddConnection(ChildConnection $connection) |
||
| 1650 | |||
| 1651 | /** |
||
| 1652 | * @param ChildConnection $connection The ChildConnection object to remove. |
||
| 1653 | * @return $this|ChildInstance The current object (for fluent API support) |
||
| 1654 | */ |
||
| 1655 | View Code Duplication | public function removeConnection(ChildConnection $connection) |
|
| 1670 | |||
| 1671 | |||
| 1672 | /** |
||
| 1673 | * If this collection has already been initialized with |
||
| 1674 | * an identical criteria, it returns the collection. |
||
| 1675 | * Otherwise if this Instance is new, it will return |
||
| 1676 | * an empty collection; or if this Instance has previously |
||
| 1677 | * been saved, it will retrieve related Connections from storage. |
||
| 1678 | * |
||
| 1679 | * This method is protected by default in order to keep the public |
||
| 1680 | * api reasonable. You can provide public methods for those you |
||
| 1681 | * actually need in Instance. |
||
| 1682 | * |
||
| 1683 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
| 1684 | * @param ConnectionInterface $con optional connection object |
||
| 1685 | * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
||
| 1686 | * @return ObjectCollection|ChildConnection[] List of ChildConnection objects |
||
| 1687 | */ |
||
| 1688 | View Code Duplication | public function getConnectionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
| 1695 | |||
| 1696 | /** |
||
| 1697 | * Clears out the collInputs collection |
||
| 1698 | * |
||
| 1699 | * This does not modify the database; however, it will remove any associated objects, causing |
||
| 1700 | * them to be refetched by subsequent calls to accessor method. |
||
| 1701 | * |
||
| 1702 | * @return void |
||
| 1703 | * @see addInputs() |
||
| 1704 | */ |
||
| 1705 | public function clearInputs() |
||
| 1709 | |||
| 1710 | /** |
||
| 1711 | * Reset is the collInputs collection loaded partially. |
||
| 1712 | */ |
||
| 1713 | public function resetPartialInputs($v = true) |
||
| 1717 | |||
| 1718 | /** |
||
| 1719 | * Initializes the collInputs collection. |
||
| 1720 | * |
||
| 1721 | * By default this just sets the collInputs collection to an empty array (like clearcollInputs()); |
||
| 1722 | * however, you may wish to override this method in your stub class to provide setting appropriate |
||
| 1723 | * to your application -- for example, setting the initial array to the values stored in database. |
||
| 1724 | * |
||
| 1725 | * @param boolean $overrideExisting If set to true, the method call initializes |
||
| 1726 | * the collection even if it is not empty |
||
| 1727 | * |
||
| 1728 | * @return void |
||
| 1729 | */ |
||
| 1730 | View Code Duplication | public function initInputs($overrideExisting = true) |
|
| 1741 | |||
| 1742 | /** |
||
| 1743 | * Gets an array of ChildInput objects which contain a foreign key that references this object. |
||
| 1744 | * |
||
| 1745 | * If the $criteria is not null, it is used to always fetch the results from the database. |
||
| 1746 | * Otherwise the results are fetched from the database the first time, then cached. |
||
| 1747 | * Next time the same method is called without $criteria, the cached collection is returned. |
||
| 1748 | * If this ChildInstance is new, it will return |
||
| 1749 | * an empty collection or the current collection; the criteria is ignored on a new object. |
||
| 1750 | * |
||
| 1751 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
| 1752 | * @param ConnectionInterface $con optional connection object |
||
| 1753 | * @return ObjectCollection|ChildInput[] List of ChildInput objects |
||
| 1754 | * @throws PropelException |
||
| 1755 | */ |
||
| 1756 | View Code Duplication | public function getInputs(Criteria $criteria = null, ConnectionInterface $con = null) |
|
| 1799 | |||
| 1800 | /** |
||
| 1801 | * Sets a collection of ChildInput objects related by a one-to-many relationship |
||
| 1802 | * to the current object. |
||
| 1803 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted) |
||
| 1804 | * and new objects from the given Propel collection. |
||
| 1805 | * |
||
| 1806 | * @param Collection $inputs A Propel collection. |
||
| 1807 | * @param ConnectionInterface $con Optional connection object |
||
| 1808 | * @return $this|ChildInstance The current object (for fluent API support) |
||
| 1809 | */ |
||
| 1810 | View Code Duplication | public function setInputs(Collection $inputs, ConnectionInterface $con = null) |
|
| 1832 | |||
| 1833 | /** |
||
| 1834 | * Returns the number of related Input objects. |
||
| 1835 | * |
||
| 1836 | * @param Criteria $criteria |
||
| 1837 | * @param boolean $distinct |
||
| 1838 | * @param ConnectionInterface $con |
||
| 1839 | * @return int Count of related Input objects. |
||
| 1840 | * @throws PropelException |
||
| 1841 | */ |
||
| 1842 | public function countInputs(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) |
||
| 1866 | |||
| 1867 | /** |
||
| 1868 | * Method called to associate a ChildInput object to this object |
||
| 1869 | * through the ChildInput foreign key attribute. |
||
| 1870 | * |
||
| 1871 | * @param ChildInput $l ChildInput |
||
| 1872 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support) |
||
| 1873 | */ |
||
| 1874 | public function addInput(ChildInput $l) |
||
| 1891 | |||
| 1892 | /** |
||
| 1893 | * @param ChildInput $input The ChildInput object to add. |
||
| 1894 | */ |
||
| 1895 | protected function doAddInput(ChildInput $input) |
||
| 1900 | |||
| 1901 | /** |
||
| 1902 | * @param ChildInput $input The ChildInput object to remove. |
||
| 1903 | * @return $this|ChildInstance The current object (for fluent API support) |
||
| 1904 | */ |
||
| 1905 | View Code Duplication | public function removeInput(ChildInput $input) |
|
| 1920 | |||
| 1921 | /** |
||
| 1922 | * Clears out the collChannels collection |
||
| 1923 | * |
||
| 1924 | * This does not modify the database; however, it will remove any associated objects, causing |
||
| 1925 | * them to be refetched by subsequent calls to accessor method. |
||
| 1926 | * |
||
| 1927 | * @return void |
||
| 1928 | * @see addChannels() |
||
| 1929 | */ |
||
| 1930 | public function clearChannels() |
||
| 1934 | |||
| 1935 | /** |
||
| 1936 | * Reset is the collChannels collection loaded partially. |
||
| 1937 | */ |
||
| 1938 | public function resetPartialChannels($v = true) |
||
| 1942 | |||
| 1943 | /** |
||
| 1944 | * Initializes the collChannels collection. |
||
| 1945 | * |
||
| 1946 | * By default this just sets the collChannels collection to an empty array (like clearcollChannels()); |
||
| 1947 | * however, you may wish to override this method in your stub class to provide setting appropriate |
||
| 1948 | * to your application -- for example, setting the initial array to the values stored in database. |
||
| 1949 | * |
||
| 1950 | * @param boolean $overrideExisting If set to true, the method call initializes |
||
| 1951 | * the collection even if it is not empty |
||
| 1952 | * |
||
| 1953 | * @return void |
||
| 1954 | */ |
||
| 1955 | View Code Duplication | public function initChannels($overrideExisting = true) |
|
| 1966 | |||
| 1967 | /** |
||
| 1968 | * Gets an array of ChildChannel objects which contain a foreign key that references this object. |
||
| 1969 | * |
||
| 1970 | * If the $criteria is not null, it is used to always fetch the results from the database. |
||
| 1971 | * Otherwise the results are fetched from the database the first time, then cached. |
||
| 1972 | * Next time the same method is called without $criteria, the cached collection is returned. |
||
| 1973 | * If this ChildInstance is new, it will return |
||
| 1974 | * an empty collection or the current collection; the criteria is ignored on a new object. |
||
| 1975 | * |
||
| 1976 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
| 1977 | * @param ConnectionInterface $con optional connection object |
||
| 1978 | * @return ObjectCollection|ChildChannel[] List of ChildChannel objects |
||
| 1979 | * @throws PropelException |
||
| 1980 | */ |
||
| 1981 | View Code Duplication | public function getChannels(Criteria $criteria = null, ConnectionInterface $con = null) |
|
| 2024 | |||
| 2025 | /** |
||
| 2026 | * Sets a collection of ChildChannel objects related by a one-to-many relationship |
||
| 2027 | * to the current object. |
||
| 2028 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted) |
||
| 2029 | * and new objects from the given Propel collection. |
||
| 2030 | * |
||
| 2031 | * @param Collection $channels A Propel collection. |
||
| 2032 | * @param ConnectionInterface $con Optional connection object |
||
| 2033 | * @return $this|ChildInstance The current object (for fluent API support) |
||
| 2034 | */ |
||
| 2035 | public function setChannels(Collection $channels, ConnectionInterface $con = null) |
||
| 2057 | |||
| 2058 | /** |
||
| 2059 | * Returns the number of related Channel objects. |
||
| 2060 | * |
||
| 2061 | * @param Criteria $criteria |
||
| 2062 | * @param boolean $distinct |
||
| 2063 | * @param ConnectionInterface $con |
||
| 2064 | * @return int Count of related Channel objects. |
||
| 2065 | * @throws PropelException |
||
| 2066 | */ |
||
| 2067 | View Code Duplication | public function countChannels(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) |
|
| 2091 | |||
| 2092 | /** |
||
| 2093 | * Method called to associate a ChildChannel object to this object |
||
| 2094 | * through the ChildChannel foreign key attribute. |
||
| 2095 | * |
||
| 2096 | * @param ChildChannel $l ChildChannel |
||
| 2097 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support) |
||
| 2098 | */ |
||
| 2099 | public function addChannel(ChildChannel $l) |
||
| 2116 | |||
| 2117 | /** |
||
| 2118 | * @param ChildChannel $channel The ChildChannel object to add. |
||
| 2119 | */ |
||
| 2120 | protected function doAddChannel(ChildChannel $channel) |
||
| 2125 | |||
| 2126 | /** |
||
| 2127 | * @param ChildChannel $channel The ChildChannel object to remove. |
||
| 2128 | * @return $this|ChildInstance The current object (for fluent API support) |
||
| 2129 | */ |
||
| 2130 | public function removeChannel(ChildChannel $channel) |
||
| 2145 | |||
| 2146 | /** |
||
| 2147 | * Clears out the collSubscriptions collection |
||
| 2148 | * |
||
| 2149 | * This does not modify the database; however, it will remove any associated objects, causing |
||
| 2150 | * them to be refetched by subsequent calls to accessor method. |
||
| 2151 | * |
||
| 2152 | * @return void |
||
| 2153 | * @see addSubscriptions() |
||
| 2154 | */ |
||
| 2155 | public function clearSubscriptions() |
||
| 2159 | |||
| 2160 | /** |
||
| 2161 | * Reset is the collSubscriptions collection loaded partially. |
||
| 2162 | */ |
||
| 2163 | public function resetPartialSubscriptions($v = true) |
||
| 2167 | |||
| 2168 | /** |
||
| 2169 | * Initializes the collSubscriptions collection. |
||
| 2170 | * |
||
| 2171 | * By default this just sets the collSubscriptions collection to an empty array (like clearcollSubscriptions()); |
||
| 2172 | * however, you may wish to override this method in your stub class to provide setting appropriate |
||
| 2173 | * to your application -- for example, setting the initial array to the values stored in database. |
||
| 2174 | * |
||
| 2175 | * @param boolean $overrideExisting If set to true, the method call initializes |
||
| 2176 | * the collection even if it is not empty |
||
| 2177 | * |
||
| 2178 | * @return void |
||
| 2179 | */ |
||
| 2180 | View Code Duplication | public function initSubscriptions($overrideExisting = true) |
|
| 2191 | |||
| 2192 | /** |
||
| 2193 | * Gets an array of ChildSubscription objects which contain a foreign key that references this object. |
||
| 2194 | * |
||
| 2195 | * If the $criteria is not null, it is used to always fetch the results from the database. |
||
| 2196 | * Otherwise the results are fetched from the database the first time, then cached. |
||
| 2197 | * Next time the same method is called without $criteria, the cached collection is returned. |
||
| 2198 | * If this ChildInstance is new, it will return |
||
| 2199 | * an empty collection or the current collection; the criteria is ignored on a new object. |
||
| 2200 | * |
||
| 2201 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
| 2202 | * @param ConnectionInterface $con optional connection object |
||
| 2203 | * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects |
||
| 2204 | * @throws PropelException |
||
| 2205 | */ |
||
| 2206 | View Code Duplication | public function getSubscriptions(Criteria $criteria = null, ConnectionInterface $con = null) |
|
| 2249 | |||
| 2250 | /** |
||
| 2251 | * Sets a collection of ChildSubscription objects related by a one-to-many relationship |
||
| 2252 | * to the current object. |
||
| 2253 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted) |
||
| 2254 | * and new objects from the given Propel collection. |
||
| 2255 | * |
||
| 2256 | * @param Collection $subscriptions A Propel collection. |
||
| 2257 | * @param ConnectionInterface $con Optional connection object |
||
| 2258 | * @return $this|ChildInstance The current object (for fluent API support) |
||
| 2259 | */ |
||
| 2260 | public function setSubscriptions(Collection $subscriptions, ConnectionInterface $con = null) |
||
| 2282 | |||
| 2283 | /** |
||
| 2284 | * Returns the number of related Subscription objects. |
||
| 2285 | * |
||
| 2286 | * @param Criteria $criteria |
||
| 2287 | * @param boolean $distinct |
||
| 2288 | * @param ConnectionInterface $con |
||
| 2289 | * @return int Count of related Subscription objects. |
||
| 2290 | * @throws PropelException |
||
| 2291 | */ |
||
| 2292 | View Code Duplication | public function countSubscriptions(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) |
|
| 2316 | |||
| 2317 | /** |
||
| 2318 | * Method called to associate a ChildSubscription object to this object |
||
| 2319 | * through the ChildSubscription foreign key attribute. |
||
| 2320 | * |
||
| 2321 | * @param ChildSubscription $l ChildSubscription |
||
| 2322 | * @return $this|\Jalle19\StatusManager\Database\Instance The current object (for fluent API support) |
||
| 2323 | */ |
||
| 2324 | View Code Duplication | public function addSubscription(ChildSubscription $l) |
|
| 2341 | |||
| 2342 | /** |
||
| 2343 | * @param ChildSubscription $subscription The ChildSubscription object to add. |
||
| 2344 | */ |
||
| 2345 | protected function doAddSubscription(ChildSubscription $subscription) |
||
| 2350 | |||
| 2351 | /** |
||
| 2352 | * @param ChildSubscription $subscription The ChildSubscription object to remove. |
||
| 2353 | * @return $this|ChildInstance The current object (for fluent API support) |
||
| 2354 | */ |
||
| 2355 | public function removeSubscription(ChildSubscription $subscription) |
||
| 2370 | |||
| 2371 | |||
| 2372 | /** |
||
| 2373 | * If this collection has already been initialized with |
||
| 2374 | * an identical criteria, it returns the collection. |
||
| 2375 | * Otherwise if this Instance is new, it will return |
||
| 2376 | * an empty collection; or if this Instance has previously |
||
| 2377 | * been saved, it will retrieve related Subscriptions from storage. |
||
| 2378 | * |
||
| 2379 | * This method is protected by default in order to keep the public |
||
| 2380 | * api reasonable. You can provide public methods for those you |
||
| 2381 | * actually need in Instance. |
||
| 2382 | * |
||
| 2383 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
| 2384 | * @param ConnectionInterface $con optional connection object |
||
| 2385 | * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
||
| 2386 | * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects |
||
| 2387 | */ |
||
| 2388 | View Code Duplication | public function getSubscriptionsJoinInput(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
| 2395 | |||
| 2396 | |||
| 2397 | /** |
||
| 2398 | * If this collection has already been initialized with |
||
| 2399 | * an identical criteria, it returns the collection. |
||
| 2400 | * Otherwise if this Instance is new, it will return |
||
| 2401 | * an empty collection; or if this Instance has previously |
||
| 2402 | * been saved, it will retrieve related Subscriptions from storage. |
||
| 2403 | * |
||
| 2404 | * This method is protected by default in order to keep the public |
||
| 2405 | * api reasonable. You can provide public methods for those you |
||
| 2406 | * actually need in Instance. |
||
| 2407 | * |
||
| 2408 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
| 2409 | * @param ConnectionInterface $con optional connection object |
||
| 2410 | * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
||
| 2411 | * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects |
||
| 2412 | */ |
||
| 2413 | View Code Duplication | public function getSubscriptionsJoinUser(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
| 2420 | |||
| 2421 | |||
| 2422 | /** |
||
| 2423 | * If this collection has already been initialized with |
||
| 2424 | * an identical criteria, it returns the collection. |
||
| 2425 | * Otherwise if this Instance is new, it will return |
||
| 2426 | * an empty collection; or if this Instance has previously |
||
| 2427 | * been saved, it will retrieve related Subscriptions from storage. |
||
| 2428 | * |
||
| 2429 | * This method is protected by default in order to keep the public |
||
| 2430 | * api reasonable. You can provide public methods for those you |
||
| 2431 | * actually need in Instance. |
||
| 2432 | * |
||
| 2433 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
| 2434 | * @param ConnectionInterface $con optional connection object |
||
| 2435 | * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
||
| 2436 | * @return ObjectCollection|ChildSubscription[] List of ChildSubscription objects |
||
| 2437 | */ |
||
| 2438 | View Code Duplication | public function getSubscriptionsJoinChannel(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
| 2445 | |||
| 2446 | /** |
||
| 2447 | * Clears the current object, sets all attributes to their default values and removes |
||
| 2448 | * outgoing references as well as back-references (from other objects to this one. Results probably in a database |
||
| 2449 | * change of those foreign objects when you call `save` there). |
||
| 2450 | */ |
||
| 2451 | public function clear() |
||
| 2460 | |||
| 2461 | /** |
||
| 2462 | * Resets all references and back-references to other model objects or collections of model objects. |
||
| 2463 | * |
||
| 2464 | * This method is used to reset all php object references (not the actual reference in the database). |
||
| 2465 | * Necessary for object serialisation. |
||
| 2466 | * |
||
| 2467 | * @param boolean $deep Whether to also clear the references on all referrer objects. |
||
| 2468 | */ |
||
| 2469 | public function clearAllReferences($deep = false) |
||
| 2505 | |||
| 2506 | /** |
||
| 2507 | * Return the string representation of this object |
||
| 2508 | * |
||
| 2509 | * @return string |
||
| 2510 | */ |
||
| 2511 | public function __toString() |
||
| 2515 | |||
| 2516 | /** |
||
| 2517 | * Code to be run before persisting the object |
||
| 2518 | * @param ConnectionInterface $con |
||
| 2519 | * @return boolean |
||
| 2520 | */ |
||
| 2521 | public function preSave(ConnectionInterface $con = null) |
||
| 2525 | |||
| 2526 | /** |
||
| 2527 | * Code to be run after persisting the object |
||
| 2528 | * @param ConnectionInterface $con |
||
| 2529 | */ |
||
| 2530 | public function postSave(ConnectionInterface $con = null) |
||
| 2534 | |||
| 2535 | /** |
||
| 2536 | * Code to be run before inserting to database |
||
| 2537 | * @param ConnectionInterface $con |
||
| 2538 | * @return boolean |
||
| 2539 | */ |
||
| 2540 | public function preInsert(ConnectionInterface $con = null) |
||
| 2544 | |||
| 2545 | /** |
||
| 2546 | * Code to be run after inserting to database |
||
| 2547 | * @param ConnectionInterface $con |
||
| 2548 | */ |
||
| 2549 | public function postInsert(ConnectionInterface $con = null) |
||
| 2553 | |||
| 2554 | /** |
||
| 2555 | * Code to be run before updating the object in database |
||
| 2556 | * @param ConnectionInterface $con |
||
| 2557 | * @return boolean |
||
| 2558 | */ |
||
| 2559 | public function preUpdate(ConnectionInterface $con = null) |
||
| 2563 | |||
| 2564 | /** |
||
| 2565 | * Code to be run after updating the object in database |
||
| 2566 | * @param ConnectionInterface $con |
||
| 2567 | */ |
||
| 2568 | public function postUpdate(ConnectionInterface $con = null) |
||
| 2572 | |||
| 2573 | /** |
||
| 2574 | * Code to be run before deleting the object in database |
||
| 2575 | * @param ConnectionInterface $con |
||
| 2576 | * @return boolean |
||
| 2577 | */ |
||
| 2578 | public function preDelete(ConnectionInterface $con = null) |
||
| 2582 | |||
| 2583 | /** |
||
| 2584 | * Code to be run after deleting the object in database |
||
| 2585 | * @param ConnectionInterface $con |
||
| 2586 | */ |
||
| 2587 | public function postDelete(ConnectionInterface $con = null) |
||
| 2591 | |||
| 2592 | |||
| 2593 | /** |
||
| 2594 | * Derived method to catches calls to undefined methods. |
||
| 2595 | * |
||
| 2596 | * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). |
||
| 2597 | * Allows to define default __call() behavior if you overwrite __call() |
||
| 2598 | * |
||
| 2599 | * @param string $name |
||
| 2600 | * @param mixed $params |
||
| 2601 | * |
||
| 2602 | * @return array|string |
||
| 2603 | */ |
||
| 2604 | View Code Duplication | public function __call($name, $params) |
|
| 2633 | |||
| 2634 | } |
||
| 2635 |
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.