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 BannerImageI18n 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 BannerImageI18n, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 31 | abstract class BannerImageI18n extends PropelBaseModelClass implements ActiveRecordInterface |
||
| 32 | { |
||
| 33 | /** |
||
| 34 | * TableMap class name |
||
| 35 | */ |
||
| 36 | const TABLE_MAP = '\\xbanners\\models\\Map\\BannerImageI18nTableMap'; |
||
| 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 src field. |
||
| 82 | * |
||
| 83 | * @var string |
||
| 84 | */ |
||
| 85 | protected $src; |
||
| 86 | |||
| 87 | /** |
||
| 88 | * The value for the name field. |
||
| 89 | * |
||
| 90 | * @var string |
||
| 91 | */ |
||
| 92 | protected $name; |
||
| 93 | |||
| 94 | /** |
||
| 95 | * The value for the clicks field. |
||
| 96 | * |
||
| 97 | * @var int |
||
| 98 | */ |
||
| 99 | protected $clicks; |
||
| 100 | |||
| 101 | /** |
||
| 102 | * The value for the description field. |
||
| 103 | * |
||
| 104 | * @var string |
||
| 105 | */ |
||
| 106 | protected $description; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @var ChildBannerImage |
||
| 110 | */ |
||
| 111 | protected $aBannerImage; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * Flag to prevent endless save loop, if this object is referenced |
||
| 115 | * by another object which falls in this transaction. |
||
| 116 | * |
||
| 117 | * @var boolean |
||
| 118 | */ |
||
| 119 | protected $alreadyInSave = false; |
||
| 120 | |||
| 121 | /** |
||
| 122 | * Applies default values to this object. |
||
| 123 | * This method should be called from the object's constructor (or |
||
| 124 | * equivalent initialization method). |
||
| 125 | * @see __construct() |
||
| 126 | */ |
||
| 127 | public function applyDefaultValues() |
||
| 131 | |||
| 132 | /** |
||
| 133 | * Initializes internal state of xbanners\models\Base\BannerImageI18n object. |
||
| 134 | * @see applyDefaults() |
||
| 135 | */ |
||
| 136 | public function __construct() |
||
| 140 | |||
| 141 | /** |
||
| 142 | * Returns whether the object has been modified. |
||
| 143 | * |
||
| 144 | * @return boolean True if the object has been modified. |
||
| 145 | */ |
||
| 146 | public function isModified() |
||
| 150 | |||
| 151 | /** |
||
| 152 | * Has specified column been modified? |
||
| 153 | * |
||
| 154 | * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID |
||
| 155 | * @return boolean True if $col has been modified. |
||
| 156 | */ |
||
| 157 | public function isColumnModified($col) |
||
| 161 | |||
| 162 | /** |
||
| 163 | * Get the columns that have been modified in this object. |
||
| 164 | * @return array A unique list of the modified column names for this object. |
||
| 165 | */ |
||
| 166 | public function getModifiedColumns() |
||
| 170 | |||
| 171 | /** |
||
| 172 | * Returns whether the object has ever been saved. This will |
||
| 173 | * be false, if the object was retrieved from storage or was created |
||
| 174 | * and then saved. |
||
| 175 | * |
||
| 176 | * @return boolean true, if the object has never been persisted. |
||
| 177 | */ |
||
| 178 | public function isNew() |
||
| 182 | |||
| 183 | /** |
||
| 184 | * Setter for the isNew attribute. This method will be called |
||
| 185 | * by Propel-generated children and objects. |
||
| 186 | * |
||
| 187 | * @param boolean $b the state of the object. |
||
| 188 | */ |
||
| 189 | public function setNew($b) |
||
| 193 | |||
| 194 | /** |
||
| 195 | * Whether this object has been deleted. |
||
| 196 | * @return boolean The deleted state of this object. |
||
| 197 | */ |
||
| 198 | public function isDeleted() |
||
| 202 | |||
| 203 | /** |
||
| 204 | * Specify whether this object has been deleted. |
||
| 205 | * @param boolean $b The deleted state of this object. |
||
| 206 | * @return void |
||
| 207 | */ |
||
| 208 | public function setDeleted($b) |
||
| 212 | |||
| 213 | /** |
||
| 214 | * Sets the modified state for the object to be false. |
||
| 215 | * @param string $col If supplied, only the specified column is reset. |
||
| 216 | * @return void |
||
| 217 | */ |
||
| 218 | View Code Duplication | public function resetModified($col = null) |
|
| 228 | |||
| 229 | /** |
||
| 230 | * Compares this with another <code>BannerImageI18n</code> instance. If |
||
| 231 | * <code>obj</code> is an instance of <code>BannerImageI18n</code>, delegates to |
||
| 232 | * <code>equals(BannerImageI18n)</code>. Otherwise, returns <code>false</code>. |
||
| 233 | * |
||
| 234 | * @param mixed $obj The object to compare to. |
||
| 235 | * @return boolean Whether equal to the object specified. |
||
| 236 | */ |
||
| 237 | View Code Duplication | public function equals($obj) |
|
| 253 | |||
| 254 | /** |
||
| 255 | * Get the associative array of the virtual columns in this object |
||
| 256 | * |
||
| 257 | * @return array |
||
| 258 | */ |
||
| 259 | public function getVirtualColumns() |
||
| 263 | |||
| 264 | /** |
||
| 265 | * Checks the existence of a virtual column in this object |
||
| 266 | * |
||
| 267 | * @param string $name The virtual column name |
||
| 268 | * @return boolean |
||
| 269 | */ |
||
| 270 | public function hasVirtualColumn($name) |
||
| 274 | |||
| 275 | /** |
||
| 276 | * Get the value of a virtual column in this object |
||
| 277 | * |
||
| 278 | * @param string $name The virtual column name |
||
| 279 | * @return mixed |
||
| 280 | * |
||
| 281 | * @throws PropelException |
||
| 282 | */ |
||
| 283 | View Code Duplication | public function getVirtualColumn($name) |
|
| 291 | |||
| 292 | /** |
||
| 293 | * Set the value of a virtual column in this object |
||
| 294 | * |
||
| 295 | * @param string $name The virtual column name |
||
| 296 | * @param mixed $value The value to give to the virtual column |
||
| 297 | * |
||
| 298 | * @return $this|BannerImageI18n The current object, for fluid interface |
||
| 299 | */ |
||
| 300 | public function setVirtualColumn($name, $value) |
||
| 306 | |||
| 307 | /** |
||
| 308 | * Logs a message using Propel::log(). |
||
| 309 | * |
||
| 310 | * @param string $msg |
||
| 311 | * @param int $priority One of the Propel::LOG_* logging levels |
||
| 312 | * @return boolean |
||
|
|
|||
| 313 | */ |
||
| 314 | protected function log($msg, $priority = Propel::LOG_INFO) |
||
| 318 | |||
| 319 | /** |
||
| 320 | * Export the current object properties to a string, using a given parser format |
||
| 321 | * <code> |
||
| 322 | * $book = BookQuery::create()->findPk(9012); |
||
| 323 | * echo $book->exportTo('JSON'); |
||
| 324 | * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
| 325 | * </code> |
||
| 326 | * |
||
| 327 | * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
| 328 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. |
||
| 329 | * @return string The exported data |
||
| 330 | */ |
||
| 331 | View Code Duplication | public function exportTo($parser, $includeLazyLoadColumns = true) |
|
| 339 | |||
| 340 | /** |
||
| 341 | * Clean up internal collections prior to serializing |
||
| 342 | * Avoids recursive loops that turn into segmentation faults when serializing |
||
| 343 | */ |
||
| 344 | View Code Duplication | public function __sleep() |
|
| 358 | |||
| 359 | /** |
||
| 360 | * Get the [id] column value. |
||
| 361 | * |
||
| 362 | * @return int |
||
| 363 | */ |
||
| 364 | public function getId() |
||
| 368 | |||
| 369 | /** |
||
| 370 | * Get the [locale] column value. |
||
| 371 | * |
||
| 372 | * @return string |
||
| 373 | */ |
||
| 374 | public function getLocale() |
||
| 378 | |||
| 379 | /** |
||
| 380 | * Get the [src] column value. |
||
| 381 | * |
||
| 382 | * @return string |
||
| 383 | */ |
||
| 384 | public function getSrc() |
||
| 388 | |||
| 389 | /** |
||
| 390 | * Get the [name] column value. |
||
| 391 | * |
||
| 392 | * @return string |
||
| 393 | */ |
||
| 394 | public function getName() |
||
| 398 | |||
| 399 | /** |
||
| 400 | * Get the [clicks] column value. |
||
| 401 | * |
||
| 402 | * @return int |
||
| 403 | */ |
||
| 404 | public function getClicks() |
||
| 408 | |||
| 409 | /** |
||
| 410 | * Get the [description] column value. |
||
| 411 | * |
||
| 412 | * @return string |
||
| 413 | */ |
||
| 414 | public function getDescription() |
||
| 418 | |||
| 419 | /** |
||
| 420 | * Set the value of [id] column. |
||
| 421 | * |
||
| 422 | * @param int $v new value |
||
| 423 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 424 | */ |
||
| 425 | View Code Duplication | public function setId($v) |
|
| 442 | |||
| 443 | /** |
||
| 444 | * Set the value of [locale] column. |
||
| 445 | * |
||
| 446 | * @param string $v new value |
||
| 447 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 448 | */ |
||
| 449 | View Code Duplication | public function setLocale($v) |
|
| 462 | |||
| 463 | /** |
||
| 464 | * Set the value of [src] column. |
||
| 465 | * |
||
| 466 | * @param string $v new value |
||
| 467 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 468 | */ |
||
| 469 | View Code Duplication | public function setSrc($v) |
|
| 482 | |||
| 483 | /** |
||
| 484 | * Set the value of [name] column. |
||
| 485 | * |
||
| 486 | * @param string $v new value |
||
| 487 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 488 | */ |
||
| 489 | View Code Duplication | public function setName($v) |
|
| 502 | |||
| 503 | /** |
||
| 504 | * Set the value of [clicks] column. |
||
| 505 | * |
||
| 506 | * @param int $v new value |
||
| 507 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 508 | */ |
||
| 509 | View Code Duplication | public function setClicks($v) |
|
| 522 | |||
| 523 | /** |
||
| 524 | * Set the value of [description] column. |
||
| 525 | * |
||
| 526 | * @param string $v new value |
||
| 527 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 528 | */ |
||
| 529 | View Code Duplication | public function setDescription($v) |
|
| 542 | |||
| 543 | /** |
||
| 544 | * Indicates whether the columns in this object are only set to default values. |
||
| 545 | * |
||
| 546 | * This method can be used in conjunction with isModified() to indicate whether an object is both |
||
| 547 | * modified _and_ has some values set which are non-default. |
||
| 548 | * |
||
| 549 | * @return boolean Whether the columns in this object are only been set with default values. |
||
| 550 | */ |
||
| 551 | public function hasOnlyDefaultValues() |
||
| 560 | |||
| 561 | /** |
||
| 562 | * Hydrates (populates) the object variables with values from the database resultset. |
||
| 563 | * |
||
| 564 | * An offset (0-based "start column") is specified so that objects can be hydrated |
||
| 565 | * with a subset of the columns in the resultset rows. This is needed, for example, |
||
| 566 | * for results of JOIN queries where the resultset row includes columns from two or |
||
| 567 | * more tables. |
||
| 568 | * |
||
| 569 | * @param array $row The row returned by DataFetcher->fetch(). |
||
| 570 | * @param int $startcol 0-based offset column which indicates which restultset column to start with. |
||
| 571 | * @param boolean $rehydrate Whether this object is being re-hydrated from the database. |
||
| 572 | * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
||
| 573 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 574 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 575 | * |
||
| 576 | * @return int next starting column |
||
| 577 | * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. |
||
| 578 | */ |
||
| 579 | View Code Duplication | public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) |
|
| 614 | |||
| 615 | /** |
||
| 616 | * Checks and repairs the internal consistency of the object. |
||
| 617 | * |
||
| 618 | * This method is executed after an already-instantiated object is re-hydrated |
||
| 619 | * from the database. It exists to check any foreign keys to make sure that |
||
| 620 | * the objects related to the current object are correct based on foreign key. |
||
| 621 | * |
||
| 622 | * You can override this method in the stub class, but you should always invoke |
||
| 623 | * the base method from the overridden method (i.e. parent::ensureConsistency()), |
||
| 624 | * in case your model changes. |
||
| 625 | * |
||
| 626 | * @throws PropelException |
||
| 627 | */ |
||
| 628 | public function ensureConsistency() |
||
| 634 | |||
| 635 | /** |
||
| 636 | * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. |
||
| 637 | * |
||
| 638 | * This will only work if the object has been saved and has a valid primary key set. |
||
| 639 | * |
||
| 640 | * @param boolean $deep (optional) Whether to also de-associated any related objects. |
||
| 641 | * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. |
||
| 642 | * @return void |
||
| 643 | * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db |
||
| 644 | */ |
||
| 645 | View Code Duplication | public function reload($deep = false, ConnectionInterface $con = null) |
|
| 675 | |||
| 676 | /** |
||
| 677 | * Removes this object from datastore and sets delete attribute. |
||
| 678 | * |
||
| 679 | * @param ConnectionInterface $con |
||
| 680 | * @return void |
||
| 681 | * @throws PropelException |
||
| 682 | * @see BannerImageI18n::setDeleted() |
||
| 683 | * @see BannerImageI18n::isDeleted() |
||
| 684 | */ |
||
| 685 | View Code Duplication | public function delete(ConnectionInterface $con = null) |
|
| 706 | |||
| 707 | /** |
||
| 708 | * Persists this object to the database. |
||
| 709 | * |
||
| 710 | * If the object is new, it inserts it; otherwise an update is performed. |
||
| 711 | * All modified related objects will also be persisted in the doSave() |
||
| 712 | * method. This method wraps all precipitate database operations in a |
||
| 713 | * single transaction. |
||
| 714 | * |
||
| 715 | * @param ConnectionInterface $con |
||
| 716 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
| 717 | * @throws PropelException |
||
| 718 | * @see doSave() |
||
| 719 | */ |
||
| 720 | View Code Duplication | public function save(ConnectionInterface $con = null) |
|
| 758 | |||
| 759 | /** |
||
| 760 | * Performs the work of inserting or updating the row in the database. |
||
| 761 | * |
||
| 762 | * If the object is new, it inserts it; otherwise an update is performed. |
||
| 763 | * All related objects are also updated in this method. |
||
| 764 | * |
||
| 765 | * @param ConnectionInterface $con |
||
| 766 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
| 767 | * @throws PropelException |
||
| 768 | * @see save() |
||
| 769 | */ |
||
| 770 | View Code Duplication | protected function doSave(ConnectionInterface $con) |
|
| 805 | |||
| 806 | /** |
||
| 807 | * Insert the row in the database. |
||
| 808 | * |
||
| 809 | * @param ConnectionInterface $con |
||
| 810 | * |
||
| 811 | * @throws PropelException |
||
| 812 | * @see doSave() |
||
| 813 | */ |
||
| 814 | protected function doInsert(ConnectionInterface $con) |
||
| 878 | |||
| 879 | /** |
||
| 880 | * Update the row in the database. |
||
| 881 | * |
||
| 882 | * @param ConnectionInterface $con |
||
| 883 | * |
||
| 884 | * @return Integer Number of updated rows |
||
| 885 | * @see doSave() |
||
| 886 | */ |
||
| 887 | protected function doUpdate(ConnectionInterface $con) |
||
| 894 | |||
| 895 | /** |
||
| 896 | * Retrieves a field from the object by name passed in as a string. |
||
| 897 | * |
||
| 898 | * @param string $name name |
||
| 899 | * @param string $type The type of fieldname the $name is of: |
||
| 900 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 901 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 902 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 903 | * @return mixed Value of field. |
||
| 904 | */ |
||
| 905 | View Code Duplication | public function getByName($name, $type = TableMap::TYPE_PHPNAME) |
|
| 912 | |||
| 913 | /** |
||
| 914 | * Retrieves a field from the object by Position as specified in the xml schema. |
||
| 915 | * Zero-based. |
||
| 916 | * |
||
| 917 | * @param int $pos position in xml schema |
||
| 918 | * @return mixed Value of field at $pos |
||
| 919 | */ |
||
| 920 | public function getByPosition($pos) |
||
| 946 | |||
| 947 | /** |
||
| 948 | * Exports the object as an array. |
||
| 949 | * |
||
| 950 | * You can specify the key type of the array by passing one of the class |
||
| 951 | * type constants. |
||
| 952 | * |
||
| 953 | * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 954 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 955 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 956 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. |
||
| 957 | * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion |
||
| 958 | * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. |
||
| 959 | * |
||
| 960 | * @return array an associative array containing the field names (as keys) and field values |
||
| 961 | */ |
||
| 962 | public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) |
||
| 1003 | |||
| 1004 | /** |
||
| 1005 | * Sets a field from the object by name passed in as a string. |
||
| 1006 | * |
||
| 1007 | * @param string $name |
||
| 1008 | * @param mixed $value field value |
||
| 1009 | * @param string $type The type of fieldname the $name is of: |
||
| 1010 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 1011 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 1012 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 1013 | * @return $this|\xbanners\models\BannerImageI18n |
||
| 1014 | */ |
||
| 1015 | public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) |
||
| 1021 | |||
| 1022 | /** |
||
| 1023 | * Sets a field from the object by Position as specified in the xml schema. |
||
| 1024 | * Zero-based. |
||
| 1025 | * |
||
| 1026 | * @param int $pos position in xml schema |
||
| 1027 | * @param mixed $value field value |
||
| 1028 | * @return $this|\xbanners\models\BannerImageI18n |
||
| 1029 | */ |
||
| 1030 | public function setByPosition($pos, $value) |
||
| 1055 | |||
| 1056 | /** |
||
| 1057 | * Populates the object using an array. |
||
| 1058 | * |
||
| 1059 | * This is particularly useful when populating an object from one of the |
||
| 1060 | * request arrays (e.g. $_POST). This method goes through the column |
||
| 1061 | * names, checking to see whether a matching key exists in populated |
||
| 1062 | * array. If so the setByName() method is called for that column. |
||
| 1063 | * |
||
| 1064 | * You can specify the key type of the array by additionally passing one |
||
| 1065 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 1066 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 1067 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
| 1068 | * |
||
| 1069 | * @param array $arr An array to populate the object from. |
||
| 1070 | * @param string $keyType The type of keys the array uses. |
||
| 1071 | * @return void |
||
| 1072 | */ |
||
| 1073 | View Code Duplication | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) |
|
| 1096 | |||
| 1097 | /** |
||
| 1098 | * Populate the current object from a string, using a given parser format |
||
| 1099 | * <code> |
||
| 1100 | * $book = new Book(); |
||
| 1101 | * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
| 1102 | * </code> |
||
| 1103 | * |
||
| 1104 | * You can specify the key type of the array by additionally passing one |
||
| 1105 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 1106 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 1107 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
| 1108 | * |
||
| 1109 | * @param mixed $parser A AbstractParser instance, |
||
| 1110 | * or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
| 1111 | * @param string $data The source data to import from |
||
| 1112 | * @param string $keyType The type of keys the array uses. |
||
| 1113 | * |
||
| 1114 | * @return $this|\xbanners\models\BannerImageI18n The current object, for fluid interface |
||
| 1115 | */ |
||
| 1116 | View Code Duplication | public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) |
|
| 1126 | |||
| 1127 | /** |
||
| 1128 | * Build a Criteria object containing the values of all modified columns in this object. |
||
| 1129 | * |
||
| 1130 | * @return Criteria The Criteria object containing all modified values. |
||
| 1131 | */ |
||
| 1132 | public function buildCriteria() |
||
| 1157 | |||
| 1158 | /** |
||
| 1159 | * Builds a Criteria object containing the primary key for this object. |
||
| 1160 | * |
||
| 1161 | * Unlike buildCriteria() this method includes the primary key values regardless |
||
| 1162 | * of whether or not they have been modified. |
||
| 1163 | * |
||
| 1164 | * @throws LogicException if no primary key is defined |
||
| 1165 | * |
||
| 1166 | * @return Criteria The Criteria object containing value(s) for primary key(s). |
||
| 1167 | */ |
||
| 1168 | public function buildPkeyCriteria() |
||
| 1176 | |||
| 1177 | /** |
||
| 1178 | * If the primary key is not null, return the hashcode of the |
||
| 1179 | * primary key. Otherwise, return the hash code of the object. |
||
| 1180 | * |
||
| 1181 | * @return int Hashcode |
||
| 1182 | */ |
||
| 1183 | View Code Duplication | public function hashCode() |
|
| 1206 | |||
| 1207 | /** |
||
| 1208 | * Returns the composite primary key for this object. |
||
| 1209 | * The array elements will be in same order as specified in XML. |
||
| 1210 | * @return array |
||
| 1211 | */ |
||
| 1212 | View Code Duplication | public function getPrimaryKey() |
|
| 1220 | |||
| 1221 | /** |
||
| 1222 | * Set the [composite] primary key. |
||
| 1223 | * |
||
| 1224 | * @param array $keys The elements of the composite key (order must match the order in XML file). |
||
| 1225 | * @return void |
||
| 1226 | */ |
||
| 1227 | public function setPrimaryKey($keys) |
||
| 1232 | |||
| 1233 | /** |
||
| 1234 | * Returns true if the primary key for this object is null. |
||
| 1235 | * @return boolean |
||
| 1236 | */ |
||
| 1237 | public function isPrimaryKeyNull() |
||
| 1241 | |||
| 1242 | /** |
||
| 1243 | * Sets contents of passed object to values from current object. |
||
| 1244 | * |
||
| 1245 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
| 1246 | * objects. |
||
| 1247 | * |
||
| 1248 | * @param object $copyObj An object of \xbanners\models\BannerImageI18n (or compatible) type. |
||
| 1249 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
| 1250 | * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. |
||
| 1251 | * @throws PropelException |
||
| 1252 | */ |
||
| 1253 | public function copyInto($copyObj, $deepCopy = false, $makeNew = true) |
||
| 1265 | |||
| 1266 | /** |
||
| 1267 | * Makes a copy of this object that will be inserted as a new row in table when saved. |
||
| 1268 | * It creates a new object filling in the simple attributes, but skipping any primary |
||
| 1269 | * keys that are defined for the table. |
||
| 1270 | * |
||
| 1271 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
| 1272 | * objects. |
||
| 1273 | * |
||
| 1274 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
| 1275 | * @return \xbanners\models\BannerImageI18n Clone of current object. |
||
| 1276 | * @throws PropelException |
||
| 1277 | */ |
||
| 1278 | View Code Duplication | public function copy($deepCopy = false) |
|
| 1287 | |||
| 1288 | /** |
||
| 1289 | * Declares an association between this object and a ChildBannerImage object. |
||
| 1290 | * |
||
| 1291 | * @param ChildBannerImage $v |
||
| 1292 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 1293 | * @throws PropelException |
||
| 1294 | */ |
||
| 1295 | View Code Duplication | public function setBannerImage(ChildBannerImage $v = null) |
|
| 1314 | |||
| 1315 | |||
| 1316 | /** |
||
| 1317 | * Get the associated ChildBannerImage object |
||
| 1318 | * |
||
| 1319 | * @param ConnectionInterface $con Optional Connection object. |
||
| 1320 | * @return ChildBannerImage The associated ChildBannerImage object. |
||
| 1321 | * @throws PropelException |
||
| 1322 | */ |
||
| 1323 | public function getBannerImage(ConnectionInterface $con = null) |
||
| 1338 | |||
| 1339 | /** |
||
| 1340 | * Clears the current object, sets all attributes to their default values and removes |
||
| 1341 | * outgoing references as well as back-references (from other objects to this one. Results probably in a database |
||
| 1342 | * change of those foreign objects when you call `save` there). |
||
| 1343 | */ |
||
| 1344 | public function clear() |
||
| 1362 | |||
| 1363 | /** |
||
| 1364 | * Resets all references and back-references to other model objects or collections of model objects. |
||
| 1365 | * |
||
| 1366 | * This method is used to reset all php object references (not the actual reference in the database). |
||
| 1367 | * Necessary for object serialisation. |
||
| 1368 | * |
||
| 1369 | * @param boolean $deep Whether to also clear the references on all referrer objects. |
||
| 1370 | */ |
||
| 1371 | public function clearAllReferences($deep = false) |
||
| 1378 | |||
| 1379 | /** |
||
| 1380 | * Return the string representation of this object |
||
| 1381 | * |
||
| 1382 | * @return string |
||
| 1383 | */ |
||
| 1384 | public function __toString() |
||
| 1388 | |||
| 1389 | /** |
||
| 1390 | * Code to be run before persisting the object |
||
| 1391 | * @param ConnectionInterface $con |
||
| 1392 | * @return boolean |
||
| 1393 | */ |
||
| 1394 | public function preSave(ConnectionInterface $con = null) |
||
| 1401 | |||
| 1402 | /** |
||
| 1403 | * Code to be run after persisting the object |
||
| 1404 | * @param ConnectionInterface $con |
||
| 1405 | */ |
||
| 1406 | public function postSave(ConnectionInterface $con = null) |
||
| 1412 | |||
| 1413 | /** |
||
| 1414 | * Code to be run before inserting to database |
||
| 1415 | * @param ConnectionInterface $con |
||
| 1416 | * @return boolean |
||
| 1417 | */ |
||
| 1418 | public function preInsert(ConnectionInterface $con = null) |
||
| 1425 | |||
| 1426 | /** |
||
| 1427 | * Code to be run after inserting to database |
||
| 1428 | * @param ConnectionInterface $con |
||
| 1429 | */ |
||
| 1430 | public function postInsert(ConnectionInterface $con = null) |
||
| 1436 | |||
| 1437 | /** |
||
| 1438 | * Code to be run before updating the object in database |
||
| 1439 | * @param ConnectionInterface $con |
||
| 1440 | * @return boolean |
||
| 1441 | */ |
||
| 1442 | public function preUpdate(ConnectionInterface $con = null) |
||
| 1449 | |||
| 1450 | /** |
||
| 1451 | * Code to be run after updating the object in database |
||
| 1452 | * @param ConnectionInterface $con |
||
| 1453 | */ |
||
| 1454 | public function postUpdate(ConnectionInterface $con = null) |
||
| 1460 | |||
| 1461 | /** |
||
| 1462 | * Code to be run before deleting the object in database |
||
| 1463 | * @param ConnectionInterface $con |
||
| 1464 | * @return boolean |
||
| 1465 | */ |
||
| 1466 | public function preDelete(ConnectionInterface $con = null) |
||
| 1473 | |||
| 1474 | /** |
||
| 1475 | * Code to be run after deleting the object in database |
||
| 1476 | * @param ConnectionInterface $con |
||
| 1477 | */ |
||
| 1478 | public function postDelete(ConnectionInterface $con = null) |
||
| 1484 | |||
| 1485 | |||
| 1486 | /** |
||
| 1487 | * Derived method to catches calls to undefined methods. |
||
| 1488 | * |
||
| 1489 | * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). |
||
| 1490 | * Allows to define default __call() behavior if you overwrite __call() |
||
| 1491 | * |
||
| 1492 | * @param string $name |
||
| 1493 | * @param mixed $params |
||
| 1494 | * |
||
| 1495 | * @return array|string |
||
| 1496 | */ |
||
| 1497 | View Code Duplication | public function __call($name, $params) |
|
| 1526 | |||
| 1527 | } |
||
| 1528 |
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.