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 BannersI18n 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 BannersI18n, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 31 | abstract class BannersI18n extends PropelBaseModelClass implements ActiveRecordInterface |
||
| 32 | { |
||
| 33 | /** |
||
| 34 | * TableMap class name |
||
| 35 | */ |
||
| 36 | const TABLE_MAP = '\\xbanners\\models\\Map\\BannersI18nTableMap'; |
||
| 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 id field. |
||
| 67 | * |
||
| 68 | * @var int |
||
| 69 | */ |
||
| 70 | protected $id; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * The value for the locale field. |
||
| 74 | * |
||
| 75 | * Note: this column has a database default value of: 'ru' |
||
| 76 | * @var string |
||
| 77 | */ |
||
| 78 | protected $locale; |
||
| 79 | |||
| 80 | /** |
||
| 81 | * The value for the name field. |
||
| 82 | * |
||
| 83 | * @var string |
||
| 84 | */ |
||
| 85 | protected $name; |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @var ChildBanners |
||
| 89 | */ |
||
| 90 | protected $aBanners; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * Flag to prevent endless save loop, if this object is referenced |
||
| 94 | * by another object which falls in this transaction. |
||
| 95 | * |
||
| 96 | * @var boolean |
||
| 97 | */ |
||
| 98 | protected $alreadyInSave = false; |
||
| 99 | |||
| 100 | /** |
||
| 101 | * Applies default values to this object. |
||
| 102 | * This method should be called from the object's constructor (or |
||
| 103 | * equivalent initialization method). |
||
| 104 | * @see __construct() |
||
| 105 | */ |
||
| 106 | public function applyDefaultValues() |
||
| 110 | |||
| 111 | /** |
||
| 112 | * Initializes internal state of xbanners\models\Base\BannersI18n object. |
||
| 113 | * @see applyDefaults() |
||
| 114 | */ |
||
| 115 | public function __construct() |
||
| 119 | |||
| 120 | /** |
||
| 121 | * Returns whether the object has been modified. |
||
| 122 | * |
||
| 123 | * @return boolean True if the object has been modified. |
||
| 124 | */ |
||
| 125 | public function isModified() |
||
| 129 | |||
| 130 | /** |
||
| 131 | * Has specified column been modified? |
||
| 132 | * |
||
| 133 | * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID |
||
| 134 | * @return boolean True if $col has been modified. |
||
| 135 | */ |
||
| 136 | public function isColumnModified($col) |
||
| 140 | |||
| 141 | /** |
||
| 142 | * Get the columns that have been modified in this object. |
||
| 143 | * @return array A unique list of the modified column names for this object. |
||
| 144 | */ |
||
| 145 | public function getModifiedColumns() |
||
| 149 | |||
| 150 | /** |
||
| 151 | * Returns whether the object has ever been saved. This will |
||
| 152 | * be false, if the object was retrieved from storage or was created |
||
| 153 | * and then saved. |
||
| 154 | * |
||
| 155 | * @return boolean true, if the object has never been persisted. |
||
| 156 | */ |
||
| 157 | public function isNew() |
||
| 161 | |||
| 162 | /** |
||
| 163 | * Setter for the isNew attribute. This method will be called |
||
| 164 | * by Propel-generated children and objects. |
||
| 165 | * |
||
| 166 | * @param boolean $b the state of the object. |
||
| 167 | */ |
||
| 168 | public function setNew($b) |
||
| 172 | |||
| 173 | /** |
||
| 174 | * Whether this object has been deleted. |
||
| 175 | * @return boolean The deleted state of this object. |
||
| 176 | */ |
||
| 177 | public function isDeleted() |
||
| 181 | |||
| 182 | /** |
||
| 183 | * Specify whether this object has been deleted. |
||
| 184 | * @param boolean $b The deleted state of this object. |
||
| 185 | * @return void |
||
| 186 | */ |
||
| 187 | public function setDeleted($b) |
||
| 191 | |||
| 192 | /** |
||
| 193 | * Sets the modified state for the object to be false. |
||
| 194 | * @param string $col If supplied, only the specified column is reset. |
||
| 195 | * @return void |
||
| 196 | */ |
||
| 197 | View Code Duplication | public function resetModified($col = null) |
|
| 207 | |||
| 208 | /** |
||
| 209 | * Compares this with another <code>BannersI18n</code> instance. If |
||
| 210 | * <code>obj</code> is an instance of <code>BannersI18n</code>, delegates to |
||
| 211 | * <code>equals(BannersI18n)</code>. Otherwise, returns <code>false</code>. |
||
| 212 | * |
||
| 213 | * @param mixed $obj The object to compare to. |
||
| 214 | * @return boolean Whether equal to the object specified. |
||
| 215 | */ |
||
| 216 | View Code Duplication | public function equals($obj) |
|
| 232 | |||
| 233 | /** |
||
| 234 | * Get the associative array of the virtual columns in this object |
||
| 235 | * |
||
| 236 | * @return array |
||
| 237 | */ |
||
| 238 | public function getVirtualColumns() |
||
| 242 | |||
| 243 | /** |
||
| 244 | * Checks the existence of a virtual column in this object |
||
| 245 | * |
||
| 246 | * @param string $name The virtual column name |
||
| 247 | * @return boolean |
||
| 248 | */ |
||
| 249 | public function hasVirtualColumn($name) |
||
| 253 | |||
| 254 | /** |
||
| 255 | * Get the value of a virtual column in this object |
||
| 256 | * |
||
| 257 | * @param string $name The virtual column name |
||
| 258 | * @return mixed |
||
| 259 | * |
||
| 260 | * @throws PropelException |
||
| 261 | */ |
||
| 262 | View Code Duplication | public function getVirtualColumn($name) |
|
| 270 | |||
| 271 | /** |
||
| 272 | * Set the value of a virtual column in this object |
||
| 273 | * |
||
| 274 | * @param string $name The virtual column name |
||
| 275 | * @param mixed $value The value to give to the virtual column |
||
| 276 | * |
||
| 277 | * @return $this|BannersI18n The current object, for fluid interface |
||
| 278 | */ |
||
| 279 | public function setVirtualColumn($name, $value) |
||
| 285 | |||
| 286 | /** |
||
| 287 | * Logs a message using Propel::log(). |
||
| 288 | * |
||
| 289 | * @param string $msg |
||
| 290 | * @param int $priority One of the Propel::LOG_* logging levels |
||
| 291 | * @return boolean |
||
|
|
|||
| 292 | */ |
||
| 293 | protected function log($msg, $priority = Propel::LOG_INFO) |
||
| 297 | |||
| 298 | /** |
||
| 299 | * Export the current object properties to a string, using a given parser format |
||
| 300 | * <code> |
||
| 301 | * $book = BookQuery::create()->findPk(9012); |
||
| 302 | * echo $book->exportTo('JSON'); |
||
| 303 | * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
| 304 | * </code> |
||
| 305 | * |
||
| 306 | * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
| 307 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. |
||
| 308 | * @return string The exported data |
||
| 309 | */ |
||
| 310 | View Code Duplication | public function exportTo($parser, $includeLazyLoadColumns = true) |
|
| 318 | |||
| 319 | /** |
||
| 320 | * Clean up internal collections prior to serializing |
||
| 321 | * Avoids recursive loops that turn into segmentation faults when serializing |
||
| 322 | */ |
||
| 323 | View Code Duplication | public function __sleep() |
|
| 337 | |||
| 338 | /** |
||
| 339 | * Get the [id] column value. |
||
| 340 | * |
||
| 341 | * @return int |
||
| 342 | */ |
||
| 343 | public function getId() |
||
| 347 | |||
| 348 | /** |
||
| 349 | * Get the [locale] column value. |
||
| 350 | * |
||
| 351 | * @return string |
||
| 352 | */ |
||
| 353 | public function getLocale() |
||
| 357 | |||
| 358 | /** |
||
| 359 | * Get the [name] column value. |
||
| 360 | * |
||
| 361 | * @return string |
||
| 362 | */ |
||
| 363 | public function getName() |
||
| 367 | |||
| 368 | /** |
||
| 369 | * Set the value of [id] column. |
||
| 370 | * |
||
| 371 | * @param int $v new value |
||
| 372 | * @return $this|\xbanners\models\BannersI18n The current object (for fluent API support) |
||
| 373 | */ |
||
| 374 | View Code Duplication | public function setId($v) |
|
| 391 | |||
| 392 | /** |
||
| 393 | * Set the value of [locale] column. |
||
| 394 | * |
||
| 395 | * @param string $v new value |
||
| 396 | * @return $this|\xbanners\models\BannersI18n The current object (for fluent API support) |
||
| 397 | */ |
||
| 398 | View Code Duplication | public function setLocale($v) |
|
| 411 | |||
| 412 | /** |
||
| 413 | * Set the value of [name] column. |
||
| 414 | * |
||
| 415 | * @param string $v new value |
||
| 416 | * @return $this|\xbanners\models\BannersI18n The current object (for fluent API support) |
||
| 417 | */ |
||
| 418 | public function setName($v) |
||
| 431 | |||
| 432 | /** |
||
| 433 | * Indicates whether the columns in this object are only set to default values. |
||
| 434 | * |
||
| 435 | * This method can be used in conjunction with isModified() to indicate whether an object is both |
||
| 436 | * modified _and_ has some values set which are non-default. |
||
| 437 | * |
||
| 438 | * @return boolean Whether the columns in this object are only been set with default values. |
||
| 439 | */ |
||
| 440 | public function hasOnlyDefaultValues() |
||
| 449 | |||
| 450 | /** |
||
| 451 | * Hydrates (populates) the object variables with values from the database resultset. |
||
| 452 | * |
||
| 453 | * An offset (0-based "start column") is specified so that objects can be hydrated |
||
| 454 | * with a subset of the columns in the resultset rows. This is needed, for example, |
||
| 455 | * for results of JOIN queries where the resultset row includes columns from two or |
||
| 456 | * more tables. |
||
| 457 | * |
||
| 458 | * @param array $row The row returned by DataFetcher->fetch(). |
||
| 459 | * @param int $startcol 0-based offset column which indicates which restultset column to start with. |
||
| 460 | * @param boolean $rehydrate Whether this object is being re-hydrated from the database. |
||
| 461 | * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
||
| 462 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 463 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 464 | * |
||
| 465 | * @return int next starting column |
||
| 466 | * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. |
||
| 467 | */ |
||
| 468 | public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) |
||
| 494 | |||
| 495 | /** |
||
| 496 | * Checks and repairs the internal consistency of the object. |
||
| 497 | * |
||
| 498 | * This method is executed after an already-instantiated object is re-hydrated |
||
| 499 | * from the database. It exists to check any foreign keys to make sure that |
||
| 500 | * the objects related to the current object are correct based on foreign key. |
||
| 501 | * |
||
| 502 | * You can override this method in the stub class, but you should always invoke |
||
| 503 | * the base method from the overridden method (i.e. parent::ensureConsistency()), |
||
| 504 | * in case your model changes. |
||
| 505 | * |
||
| 506 | * @throws PropelException |
||
| 507 | */ |
||
| 508 | public function ensureConsistency() |
||
| 514 | |||
| 515 | /** |
||
| 516 | * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. |
||
| 517 | * |
||
| 518 | * This will only work if the object has been saved and has a valid primary key set. |
||
| 519 | * |
||
| 520 | * @param boolean $deep (optional) Whether to also de-associated any related objects. |
||
| 521 | * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. |
||
| 522 | * @return void |
||
| 523 | * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db |
||
| 524 | */ |
||
| 525 | View Code Duplication | public function reload($deep = false, ConnectionInterface $con = null) |
|
| 555 | |||
| 556 | /** |
||
| 557 | * Removes this object from datastore and sets delete attribute. |
||
| 558 | * |
||
| 559 | * @param ConnectionInterface $con |
||
| 560 | * @return void |
||
| 561 | * @throws PropelException |
||
| 562 | * @see BannersI18n::setDeleted() |
||
| 563 | * @see BannersI18n::isDeleted() |
||
| 564 | */ |
||
| 565 | View Code Duplication | public function delete(ConnectionInterface $con = null) |
|
| 586 | |||
| 587 | /** |
||
| 588 | * Persists this object to the database. |
||
| 589 | * |
||
| 590 | * If the object is new, it inserts it; otherwise an update is performed. |
||
| 591 | * All modified related objects will also be persisted in the doSave() |
||
| 592 | * method. This method wraps all precipitate database operations in a |
||
| 593 | * single transaction. |
||
| 594 | * |
||
| 595 | * @param ConnectionInterface $con |
||
| 596 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
| 597 | * @throws PropelException |
||
| 598 | * @see doSave() |
||
| 599 | */ |
||
| 600 | View Code Duplication | public function save(ConnectionInterface $con = null) |
|
| 638 | |||
| 639 | /** |
||
| 640 | * Performs the work of inserting or updating the row in the database. |
||
| 641 | * |
||
| 642 | * If the object is new, it inserts it; otherwise an update is performed. |
||
| 643 | * All related objects are also updated in this method. |
||
| 644 | * |
||
| 645 | * @param ConnectionInterface $con |
||
| 646 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
| 647 | * @throws PropelException |
||
| 648 | * @see save() |
||
| 649 | */ |
||
| 650 | View Code Duplication | protected function doSave(ConnectionInterface $con) |
|
| 685 | |||
| 686 | /** |
||
| 687 | * Insert the row in the database. |
||
| 688 | * |
||
| 689 | * @param ConnectionInterface $con |
||
| 690 | * |
||
| 691 | * @throws PropelException |
||
| 692 | * @see doSave() |
||
| 693 | */ |
||
| 694 | protected function doInsert(ConnectionInterface $con) |
||
| 740 | |||
| 741 | /** |
||
| 742 | * Update the row in the database. |
||
| 743 | * |
||
| 744 | * @param ConnectionInterface $con |
||
| 745 | * |
||
| 746 | * @return Integer Number of updated rows |
||
| 747 | * @see doSave() |
||
| 748 | */ |
||
| 749 | protected function doUpdate(ConnectionInterface $con) |
||
| 756 | |||
| 757 | /** |
||
| 758 | * Retrieves a field from the object by name passed in as a string. |
||
| 759 | * |
||
| 760 | * @param string $name name |
||
| 761 | * @param string $type The type of fieldname the $name is of: |
||
| 762 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 763 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 764 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 765 | * @return mixed Value of field. |
||
| 766 | */ |
||
| 767 | View Code Duplication | public function getByName($name, $type = TableMap::TYPE_PHPNAME) |
|
| 774 | |||
| 775 | /** |
||
| 776 | * Retrieves a field from the object by Position as specified in the xml schema. |
||
| 777 | * Zero-based. |
||
| 778 | * |
||
| 779 | * @param int $pos position in xml schema |
||
| 780 | * @return mixed Value of field at $pos |
||
| 781 | */ |
||
| 782 | public function getByPosition($pos) |
||
| 799 | |||
| 800 | /** |
||
| 801 | * Exports the object as an array. |
||
| 802 | * |
||
| 803 | * You can specify the key type of the array by passing one of the class |
||
| 804 | * type constants. |
||
| 805 | * |
||
| 806 | * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 807 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 808 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 809 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. |
||
| 810 | * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion |
||
| 811 | * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. |
||
| 812 | * |
||
| 813 | * @return array an associative array containing the field names (as keys) and field values |
||
| 814 | */ |
||
| 815 | public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) |
||
| 853 | |||
| 854 | /** |
||
| 855 | * Sets a field from the object by name passed in as a string. |
||
| 856 | * |
||
| 857 | * @param string $name |
||
| 858 | * @param mixed $value field value |
||
| 859 | * @param string $type The type of fieldname the $name is of: |
||
| 860 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 861 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 862 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 863 | * @return $this|\xbanners\models\BannersI18n |
||
| 864 | */ |
||
| 865 | public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) |
||
| 871 | |||
| 872 | /** |
||
| 873 | * Sets a field from the object by Position as specified in the xml schema. |
||
| 874 | * Zero-based. |
||
| 875 | * |
||
| 876 | * @param int $pos position in xml schema |
||
| 877 | * @param mixed $value field value |
||
| 878 | * @return $this|\xbanners\models\BannersI18n |
||
| 879 | */ |
||
| 880 | public function setByPosition($pos, $value) |
||
| 896 | |||
| 897 | /** |
||
| 898 | * Populates the object using an array. |
||
| 899 | * |
||
| 900 | * This is particularly useful when populating an object from one of the |
||
| 901 | * request arrays (e.g. $_POST). This method goes through the column |
||
| 902 | * names, checking to see whether a matching key exists in populated |
||
| 903 | * array. If so the setByName() method is called for that column. |
||
| 904 | * |
||
| 905 | * You can specify the key type of the array by additionally passing one |
||
| 906 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 907 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 908 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
| 909 | * |
||
| 910 | * @param array $arr An array to populate the object from. |
||
| 911 | * @param string $keyType The type of keys the array uses. |
||
| 912 | * @return void |
||
| 913 | */ |
||
| 914 | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) |
||
| 928 | |||
| 929 | /** |
||
| 930 | * Populate the current object from a string, using a given parser format |
||
| 931 | * <code> |
||
| 932 | * $book = new Book(); |
||
| 933 | * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
| 934 | * </code> |
||
| 935 | * |
||
| 936 | * You can specify the key type of the array by additionally passing one |
||
| 937 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 938 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 939 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
| 940 | * |
||
| 941 | * @param mixed $parser A AbstractParser instance, |
||
| 942 | * or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
| 943 | * @param string $data The source data to import from |
||
| 944 | * @param string $keyType The type of keys the array uses. |
||
| 945 | * |
||
| 946 | * @return $this|\xbanners\models\BannersI18n The current object, for fluid interface |
||
| 947 | */ |
||
| 948 | View Code Duplication | public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) |
|
| 958 | |||
| 959 | /** |
||
| 960 | * Build a Criteria object containing the values of all modified columns in this object. |
||
| 961 | * |
||
| 962 | * @return Criteria The Criteria object containing all modified values. |
||
| 963 | */ |
||
| 964 | public function buildCriteria() |
||
| 980 | |||
| 981 | /** |
||
| 982 | * Builds a Criteria object containing the primary key for this object. |
||
| 983 | * |
||
| 984 | * Unlike buildCriteria() this method includes the primary key values regardless |
||
| 985 | * of whether or not they have been modified. |
||
| 986 | * |
||
| 987 | * @throws LogicException if no primary key is defined |
||
| 988 | * |
||
| 989 | * @return Criteria The Criteria object containing value(s) for primary key(s). |
||
| 990 | */ |
||
| 991 | public function buildPkeyCriteria() |
||
| 999 | |||
| 1000 | /** |
||
| 1001 | * If the primary key is not null, return the hashcode of the |
||
| 1002 | * primary key. Otherwise, return the hash code of the object. |
||
| 1003 | * |
||
| 1004 | * @return int Hashcode |
||
| 1005 | */ |
||
| 1006 | View Code Duplication | public function hashCode() |
|
| 1029 | |||
| 1030 | /** |
||
| 1031 | * Returns the composite primary key for this object. |
||
| 1032 | * The array elements will be in same order as specified in XML. |
||
| 1033 | * @return array |
||
| 1034 | */ |
||
| 1035 | View Code Duplication | public function getPrimaryKey() |
|
| 1043 | |||
| 1044 | /** |
||
| 1045 | * Set the [composite] primary key. |
||
| 1046 | * |
||
| 1047 | * @param array $keys The elements of the composite key (order must match the order in XML file). |
||
| 1048 | * @return void |
||
| 1049 | */ |
||
| 1050 | public function setPrimaryKey($keys) |
||
| 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 \xbanners\models\BannersI18n (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) |
||
| 1085 | |||
| 1086 | /** |
||
| 1087 | * Makes a copy of this object that will be inserted as a new row in table when saved. |
||
| 1088 | * It creates a new object filling in the simple attributes, but skipping any primary |
||
| 1089 | * keys that are defined for the table. |
||
| 1090 | * |
||
| 1091 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
| 1092 | * objects. |
||
| 1093 | * |
||
| 1094 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
| 1095 | * @return \xbanners\models\BannersI18n Clone of current object. |
||
| 1096 | * @throws PropelException |
||
| 1097 | */ |
||
| 1098 | View Code Duplication | public function copy($deepCopy = false) |
|
| 1107 | |||
| 1108 | /** |
||
| 1109 | * Declares an association between this object and a ChildBanners object. |
||
| 1110 | * |
||
| 1111 | * @param ChildBanners $v |
||
| 1112 | * @return $this|\xbanners\models\BannersI18n The current object (for fluent API support) |
||
| 1113 | * @throws PropelException |
||
| 1114 | */ |
||
| 1115 | View Code Duplication | public function setBanners(ChildBanners $v = null) |
|
| 1134 | |||
| 1135 | |||
| 1136 | /** |
||
| 1137 | * Get the associated ChildBanners object |
||
| 1138 | * |
||
| 1139 | * @param ConnectionInterface $con Optional Connection object. |
||
| 1140 | * @return ChildBanners The associated ChildBanners object. |
||
| 1141 | * @throws PropelException |
||
| 1142 | */ |
||
| 1143 | View Code Duplication | public function getBanners(ConnectionInterface $con = null) |
|
| 1158 | |||
| 1159 | /** |
||
| 1160 | * Clears the current object, sets all attributes to their default values and removes |
||
| 1161 | * outgoing references as well as back-references (from other objects to this one. Results probably in a database |
||
| 1162 | * change of those foreign objects when you call `save` there). |
||
| 1163 | */ |
||
| 1164 | public function clear() |
||
| 1179 | |||
| 1180 | /** |
||
| 1181 | * Resets all references and back-references to other model objects or collections of model objects. |
||
| 1182 | * |
||
| 1183 | * This method is used to reset all php object references (not the actual reference in the database). |
||
| 1184 | * Necessary for object serialisation. |
||
| 1185 | * |
||
| 1186 | * @param boolean $deep Whether to also clear the references on all referrer objects. |
||
| 1187 | */ |
||
| 1188 | public function clearAllReferences($deep = false) |
||
| 1195 | |||
| 1196 | /** |
||
| 1197 | * Return the string representation of this object |
||
| 1198 | * |
||
| 1199 | * @return string |
||
| 1200 | */ |
||
| 1201 | public function __toString() |
||
| 1205 | |||
| 1206 | /** |
||
| 1207 | * Code to be run before persisting the object |
||
| 1208 | * @param ConnectionInterface $con |
||
| 1209 | * @return boolean |
||
| 1210 | */ |
||
| 1211 | public function preSave(ConnectionInterface $con = null) |
||
| 1218 | |||
| 1219 | /** |
||
| 1220 | * Code to be run after persisting the object |
||
| 1221 | * @param ConnectionInterface $con |
||
| 1222 | */ |
||
| 1223 | public function postSave(ConnectionInterface $con = null) |
||
| 1229 | |||
| 1230 | /** |
||
| 1231 | * Code to be run before inserting to database |
||
| 1232 | * @param ConnectionInterface $con |
||
| 1233 | * @return boolean |
||
| 1234 | */ |
||
| 1235 | public function preInsert(ConnectionInterface $con = null) |
||
| 1242 | |||
| 1243 | /** |
||
| 1244 | * Code to be run after inserting to database |
||
| 1245 | * @param ConnectionInterface $con |
||
| 1246 | */ |
||
| 1247 | public function postInsert(ConnectionInterface $con = null) |
||
| 1253 | |||
| 1254 | /** |
||
| 1255 | * Code to be run before updating the object in database |
||
| 1256 | * @param ConnectionInterface $con |
||
| 1257 | * @return boolean |
||
| 1258 | */ |
||
| 1259 | public function preUpdate(ConnectionInterface $con = null) |
||
| 1266 | |||
| 1267 | /** |
||
| 1268 | * Code to be run after updating the object in database |
||
| 1269 | * @param ConnectionInterface $con |
||
| 1270 | */ |
||
| 1271 | public function postUpdate(ConnectionInterface $con = null) |
||
| 1277 | |||
| 1278 | /** |
||
| 1279 | * Code to be run before deleting the object in database |
||
| 1280 | * @param ConnectionInterface $con |
||
| 1281 | * @return boolean |
||
| 1282 | */ |
||
| 1283 | public function preDelete(ConnectionInterface $con = null) |
||
| 1290 | |||
| 1291 | /** |
||
| 1292 | * Code to be run after deleting the object in database |
||
| 1293 | * @param ConnectionInterface $con |
||
| 1294 | */ |
||
| 1295 | public function postDelete(ConnectionInterface $con = null) |
||
| 1301 | |||
| 1302 | |||
| 1303 | /** |
||
| 1304 | * Derived method to catches calls to undefined methods. |
||
| 1305 | * |
||
| 1306 | * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). |
||
| 1307 | * Allows to define default __call() behavior if you overwrite __call() |
||
| 1308 | * |
||
| 1309 | * @param string $name |
||
| 1310 | * @param mixed $params |
||
| 1311 | * |
||
| 1312 | * @return array|string |
||
| 1313 | */ |
||
| 1314 | View Code Duplication | public function __call($name, $params) |
|
| 1343 | |||
| 1344 | } |
||
| 1345 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.