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 PageLinkProduct 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 PageLinkProduct, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 31 | abstract class PageLinkProduct extends PropelBaseModelClass implements ActiveRecordInterface |
||
| 32 | { |
||
|
|
|||
| 33 | /** |
||
| 34 | * TableMap class name |
||
| 35 | */ |
||
| 36 | const TABLE_MAP = '\\mod_link\\models\\Map\\PageLinkProductTableMap'; |
||
| 37 | |||
| 38 | |||
| 39 | /** |
||
| 40 | * attribute to determine if this object has previously been saved. |
||
| 41 | * @var boolean |
||
| 42 | */ |
||
| 43 | protected $new = true; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * attribute to determine whether this object has been deleted. |
||
| 47 | * @var boolean |
||
| 48 | */ |
||
| 49 | protected $deleted = false; |
||
| 50 | |||
| 51 | /** |
||
| 52 | * The columns that have been modified in current object. |
||
| 53 | * Tracking modified columns allows us to only update modified columns. |
||
| 54 | * @var array |
||
| 55 | */ |
||
| 56 | protected $modifiedColumns = array(); |
||
| 57 | |||
| 58 | /** |
||
| 59 | * The (virtual) columns that are added at runtime |
||
| 60 | * The formatters can add supplementary columns based on a resultset |
||
| 61 | * @var array |
||
| 62 | */ |
||
| 63 | protected $virtualColumns = array(); |
||
| 64 | |||
| 65 | /** |
||
| 66 | * The value for the link_id field. |
||
| 67 | * |
||
| 68 | * @var int |
||
| 69 | */ |
||
| 70 | protected $link_id; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * The value for the product_id field. |
||
| 74 | * |
||
| 75 | * @var int |
||
| 76 | */ |
||
| 77 | protected $product_id; |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @var ChildPageLink |
||
| 81 | */ |
||
| 82 | protected $aPageLink; |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Flag to prevent endless save loop, if this object is referenced |
||
| 86 | * by another object which falls in this transaction. |
||
| 87 | * |
||
| 88 | * @var boolean |
||
| 89 | */ |
||
| 90 | protected $alreadyInSave = false; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * Initializes internal state of mod_link\models\Base\PageLinkProduct object. |
||
| 94 | */ |
||
| 95 | public function __construct() |
||
| 98 | |||
| 99 | /** |
||
| 100 | * Returns whether the object has been modified. |
||
| 101 | * |
||
| 102 | * @return boolean True if the object has been modified. |
||
| 103 | */ |
||
| 104 | public function isModified() |
||
| 108 | |||
| 109 | /** |
||
| 110 | * Has specified column been modified? |
||
| 111 | * |
||
| 112 | * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID |
||
| 113 | * @return boolean True if $col has been modified. |
||
| 114 | */ |
||
| 115 | public function isColumnModified($col) |
||
| 119 | |||
| 120 | /** |
||
| 121 | * Get the columns that have been modified in this object. |
||
| 122 | * @return array A unique list of the modified column names for this object. |
||
| 123 | */ |
||
| 124 | public function getModifiedColumns() |
||
| 128 | |||
| 129 | /** |
||
| 130 | * Returns whether the object has ever been saved. This will |
||
| 131 | * be false, if the object was retrieved from storage or was created |
||
| 132 | * and then saved. |
||
| 133 | * |
||
| 134 | * @return boolean true, if the object has never been persisted. |
||
| 135 | */ |
||
| 136 | public function isNew() |
||
| 140 | |||
| 141 | /** |
||
| 142 | * Setter for the isNew attribute. This method will be called |
||
| 143 | * by Propel-generated children and objects. |
||
| 144 | * |
||
| 145 | * @param boolean $b the state of the object. |
||
| 146 | */ |
||
| 147 | public function setNew($b) |
||
| 151 | |||
| 152 | /** |
||
| 153 | * Whether this object has been deleted. |
||
| 154 | * @return boolean The deleted state of this object. |
||
| 155 | */ |
||
| 156 | public function isDeleted() |
||
| 160 | |||
| 161 | /** |
||
| 162 | * Specify whether this object has been deleted. |
||
| 163 | * @param boolean $b The deleted state of this object. |
||
| 164 | * @return void |
||
| 165 | */ |
||
| 166 | public function setDeleted($b) |
||
| 170 | |||
| 171 | /** |
||
| 172 | * Sets the modified state for the object to be false. |
||
| 173 | * @param string $col If supplied, only the specified column is reset. |
||
| 174 | * @return void |
||
| 175 | */ |
||
| 176 | View Code Duplication | public function resetModified($col = null) |
|
| 186 | |||
| 187 | /** |
||
| 188 | * Compares this with another <code>PageLinkProduct</code> instance. If |
||
| 189 | * <code>obj</code> is an instance of <code>PageLinkProduct</code>, delegates to |
||
| 190 | * <code>equals(PageLinkProduct)</code>. Otherwise, returns <code>false</code>. |
||
| 191 | * |
||
| 192 | * @param mixed $obj The object to compare to. |
||
| 193 | * @return boolean Whether equal to the object specified. |
||
| 194 | */ |
||
| 195 | public function equals($obj) |
||
| 211 | |||
| 212 | /** |
||
| 213 | * Get the associative array of the virtual columns in this object |
||
| 214 | * |
||
| 215 | * @return array |
||
| 216 | */ |
||
| 217 | public function getVirtualColumns() |
||
| 221 | |||
| 222 | /** |
||
| 223 | * Checks the existence of a virtual column in this object |
||
| 224 | * |
||
| 225 | * @param string $name The virtual column name |
||
| 226 | * @return boolean |
||
| 227 | */ |
||
| 228 | public function hasVirtualColumn($name) |
||
| 232 | |||
| 233 | /** |
||
| 234 | * Get the value of a virtual column in this object |
||
| 235 | * |
||
| 236 | * @param string $name The virtual column name |
||
| 237 | * @return mixed |
||
| 238 | * |
||
| 239 | * @throws PropelException |
||
| 240 | */ |
||
| 241 | public function getVirtualColumn($name) |
||
| 249 | |||
| 250 | /** |
||
| 251 | * Set the value of a virtual column in this object |
||
| 252 | * |
||
| 253 | * @param string $name The virtual column name |
||
| 254 | * @param mixed $value The value to give to the virtual column |
||
| 255 | * |
||
| 256 | * @return $this|PageLinkProduct The current object, for fluid interface |
||
| 257 | */ |
||
| 258 | public function setVirtualColumn($name, $value) |
||
| 264 | |||
| 265 | /** |
||
| 266 | * Logs a message using Propel::log(). |
||
| 267 | * |
||
| 268 | * @param string $msg |
||
| 269 | * @param int $priority One of the Propel::LOG_* logging levels |
||
| 270 | * @return boolean |
||
| 271 | */ |
||
| 272 | protected function log($msg, $priority = Propel::LOG_INFO) |
||
| 276 | |||
| 277 | /** |
||
| 278 | * Export the current object properties to a string, using a given parser format |
||
| 279 | * <code> |
||
| 280 | * $book = BookQuery::create()->findPk(9012); |
||
| 281 | * echo $book->exportTo('JSON'); |
||
| 282 | * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
| 283 | * </code> |
||
| 284 | * |
||
| 285 | * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
| 286 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. |
||
| 287 | * @return string The exported data |
||
| 288 | */ |
||
| 289 | View Code Duplication | public function exportTo($parser, $includeLazyLoadColumns = true) |
|
| 297 | |||
| 298 | /** |
||
| 299 | * Clean up internal collections prior to serializing |
||
| 300 | * Avoids recursive loops that turn into segmentation faults when serializing |
||
| 301 | */ |
||
| 302 | View Code Duplication | public function __sleep() |
|
| 316 | |||
| 317 | /** |
||
| 318 | * Get the [link_id] column value. |
||
| 319 | * |
||
| 320 | * @return int |
||
| 321 | */ |
||
| 322 | public function getLinkId() |
||
| 326 | |||
| 327 | /** |
||
| 328 | * Get the [product_id] column value. |
||
| 329 | * |
||
| 330 | * @return int |
||
| 331 | */ |
||
| 332 | public function getProductId() |
||
| 336 | |||
| 337 | /** |
||
| 338 | * Set the value of [link_id] column. |
||
| 339 | * |
||
| 340 | * @param int $v new value |
||
| 341 | * @return $this|\mod_link\models\PageLinkProduct The current object (for fluent API support) |
||
| 342 | */ |
||
| 343 | View Code Duplication | public function setLinkId($v) |
|
| 360 | |||
| 361 | /** |
||
| 362 | * Set the value of [product_id] column. |
||
| 363 | * |
||
| 364 | * @param int $v new value |
||
| 365 | * @return $this|\mod_link\models\PageLinkProduct The current object (for fluent API support) |
||
| 366 | */ |
||
| 367 | View Code Duplication | public function setProductId($v) |
|
| 380 | |||
| 381 | /** |
||
| 382 | * Indicates whether the columns in this object are only set to default values. |
||
| 383 | * |
||
| 384 | * This method can be used in conjunction with isModified() to indicate whether an object is both |
||
| 385 | * modified _and_ has some values set which are non-default. |
||
| 386 | * |
||
| 387 | * @return boolean Whether the columns in this object are only been set with default values. |
||
| 388 | */ |
||
| 389 | public function hasOnlyDefaultValues() |
||
| 394 | |||
| 395 | /** |
||
| 396 | * Hydrates (populates) the object variables with values from the database resultset. |
||
| 397 | * |
||
| 398 | * An offset (0-based "start column") is specified so that objects can be hydrated |
||
| 399 | * with a subset of the columns in the resultset rows. This is needed, for example, |
||
| 400 | * for results of JOIN queries where the resultset row includes columns from two or |
||
| 401 | * more tables. |
||
| 402 | * |
||
| 403 | * @param array $row The row returned by DataFetcher->fetch(). |
||
| 404 | * @param int $startcol 0-based offset column which indicates which restultset column to start with. |
||
| 405 | * @param boolean $rehydrate Whether this object is being re-hydrated from the database. |
||
| 406 | * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
||
| 407 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 408 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 409 | * |
||
| 410 | * @return int next starting column |
||
| 411 | * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. |
||
| 412 | */ |
||
| 413 | View Code Duplication | public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) |
|
| 436 | |||
| 437 | /** |
||
| 438 | * Checks and repairs the internal consistency of the object. |
||
| 439 | * |
||
| 440 | * This method is executed after an already-instantiated object is re-hydrated |
||
| 441 | * from the database. It exists to check any foreign keys to make sure that |
||
| 442 | * the objects related to the current object are correct based on foreign key. |
||
| 443 | * |
||
| 444 | * You can override this method in the stub class, but you should always invoke |
||
| 445 | * the base method from the overridden method (i.e. parent::ensureConsistency()), |
||
| 446 | * in case your model changes. |
||
| 447 | * |
||
| 448 | * @throws PropelException |
||
| 449 | */ |
||
| 450 | public function ensureConsistency() |
||
| 456 | |||
| 457 | /** |
||
| 458 | * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. |
||
| 459 | * |
||
| 460 | * This will only work if the object has been saved and has a valid primary key set. |
||
| 461 | * |
||
| 462 | * @param boolean $deep (optional) Whether to also de-associated any related objects. |
||
| 463 | * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. |
||
| 464 | * @return void |
||
| 465 | * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db |
||
| 466 | */ |
||
| 467 | public function reload($deep = false, ConnectionInterface $con = null) |
||
| 497 | |||
| 498 | /** |
||
| 499 | * Removes this object from datastore and sets delete attribute. |
||
| 500 | * |
||
| 501 | * @param ConnectionInterface $con |
||
| 502 | * @return void |
||
| 503 | * @throws PropelException |
||
| 504 | * @see PageLinkProduct::setDeleted() |
||
| 505 | * @see PageLinkProduct::isDeleted() |
||
| 506 | */ |
||
| 507 | View Code Duplication | public function delete(ConnectionInterface $con = null) |
|
| 528 | |||
| 529 | /** |
||
| 530 | * Persists this object to the database. |
||
| 531 | * |
||
| 532 | * If the object is new, it inserts it; otherwise an update is performed. |
||
| 533 | * All modified related objects will also be persisted in the doSave() |
||
| 534 | * method. This method wraps all precipitate database operations in a |
||
| 535 | * single transaction. |
||
| 536 | * |
||
| 537 | * @param ConnectionInterface $con |
||
| 538 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
| 539 | * @throws PropelException |
||
| 540 | * @see doSave() |
||
| 541 | */ |
||
| 542 | View Code Duplication | public function save(ConnectionInterface $con = null) |
|
| 576 | |||
| 577 | /** |
||
| 578 | * Performs the work of inserting or updating the row in the database. |
||
| 579 | * |
||
| 580 | * If the object is new, it inserts it; otherwise an update is performed. |
||
| 581 | * All related objects are also updated in this method. |
||
| 582 | * |
||
| 583 | * @param ConnectionInterface $con |
||
| 584 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
| 585 | * @throws PropelException |
||
| 586 | * @see save() |
||
| 587 | */ |
||
| 588 | View Code Duplication | protected function doSave(ConnectionInterface $con) |
|
| 623 | |||
| 624 | /** |
||
| 625 | * Insert the row in the database. |
||
| 626 | * |
||
| 627 | * @param ConnectionInterface $con |
||
| 628 | * |
||
| 629 | * @throws PropelException |
||
| 630 | * @see doSave() |
||
| 631 | */ |
||
| 632 | View Code Duplication | protected function doInsert(ConnectionInterface $con) |
|
| 672 | |||
| 673 | /** |
||
| 674 | * Update the row in the database. |
||
| 675 | * |
||
| 676 | * @param ConnectionInterface $con |
||
| 677 | * |
||
| 678 | * @return Integer Number of updated rows |
||
| 679 | * @see doSave() |
||
| 680 | */ |
||
| 681 | protected function doUpdate(ConnectionInterface $con) |
||
| 688 | |||
| 689 | /** |
||
| 690 | * Retrieves a field from the object by name passed in as a string. |
||
| 691 | * |
||
| 692 | * @param string $name name |
||
| 693 | * @param string $type The type of fieldname the $name is of: |
||
| 694 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 695 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 696 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 697 | * @return mixed Value of field. |
||
| 698 | */ |
||
| 699 | public function getByName($name, $type = TableMap::TYPE_PHPNAME) |
||
| 706 | |||
| 707 | /** |
||
| 708 | * Retrieves a field from the object by Position as specified in the xml schema. |
||
| 709 | * Zero-based. |
||
| 710 | * |
||
| 711 | * @param int $pos position in xml schema |
||
| 712 | * @return mixed Value of field at $pos |
||
| 713 | */ |
||
| 714 | View Code Duplication | public function getByPosition($pos) |
|
| 728 | |||
| 729 | /** |
||
| 730 | * Exports the object as an array. |
||
| 731 | * |
||
| 732 | * You can specify the key type of the array by passing one of the class |
||
| 733 | * type constants. |
||
| 734 | * |
||
| 735 | * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 736 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 737 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 738 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. |
||
| 739 | * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion |
||
| 740 | * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. |
||
| 741 | * |
||
| 742 | * @return array an associative array containing the field names (as keys) and field values |
||
| 743 | */ |
||
| 744 | View Code Duplication | public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) |
|
| 781 | |||
| 782 | /** |
||
| 783 | * Sets a field from the object by name passed in as a string. |
||
| 784 | * |
||
| 785 | * @param string $name |
||
| 786 | * @param mixed $value field value |
||
| 787 | * @param string $type The type of fieldname the $name is of: |
||
| 788 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 789 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 790 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 791 | * @return $this|\mod_link\models\PageLinkProduct |
||
| 792 | */ |
||
| 793 | public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) |
||
| 799 | |||
| 800 | /** |
||
| 801 | * Sets a field from the object by Position as specified in the xml schema. |
||
| 802 | * Zero-based. |
||
| 803 | * |
||
| 804 | * @param int $pos position in xml schema |
||
| 805 | * @param mixed $value field value |
||
| 806 | * @return $this|\mod_link\models\PageLinkProduct |
||
| 807 | */ |
||
| 808 | View Code Duplication | public function setByPosition($pos, $value) |
|
| 821 | |||
| 822 | /** |
||
| 823 | * Populates the object using an array. |
||
| 824 | * |
||
| 825 | * This is particularly useful when populating an object from one of the |
||
| 826 | * request arrays (e.g. $_POST). This method goes through the column |
||
| 827 | * names, checking to see whether a matching key exists in populated |
||
| 828 | * array. If so the setByName() method is called for that column. |
||
| 829 | * |
||
| 830 | * You can specify the key type of the array by additionally passing one |
||
| 831 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 832 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 833 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
| 834 | * |
||
| 835 | * @param array $arr An array to populate the object from. |
||
| 836 | * @param string $keyType The type of keys the array uses. |
||
| 837 | * @return void |
||
| 838 | */ |
||
| 839 | View Code Duplication | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) |
|
| 850 | |||
| 851 | /** |
||
| 852 | * Populate the current object from a string, using a given parser format |
||
| 853 | * <code> |
||
| 854 | * $book = new Book(); |
||
| 855 | * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
| 856 | * </code> |
||
| 857 | * |
||
| 858 | * You can specify the key type of the array by additionally passing one |
||
| 859 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 860 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 861 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
| 862 | * |
||
| 863 | * @param mixed $parser A AbstractParser instance, |
||
| 864 | * or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
| 865 | * @param string $data The source data to import from |
||
| 866 | * @param string $keyType The type of keys the array uses. |
||
| 867 | * |
||
| 868 | * @return $this|\mod_link\models\PageLinkProduct The current object, for fluid interface |
||
| 869 | */ |
||
| 870 | View Code Duplication | public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) |
|
| 880 | |||
| 881 | /** |
||
| 882 | * Build a Criteria object containing the values of all modified columns in this object. |
||
| 883 | * |
||
| 884 | * @return Criteria The Criteria object containing all modified values. |
||
| 885 | */ |
||
| 886 | View Code Duplication | public function buildCriteria() |
|
| 899 | |||
| 900 | /** |
||
| 901 | * Builds a Criteria object containing the primary key for this object. |
||
| 902 | * |
||
| 903 | * Unlike buildCriteria() this method includes the primary key values regardless |
||
| 904 | * of whether or not they have been modified. |
||
| 905 | * |
||
| 906 | * @throws LogicException if no primary key is defined |
||
| 907 | * |
||
| 908 | * @return Criteria The Criteria object containing value(s) for primary key(s). |
||
| 909 | */ |
||
| 910 | public function buildPkeyCriteria() |
||
| 918 | |||
| 919 | /** |
||
| 920 | * If the primary key is not null, return the hashcode of the |
||
| 921 | * primary key. Otherwise, return the hash code of the object. |
||
| 922 | * |
||
| 923 | * @return int Hashcode |
||
| 924 | */ |
||
| 925 | View Code Duplication | public function hashCode() |
|
| 948 | |||
| 949 | /** |
||
| 950 | * Returns the composite primary key for this object. |
||
| 951 | * The array elements will be in same order as specified in XML. |
||
| 952 | * @return array |
||
| 953 | */ |
||
| 954 | View Code Duplication | public function getPrimaryKey() |
|
| 962 | |||
| 963 | /** |
||
| 964 | * Set the [composite] primary key. |
||
| 965 | * |
||
| 966 | * @param array $keys The elements of the composite key (order must match the order in XML file). |
||
| 967 | * @return void |
||
| 968 | */ |
||
| 969 | public function setPrimaryKey($keys) |
||
| 974 | |||
| 975 | /** |
||
| 976 | * Returns true if the primary key for this object is null. |
||
| 977 | * @return boolean |
||
| 978 | */ |
||
| 979 | public function isPrimaryKeyNull() |
||
| 983 | |||
| 984 | /** |
||
| 985 | * Sets contents of passed object to values from current object. |
||
| 986 | * |
||
| 987 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
| 988 | * objects. |
||
| 989 | * |
||
| 990 | * @param object $copyObj An object of \mod_link\models\PageLinkProduct (or compatible) type. |
||
| 991 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
| 992 | * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. |
||
| 993 | * @throws PropelException |
||
| 994 | */ |
||
| 995 | View Code Duplication | public function copyInto($copyObj, $deepCopy = false, $makeNew = true) |
|
| 1003 | |||
| 1004 | /** |
||
| 1005 | * Makes a copy of this object that will be inserted as a new row in table when saved. |
||
| 1006 | * It creates a new object filling in the simple attributes, but skipping any primary |
||
| 1007 | * keys that are defined for the table. |
||
| 1008 | * |
||
| 1009 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
| 1010 | * objects. |
||
| 1011 | * |
||
| 1012 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
| 1013 | * @return \mod_link\models\PageLinkProduct Clone of current object. |
||
| 1014 | * @throws PropelException |
||
| 1015 | */ |
||
| 1016 | public function copy($deepCopy = false) |
||
| 1025 | |||
| 1026 | /** |
||
| 1027 | * Declares an association between this object and a ChildPageLink object. |
||
| 1028 | * |
||
| 1029 | * @param ChildPageLink $v |
||
| 1030 | * @return $this|\mod_link\models\PageLinkProduct The current object (for fluent API support) |
||
| 1031 | * @throws PropelException |
||
| 1032 | */ |
||
| 1033 | View Code Duplication | public function setPageLink(ChildPageLink $v = null) |
|
| 1052 | |||
| 1053 | |||
| 1054 | /** |
||
| 1055 | * Get the associated ChildPageLink object |
||
| 1056 | * |
||
| 1057 | * @param ConnectionInterface $con Optional Connection object. |
||
| 1058 | * @return ChildPageLink The associated ChildPageLink object. |
||
| 1059 | * @throws PropelException |
||
| 1060 | */ |
||
| 1061 | View Code Duplication | public function getPageLink(ConnectionInterface $con = null) |
|
| 1076 | |||
| 1077 | /** |
||
| 1078 | * Clears the current object, sets all attributes to their default values and removes |
||
| 1079 | * outgoing references as well as back-references (from other objects to this one. Results probably in a database |
||
| 1080 | * change of those foreign objects when you call `save` there). |
||
| 1081 | */ |
||
| 1082 | View Code Duplication | public function clear() |
|
| 1095 | |||
| 1096 | /** |
||
| 1097 | * Resets all references and back-references to other model objects or collections of model objects. |
||
| 1098 | * |
||
| 1099 | * This method is used to reset all php object references (not the actual reference in the database). |
||
| 1100 | * Necessary for object serialisation. |
||
| 1101 | * |
||
| 1102 | * @param boolean $deep Whether to also clear the references on all referrer objects. |
||
| 1103 | */ |
||
| 1104 | public function clearAllReferences($deep = false) |
||
| 1111 | |||
| 1112 | /** |
||
| 1113 | * Return the string representation of this object |
||
| 1114 | * |
||
| 1115 | * @return string |
||
| 1116 | */ |
||
| 1117 | public function __toString() |
||
| 1121 | |||
| 1122 | /** |
||
| 1123 | * Code to be run before persisting the object |
||
| 1124 | * @param ConnectionInterface $con |
||
| 1125 | * @return boolean |
||
| 1126 | */ |
||
| 1127 | public function preSave(ConnectionInterface $con = null) |
||
| 1134 | |||
| 1135 | /** |
||
| 1136 | * Code to be run after persisting the object |
||
| 1137 | * @param ConnectionInterface $con |
||
| 1138 | */ |
||
| 1139 | public function postSave(ConnectionInterface $con = null) |
||
| 1145 | |||
| 1146 | /** |
||
| 1147 | * Code to be run before inserting to database |
||
| 1148 | * @param ConnectionInterface $con |
||
| 1149 | * @return boolean |
||
| 1150 | */ |
||
| 1151 | public function preInsert(ConnectionInterface $con = null) |
||
| 1158 | |||
| 1159 | /** |
||
| 1160 | * Code to be run after inserting to database |
||
| 1161 | * @param ConnectionInterface $con |
||
| 1162 | */ |
||
| 1163 | public function postInsert(ConnectionInterface $con = null) |
||
| 1169 | |||
| 1170 | /** |
||
| 1171 | * Code to be run before updating the object in database |
||
| 1172 | * @param ConnectionInterface $con |
||
| 1173 | * @return boolean |
||
| 1174 | */ |
||
| 1175 | public function preUpdate(ConnectionInterface $con = null) |
||
| 1182 | |||
| 1183 | /** |
||
| 1184 | * Code to be run after updating the object in database |
||
| 1185 | * @param ConnectionInterface $con |
||
| 1186 | */ |
||
| 1187 | public function postUpdate(ConnectionInterface $con = null) |
||
| 1193 | |||
| 1194 | /** |
||
| 1195 | * Code to be run before deleting the object in database |
||
| 1196 | * @param ConnectionInterface $con |
||
| 1197 | * @return boolean |
||
| 1198 | */ |
||
| 1199 | public function preDelete(ConnectionInterface $con = null) |
||
| 1206 | |||
| 1207 | /** |
||
| 1208 | * Code to be run after deleting the object in database |
||
| 1209 | * @param ConnectionInterface $con |
||
| 1210 | */ |
||
| 1211 | public function postDelete(ConnectionInterface $con = null) |
||
| 1217 | |||
| 1218 | |||
| 1219 | /** |
||
| 1220 | * Derived method to catches calls to undefined methods. |
||
| 1221 | * |
||
| 1222 | * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). |
||
| 1223 | * Allows to define default __call() behavior if you overwrite __call() |
||
| 1224 | * |
||
| 1225 | * @param string $name |
||
| 1226 | * @param mixed $params |
||
| 1227 | * |
||
| 1228 | * @return array|string |
||
| 1229 | */ |
||
| 1230 | View Code Duplication | public function __call($name, $params) |
|
| 1259 | |||
| 1260 | } |
||
| 1261 |