Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like BannersI18n often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use BannersI18n, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
30 | abstract class BannersI18n implements ActiveRecordInterface |
||
31 | { |
||
|
|||
32 | /** |
||
33 | * TableMap class name |
||
34 | */ |
||
35 | const TABLE_MAP = '\\xbanners\\models\\Map\\BannersI18nTableMap'; |
||
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 name field. |
||
81 | * |
||
82 | * @var string |
||
83 | */ |
||
84 | protected $name; |
||
85 | |||
86 | /** |
||
87 | * @var ChildBanners |
||
88 | */ |
||
89 | protected $aBanners; |
||
90 | |||
91 | /** |
||
92 | * Flag to prevent endless save loop, if this object is referenced |
||
93 | * by another object which falls in this transaction. |
||
94 | * |
||
95 | * @var boolean |
||
96 | */ |
||
97 | protected $alreadyInSave = false; |
||
98 | |||
99 | /** |
||
100 | * Applies default values to this object. |
||
101 | * This method should be called from the object's constructor (or |
||
102 | * equivalent initialization method). |
||
103 | * @see __construct() |
||
104 | */ |
||
105 | public function applyDefaultValues() |
||
109 | |||
110 | /** |
||
111 | * Initializes internal state of xbanners\models\Base\BannersI18n object. |
||
112 | * @see applyDefaults() |
||
113 | */ |
||
114 | public function __construct() |
||
118 | |||
119 | /** |
||
120 | * Returns whether the object has been modified. |
||
121 | * |
||
122 | * @return boolean True if the object has been modified. |
||
123 | */ |
||
124 | public function isModified() |
||
128 | |||
129 | /** |
||
130 | * Has specified column been modified? |
||
131 | * |
||
132 | * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID |
||
133 | * @return boolean True if $col has been modified. |
||
134 | */ |
||
135 | public function isColumnModified($col) |
||
139 | |||
140 | /** |
||
141 | * Get the columns that have been modified in this object. |
||
142 | * @return array A unique list of the modified column names for this object. |
||
143 | */ |
||
144 | public function getModifiedColumns() |
||
148 | |||
149 | /** |
||
150 | * Returns whether the object has ever been saved. This will |
||
151 | * be false, if the object was retrieved from storage or was created |
||
152 | * and then saved. |
||
153 | * |
||
154 | * @return boolean true, if the object has never been persisted. |
||
155 | */ |
||
156 | public function isNew() |
||
160 | |||
161 | /** |
||
162 | * Setter for the isNew attribute. This method will be called |
||
163 | * by Propel-generated children and objects. |
||
164 | * |
||
165 | * @param boolean $b the state of the object. |
||
166 | */ |
||
167 | public function setNew($b) |
||
171 | |||
172 | /** |
||
173 | * Whether this object has been deleted. |
||
174 | * @return boolean The deleted state of this object. |
||
175 | */ |
||
176 | public function isDeleted() |
||
180 | |||
181 | /** |
||
182 | * Specify whether this object has been deleted. |
||
183 | * @param boolean $b The deleted state of this object. |
||
184 | * @return void |
||
185 | */ |
||
186 | public function setDeleted($b) |
||
190 | |||
191 | /** |
||
192 | * Sets the modified state for the object to be false. |
||
193 | * @param string $col If supplied, only the specified column is reset. |
||
194 | * @return void |
||
195 | */ |
||
196 | View Code Duplication | public function resetModified($col = null) |
|
206 | |||
207 | /** |
||
208 | * Compares this with another <code>BannersI18n</code> instance. If |
||
209 | * <code>obj</code> is an instance of <code>BannersI18n</code>, delegates to |
||
210 | * <code>equals(BannersI18n)</code>. Otherwise, returns <code>false</code>. |
||
211 | * |
||
212 | * @param mixed $obj The object to compare to. |
||
213 | * @return boolean Whether equal to the object specified. |
||
214 | */ |
||
215 | View Code Duplication | public function equals($obj) |
|
231 | |||
232 | /** |
||
233 | * Get the associative array of the virtual columns in this object |
||
234 | * |
||
235 | * @return array |
||
236 | */ |
||
237 | public function getVirtualColumns() |
||
241 | |||
242 | /** |
||
243 | * Checks the existence of a virtual column in this object |
||
244 | * |
||
245 | * @param string $name The virtual column name |
||
246 | * @return boolean |
||
247 | */ |
||
248 | public function hasVirtualColumn($name) |
||
252 | |||
253 | /** |
||
254 | * Get the value of a virtual column in this object |
||
255 | * |
||
256 | * @param string $name The virtual column name |
||
257 | * @return mixed |
||
258 | * |
||
259 | * @throws PropelException |
||
260 | */ |
||
261 | View Code Duplication | public function getVirtualColumn($name) |
|
269 | |||
270 | /** |
||
271 | * Set the value of a virtual column in this object |
||
272 | * |
||
273 | * @param string $name The virtual column name |
||
274 | * @param mixed $value The value to give to the virtual column |
||
275 | * |
||
276 | * @return $this|BannersI18n The current object, for fluid interface |
||
277 | */ |
||
278 | public function setVirtualColumn($name, $value) |
||
284 | |||
285 | /** |
||
286 | * Logs a message using Propel::log(). |
||
287 | * |
||
288 | * @param string $msg |
||
289 | * @param int $priority One of the Propel::LOG_* logging levels |
||
290 | * @return boolean |
||
291 | */ |
||
292 | protected function log($msg, $priority = Propel::LOG_INFO) |
||
296 | |||
297 | /** |
||
298 | * Export the current object properties to a string, using a given parser format |
||
299 | * <code> |
||
300 | * $book = BookQuery::create()->findPk(9012); |
||
301 | * echo $book->exportTo('JSON'); |
||
302 | * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
303 | * </code> |
||
304 | * |
||
305 | * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
306 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. |
||
307 | * @return string The exported data |
||
308 | */ |
||
309 | View Code Duplication | public function exportTo($parser, $includeLazyLoadColumns = true) |
|
317 | |||
318 | /** |
||
319 | * Clean up internal collections prior to serializing |
||
320 | * Avoids recursive loops that turn into segmentation faults when serializing |
||
321 | */ |
||
322 | View Code Duplication | public function __sleep() |
|
336 | |||
337 | /** |
||
338 | * Get the [id] column value. |
||
339 | * |
||
340 | * @return int |
||
341 | */ |
||
342 | public function getId() |
||
346 | |||
347 | /** |
||
348 | * Get the [locale] column value. |
||
349 | * |
||
350 | * @return string |
||
351 | */ |
||
352 | public function getLocale() |
||
356 | |||
357 | /** |
||
358 | * Get the [name] column value. |
||
359 | * |
||
360 | * @return string |
||
361 | */ |
||
362 | public function getName() |
||
366 | |||
367 | /** |
||
368 | * Set the value of [id] column. |
||
369 | * |
||
370 | * @param int $v new value |
||
371 | * @return $this|\xbanners\models\BannersI18n The current object (for fluent API support) |
||
372 | */ |
||
373 | View Code Duplication | public function setId($v) |
|
390 | |||
391 | /** |
||
392 | * Set the value of [locale] column. |
||
393 | * |
||
394 | * @param string $v new value |
||
395 | * @return $this|\xbanners\models\BannersI18n The current object (for fluent API support) |
||
396 | */ |
||
397 | View Code Duplication | public function setLocale($v) |
|
410 | |||
411 | /** |
||
412 | * Set the value of [name] column. |
||
413 | * |
||
414 | * @param string $v new value |
||
415 | * @return $this|\xbanners\models\BannersI18n The current object (for fluent API support) |
||
416 | */ |
||
417 | public function setName($v) |
||
430 | |||
431 | /** |
||
432 | * Indicates whether the columns in this object are only set to default values. |
||
433 | * |
||
434 | * This method can be used in conjunction with isModified() to indicate whether an object is both |
||
435 | * modified _and_ has some values set which are non-default. |
||
436 | * |
||
437 | * @return boolean Whether the columns in this object are only been set with default values. |
||
438 | */ |
||
439 | public function hasOnlyDefaultValues() |
||
448 | |||
449 | /** |
||
450 | * Hydrates (populates) the object variables with values from the database resultset. |
||
451 | * |
||
452 | * An offset (0-based "start column") is specified so that objects can be hydrated |
||
453 | * with a subset of the columns in the resultset rows. This is needed, for example, |
||
454 | * for results of JOIN queries where the resultset row includes columns from two or |
||
455 | * more tables. |
||
456 | * |
||
457 | * @param array $row The row returned by DataFetcher->fetch(). |
||
458 | * @param int $startcol 0-based offset column which indicates which restultset column to start with. |
||
459 | * @param boolean $rehydrate Whether this object is being re-hydrated from the database. |
||
460 | * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
||
461 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
462 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
463 | * |
||
464 | * @return int next starting column |
||
465 | * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. |
||
466 | */ |
||
467 | public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) |
||
493 | |||
494 | /** |
||
495 | * Checks and repairs the internal consistency of the object. |
||
496 | * |
||
497 | * This method is executed after an already-instantiated object is re-hydrated |
||
498 | * from the database. It exists to check any foreign keys to make sure that |
||
499 | * the objects related to the current object are correct based on foreign key. |
||
500 | * |
||
501 | * You can override this method in the stub class, but you should always invoke |
||
502 | * the base method from the overridden method (i.e. parent::ensureConsistency()), |
||
503 | * in case your model changes. |
||
504 | * |
||
505 | * @throws PropelException |
||
506 | */ |
||
507 | public function ensureConsistency() |
||
513 | |||
514 | /** |
||
515 | * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. |
||
516 | * |
||
517 | * This will only work if the object has been saved and has a valid primary key set. |
||
518 | * |
||
519 | * @param boolean $deep (optional) Whether to also de-associated any related objects. |
||
520 | * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. |
||
521 | * @return void |
||
522 | * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db |
||
523 | */ |
||
524 | View Code Duplication | public function reload($deep = false, ConnectionInterface $con = null) |
|
554 | |||
555 | /** |
||
556 | * Removes this object from datastore and sets delete attribute. |
||
557 | * |
||
558 | * @param ConnectionInterface $con |
||
559 | * @return void |
||
560 | * @throws PropelException |
||
561 | * @see BannersI18n::setDeleted() |
||
562 | * @see BannersI18n::isDeleted() |
||
563 | */ |
||
564 | View Code Duplication | public function delete(ConnectionInterface $con = null) |
|
585 | |||
586 | /** |
||
587 | * Persists this object to the database. |
||
588 | * |
||
589 | * If the object is new, it inserts it; otherwise an update is performed. |
||
590 | * All modified related objects will also be persisted in the doSave() |
||
591 | * method. This method wraps all precipitate database operations in a |
||
592 | * single transaction. |
||
593 | * |
||
594 | * @param ConnectionInterface $con |
||
595 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
596 | * @throws PropelException |
||
597 | * @see doSave() |
||
598 | */ |
||
599 | View Code Duplication | public function save(ConnectionInterface $con = null) |
|
633 | |||
634 | /** |
||
635 | * Performs the work of inserting or updating the row in the database. |
||
636 | * |
||
637 | * If the object is new, it inserts it; otherwise an update is performed. |
||
638 | * All related objects are also updated in this method. |
||
639 | * |
||
640 | * @param ConnectionInterface $con |
||
641 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
642 | * @throws PropelException |
||
643 | * @see save() |
||
644 | */ |
||
645 | View Code Duplication | protected function doSave(ConnectionInterface $con) |
|
680 | |||
681 | /** |
||
682 | * Insert the row in the database. |
||
683 | * |
||
684 | * @param ConnectionInterface $con |
||
685 | * |
||
686 | * @throws PropelException |
||
687 | * @see doSave() |
||
688 | */ |
||
689 | protected function doInsert(ConnectionInterface $con) |
||
735 | |||
736 | /** |
||
737 | * Update the row in the database. |
||
738 | * |
||
739 | * @param ConnectionInterface $con |
||
740 | * |
||
741 | * @return Integer Number of updated rows |
||
742 | * @see doSave() |
||
743 | */ |
||
744 | protected function doUpdate(ConnectionInterface $con) |
||
751 | |||
752 | /** |
||
753 | * Retrieves a field from the object by name passed in as a string. |
||
754 | * |
||
755 | * @param string $name name |
||
756 | * @param string $type The type of fieldname the $name is of: |
||
757 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
758 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
759 | * Defaults to TableMap::TYPE_PHPNAME. |
||
760 | * @return mixed Value of field. |
||
761 | */ |
||
762 | View Code Duplication | public function getByName($name, $type = TableMap::TYPE_PHPNAME) |
|
769 | |||
770 | /** |
||
771 | * Retrieves a field from the object by Position as specified in the xml schema. |
||
772 | * Zero-based. |
||
773 | * |
||
774 | * @param int $pos position in xml schema |
||
775 | * @return mixed Value of field at $pos |
||
776 | */ |
||
777 | public function getByPosition($pos) |
||
794 | |||
795 | /** |
||
796 | * Exports the object as an array. |
||
797 | * |
||
798 | * You can specify the key type of the array by passing one of the class |
||
799 | * type constants. |
||
800 | * |
||
801 | * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
802 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
803 | * Defaults to TableMap::TYPE_PHPNAME. |
||
804 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. |
||
805 | * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion |
||
806 | * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. |
||
807 | * |
||
808 | * @return array an associative array containing the field names (as keys) and field values |
||
809 | */ |
||
810 | public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) |
||
811 | { |
||
812 | |||
813 | if (isset($alreadyDumpedObjects['BannersI18n'][$this->hashCode()])) { |
||
814 | return '*RECURSION*'; |
||
815 | } |
||
816 | $alreadyDumpedObjects['BannersI18n'][$this->hashCode()] = true; |
||
817 | $keys = BannersI18nTableMap::getFieldNames($keyType); |
||
818 | $result = array( |
||
819 | $keys[0] => $this->getId(), |
||
820 | $keys[1] => $this->getLocale(), |
||
821 | $keys[2] => $this->getName(), |
||
822 | ); |
||
823 | $virtualColumns = $this->virtualColumns; |
||
824 | foreach ($virtualColumns as $key => $virtualColumn) { |
||
825 | $result[$key] = $virtualColumn; |
||
826 | } |
||
827 | |||
828 | if ($includeForeignObjects) { |
||
829 | if (null !== $this->aBanners) { |
||
830 | |||
831 | switch ($keyType) { |
||
832 | case TableMap::TYPE_CAMELNAME: |
||
833 | $key = 'banners'; |
||
834 | break; |
||
835 | case TableMap::TYPE_FIELDNAME: |
||
836 | $key = 'banners'; |
||
837 | break; |
||
838 | default: |
||
839 | $key = 'Banners'; |
||
840 | } |
||
841 | |||
842 | $result[$key] = $this->aBanners->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); |
||
843 | } |
||
844 | } |
||
845 | |||
846 | return $result; |
||
847 | } |
||
848 | |||
849 | /** |
||
850 | * Sets a field from the object by name passed in as a string. |
||
851 | * |
||
852 | * @param string $name |
||
853 | * @param mixed $value field value |
||
854 | * @param string $type The type of fieldname the $name is of: |
||
855 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
856 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
857 | * Defaults to TableMap::TYPE_PHPNAME. |
||
858 | * @return $this|\xbanners\models\BannersI18n |
||
859 | */ |
||
860 | public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) |
||
866 | |||
867 | /** |
||
868 | * Sets a field from the object by Position as specified in the xml schema. |
||
869 | * Zero-based. |
||
870 | * |
||
871 | * @param int $pos position in xml schema |
||
872 | * @param mixed $value field value |
||
873 | * @return $this|\xbanners\models\BannersI18n |
||
874 | */ |
||
875 | public function setByPosition($pos, $value) |
||
891 | |||
892 | /** |
||
893 | * Populates the object using an array. |
||
894 | * |
||
895 | * This is particularly useful when populating an object from one of the |
||
896 | * request arrays (e.g. $_POST). This method goes through the column |
||
897 | * names, checking to see whether a matching key exists in populated |
||
898 | * array. If so the setByName() method is called for that column. |
||
899 | * |
||
900 | * You can specify the key type of the array by additionally passing one |
||
901 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
902 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
903 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
904 | * |
||
905 | * @param array $arr An array to populate the object from. |
||
906 | * @param string $keyType The type of keys the array uses. |
||
907 | * @return void |
||
908 | */ |
||
909 | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) |
||
923 | |||
924 | /** |
||
925 | * Populate the current object from a string, using a given parser format |
||
926 | * <code> |
||
927 | * $book = new Book(); |
||
928 | * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
929 | * </code> |
||
930 | * |
||
931 | * You can specify the key type of the array by additionally passing one |
||
932 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
933 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
934 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
935 | * |
||
936 | * @param mixed $parser A AbstractParser instance, |
||
937 | * or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
938 | * @param string $data The source data to import from |
||
939 | * @param string $keyType The type of keys the array uses. |
||
940 | * |
||
941 | * @return $this|\xbanners\models\BannersI18n The current object, for fluid interface |
||
942 | */ |
||
943 | View Code Duplication | public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) |
|
953 | |||
954 | /** |
||
955 | * Build a Criteria object containing the values of all modified columns in this object. |
||
956 | * |
||
957 | * @return Criteria The Criteria object containing all modified values. |
||
958 | */ |
||
959 | public function buildCriteria() |
||
975 | |||
976 | /** |
||
977 | * Builds a Criteria object containing the primary key for this object. |
||
978 | * |
||
979 | * Unlike buildCriteria() this method includes the primary key values regardless |
||
980 | * of whether or not they have been modified. |
||
981 | * |
||
982 | * @throws LogicException if no primary key is defined |
||
983 | * |
||
984 | * @return Criteria The Criteria object containing value(s) for primary key(s). |
||
985 | */ |
||
986 | public function buildPkeyCriteria() |
||
994 | |||
995 | /** |
||
996 | * If the primary key is not null, return the hashcode of the |
||
997 | * primary key. Otherwise, return the hash code of the object. |
||
998 | * |
||
999 | * @return int Hashcode |
||
1000 | */ |
||
1001 | View Code Duplication | public function hashCode() |
|
1024 | |||
1025 | /** |
||
1026 | * Returns the composite primary key for this object. |
||
1027 | * The array elements will be in same order as specified in XML. |
||
1028 | * @return array |
||
1029 | */ |
||
1030 | View Code Duplication | public function getPrimaryKey() |
|
1038 | |||
1039 | /** |
||
1040 | * Set the [composite] primary key. |
||
1041 | * |
||
1042 | * @param array $keys The elements of the composite key (order must match the order in XML file). |
||
1043 | * @return void |
||
1044 | */ |
||
1045 | public function setPrimaryKey($keys) |
||
1050 | |||
1051 | /** |
||
1052 | * Returns true if the primary key for this object is null. |
||
1053 | * @return boolean |
||
1054 | */ |
||
1055 | public function isPrimaryKeyNull() |
||
1059 | |||
1060 | /** |
||
1061 | * Sets contents of passed object to values from current object. |
||
1062 | * |
||
1063 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
1064 | * objects. |
||
1065 | * |
||
1066 | * @param object $copyObj An object of \xbanners\models\BannersI18n (or compatible) type. |
||
1067 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
1068 | * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. |
||
1069 | * @throws PropelException |
||
1070 | */ |
||
1071 | public function copyInto($copyObj, $deepCopy = false, $makeNew = true) |
||
1080 | |||
1081 | /** |
||
1082 | * Makes a copy of this object that will be inserted as a new row in table when saved. |
||
1083 | * It creates a new object filling in the simple attributes, but skipping any primary |
||
1084 | * keys that are defined for the table. |
||
1085 | * |
||
1086 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
1087 | * objects. |
||
1088 | * |
||
1089 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
1090 | * @return \xbanners\models\BannersI18n Clone of current object. |
||
1091 | * @throws PropelException |
||
1092 | */ |
||
1093 | View Code Duplication | public function copy($deepCopy = false) |
|
1102 | |||
1103 | /** |
||
1104 | * Declares an association between this object and a ChildBanners object. |
||
1105 | * |
||
1106 | * @param ChildBanners $v |
||
1107 | * @return $this|\xbanners\models\BannersI18n The current object (for fluent API support) |
||
1108 | * @throws PropelException |
||
1109 | */ |
||
1110 | View Code Duplication | public function setBanners(ChildBanners $v = null) |
|
1129 | |||
1130 | |||
1131 | /** |
||
1132 | * Get the associated ChildBanners object |
||
1133 | * |
||
1134 | * @param ConnectionInterface $con Optional Connection object. |
||
1135 | * @return ChildBanners The associated ChildBanners object. |
||
1136 | * @throws PropelException |
||
1137 | */ |
||
1138 | View Code Duplication | public function getBanners(ConnectionInterface $con = null) |
|
1153 | |||
1154 | /** |
||
1155 | * Clears the current object, sets all attributes to their default values and removes |
||
1156 | * outgoing references as well as back-references (from other objects to this one. Results probably in a database |
||
1157 | * change of those foreign objects when you call `save` there). |
||
1158 | */ |
||
1159 | public function clear() |
||
1174 | |||
1175 | /** |
||
1176 | * Resets all references and back-references to other model objects or collections of model objects. |
||
1177 | * |
||
1178 | * This method is used to reset all php object references (not the actual reference in the database). |
||
1179 | * Necessary for object serialisation. |
||
1180 | * |
||
1181 | * @param boolean $deep Whether to also clear the references on all referrer objects. |
||
1182 | */ |
||
1183 | public function clearAllReferences($deep = false) |
||
1190 | |||
1191 | /** |
||
1192 | * Return the string representation of this object |
||
1193 | * |
||
1194 | * @return string |
||
1195 | */ |
||
1196 | public function __toString() |
||
1200 | |||
1201 | /** |
||
1202 | * Code to be run before persisting the object |
||
1203 | * @param ConnectionInterface $con |
||
1204 | * @return boolean |
||
1205 | */ |
||
1206 | public function preSave(ConnectionInterface $con = null) |
||
1213 | |||
1214 | /** |
||
1215 | * Code to be run after persisting the object |
||
1216 | * @param ConnectionInterface $con |
||
1217 | */ |
||
1218 | public function postSave(ConnectionInterface $con = null) |
||
1224 | |||
1225 | /** |
||
1226 | * Code to be run before inserting to database |
||
1227 | * @param ConnectionInterface $con |
||
1228 | * @return boolean |
||
1229 | */ |
||
1230 | public function preInsert(ConnectionInterface $con = null) |
||
1237 | |||
1238 | /** |
||
1239 | * Code to be run after inserting to database |
||
1240 | * @param ConnectionInterface $con |
||
1241 | */ |
||
1242 | public function postInsert(ConnectionInterface $con = null) |
||
1248 | |||
1249 | /** |
||
1250 | * Code to be run before updating the object in database |
||
1251 | * @param ConnectionInterface $con |
||
1252 | * @return boolean |
||
1253 | */ |
||
1254 | public function preUpdate(ConnectionInterface $con = null) |
||
1261 | |||
1262 | /** |
||
1263 | * Code to be run after updating the object in database |
||
1264 | * @param ConnectionInterface $con |
||
1265 | */ |
||
1266 | public function postUpdate(ConnectionInterface $con = null) |
||
1272 | |||
1273 | /** |
||
1274 | * Code to be run before deleting the object in database |
||
1275 | * @param ConnectionInterface $con |
||
1276 | * @return boolean |
||
1277 | */ |
||
1278 | public function preDelete(ConnectionInterface $con = null) |
||
1285 | |||
1286 | /** |
||
1287 | * Code to be run after deleting the object in database |
||
1288 | * @param ConnectionInterface $con |
||
1289 | */ |
||
1290 | public function postDelete(ConnectionInterface $con = null) |
||
1296 | |||
1297 | |||
1298 | /** |
||
1299 | * Derived method to catches calls to undefined methods. |
||
1300 | * |
||
1301 | * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). |
||
1302 | * Allows to define default __call() behavior if you overwrite __call() |
||
1303 | * |
||
1304 | * @param string $name |
||
1305 | * @param mixed $params |
||
1306 | * |
||
1307 | * @return array|string |
||
1308 | */ |
||
1309 | View Code Duplication | public function __call($name, $params) |
|
1338 | |||
1339 | } |
||
1340 |