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 Banners 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 Banners, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
37 | abstract class Banners extends PropelBaseModelClass implements ActiveRecordInterface |
||
38 | { |
||
39 | /** |
||
40 | * TableMap class name |
||
41 | */ |
||
42 | const TABLE_MAP = '\\xbanners\\models\\Map\\BannersTableMap'; |
||
43 | |||
44 | |||
45 | /** |
||
46 | * attribute to determine if this object has previously been saved. |
||
47 | * @var boolean |
||
48 | */ |
||
49 | protected $new = true; |
||
50 | |||
51 | /** |
||
52 | * attribute to determine whether this object has been deleted. |
||
53 | * @var boolean |
||
54 | */ |
||
55 | protected $deleted = false; |
||
56 | |||
57 | /** |
||
58 | * The columns that have been modified in current object. |
||
59 | * Tracking modified columns allows us to only update modified columns. |
||
60 | * @var array |
||
61 | */ |
||
62 | protected $modifiedColumns = array(); |
||
63 | |||
64 | /** |
||
65 | * The (virtual) columns that are added at runtime |
||
66 | * The formatters can add supplementary columns based on a resultset |
||
67 | * @var array |
||
68 | */ |
||
69 | protected $virtualColumns = array(); |
||
70 | |||
71 | /** |
||
72 | * The value for the id field. |
||
73 | * |
||
74 | * @var int |
||
75 | */ |
||
76 | protected $id; |
||
77 | |||
78 | /** |
||
79 | * The value for the place field. |
||
80 | * |
||
81 | * @var string |
||
82 | */ |
||
83 | protected $place; |
||
84 | |||
85 | /** |
||
86 | * The value for the width field. |
||
87 | * |
||
88 | * @var int |
||
89 | */ |
||
90 | protected $width; |
||
91 | |||
92 | /** |
||
93 | * The value for the height field. |
||
94 | * |
||
95 | * @var int |
||
96 | */ |
||
97 | protected $height; |
||
98 | |||
99 | /** |
||
100 | * The value for the effects field. |
||
101 | * |
||
102 | * @var string |
||
103 | */ |
||
104 | protected $effects; |
||
105 | |||
106 | /** |
||
107 | * The value for the page_type field. |
||
108 | * |
||
109 | * @var string |
||
110 | */ |
||
111 | protected $page_type; |
||
112 | |||
113 | /** |
||
114 | * @var ObjectCollection|ChildBannerImage[] Collection to store aggregation of ChildBannerImage objects. |
||
115 | */ |
||
116 | protected $collBannerImages; |
||
117 | protected $collBannerImagesPartial; |
||
118 | |||
119 | /** |
||
120 | * @var ObjectCollection|ChildBannersI18n[] Collection to store aggregation of ChildBannersI18n objects. |
||
121 | */ |
||
122 | protected $collBannersI18ns; |
||
123 | protected $collBannersI18nsPartial; |
||
124 | |||
125 | /** |
||
126 | * Flag to prevent endless save loop, if this object is referenced |
||
127 | * by another object which falls in this transaction. |
||
128 | * |
||
129 | * @var boolean |
||
130 | */ |
||
131 | protected $alreadyInSave = false; |
||
132 | |||
133 | // i18n behavior |
||
134 | |||
135 | /** |
||
136 | * Current locale |
||
137 | * @var string |
||
138 | */ |
||
139 | protected $currentLocale = 'ru'; |
||
140 | |||
141 | /** |
||
142 | * Current translation objects |
||
143 | * @var array[ChildBannersI18n] |
||
144 | */ |
||
145 | protected $currentTranslations; |
||
146 | |||
147 | /** |
||
148 | * An array of objects scheduled for deletion. |
||
149 | * @var ObjectCollection|ChildBannerImage[] |
||
150 | */ |
||
151 | protected $bannerImagesScheduledForDeletion = null; |
||
152 | |||
153 | /** |
||
154 | * An array of objects scheduled for deletion. |
||
155 | * @var ObjectCollection|ChildBannersI18n[] |
||
156 | */ |
||
157 | protected $bannersI18nsScheduledForDeletion = null; |
||
158 | |||
159 | /** |
||
160 | * Initializes internal state of xbanners\models\Base\Banners object. |
||
161 | */ |
||
162 | public function __construct() |
||
165 | |||
166 | /** |
||
167 | * Returns whether the object has been modified. |
||
168 | * |
||
169 | * @return boolean True if the object has been modified. |
||
170 | */ |
||
171 | public function isModified() |
||
175 | |||
176 | /** |
||
177 | * Has specified column been modified? |
||
178 | * |
||
179 | * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID |
||
180 | * @return boolean True if $col has been modified. |
||
181 | */ |
||
182 | public function isColumnModified($col) |
||
186 | |||
187 | /** |
||
188 | * Get the columns that have been modified in this object. |
||
189 | * @return array A unique list of the modified column names for this object. |
||
190 | */ |
||
191 | public function getModifiedColumns() |
||
195 | |||
196 | /** |
||
197 | * Returns whether the object has ever been saved. This will |
||
198 | * be false, if the object was retrieved from storage or was created |
||
199 | * and then saved. |
||
200 | * |
||
201 | * @return boolean true, if the object has never been persisted. |
||
202 | */ |
||
203 | public function isNew() |
||
207 | |||
208 | /** |
||
209 | * Setter for the isNew attribute. This method will be called |
||
210 | * by Propel-generated children and objects. |
||
211 | * |
||
212 | * @param boolean $b the state of the object. |
||
213 | */ |
||
214 | public function setNew($b) |
||
218 | |||
219 | /** |
||
220 | * Whether this object has been deleted. |
||
221 | * @return boolean The deleted state of this object. |
||
222 | */ |
||
223 | public function isDeleted() |
||
227 | |||
228 | /** |
||
229 | * Specify whether this object has been deleted. |
||
230 | * @param boolean $b The deleted state of this object. |
||
231 | * @return void |
||
232 | */ |
||
233 | public function setDeleted($b) |
||
237 | |||
238 | /** |
||
239 | * Sets the modified state for the object to be false. |
||
240 | * @param string $col If supplied, only the specified column is reset. |
||
241 | * @return void |
||
242 | */ |
||
243 | View Code Duplication | public function resetModified($col = null) |
|
253 | |||
254 | /** |
||
255 | * Compares this with another <code>Banners</code> instance. If |
||
256 | * <code>obj</code> is an instance of <code>Banners</code>, delegates to |
||
257 | * <code>equals(Banners)</code>. Otherwise, returns <code>false</code>. |
||
258 | * |
||
259 | * @param mixed $obj The object to compare to. |
||
260 | * @return boolean Whether equal to the object specified. |
||
261 | */ |
||
262 | View Code Duplication | public function equals($obj) |
|
278 | |||
279 | /** |
||
280 | * Get the associative array of the virtual columns in this object |
||
281 | * |
||
282 | * @return array |
||
283 | */ |
||
284 | public function getVirtualColumns() |
||
288 | |||
289 | /** |
||
290 | * Checks the existence of a virtual column in this object |
||
291 | * |
||
292 | * @param string $name The virtual column name |
||
293 | * @return boolean |
||
294 | */ |
||
295 | public function hasVirtualColumn($name) |
||
299 | |||
300 | /** |
||
301 | * Get the value of a virtual column in this object |
||
302 | * |
||
303 | * @param string $name The virtual column name |
||
304 | * @return mixed |
||
305 | * |
||
306 | * @throws PropelException |
||
307 | */ |
||
308 | View Code Duplication | public function getVirtualColumn($name) |
|
316 | |||
317 | /** |
||
318 | * Set the value of a virtual column in this object |
||
319 | * |
||
320 | * @param string $name The virtual column name |
||
321 | * @param mixed $value The value to give to the virtual column |
||
322 | * |
||
323 | * @return $this|Banners The current object, for fluid interface |
||
324 | */ |
||
325 | public function setVirtualColumn($name, $value) |
||
331 | |||
332 | /** |
||
333 | * Logs a message using Propel::log(). |
||
334 | * |
||
335 | * @param string $msg |
||
336 | * @param int $priority One of the Propel::LOG_* logging levels |
||
337 | * @return boolean |
||
|
|||
338 | */ |
||
339 | protected function log($msg, $priority = Propel::LOG_INFO) |
||
343 | |||
344 | /** |
||
345 | * Export the current object properties to a string, using a given parser format |
||
346 | * <code> |
||
347 | * $book = BookQuery::create()->findPk(9012); |
||
348 | * echo $book->exportTo('JSON'); |
||
349 | * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
350 | * </code> |
||
351 | * |
||
352 | * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
353 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. |
||
354 | * @return string The exported data |
||
355 | */ |
||
356 | View Code Duplication | public function exportTo($parser, $includeLazyLoadColumns = true) |
|
364 | |||
365 | /** |
||
366 | * Clean up internal collections prior to serializing |
||
367 | * Avoids recursive loops that turn into segmentation faults when serializing |
||
368 | */ |
||
369 | View Code Duplication | public function __sleep() |
|
383 | |||
384 | /** |
||
385 | * Get the [id] column value. |
||
386 | * |
||
387 | * @return int |
||
388 | */ |
||
389 | public function getId() |
||
393 | |||
394 | /** |
||
395 | * Get the [place] column value. |
||
396 | * |
||
397 | * @return string |
||
398 | */ |
||
399 | public function getPlace() |
||
403 | |||
404 | /** |
||
405 | * Get the [width] column value. |
||
406 | * |
||
407 | * @return int |
||
408 | */ |
||
409 | public function getWidth() |
||
413 | |||
414 | /** |
||
415 | * Get the [height] column value. |
||
416 | * |
||
417 | * @return int |
||
418 | */ |
||
419 | public function getHeight() |
||
423 | |||
424 | /** |
||
425 | * Get the [effects] column value. |
||
426 | * |
||
427 | * @return string |
||
428 | */ |
||
429 | public function getEffects() |
||
433 | |||
434 | /** |
||
435 | * Get the [page_type] column value. |
||
436 | * |
||
437 | * @return string |
||
438 | */ |
||
439 | public function getPageType() |
||
443 | |||
444 | /** |
||
445 | * Set the value of [id] column. |
||
446 | * |
||
447 | * @param int $v new value |
||
448 | * @return $this|\xbanners\models\Banners The current object (for fluent API support) |
||
449 | */ |
||
450 | View Code Duplication | public function setId($v) |
|
463 | |||
464 | /** |
||
465 | * Set the value of [place] column. |
||
466 | * |
||
467 | * @param string $v new value |
||
468 | * @return $this|\xbanners\models\Banners The current object (for fluent API support) |
||
469 | */ |
||
470 | View Code Duplication | public function setPlace($v) |
|
483 | |||
484 | /** |
||
485 | * Set the value of [width] column. |
||
486 | * |
||
487 | * @param int $v new value |
||
488 | * @return $this|\xbanners\models\Banners The current object (for fluent API support) |
||
489 | */ |
||
490 | View Code Duplication | public function setWidth($v) |
|
503 | |||
504 | /** |
||
505 | * Set the value of [height] column. |
||
506 | * |
||
507 | * @param int $v new value |
||
508 | * @return $this|\xbanners\models\Banners The current object (for fluent API support) |
||
509 | */ |
||
510 | View Code Duplication | public function setHeight($v) |
|
523 | |||
524 | /** |
||
525 | * Set the value of [effects] column. |
||
526 | * |
||
527 | * @param string $v new value |
||
528 | * @return $this|\xbanners\models\Banners The current object (for fluent API support) |
||
529 | */ |
||
530 | View Code Duplication | public function setEffects($v) |
|
543 | |||
544 | /** |
||
545 | * Set the value of [page_type] column. |
||
546 | * |
||
547 | * @param string $v new value |
||
548 | * @return $this|\xbanners\models\Banners The current object (for fluent API support) |
||
549 | */ |
||
550 | View Code Duplication | public function setPageType($v) |
|
563 | |||
564 | /** |
||
565 | * Indicates whether the columns in this object are only set to default values. |
||
566 | * |
||
567 | * This method can be used in conjunction with isModified() to indicate whether an object is both |
||
568 | * modified _and_ has some values set which are non-default. |
||
569 | * |
||
570 | * @return boolean Whether the columns in this object are only been set with default values. |
||
571 | */ |
||
572 | public function hasOnlyDefaultValues() |
||
577 | |||
578 | /** |
||
579 | * Hydrates (populates) the object variables with values from the database resultset. |
||
580 | * |
||
581 | * An offset (0-based "start column") is specified so that objects can be hydrated |
||
582 | * with a subset of the columns in the resultset rows. This is needed, for example, |
||
583 | * for results of JOIN queries where the resultset row includes columns from two or |
||
584 | * more tables. |
||
585 | * |
||
586 | * @param array $row The row returned by DataFetcher->fetch(). |
||
587 | * @param int $startcol 0-based offset column which indicates which restultset column to start with. |
||
588 | * @param boolean $rehydrate Whether this object is being re-hydrated from the database. |
||
589 | * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
||
590 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
591 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
592 | * |
||
593 | * @return int next starting column |
||
594 | * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. |
||
595 | */ |
||
596 | View Code Duplication | public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) |
|
631 | |||
632 | /** |
||
633 | * Checks and repairs the internal consistency of the object. |
||
634 | * |
||
635 | * This method is executed after an already-instantiated object is re-hydrated |
||
636 | * from the database. It exists to check any foreign keys to make sure that |
||
637 | * the objects related to the current object are correct based on foreign key. |
||
638 | * |
||
639 | * You can override this method in the stub class, but you should always invoke |
||
640 | * the base method from the overridden method (i.e. parent::ensureConsistency()), |
||
641 | * in case your model changes. |
||
642 | * |
||
643 | * @throws PropelException |
||
644 | */ |
||
645 | public function ensureConsistency() |
||
648 | |||
649 | /** |
||
650 | * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. |
||
651 | * |
||
652 | * This will only work if the object has been saved and has a valid primary key set. |
||
653 | * |
||
654 | * @param boolean $deep (optional) Whether to also de-associated any related objects. |
||
655 | * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. |
||
656 | * @return void |
||
657 | * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db |
||
658 | */ |
||
659 | View Code Duplication | public function reload($deep = false, ConnectionInterface $con = null) |
|
692 | |||
693 | /** |
||
694 | * Removes this object from datastore and sets delete attribute. |
||
695 | * |
||
696 | * @param ConnectionInterface $con |
||
697 | * @return void |
||
698 | * @throws PropelException |
||
699 | * @see Banners::setDeleted() |
||
700 | * @see Banners::isDeleted() |
||
701 | */ |
||
702 | View Code Duplication | public function delete(ConnectionInterface $con = null) |
|
723 | |||
724 | /** |
||
725 | * Persists this object to the database. |
||
726 | * |
||
727 | * If the object is new, it inserts it; otherwise an update is performed. |
||
728 | * All modified related objects will also be persisted in the doSave() |
||
729 | * method. This method wraps all precipitate database operations in a |
||
730 | * single transaction. |
||
731 | * |
||
732 | * @param ConnectionInterface $con |
||
733 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
734 | * @throws PropelException |
||
735 | * @see doSave() |
||
736 | */ |
||
737 | View Code Duplication | public function save(ConnectionInterface $con = null) |
|
775 | |||
776 | /** |
||
777 | * Performs the work of inserting or updating the row in the database. |
||
778 | * |
||
779 | * If the object is new, it inserts it; otherwise an update is performed. |
||
780 | * All related objects are also updated in this method. |
||
781 | * |
||
782 | * @param ConnectionInterface $con |
||
783 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
784 | * @throws PropelException |
||
785 | * @see save() |
||
786 | */ |
||
787 | View Code Duplication | protected function doSave(ConnectionInterface $con) |
|
844 | |||
845 | /** |
||
846 | * Insert the row in the database. |
||
847 | * |
||
848 | * @param ConnectionInterface $con |
||
849 | * |
||
850 | * @throws PropelException |
||
851 | * @see doSave() |
||
852 | */ |
||
853 | protected function doInsert(ConnectionInterface $con) |
||
928 | |||
929 | /** |
||
930 | * Update the row in the database. |
||
931 | * |
||
932 | * @param ConnectionInterface $con |
||
933 | * |
||
934 | * @return Integer Number of updated rows |
||
935 | * @see doSave() |
||
936 | */ |
||
937 | protected function doUpdate(ConnectionInterface $con) |
||
944 | |||
945 | /** |
||
946 | * Retrieves a field from the object by name passed in as a string. |
||
947 | * |
||
948 | * @param string $name name |
||
949 | * @param string $type The type of fieldname the $name is of: |
||
950 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
951 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
952 | * Defaults to TableMap::TYPE_PHPNAME. |
||
953 | * @return mixed Value of field. |
||
954 | */ |
||
955 | View Code Duplication | public function getByName($name, $type = TableMap::TYPE_PHPNAME) |
|
962 | |||
963 | /** |
||
964 | * Retrieves a field from the object by Position as specified in the xml schema. |
||
965 | * Zero-based. |
||
966 | * |
||
967 | * @param int $pos position in xml schema |
||
968 | * @return mixed Value of field at $pos |
||
969 | */ |
||
970 | public function getByPosition($pos) |
||
996 | |||
997 | /** |
||
998 | * Exports the object as an array. |
||
999 | * |
||
1000 | * You can specify the key type of the array by passing one of the class |
||
1001 | * type constants. |
||
1002 | * |
||
1003 | * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
1004 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
1005 | * Defaults to TableMap::TYPE_PHPNAME. |
||
1006 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. |
||
1007 | * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion |
||
1008 | * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. |
||
1009 | * |
||
1010 | * @return array an associative array containing the field names (as keys) and field values |
||
1011 | */ |
||
1012 | View Code Duplication | public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) |
|
1068 | |||
1069 | /** |
||
1070 | * Sets a field from the object by name passed in as a string. |
||
1071 | * |
||
1072 | * @param string $name |
||
1073 | * @param mixed $value field value |
||
1074 | * @param string $type The type of fieldname the $name is of: |
||
1075 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
1076 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
1077 | * Defaults to TableMap::TYPE_PHPNAME. |
||
1078 | * @return $this|\xbanners\models\Banners |
||
1079 | */ |
||
1080 | public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) |
||
1086 | |||
1087 | /** |
||
1088 | * Sets a field from the object by Position as specified in the xml schema. |
||
1089 | * Zero-based. |
||
1090 | * |
||
1091 | * @param int $pos position in xml schema |
||
1092 | * @param mixed $value field value |
||
1093 | * @return $this|\xbanners\models\Banners |
||
1094 | */ |
||
1095 | public function setByPosition($pos, $value) |
||
1120 | |||
1121 | /** |
||
1122 | * Populates the object using an array. |
||
1123 | * |
||
1124 | * This is particularly useful when populating an object from one of the |
||
1125 | * request arrays (e.g. $_POST). This method goes through the column |
||
1126 | * names, checking to see whether a matching key exists in populated |
||
1127 | * array. If so the setByName() method is called for that column. |
||
1128 | * |
||
1129 | * You can specify the key type of the array by additionally passing one |
||
1130 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
1131 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
1132 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
1133 | * |
||
1134 | * @param array $arr An array to populate the object from. |
||
1135 | * @param string $keyType The type of keys the array uses. |
||
1136 | * @return void |
||
1137 | */ |
||
1138 | View Code Duplication | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) |
|
1161 | |||
1162 | /** |
||
1163 | * Populate the current object from a string, using a given parser format |
||
1164 | * <code> |
||
1165 | * $book = new Book(); |
||
1166 | * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
1167 | * </code> |
||
1168 | * |
||
1169 | * You can specify the key type of the array by additionally passing one |
||
1170 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
1171 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
1172 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
1173 | * |
||
1174 | * @param mixed $parser A AbstractParser instance, |
||
1175 | * or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
1176 | * @param string $data The source data to import from |
||
1177 | * @param string $keyType The type of keys the array uses. |
||
1178 | * |
||
1179 | * @return $this|\xbanners\models\Banners The current object, for fluid interface |
||
1180 | */ |
||
1181 | View Code Duplication | public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) |
|
1191 | |||
1192 | /** |
||
1193 | * Build a Criteria object containing the values of all modified columns in this object. |
||
1194 | * |
||
1195 | * @return Criteria The Criteria object containing all modified values. |
||
1196 | */ |
||
1197 | public function buildCriteria() |
||
1222 | |||
1223 | /** |
||
1224 | * Builds a Criteria object containing the primary key for this object. |
||
1225 | * |
||
1226 | * Unlike buildCriteria() this method includes the primary key values regardless |
||
1227 | * of whether or not they have been modified. |
||
1228 | * |
||
1229 | * @throws LogicException if no primary key is defined |
||
1230 | * |
||
1231 | * @return Criteria The Criteria object containing value(s) for primary key(s). |
||
1232 | */ |
||
1233 | public function buildPkeyCriteria() |
||
1240 | |||
1241 | /** |
||
1242 | * If the primary key is not null, return the hashcode of the |
||
1243 | * primary key. Otherwise, return the hash code of the object. |
||
1244 | * |
||
1245 | * @return int Hashcode |
||
1246 | */ |
||
1247 | View Code Duplication | public function hashCode() |
|
1262 | |||
1263 | /** |
||
1264 | * Returns the primary key for this object (row). |
||
1265 | * @return int |
||
1266 | */ |
||
1267 | public function getPrimaryKey() |
||
1271 | |||
1272 | /** |
||
1273 | * Generic method to set the primary key (id column). |
||
1274 | * |
||
1275 | * @param int $key Primary key. |
||
1276 | * @return void |
||
1277 | */ |
||
1278 | public function setPrimaryKey($key) |
||
1282 | |||
1283 | /** |
||
1284 | * Returns true if the primary key for this object is null. |
||
1285 | * @return boolean |
||
1286 | */ |
||
1287 | public function isPrimaryKeyNull() |
||
1291 | |||
1292 | /** |
||
1293 | * Sets contents of passed object to values from current object. |
||
1294 | * |
||
1295 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
1296 | * objects. |
||
1297 | * |
||
1298 | * @param object $copyObj An object of \xbanners\models\Banners (or compatible) type. |
||
1299 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
1300 | * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. |
||
1301 | * @throws PropelException |
||
1302 | */ |
||
1303 | public function copyInto($copyObj, $deepCopy = false, $makeNew = true) |
||
1335 | |||
1336 | /** |
||
1337 | * Makes a copy of this object that will be inserted as a new row in table when saved. |
||
1338 | * It creates a new object filling in the simple attributes, but skipping any primary |
||
1339 | * keys that are defined for the table. |
||
1340 | * |
||
1341 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
1342 | * objects. |
||
1343 | * |
||
1344 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
1345 | * @return \xbanners\models\Banners Clone of current object. |
||
1346 | * @throws PropelException |
||
1347 | */ |
||
1348 | View Code Duplication | public function copy($deepCopy = false) |
|
1357 | |||
1358 | |||
1359 | /** |
||
1360 | * Initializes a collection based on the name of a relation. |
||
1361 | * Avoids crafting an 'init[$relationName]s' method name |
||
1362 | * that wouldn't work when StandardEnglishPluralizer is used. |
||
1363 | * |
||
1364 | * @param string $relationName The name of the relation to initialize |
||
1365 | * @return void |
||
1366 | */ |
||
1367 | public function initRelation($relationName) |
||
1376 | |||
1377 | /** |
||
1378 | * Clears out the collBannerImages collection |
||
1379 | * |
||
1380 | * This does not modify the database; however, it will remove any associated objects, causing |
||
1381 | * them to be refetched by subsequent calls to accessor method. |
||
1382 | * |
||
1383 | * @return void |
||
1384 | * @see addBannerImages() |
||
1385 | */ |
||
1386 | public function clearBannerImages() |
||
1390 | |||
1391 | /** |
||
1392 | * Reset is the collBannerImages collection loaded partially. |
||
1393 | */ |
||
1394 | public function resetPartialBannerImages($v = true) |
||
1398 | |||
1399 | /** |
||
1400 | * Initializes the collBannerImages collection. |
||
1401 | * |
||
1402 | * By default this just sets the collBannerImages collection to an empty array (like clearcollBannerImages()); |
||
1403 | * however, you may wish to override this method in your stub class to provide setting appropriate |
||
1404 | * to your application -- for example, setting the initial array to the values stored in database. |
||
1405 | * |
||
1406 | * @param boolean $overrideExisting If set to true, the method call initializes |
||
1407 | * the collection even if it is not empty |
||
1408 | * |
||
1409 | * @return void |
||
1410 | */ |
||
1411 | View Code Duplication | public function initBannerImages($overrideExisting = true) |
|
1422 | |||
1423 | /** |
||
1424 | * Gets an array of ChildBannerImage objects which contain a foreign key that references this object. |
||
1425 | * |
||
1426 | * If the $criteria is not null, it is used to always fetch the results from the database. |
||
1427 | * Otherwise the results are fetched from the database the first time, then cached. |
||
1428 | * Next time the same method is called without $criteria, the cached collection is returned. |
||
1429 | * If this ChildBanners is new, it will return |
||
1430 | * an empty collection or the current collection; the criteria is ignored on a new object. |
||
1431 | * |
||
1432 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
1433 | * @param ConnectionInterface $con optional connection object |
||
1434 | * @return ObjectCollection|ChildBannerImage[] List of ChildBannerImage objects |
||
1435 | * @throws PropelException |
||
1436 | */ |
||
1437 | View Code Duplication | public function getBannerImages(Criteria $criteria = null, ConnectionInterface $con = null) |
|
1480 | |||
1481 | /** |
||
1482 | * Sets a collection of ChildBannerImage objects related by a one-to-many relationship |
||
1483 | * to the current object. |
||
1484 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted) |
||
1485 | * and new objects from the given Propel collection. |
||
1486 | * |
||
1487 | * @param Collection $bannerImages A Propel collection. |
||
1488 | * @param ConnectionInterface $con Optional connection object |
||
1489 | * @return $this|ChildBanners The current object (for fluent API support) |
||
1490 | */ |
||
1491 | View Code Duplication | public function setBannerImages(Collection $bannerImages, ConnectionInterface $con = null) |
|
1513 | |||
1514 | /** |
||
1515 | * Returns the number of related BannerImage objects. |
||
1516 | * |
||
1517 | * @param Criteria $criteria |
||
1518 | * @param boolean $distinct |
||
1519 | * @param ConnectionInterface $con |
||
1520 | * @return int Count of related BannerImage objects. |
||
1521 | * @throws PropelException |
||
1522 | */ |
||
1523 | View Code Duplication | public function countBannerImages(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) |
|
1547 | |||
1548 | /** |
||
1549 | * Method called to associate a ChildBannerImage object to this object |
||
1550 | * through the ChildBannerImage foreign key attribute. |
||
1551 | * |
||
1552 | * @param ChildBannerImage $l ChildBannerImage |
||
1553 | * @return $this|\xbanners\models\Banners The current object (for fluent API support) |
||
1554 | */ |
||
1555 | public function addBannerImage(ChildBannerImage $l) |
||
1572 | |||
1573 | /** |
||
1574 | * @param ChildBannerImage $bannerImage The ChildBannerImage object to add. |
||
1575 | */ |
||
1576 | protected function doAddBannerImage(ChildBannerImage $bannerImage) |
||
1581 | |||
1582 | /** |
||
1583 | * @param ChildBannerImage $bannerImage The ChildBannerImage object to remove. |
||
1584 | * @return $this|ChildBanners The current object (for fluent API support) |
||
1585 | */ |
||
1586 | View Code Duplication | public function removeBannerImage(ChildBannerImage $bannerImage) |
|
1601 | |||
1602 | /** |
||
1603 | * Clears out the collBannersI18ns collection |
||
1604 | * |
||
1605 | * This does not modify the database; however, it will remove any associated objects, causing |
||
1606 | * them to be refetched by subsequent calls to accessor method. |
||
1607 | * |
||
1608 | * @return void |
||
1609 | * @see addBannersI18ns() |
||
1610 | */ |
||
1611 | public function clearBannersI18ns() |
||
1615 | |||
1616 | /** |
||
1617 | * Reset is the collBannersI18ns collection loaded partially. |
||
1618 | */ |
||
1619 | public function resetPartialBannersI18ns($v = true) |
||
1623 | |||
1624 | /** |
||
1625 | * Initializes the collBannersI18ns collection. |
||
1626 | * |
||
1627 | * By default this just sets the collBannersI18ns collection to an empty array (like clearcollBannersI18ns()); |
||
1628 | * however, you may wish to override this method in your stub class to provide setting appropriate |
||
1629 | * to your application -- for example, setting the initial array to the values stored in database. |
||
1630 | * |
||
1631 | * @param boolean $overrideExisting If set to true, the method call initializes |
||
1632 | * the collection even if it is not empty |
||
1633 | * |
||
1634 | * @return void |
||
1635 | */ |
||
1636 | View Code Duplication | public function initBannersI18ns($overrideExisting = true) |
|
1647 | |||
1648 | /** |
||
1649 | * Gets an array of ChildBannersI18n objects which contain a foreign key that references this object. |
||
1650 | * |
||
1651 | * If the $criteria is not null, it is used to always fetch the results from the database. |
||
1652 | * Otherwise the results are fetched from the database the first time, then cached. |
||
1653 | * Next time the same method is called without $criteria, the cached collection is returned. |
||
1654 | * If this ChildBanners is new, it will return |
||
1655 | * an empty collection or the current collection; the criteria is ignored on a new object. |
||
1656 | * |
||
1657 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
1658 | * @param ConnectionInterface $con optional connection object |
||
1659 | * @return ObjectCollection|ChildBannersI18n[] List of ChildBannersI18n objects |
||
1660 | * @throws PropelException |
||
1661 | */ |
||
1662 | View Code Duplication | public function getBannersI18ns(Criteria $criteria = null, ConnectionInterface $con = null) |
|
1705 | |||
1706 | /** |
||
1707 | * Sets a collection of ChildBannersI18n objects related by a one-to-many relationship |
||
1708 | * to the current object. |
||
1709 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted) |
||
1710 | * and new objects from the given Propel collection. |
||
1711 | * |
||
1712 | * @param Collection $bannersI18ns A Propel collection. |
||
1713 | * @param ConnectionInterface $con Optional connection object |
||
1714 | * @return $this|ChildBanners The current object (for fluent API support) |
||
1715 | */ |
||
1716 | View Code Duplication | public function setBannersI18ns(Collection $bannersI18ns, ConnectionInterface $con = null) |
|
1741 | |||
1742 | /** |
||
1743 | * Returns the number of related BannersI18n objects. |
||
1744 | * |
||
1745 | * @param Criteria $criteria |
||
1746 | * @param boolean $distinct |
||
1747 | * @param ConnectionInterface $con |
||
1748 | * @return int Count of related BannersI18n objects. |
||
1749 | * @throws PropelException |
||
1750 | */ |
||
1751 | View Code Duplication | public function countBannersI18ns(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) |
|
1775 | |||
1776 | /** |
||
1777 | * Method called to associate a ChildBannersI18n object to this object |
||
1778 | * through the ChildBannersI18n foreign key attribute. |
||
1779 | * |
||
1780 | * @param ChildBannersI18n $l ChildBannersI18n |
||
1781 | * @return $this|\xbanners\models\Banners The current object (for fluent API support) |
||
1782 | */ |
||
1783 | View Code Duplication | public function addBannersI18n(ChildBannersI18n $l) |
|
1804 | |||
1805 | /** |
||
1806 | * @param ChildBannersI18n $bannersI18n The ChildBannersI18n object to add. |
||
1807 | */ |
||
1808 | protected function doAddBannersI18n(ChildBannersI18n $bannersI18n) |
||
1813 | |||
1814 | /** |
||
1815 | * @param ChildBannersI18n $bannersI18n The ChildBannersI18n object to remove. |
||
1816 | * @return $this|ChildBanners The current object (for fluent API support) |
||
1817 | */ |
||
1818 | View Code Duplication | public function removeBannersI18n(ChildBannersI18n $bannersI18n) |
|
1833 | |||
1834 | /** |
||
1835 | * Clears the current object, sets all attributes to their default values and removes |
||
1836 | * outgoing references as well as back-references (from other objects to this one. Results probably in a database |
||
1837 | * change of those foreign objects when you call `save` there). |
||
1838 | */ |
||
1839 | View Code Duplication | public function clear() |
|
1853 | |||
1854 | /** |
||
1855 | * Resets all references and back-references to other model objects or collections of model objects. |
||
1856 | * |
||
1857 | * This method is used to reset all php object references (not the actual reference in the database). |
||
1858 | * Necessary for object serialisation. |
||
1859 | * |
||
1860 | * @param boolean $deep Whether to also clear the references on all referrer objects. |
||
1861 | */ |
||
1862 | public function clearAllReferences($deep = false) |
||
1884 | |||
1885 | /** |
||
1886 | * Return the string representation of this object |
||
1887 | * |
||
1888 | * @return string |
||
1889 | */ |
||
1890 | public function __toString() |
||
1894 | |||
1895 | // i18n behavior |
||
1896 | |||
1897 | /** |
||
1898 | * Sets the locale for translations |
||
1899 | * |
||
1900 | * @param string $locale Locale to use for the translation, e.g. 'fr_FR' |
||
1901 | * |
||
1902 | * @return $this|ChildBanners The current object (for fluent API support) |
||
1903 | */ |
||
1904 | public function setLocale($locale = 'ru') |
||
1910 | |||
1911 | /** |
||
1912 | * Gets the locale for translations |
||
1913 | * |
||
1914 | * @return string $locale Locale to use for the translation, e.g. 'fr_FR' |
||
1915 | */ |
||
1916 | public function getLocale() |
||
1920 | |||
1921 | /** |
||
1922 | * Returns the current translation for a given locale |
||
1923 | * |
||
1924 | * @param string $locale Locale to use for the translation, e.g. 'fr_FR' |
||
1925 | * @param ConnectionInterface $con an optional connection object |
||
1926 | * |
||
1927 | * @return ChildBannersI18n */ |
||
1928 | View Code Duplication | public function getTranslation($locale = 'ru', ConnectionInterface $con = null) |
|
1954 | |||
1955 | /** |
||
1956 | * Remove the translation for a given locale |
||
1957 | * |
||
1958 | * @param string $locale Locale to use for the translation, e.g. 'fr_FR' |
||
1959 | * @param ConnectionInterface $con an optional connection object |
||
1960 | * |
||
1961 | * @return $this|ChildBanners The current object (for fluent API support) |
||
1962 | */ |
||
1963 | View Code Duplication | public function removeTranslation($locale = 'ru', ConnectionInterface $con = null) |
|
1982 | |||
1983 | /** |
||
1984 | * Returns the current translation |
||
1985 | * |
||
1986 | * @param ConnectionInterface $con an optional connection object |
||
1987 | * |
||
1988 | * @return ChildBannersI18n */ |
||
1989 | public function getCurrentTranslation(ConnectionInterface $con = null) |
||
1993 | |||
1994 | |||
1995 | /** |
||
1996 | * Get the [name] column value. |
||
1997 | * |
||
1998 | * @return string |
||
1999 | */ |
||
2000 | public function getName() |
||
2004 | |||
2005 | |||
2006 | /** |
||
2007 | * Set the value of [name] column. |
||
2008 | * |
||
2009 | * @param string $v new value |
||
2010 | * @return $this|\xbanners\models\BannersI18n The current object (for fluent API support) |
||
2011 | */ |
||
2012 | public function setName($v) |
||
2017 | |||
2018 | /** |
||
2019 | * Code to be run before persisting the object |
||
2020 | * @param ConnectionInterface $con |
||
2021 | * @return boolean |
||
2022 | */ |
||
2023 | public function preSave(ConnectionInterface $con = null) |
||
2030 | |||
2031 | /** |
||
2032 | * Code to be run after persisting the object |
||
2033 | * @param ConnectionInterface $con |
||
2034 | */ |
||
2035 | public function postSave(ConnectionInterface $con = null) |
||
2041 | |||
2042 | /** |
||
2043 | * Code to be run before inserting to database |
||
2044 | * @param ConnectionInterface $con |
||
2045 | * @return boolean |
||
2046 | */ |
||
2047 | public function preInsert(ConnectionInterface $con = null) |
||
2054 | |||
2055 | /** |
||
2056 | * Code to be run after inserting to database |
||
2057 | * @param ConnectionInterface $con |
||
2058 | */ |
||
2059 | public function postInsert(ConnectionInterface $con = null) |
||
2065 | |||
2066 | /** |
||
2067 | * Code to be run before updating the object in database |
||
2068 | * @param ConnectionInterface $con |
||
2069 | * @return boolean |
||
2070 | */ |
||
2071 | public function preUpdate(ConnectionInterface $con = null) |
||
2078 | |||
2079 | /** |
||
2080 | * Code to be run after updating the object in database |
||
2081 | * @param ConnectionInterface $con |
||
2082 | */ |
||
2083 | public function postUpdate(ConnectionInterface $con = null) |
||
2089 | |||
2090 | /** |
||
2091 | * Code to be run before deleting the object in database |
||
2092 | * @param ConnectionInterface $con |
||
2093 | * @return boolean |
||
2094 | */ |
||
2095 | public function preDelete(ConnectionInterface $con = null) |
||
2102 | |||
2103 | /** |
||
2104 | * Code to be run after deleting the object in database |
||
2105 | * @param ConnectionInterface $con |
||
2106 | */ |
||
2107 | public function postDelete(ConnectionInterface $con = null) |
||
2113 | |||
2114 | |||
2115 | /** |
||
2116 | * Derived method to catches calls to undefined methods. |
||
2117 | * |
||
2118 | * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). |
||
2119 | * Allows to define default __call() behavior if you overwrite __call() |
||
2120 | * |
||
2121 | * @param string $name |
||
2122 | * @param mixed $params |
||
2123 | * |
||
2124 | * @return array|string |
||
2125 | */ |
||
2126 | View Code Duplication | public function __call($name, $params) |
|
2155 | |||
2156 | } |
||
2157 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.