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 |
||
| 30 | abstract class BannerImageI18n implements ActiveRecordInterface |
||
| 31 | { |
||
| 32 | /** |
||
| 33 | * TableMap class name |
||
| 34 | */ |
||
| 35 | const TABLE_MAP = '\\xbanners\\models\\Map\\BannerImageI18nTableMap'; |
||
| 36 | |||
| 37 | |||
| 38 | /** |
||
| 39 | * attribute to determine if this object has previously been saved. |
||
| 40 | * @var boolean |
||
| 41 | */ |
||
| 42 | protected $new = true; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * attribute to determine whether this object has been deleted. |
||
| 46 | * @var boolean |
||
| 47 | */ |
||
| 48 | protected $deleted = false; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * The columns that have been modified in current object. |
||
| 52 | * Tracking modified columns allows us to only update modified columns. |
||
| 53 | * @var array |
||
| 54 | */ |
||
| 55 | protected $modifiedColumns = array(); |
||
| 56 | |||
| 57 | /** |
||
| 58 | * The (virtual) columns that are added at runtime |
||
| 59 | * The formatters can add supplementary columns based on a resultset |
||
| 60 | * @var array |
||
| 61 | */ |
||
| 62 | protected $virtualColumns = array(); |
||
| 63 | |||
| 64 | /** |
||
| 65 | * The value for the id field. |
||
| 66 | * |
||
| 67 | * @var int |
||
| 68 | */ |
||
| 69 | protected $id; |
||
| 70 | |||
| 71 | /** |
||
| 72 | * The value for the locale field. |
||
| 73 | * |
||
| 74 | * Note: this column has a database default value of: 'ru' |
||
| 75 | * @var string |
||
| 76 | */ |
||
| 77 | protected $locale; |
||
| 78 | |||
| 79 | /** |
||
| 80 | * The value for the src field. |
||
| 81 | * |
||
| 82 | * @var string |
||
| 83 | */ |
||
| 84 | protected $src; |
||
| 85 | |||
| 86 | /** |
||
| 87 | * The value for the name field. |
||
| 88 | * |
||
| 89 | * @var string |
||
| 90 | */ |
||
| 91 | protected $name; |
||
| 92 | |||
| 93 | /** |
||
| 94 | * The value for the clicks field. |
||
| 95 | * |
||
| 96 | * @var int |
||
| 97 | */ |
||
| 98 | protected $clicks; |
||
| 99 | |||
| 100 | /** |
||
| 101 | * The value for the description field. |
||
| 102 | * |
||
| 103 | * @var string |
||
| 104 | */ |
||
| 105 | protected $description; |
||
| 106 | |||
| 107 | /** |
||
| 108 | * @var ChildBannerImage |
||
| 109 | */ |
||
| 110 | protected $aBannerImage; |
||
| 111 | |||
| 112 | /** |
||
| 113 | * Flag to prevent endless save loop, if this object is referenced |
||
| 114 | * by another object which falls in this transaction. |
||
| 115 | * |
||
| 116 | * @var boolean |
||
| 117 | */ |
||
| 118 | protected $alreadyInSave = false; |
||
| 119 | |||
| 120 | /** |
||
| 121 | * Applies default values to this object. |
||
| 122 | * This method should be called from the object's constructor (or |
||
| 123 | * equivalent initialization method). |
||
| 124 | * @see __construct() |
||
| 125 | */ |
||
| 126 | public function applyDefaultValues() |
||
| 130 | |||
| 131 | /** |
||
| 132 | * Initializes internal state of xbanners\models\Base\BannerImageI18n object. |
||
| 133 | * @see applyDefaults() |
||
| 134 | */ |
||
| 135 | public function __construct() |
||
| 139 | |||
| 140 | /** |
||
| 141 | * Returns whether the object has been modified. |
||
| 142 | * |
||
| 143 | * @return boolean True if the object has been modified. |
||
| 144 | */ |
||
| 145 | public function isModified() |
||
| 149 | |||
| 150 | /** |
||
| 151 | * Has specified column been modified? |
||
| 152 | * |
||
| 153 | * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID |
||
| 154 | * @return boolean True if $col has been modified. |
||
| 155 | */ |
||
| 156 | public function isColumnModified($col) |
||
| 160 | |||
| 161 | /** |
||
| 162 | * Get the columns that have been modified in this object. |
||
| 163 | * @return array A unique list of the modified column names for this object. |
||
| 164 | */ |
||
| 165 | public function getModifiedColumns() |
||
| 169 | |||
| 170 | /** |
||
| 171 | * Returns whether the object has ever been saved. This will |
||
| 172 | * be false, if the object was retrieved from storage or was created |
||
| 173 | * and then saved. |
||
| 174 | * |
||
| 175 | * @return boolean true, if the object has never been persisted. |
||
| 176 | */ |
||
| 177 | public function isNew() |
||
| 181 | |||
| 182 | /** |
||
| 183 | * Setter for the isNew attribute. This method will be called |
||
| 184 | * by Propel-generated children and objects. |
||
| 185 | * |
||
| 186 | * @param boolean $b the state of the object. |
||
| 187 | */ |
||
| 188 | public function setNew($b) |
||
| 192 | |||
| 193 | /** |
||
| 194 | * Whether this object has been deleted. |
||
| 195 | * @return boolean The deleted state of this object. |
||
| 196 | */ |
||
| 197 | public function isDeleted() |
||
| 201 | |||
| 202 | /** |
||
| 203 | * Specify whether this object has been deleted. |
||
| 204 | * @param boolean $b The deleted state of this object. |
||
| 205 | * @return void |
||
| 206 | */ |
||
| 207 | public function setDeleted($b) |
||
| 211 | |||
| 212 | /** |
||
| 213 | * Sets the modified state for the object to be false. |
||
| 214 | * @param string $col If supplied, only the specified column is reset. |
||
| 215 | * @return void |
||
| 216 | */ |
||
| 217 | View Code Duplication | public function resetModified($col = null) |
|
| 227 | |||
| 228 | /** |
||
| 229 | * Compares this with another <code>BannerImageI18n</code> instance. If |
||
| 230 | * <code>obj</code> is an instance of <code>BannerImageI18n</code>, delegates to |
||
| 231 | * <code>equals(BannerImageI18n)</code>. Otherwise, returns <code>false</code>. |
||
| 232 | * |
||
| 233 | * @param mixed $obj The object to compare to. |
||
| 234 | * @return boolean Whether equal to the object specified. |
||
| 235 | */ |
||
| 236 | View Code Duplication | public function equals($obj) |
|
| 252 | |||
| 253 | /** |
||
| 254 | * Get the associative array of the virtual columns in this object |
||
| 255 | * |
||
| 256 | * @return array |
||
| 257 | */ |
||
| 258 | public function getVirtualColumns() |
||
| 262 | |||
| 263 | /** |
||
| 264 | * Checks the existence of a virtual column in this object |
||
| 265 | * |
||
| 266 | * @param string $name The virtual column name |
||
| 267 | * @return boolean |
||
| 268 | */ |
||
| 269 | public function hasVirtualColumn($name) |
||
| 273 | |||
| 274 | /** |
||
| 275 | * Get the value of a virtual column in this object |
||
| 276 | * |
||
| 277 | * @param string $name The virtual column name |
||
| 278 | * @return mixed |
||
| 279 | * |
||
| 280 | * @throws PropelException |
||
| 281 | */ |
||
| 282 | View Code Duplication | public function getVirtualColumn($name) |
|
| 290 | |||
| 291 | /** |
||
| 292 | * Set the value of a virtual column in this object |
||
| 293 | * |
||
| 294 | * @param string $name The virtual column name |
||
| 295 | * @param mixed $value The value to give to the virtual column |
||
| 296 | * |
||
| 297 | * @return $this|BannerImageI18n The current object, for fluid interface |
||
| 298 | */ |
||
| 299 | public function setVirtualColumn($name, $value) |
||
| 305 | |||
| 306 | /** |
||
| 307 | * Logs a message using Propel::log(). |
||
| 308 | * |
||
| 309 | * @param string $msg |
||
| 310 | * @param int $priority One of the Propel::LOG_* logging levels |
||
| 311 | * @return boolean |
||
| 312 | */ |
||
| 313 | protected function log($msg, $priority = Propel::LOG_INFO) |
||
| 317 | |||
| 318 | /** |
||
| 319 | * Export the current object properties to a string, using a given parser format |
||
| 320 | * <code> |
||
| 321 | * $book = BookQuery::create()->findPk(9012); |
||
| 322 | * echo $book->exportTo('JSON'); |
||
| 323 | * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
| 324 | * </code> |
||
| 325 | * |
||
| 326 | * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
| 327 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. |
||
| 328 | * @return string The exported data |
||
| 329 | */ |
||
| 330 | View Code Duplication | public function exportTo($parser, $includeLazyLoadColumns = true) |
|
| 338 | |||
| 339 | /** |
||
| 340 | * Clean up internal collections prior to serializing |
||
| 341 | * Avoids recursive loops that turn into segmentation faults when serializing |
||
| 342 | */ |
||
| 343 | View Code Duplication | public function __sleep() |
|
| 357 | |||
| 358 | /** |
||
| 359 | * Get the [id] column value. |
||
| 360 | * |
||
| 361 | * @return int |
||
| 362 | */ |
||
| 363 | public function getId() |
||
| 367 | |||
| 368 | /** |
||
| 369 | * Get the [locale] column value. |
||
| 370 | * |
||
| 371 | * @return string |
||
| 372 | */ |
||
| 373 | public function getLocale() |
||
| 377 | |||
| 378 | /** |
||
| 379 | * Get the [src] column value. |
||
| 380 | * |
||
| 381 | * @return string |
||
| 382 | */ |
||
| 383 | public function getSrc() |
||
| 387 | |||
| 388 | /** |
||
| 389 | * Get the [name] column value. |
||
| 390 | * |
||
| 391 | * @return string |
||
| 392 | */ |
||
| 393 | public function getName() |
||
| 397 | |||
| 398 | /** |
||
| 399 | * Get the [clicks] column value. |
||
| 400 | * |
||
| 401 | * @return int |
||
| 402 | */ |
||
| 403 | public function getClicks() |
||
| 407 | |||
| 408 | /** |
||
| 409 | * Get the [description] column value. |
||
| 410 | * |
||
| 411 | * @return string |
||
| 412 | */ |
||
| 413 | public function getDescription() |
||
| 417 | |||
| 418 | /** |
||
| 419 | * Set the value of [id] column. |
||
| 420 | * |
||
| 421 | * @param int $v new value |
||
| 422 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 423 | */ |
||
| 424 | View Code Duplication | public function setId($v) |
|
| 441 | |||
| 442 | /** |
||
| 443 | * Set the value of [locale] column. |
||
| 444 | * |
||
| 445 | * @param string $v new value |
||
| 446 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 447 | */ |
||
| 448 | View Code Duplication | public function setLocale($v) |
|
| 461 | |||
| 462 | /** |
||
| 463 | * Set the value of [src] column. |
||
| 464 | * |
||
| 465 | * @param string $v new value |
||
| 466 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 467 | */ |
||
| 468 | View Code Duplication | public function setSrc($v) |
|
| 481 | |||
| 482 | /** |
||
| 483 | * Set the value of [name] column. |
||
| 484 | * |
||
| 485 | * @param string $v new value |
||
| 486 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 487 | */ |
||
| 488 | View Code Duplication | public function setName($v) |
|
| 501 | |||
| 502 | /** |
||
| 503 | * Set the value of [clicks] column. |
||
| 504 | * |
||
| 505 | * @param int $v new value |
||
| 506 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 507 | */ |
||
| 508 | View Code Duplication | public function setClicks($v) |
|
| 521 | |||
| 522 | /** |
||
| 523 | * Set the value of [description] column. |
||
| 524 | * |
||
| 525 | * @param string $v new value |
||
| 526 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 527 | */ |
||
| 528 | View Code Duplication | public function setDescription($v) |
|
| 541 | |||
| 542 | /** |
||
| 543 | * Indicates whether the columns in this object are only set to default values. |
||
| 544 | * |
||
| 545 | * This method can be used in conjunction with isModified() to indicate whether an object is both |
||
| 546 | * modified _and_ has some values set which are non-default. |
||
| 547 | * |
||
| 548 | * @return boolean Whether the columns in this object are only been set with default values. |
||
| 549 | */ |
||
| 550 | public function hasOnlyDefaultValues() |
||
| 559 | |||
| 560 | /** |
||
| 561 | * Hydrates (populates) the object variables with values from the database resultset. |
||
| 562 | * |
||
| 563 | * An offset (0-based "start column") is specified so that objects can be hydrated |
||
| 564 | * with a subset of the columns in the resultset rows. This is needed, for example, |
||
| 565 | * for results of JOIN queries where the resultset row includes columns from two or |
||
| 566 | * more tables. |
||
| 567 | * |
||
| 568 | * @param array $row The row returned by DataFetcher->fetch(). |
||
| 569 | * @param int $startcol 0-based offset column which indicates which restultset column to start with. |
||
| 570 | * @param boolean $rehydrate Whether this object is being re-hydrated from the database. |
||
| 571 | * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
||
| 572 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 573 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 574 | * |
||
| 575 | * @return int next starting column |
||
| 576 | * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. |
||
| 577 | */ |
||
| 578 | View Code Duplication | public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) |
|
| 613 | |||
| 614 | /** |
||
| 615 | * Checks and repairs the internal consistency of the object. |
||
| 616 | * |
||
| 617 | * This method is executed after an already-instantiated object is re-hydrated |
||
| 618 | * from the database. It exists to check any foreign keys to make sure that |
||
| 619 | * the objects related to the current object are correct based on foreign key. |
||
| 620 | * |
||
| 621 | * You can override this method in the stub class, but you should always invoke |
||
| 622 | * the base method from the overridden method (i.e. parent::ensureConsistency()), |
||
| 623 | * in case your model changes. |
||
| 624 | * |
||
| 625 | * @throws PropelException |
||
| 626 | */ |
||
| 627 | public function ensureConsistency() |
||
| 633 | |||
| 634 | /** |
||
| 635 | * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. |
||
| 636 | * |
||
| 637 | * This will only work if the object has been saved and has a valid primary key set. |
||
| 638 | * |
||
| 639 | * @param boolean $deep (optional) Whether to also de-associated any related objects. |
||
| 640 | * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. |
||
| 641 | * @return void |
||
| 642 | * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db |
||
| 643 | */ |
||
| 644 | View Code Duplication | public function reload($deep = false, ConnectionInterface $con = null) |
|
| 674 | |||
| 675 | /** |
||
| 676 | * Removes this object from datastore and sets delete attribute. |
||
| 677 | * |
||
| 678 | * @param ConnectionInterface $con |
||
| 679 | * @return void |
||
| 680 | * @throws PropelException |
||
| 681 | * @see BannerImageI18n::setDeleted() |
||
| 682 | * @see BannerImageI18n::isDeleted() |
||
| 683 | */ |
||
| 684 | View Code Duplication | public function delete(ConnectionInterface $con = null) |
|
| 705 | |||
| 706 | /** |
||
| 707 | * Persists this object to the database. |
||
| 708 | * |
||
| 709 | * If the object is new, it inserts it; otherwise an update is performed. |
||
| 710 | * All modified related objects will also be persisted in the doSave() |
||
| 711 | * method. This method wraps all precipitate database operations in a |
||
| 712 | * single transaction. |
||
| 713 | * |
||
| 714 | * @param ConnectionInterface $con |
||
| 715 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
| 716 | * @throws PropelException |
||
| 717 | * @see doSave() |
||
| 718 | */ |
||
| 719 | View Code Duplication | public function save(ConnectionInterface $con = null) |
|
| 753 | |||
| 754 | /** |
||
| 755 | * Performs the work of inserting or updating the row in the database. |
||
| 756 | * |
||
| 757 | * If the object is new, it inserts it; otherwise an update is performed. |
||
| 758 | * All related objects are also updated in this method. |
||
| 759 | * |
||
| 760 | * @param ConnectionInterface $con |
||
| 761 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
| 762 | * @throws PropelException |
||
| 763 | * @see save() |
||
| 764 | */ |
||
| 765 | View Code Duplication | protected function doSave(ConnectionInterface $con) |
|
| 800 | |||
| 801 | /** |
||
| 802 | * Insert the row in the database. |
||
| 803 | * |
||
| 804 | * @param ConnectionInterface $con |
||
| 805 | * |
||
| 806 | * @throws PropelException |
||
| 807 | * @see doSave() |
||
| 808 | */ |
||
| 809 | protected function doInsert(ConnectionInterface $con) |
||
| 873 | |||
| 874 | /** |
||
| 875 | * Update the row in the database. |
||
| 876 | * |
||
| 877 | * @param ConnectionInterface $con |
||
| 878 | * |
||
| 879 | * @return Integer Number of updated rows |
||
| 880 | * @see doSave() |
||
| 881 | */ |
||
| 882 | protected function doUpdate(ConnectionInterface $con) |
||
| 889 | |||
| 890 | /** |
||
| 891 | * Retrieves a field from the object by name passed in as a string. |
||
| 892 | * |
||
| 893 | * @param string $name name |
||
| 894 | * @param string $type The type of fieldname the $name is of: |
||
| 895 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 896 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 897 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 898 | * @return mixed Value of field. |
||
| 899 | */ |
||
| 900 | View Code Duplication | public function getByName($name, $type = TableMap::TYPE_PHPNAME) |
|
| 907 | |||
| 908 | /** |
||
| 909 | * Retrieves a field from the object by Position as specified in the xml schema. |
||
| 910 | * Zero-based. |
||
| 911 | * |
||
| 912 | * @param int $pos position in xml schema |
||
| 913 | * @return mixed Value of field at $pos |
||
| 914 | */ |
||
| 915 | public function getByPosition($pos) |
||
| 941 | |||
| 942 | /** |
||
| 943 | * Exports the object as an array. |
||
| 944 | * |
||
| 945 | * You can specify the key type of the array by passing one of the class |
||
| 946 | * type constants. |
||
| 947 | * |
||
| 948 | * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 949 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 950 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 951 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. |
||
| 952 | * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion |
||
| 953 | * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. |
||
| 954 | * |
||
| 955 | * @return array an associative array containing the field names (as keys) and field values |
||
| 956 | */ |
||
| 957 | public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) |
||
| 998 | |||
| 999 | /** |
||
| 1000 | * Sets a field from the object by name passed in as a string. |
||
| 1001 | * |
||
| 1002 | * @param string $name |
||
| 1003 | * @param mixed $value field value |
||
| 1004 | * @param string $type The type of fieldname the $name is of: |
||
| 1005 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
| 1006 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 1007 | * Defaults to TableMap::TYPE_PHPNAME. |
||
| 1008 | * @return $this|\xbanners\models\BannerImageI18n |
||
| 1009 | */ |
||
| 1010 | public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) |
||
| 1016 | |||
| 1017 | /** |
||
| 1018 | * Sets a field from the object by Position as specified in the xml schema. |
||
| 1019 | * Zero-based. |
||
| 1020 | * |
||
| 1021 | * @param int $pos position in xml schema |
||
| 1022 | * @param mixed $value field value |
||
| 1023 | * @return $this|\xbanners\models\BannerImageI18n |
||
| 1024 | */ |
||
| 1025 | public function setByPosition($pos, $value) |
||
| 1050 | |||
| 1051 | /** |
||
| 1052 | * Populates the object using an array. |
||
| 1053 | * |
||
| 1054 | * This is particularly useful when populating an object from one of the |
||
| 1055 | * request arrays (e.g. $_POST). This method goes through the column |
||
| 1056 | * names, checking to see whether a matching key exists in populated |
||
| 1057 | * array. If so the setByName() method is called for that column. |
||
| 1058 | * |
||
| 1059 | * You can specify the key type of the array by additionally passing one |
||
| 1060 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 1061 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 1062 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
| 1063 | * |
||
| 1064 | * @param array $arr An array to populate the object from. |
||
| 1065 | * @param string $keyType The type of keys the array uses. |
||
| 1066 | * @return void |
||
| 1067 | */ |
||
| 1068 | View Code Duplication | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) |
|
| 1091 | |||
| 1092 | /** |
||
| 1093 | * Populate the current object from a string, using a given parser format |
||
| 1094 | * <code> |
||
| 1095 | * $book = new Book(); |
||
| 1096 | * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
| 1097 | * </code> |
||
| 1098 | * |
||
| 1099 | * You can specify the key type of the array by additionally passing one |
||
| 1100 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
| 1101 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
| 1102 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
| 1103 | * |
||
| 1104 | * @param mixed $parser A AbstractParser instance, |
||
| 1105 | * or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
| 1106 | * @param string $data The source data to import from |
||
| 1107 | * @param string $keyType The type of keys the array uses. |
||
| 1108 | * |
||
| 1109 | * @return $this|\xbanners\models\BannerImageI18n The current object, for fluid interface |
||
| 1110 | */ |
||
| 1111 | View Code Duplication | public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) |
|
| 1121 | |||
| 1122 | /** |
||
| 1123 | * Build a Criteria object containing the values of all modified columns in this object. |
||
| 1124 | * |
||
| 1125 | * @return Criteria The Criteria object containing all modified values. |
||
| 1126 | */ |
||
| 1127 | public function buildCriteria() |
||
| 1152 | |||
| 1153 | /** |
||
| 1154 | * Builds a Criteria object containing the primary key for this object. |
||
| 1155 | * |
||
| 1156 | * Unlike buildCriteria() this method includes the primary key values regardless |
||
| 1157 | * of whether or not they have been modified. |
||
| 1158 | * |
||
| 1159 | * @throws LogicException if no primary key is defined |
||
| 1160 | * |
||
| 1161 | * @return Criteria The Criteria object containing value(s) for primary key(s). |
||
| 1162 | */ |
||
| 1163 | public function buildPkeyCriteria() |
||
| 1171 | |||
| 1172 | /** |
||
| 1173 | * If the primary key is not null, return the hashcode of the |
||
| 1174 | * primary key. Otherwise, return the hash code of the object. |
||
| 1175 | * |
||
| 1176 | * @return int Hashcode |
||
| 1177 | */ |
||
| 1178 | View Code Duplication | public function hashCode() |
|
| 1201 | |||
| 1202 | /** |
||
| 1203 | * Returns the composite primary key for this object. |
||
| 1204 | * The array elements will be in same order as specified in XML. |
||
| 1205 | * @return array |
||
| 1206 | */ |
||
| 1207 | View Code Duplication | public function getPrimaryKey() |
|
| 1215 | |||
| 1216 | /** |
||
| 1217 | * Set the [composite] primary key. |
||
| 1218 | * |
||
| 1219 | * @param array $keys The elements of the composite key (order must match the order in XML file). |
||
| 1220 | * @return void |
||
| 1221 | */ |
||
| 1222 | public function setPrimaryKey($keys) |
||
| 1227 | |||
| 1228 | /** |
||
| 1229 | * Returns true if the primary key for this object is null. |
||
| 1230 | * @return boolean |
||
| 1231 | */ |
||
| 1232 | public function isPrimaryKeyNull() |
||
| 1236 | |||
| 1237 | /** |
||
| 1238 | * Sets contents of passed object to values from current object. |
||
| 1239 | * |
||
| 1240 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
| 1241 | * objects. |
||
| 1242 | * |
||
| 1243 | * @param object $copyObj An object of \xbanners\models\BannerImageI18n (or compatible) type. |
||
| 1244 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
| 1245 | * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. |
||
| 1246 | * @throws PropelException |
||
| 1247 | */ |
||
| 1248 | public function copyInto($copyObj, $deepCopy = false, $makeNew = true) |
||
| 1260 | |||
| 1261 | /** |
||
| 1262 | * Makes a copy of this object that will be inserted as a new row in table when saved. |
||
| 1263 | * It creates a new object filling in the simple attributes, but skipping any primary |
||
| 1264 | * keys that are defined for the table. |
||
| 1265 | * |
||
| 1266 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
| 1267 | * objects. |
||
| 1268 | * |
||
| 1269 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
| 1270 | * @return \xbanners\models\BannerImageI18n Clone of current object. |
||
| 1271 | * @throws PropelException |
||
| 1272 | */ |
||
| 1273 | View Code Duplication | public function copy($deepCopy = false) |
|
| 1282 | |||
| 1283 | /** |
||
| 1284 | * Declares an association between this object and a ChildBannerImage object. |
||
| 1285 | * |
||
| 1286 | * @param ChildBannerImage $v |
||
| 1287 | * @return $this|\xbanners\models\BannerImageI18n The current object (for fluent API support) |
||
| 1288 | * @throws PropelException |
||
| 1289 | */ |
||
| 1290 | View Code Duplication | public function setBannerImage(ChildBannerImage $v = null) |
|
| 1309 | |||
| 1310 | |||
| 1311 | /** |
||
| 1312 | * Get the associated ChildBannerImage object |
||
| 1313 | * |
||
| 1314 | * @param ConnectionInterface $con Optional Connection object. |
||
| 1315 | * @return ChildBannerImage The associated ChildBannerImage object. |
||
| 1316 | * @throws PropelException |
||
| 1317 | */ |
||
| 1318 | public function getBannerImage(ConnectionInterface $con = null) |
||
| 1333 | |||
| 1334 | /** |
||
| 1335 | * Clears the current object, sets all attributes to their default values and removes |
||
| 1336 | * outgoing references as well as back-references (from other objects to this one. Results probably in a database |
||
| 1337 | * change of those foreign objects when you call `save` there). |
||
| 1338 | */ |
||
| 1339 | public function clear() |
||
| 1357 | |||
| 1358 | /** |
||
| 1359 | * Resets all references and back-references to other model objects or collections of model objects. |
||
| 1360 | * |
||
| 1361 | * This method is used to reset all php object references (not the actual reference in the database). |
||
| 1362 | * Necessary for object serialisation. |
||
| 1363 | * |
||
| 1364 | * @param boolean $deep Whether to also clear the references on all referrer objects. |
||
| 1365 | */ |
||
| 1366 | public function clearAllReferences($deep = false) |
||
| 1373 | |||
| 1374 | /** |
||
| 1375 | * Return the string representation of this object |
||
| 1376 | * |
||
| 1377 | * @return string |
||
| 1378 | */ |
||
| 1379 | public function __toString() |
||
| 1383 | |||
| 1384 | /** |
||
| 1385 | * Code to be run before persisting the object |
||
| 1386 | * @param ConnectionInterface $con |
||
| 1387 | * @return boolean |
||
| 1388 | */ |
||
| 1389 | public function preSave(ConnectionInterface $con = null) |
||
| 1393 | |||
| 1394 | /** |
||
| 1395 | * Code to be run after persisting the object |
||
| 1396 | * @param ConnectionInterface $con |
||
| 1397 | */ |
||
| 1398 | public function postSave(ConnectionInterface $con = null) |
||
| 1402 | |||
| 1403 | /** |
||
| 1404 | * Code to be run before inserting to database |
||
| 1405 | * @param ConnectionInterface $con |
||
| 1406 | * @return boolean |
||
| 1407 | */ |
||
| 1408 | public function preInsert(ConnectionInterface $con = null) |
||
| 1412 | |||
| 1413 | /** |
||
| 1414 | * Code to be run after inserting to database |
||
| 1415 | * @param ConnectionInterface $con |
||
| 1416 | */ |
||
| 1417 | public function postInsert(ConnectionInterface $con = null) |
||
| 1421 | |||
| 1422 | /** |
||
| 1423 | * Code to be run before updating the object in database |
||
| 1424 | * @param ConnectionInterface $con |
||
| 1425 | * @return boolean |
||
| 1426 | */ |
||
| 1427 | public function preUpdate(ConnectionInterface $con = null) |
||
| 1431 | |||
| 1432 | /** |
||
| 1433 | * Code to be run after updating the object in database |
||
| 1434 | * @param ConnectionInterface $con |
||
| 1435 | */ |
||
| 1436 | public function postUpdate(ConnectionInterface $con = null) |
||
| 1440 | |||
| 1441 | /** |
||
| 1442 | * Code to be run before deleting the object in database |
||
| 1443 | * @param ConnectionInterface $con |
||
| 1444 | * @return boolean |
||
| 1445 | */ |
||
| 1446 | public function preDelete(ConnectionInterface $con = null) |
||
| 1450 | |||
| 1451 | /** |
||
| 1452 | * Code to be run after deleting the object in database |
||
| 1453 | * @param ConnectionInterface $con |
||
| 1454 | */ |
||
| 1455 | public function postDelete(ConnectionInterface $con = null) |
||
| 1459 | |||
| 1460 | |||
| 1461 | /** |
||
| 1462 | * Derived method to catches calls to undefined methods. |
||
| 1463 | * |
||
| 1464 | * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). |
||
| 1465 | * Allows to define default __call() behavior if you overwrite __call() |
||
| 1466 | * |
||
| 1467 | * @param string $name |
||
| 1468 | * @param mixed $params |
||
| 1469 | * |
||
| 1470 | * @return array|string |
||
| 1471 | */ |
||
| 1472 | View Code Duplication | public function __call($name, $params) |
|
| 1501 | |||
| 1502 | } |
||
| 1503 |