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 Route 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 Route, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
39 | abstract class Route extends PropelBaseModelClass implements ActiveRecordInterface |
||
40 | { |
||
41 | /** |
||
42 | * TableMap class name |
||
43 | */ |
||
44 | const TABLE_MAP = '\\core\\models\\Map\\RouteTableMap'; |
||
45 | |||
46 | |||
47 | /** |
||
48 | * attribute to determine if this object has previously been saved. |
||
49 | * @var boolean |
||
50 | */ |
||
51 | protected $new = true; |
||
52 | |||
53 | /** |
||
54 | * attribute to determine whether this object has been deleted. |
||
55 | * @var boolean |
||
56 | */ |
||
57 | protected $deleted = false; |
||
58 | |||
59 | /** |
||
60 | * The columns that have been modified in current object. |
||
61 | * Tracking modified columns allows us to only update modified columns. |
||
62 | * @var array |
||
63 | */ |
||
64 | protected $modifiedColumns = array(); |
||
65 | |||
66 | /** |
||
67 | * The (virtual) columns that are added at runtime |
||
68 | * The formatters can add supplementary columns based on a resultset |
||
69 | * @var array |
||
70 | */ |
||
71 | protected $virtualColumns = array(); |
||
72 | |||
73 | /** |
||
74 | * The value for the id field. |
||
75 | * |
||
76 | * @var int |
||
77 | */ |
||
78 | protected $id; |
||
79 | |||
80 | /** |
||
81 | * The value for the entity_id field. |
||
82 | * |
||
83 | * @var int |
||
84 | */ |
||
85 | protected $entity_id; |
||
86 | |||
87 | /** |
||
88 | * The value for the type field. |
||
89 | * |
||
90 | * @var string |
||
91 | */ |
||
92 | protected $type; |
||
93 | |||
94 | /** |
||
95 | * The value for the parent_url field. |
||
96 | * |
||
97 | * Note: this column has a database default value of: '' |
||
98 | * @var string |
||
99 | */ |
||
100 | protected $parent_url; |
||
101 | |||
102 | /** |
||
103 | * The value for the url field. |
||
104 | * |
||
105 | * @var string |
||
106 | */ |
||
107 | protected $url; |
||
108 | |||
109 | /** |
||
110 | * @var ObjectCollection|SCategory[] Collection to store aggregation of SCategory objects. |
||
111 | */ |
||
112 | protected $collSCategories; |
||
113 | protected $collSCategoriesPartial; |
||
114 | |||
115 | /** |
||
116 | * @var ObjectCollection|SProducts[] Collection to store aggregation of SProducts objects. |
||
117 | */ |
||
118 | protected $collSProductss; |
||
119 | protected $collSProductssPartial; |
||
120 | |||
121 | /** |
||
122 | * Flag to prevent endless save loop, if this object is referenced |
||
123 | * by another object which falls in this transaction. |
||
124 | * |
||
125 | * @var boolean |
||
126 | */ |
||
127 | protected $alreadyInSave = false; |
||
128 | |||
129 | /** |
||
130 | * An array of objects scheduled for deletion. |
||
131 | * @var ObjectCollection|SCategory[] |
||
132 | */ |
||
133 | protected $sCategoriesScheduledForDeletion = null; |
||
134 | |||
135 | /** |
||
136 | * An array of objects scheduled for deletion. |
||
137 | * @var ObjectCollection|SProducts[] |
||
138 | */ |
||
139 | protected $sProductssScheduledForDeletion = null; |
||
140 | |||
141 | /** |
||
142 | * Applies default values to this object. |
||
143 | * This method should be called from the object's constructor (or |
||
144 | * equivalent initialization method). |
||
145 | * @see __construct() |
||
146 | */ |
||
147 | public function applyDefaultValues() |
||
151 | |||
152 | /** |
||
153 | * Initializes internal state of core\models\Base\Route object. |
||
154 | * @see applyDefaults() |
||
155 | */ |
||
156 | public function __construct() |
||
160 | |||
161 | /** |
||
162 | * Returns whether the object has been modified. |
||
163 | * |
||
164 | * @return boolean True if the object has been modified. |
||
165 | */ |
||
166 | public function isModified() |
||
170 | |||
171 | /** |
||
172 | * Has specified column been modified? |
||
173 | * |
||
174 | * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID |
||
175 | * @return boolean True if $col has been modified. |
||
176 | */ |
||
177 | public function isColumnModified($col) |
||
181 | |||
182 | /** |
||
183 | * Get the columns that have been modified in this object. |
||
184 | * @return array A unique list of the modified column names for this object. |
||
185 | */ |
||
186 | public function getModifiedColumns() |
||
190 | |||
191 | /** |
||
192 | * Returns whether the object has ever been saved. This will |
||
193 | * be false, if the object was retrieved from storage or was created |
||
194 | * and then saved. |
||
195 | * |
||
196 | * @return boolean true, if the object has never been persisted. |
||
197 | */ |
||
198 | public function isNew() |
||
202 | |||
203 | /** |
||
204 | * Setter for the isNew attribute. This method will be called |
||
205 | * by Propel-generated children and objects. |
||
206 | * |
||
207 | * @param boolean $b the state of the object. |
||
208 | */ |
||
209 | public function setNew($b) |
||
213 | |||
214 | /** |
||
215 | * Whether this object has been deleted. |
||
216 | * @return boolean The deleted state of this object. |
||
217 | */ |
||
218 | public function isDeleted() |
||
222 | |||
223 | /** |
||
224 | * Specify whether this object has been deleted. |
||
225 | * @param boolean $b The deleted state of this object. |
||
226 | * @return void |
||
227 | */ |
||
228 | public function setDeleted($b) |
||
232 | |||
233 | /** |
||
234 | * Sets the modified state for the object to be false. |
||
235 | * @param string $col If supplied, only the specified column is reset. |
||
236 | * @return void |
||
237 | */ |
||
238 | View Code Duplication | public function resetModified($col = null) |
|
248 | |||
249 | /** |
||
250 | * Compares this with another <code>Route</code> instance. If |
||
251 | * <code>obj</code> is an instance of <code>Route</code>, delegates to |
||
252 | * <code>equals(Route)</code>. Otherwise, returns <code>false</code>. |
||
253 | * |
||
254 | * @param mixed $obj The object to compare to. |
||
255 | * @return boolean Whether equal to the object specified. |
||
256 | */ |
||
257 | View Code Duplication | public function equals($obj) |
|
273 | |||
274 | /** |
||
275 | * Get the associative array of the virtual columns in this object |
||
276 | * |
||
277 | * @return array |
||
278 | */ |
||
279 | public function getVirtualColumns() |
||
283 | |||
284 | /** |
||
285 | * Checks the existence of a virtual column in this object |
||
286 | * |
||
287 | * @param string $name The virtual column name |
||
288 | * @return boolean |
||
289 | */ |
||
290 | public function hasVirtualColumn($name) |
||
294 | |||
295 | /** |
||
296 | * Get the value of a virtual column in this object |
||
297 | * |
||
298 | * @param string $name The virtual column name |
||
299 | * @return mixed |
||
300 | * |
||
301 | * @throws PropelException |
||
302 | */ |
||
303 | View Code Duplication | public function getVirtualColumn($name) |
|
311 | |||
312 | /** |
||
313 | * Set the value of a virtual column in this object |
||
314 | * |
||
315 | * @param string $name The virtual column name |
||
316 | * @param mixed $value The value to give to the virtual column |
||
317 | * |
||
318 | * @return $this|Route The current object, for fluid interface |
||
319 | */ |
||
320 | public function setVirtualColumn($name, $value) |
||
326 | |||
327 | /** |
||
328 | * Logs a message using Propel::log(). |
||
329 | * |
||
330 | * @param string $msg |
||
331 | * @param int $priority One of the Propel::LOG_* logging levels |
||
332 | * @return boolean |
||
|
|||
333 | */ |
||
334 | protected function log($msg, $priority = Propel::LOG_INFO) |
||
338 | |||
339 | /** |
||
340 | * Export the current object properties to a string, using a given parser format |
||
341 | * <code> |
||
342 | * $book = BookQuery::create()->findPk(9012); |
||
343 | * echo $book->exportTo('JSON'); |
||
344 | * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
345 | * </code> |
||
346 | * |
||
347 | * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
348 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. |
||
349 | * @return string The exported data |
||
350 | */ |
||
351 | View Code Duplication | public function exportTo($parser, $includeLazyLoadColumns = true) |
|
359 | |||
360 | /** |
||
361 | * Clean up internal collections prior to serializing |
||
362 | * Avoids recursive loops that turn into segmentation faults when serializing |
||
363 | */ |
||
364 | View Code Duplication | public function __sleep() |
|
378 | |||
379 | /** |
||
380 | * Get the [id] column value. |
||
381 | * |
||
382 | * @return int |
||
383 | */ |
||
384 | public function getId() |
||
388 | |||
389 | /** |
||
390 | * Get the [entity_id] column value. |
||
391 | * |
||
392 | * @return int |
||
393 | */ |
||
394 | public function getEntityId() |
||
398 | |||
399 | /** |
||
400 | * Get the [type] column value. |
||
401 | * |
||
402 | * @return string |
||
403 | */ |
||
404 | public function getType() |
||
408 | |||
409 | /** |
||
410 | * Get the [parent_url] column value. |
||
411 | * |
||
412 | * @return string |
||
413 | */ |
||
414 | public function getParentUrl() |
||
418 | |||
419 | /** |
||
420 | * Get the [url] column value. |
||
421 | * |
||
422 | * @return string |
||
423 | */ |
||
424 | public function getUrl() |
||
428 | |||
429 | /** |
||
430 | * Set the value of [id] column. |
||
431 | * |
||
432 | * @param int $v new value |
||
433 | * @return $this|\core\models\Route The current object (for fluent API support) |
||
434 | */ |
||
435 | public function setId($v) |
||
448 | |||
449 | /** |
||
450 | * Set the value of [entity_id] column. |
||
451 | * |
||
452 | * @param int $v new value |
||
453 | * @return $this|\core\models\Route The current object (for fluent API support) |
||
454 | */ |
||
455 | public function setEntityId($v) |
||
468 | |||
469 | /** |
||
470 | * Set the value of [type] column. |
||
471 | * |
||
472 | * @param string $v new value |
||
473 | * @return $this|\core\models\Route The current object (for fluent API support) |
||
474 | */ |
||
475 | public function setType($v) |
||
488 | |||
489 | /** |
||
490 | * Set the value of [parent_url] column. |
||
491 | * |
||
492 | * @param string $v new value |
||
493 | * @return $this|\core\models\Route The current object (for fluent API support) |
||
494 | */ |
||
495 | public function setParentUrl($v) |
||
508 | |||
509 | /** |
||
510 | * Set the value of [url] column. |
||
511 | * |
||
512 | * @param string $v new value |
||
513 | * @return $this|\core\models\Route The current object (for fluent API support) |
||
514 | */ |
||
515 | public function setUrl($v) |
||
528 | |||
529 | /** |
||
530 | * Indicates whether the columns in this object are only set to default values. |
||
531 | * |
||
532 | * This method can be used in conjunction with isModified() to indicate whether an object is both |
||
533 | * modified _and_ has some values set which are non-default. |
||
534 | * |
||
535 | * @return boolean Whether the columns in this object are only been set with default values. |
||
536 | */ |
||
537 | public function hasOnlyDefaultValues() |
||
546 | |||
547 | /** |
||
548 | * Hydrates (populates) the object variables with values from the database resultset. |
||
549 | * |
||
550 | * An offset (0-based "start column") is specified so that objects can be hydrated |
||
551 | * with a subset of the columns in the resultset rows. This is needed, for example, |
||
552 | * for results of JOIN queries where the resultset row includes columns from two or |
||
553 | * more tables. |
||
554 | * |
||
555 | * @param array $row The row returned by DataFetcher->fetch(). |
||
556 | * @param int $startcol 0-based offset column which indicates which restultset column to start with. |
||
557 | * @param boolean $rehydrate Whether this object is being re-hydrated from the database. |
||
558 | * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
||
559 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
560 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
561 | * |
||
562 | * @return int next starting column |
||
563 | * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. |
||
564 | */ |
||
565 | public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) |
||
597 | |||
598 | /** |
||
599 | * Checks and repairs the internal consistency of the object. |
||
600 | * |
||
601 | * This method is executed after an already-instantiated object is re-hydrated |
||
602 | * from the database. It exists to check any foreign keys to make sure that |
||
603 | * the objects related to the current object are correct based on foreign key. |
||
604 | * |
||
605 | * You can override this method in the stub class, but you should always invoke |
||
606 | * the base method from the overridden method (i.e. parent::ensureConsistency()), |
||
607 | * in case your model changes. |
||
608 | * |
||
609 | * @throws PropelException |
||
610 | */ |
||
611 | public function ensureConsistency() |
||
614 | |||
615 | /** |
||
616 | * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. |
||
617 | * |
||
618 | * This will only work if the object has been saved and has a valid primary key set. |
||
619 | * |
||
620 | * @param boolean $deep (optional) Whether to also de-associated any related objects. |
||
621 | * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. |
||
622 | * @return void |
||
623 | * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db |
||
624 | */ |
||
625 | View Code Duplication | public function reload($deep = false, ConnectionInterface $con = null) |
|
658 | |||
659 | /** |
||
660 | * Removes this object from datastore and sets delete attribute. |
||
661 | * |
||
662 | * @param ConnectionInterface $con |
||
663 | * @return void |
||
664 | * @throws PropelException |
||
665 | * @see Route::setDeleted() |
||
666 | * @see Route::isDeleted() |
||
667 | */ |
||
668 | View Code Duplication | public function delete(ConnectionInterface $con = null) |
|
689 | |||
690 | /** |
||
691 | * Persists this object to the database. |
||
692 | * |
||
693 | * If the object is new, it inserts it; otherwise an update is performed. |
||
694 | * All modified related objects will also be persisted in the doSave() |
||
695 | * method. This method wraps all precipitate database operations in a |
||
696 | * single transaction. |
||
697 | * |
||
698 | * @param ConnectionInterface $con |
||
699 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
700 | * @throws PropelException |
||
701 | * @see doSave() |
||
702 | */ |
||
703 | View Code Duplication | public function save(ConnectionInterface $con = null) |
|
741 | |||
742 | /** |
||
743 | * Performs the work of inserting or updating the row in the database. |
||
744 | * |
||
745 | * If the object is new, it inserts it; otherwise an update is performed. |
||
746 | * All related objects are also updated in this method. |
||
747 | * |
||
748 | * @param ConnectionInterface $con |
||
749 | * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. |
||
750 | * @throws PropelException |
||
751 | * @see save() |
||
752 | */ |
||
753 | View Code Duplication | protected function doSave(ConnectionInterface $con) |
|
810 | |||
811 | /** |
||
812 | * Insert the row in the database. |
||
813 | * |
||
814 | * @param ConnectionInterface $con |
||
815 | * |
||
816 | * @throws PropelException |
||
817 | * @see doSave() |
||
818 | */ |
||
819 | protected function doInsert(ConnectionInterface $con) |
||
888 | |||
889 | /** |
||
890 | * Update the row in the database. |
||
891 | * |
||
892 | * @param ConnectionInterface $con |
||
893 | * |
||
894 | * @return Integer Number of updated rows |
||
895 | * @see doSave() |
||
896 | */ |
||
897 | protected function doUpdate(ConnectionInterface $con) |
||
904 | |||
905 | /** |
||
906 | * Retrieves a field from the object by name passed in as a string. |
||
907 | * |
||
908 | * @param string $name name |
||
909 | * @param string $type The type of fieldname the $name is of: |
||
910 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
911 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
912 | * Defaults to TableMap::TYPE_PHPNAME. |
||
913 | * @return mixed Value of field. |
||
914 | */ |
||
915 | View Code Duplication | public function getByName($name, $type = TableMap::TYPE_PHPNAME) |
|
922 | |||
923 | /** |
||
924 | * Retrieves a field from the object by Position as specified in the xml schema. |
||
925 | * Zero-based. |
||
926 | * |
||
927 | * @param int $pos position in xml schema |
||
928 | * @return mixed Value of field at $pos |
||
929 | */ |
||
930 | public function getByPosition($pos) |
||
953 | |||
954 | /** |
||
955 | * Exports the object as an array. |
||
956 | * |
||
957 | * You can specify the key type of the array by passing one of the class |
||
958 | * type constants. |
||
959 | * |
||
960 | * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
961 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
962 | * Defaults to TableMap::TYPE_PHPNAME. |
||
963 | * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. |
||
964 | * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion |
||
965 | * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. |
||
966 | * |
||
967 | * @return array an associative array containing the field names (as keys) and field values |
||
968 | */ |
||
969 | View Code Duplication | public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) |
|
1024 | |||
1025 | /** |
||
1026 | * Sets a field from the object by name passed in as a string. |
||
1027 | * |
||
1028 | * @param string $name |
||
1029 | * @param mixed $value field value |
||
1030 | * @param string $type The type of fieldname the $name is of: |
||
1031 | * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
||
1032 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
1033 | * Defaults to TableMap::TYPE_PHPNAME. |
||
1034 | * @return $this|\core\models\Route |
||
1035 | */ |
||
1036 | public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) |
||
1042 | |||
1043 | /** |
||
1044 | * Sets a field from the object by Position as specified in the xml schema. |
||
1045 | * Zero-based. |
||
1046 | * |
||
1047 | * @param int $pos position in xml schema |
||
1048 | * @param mixed $value field value |
||
1049 | * @return $this|\core\models\Route |
||
1050 | */ |
||
1051 | public function setByPosition($pos, $value) |
||
1073 | |||
1074 | /** |
||
1075 | * Populates the object using an array. |
||
1076 | * |
||
1077 | * This is particularly useful when populating an object from one of the |
||
1078 | * request arrays (e.g. $_POST). This method goes through the column |
||
1079 | * names, checking to see whether a matching key exists in populated |
||
1080 | * array. If so the setByName() method is called for that column. |
||
1081 | * |
||
1082 | * You can specify the key type of the array by additionally passing one |
||
1083 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
1084 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
1085 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
1086 | * |
||
1087 | * @param array $arr An array to populate the object from. |
||
1088 | * @param string $keyType The type of keys the array uses. |
||
1089 | * @return void |
||
1090 | */ |
||
1091 | public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) |
||
1111 | |||
1112 | /** |
||
1113 | * Populate the current object from a string, using a given parser format |
||
1114 | * <code> |
||
1115 | * $book = new Book(); |
||
1116 | * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); |
||
1117 | * </code> |
||
1118 | * |
||
1119 | * You can specify the key type of the array by additionally passing one |
||
1120 | * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME, |
||
1121 | * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
||
1122 | * The default key type is the column's TableMap::TYPE_PHPNAME. |
||
1123 | * |
||
1124 | * @param mixed $parser A AbstractParser instance, |
||
1125 | * or a format name ('XML', 'YAML', 'JSON', 'CSV') |
||
1126 | * @param string $data The source data to import from |
||
1127 | * @param string $keyType The type of keys the array uses. |
||
1128 | * |
||
1129 | * @return $this|\core\models\Route The current object, for fluid interface |
||
1130 | */ |
||
1131 | View Code Duplication | public function importFrom($parser, $data, $keyType = TableMap::TYPE_PHPNAME) |
|
1141 | |||
1142 | /** |
||
1143 | * Build a Criteria object containing the values of all modified columns in this object. |
||
1144 | * |
||
1145 | * @return Criteria The Criteria object containing all modified values. |
||
1146 | */ |
||
1147 | public function buildCriteria() |
||
1169 | |||
1170 | /** |
||
1171 | * Builds a Criteria object containing the primary key for this object. |
||
1172 | * |
||
1173 | * Unlike buildCriteria() this method includes the primary key values regardless |
||
1174 | * of whether or not they have been modified. |
||
1175 | * |
||
1176 | * @throws LogicException if no primary key is defined |
||
1177 | * |
||
1178 | * @return Criteria The Criteria object containing value(s) for primary key(s). |
||
1179 | */ |
||
1180 | public function buildPkeyCriteria() |
||
1187 | |||
1188 | /** |
||
1189 | * If the primary key is not null, return the hashcode of the |
||
1190 | * primary key. Otherwise, return the hash code of the object. |
||
1191 | * |
||
1192 | * @return int Hashcode |
||
1193 | */ |
||
1194 | View Code Duplication | public function hashCode() |
|
1209 | |||
1210 | /** |
||
1211 | * Returns the primary key for this object (row). |
||
1212 | * @return int |
||
1213 | */ |
||
1214 | public function getPrimaryKey() |
||
1218 | |||
1219 | /** |
||
1220 | * Generic method to set the primary key (id column). |
||
1221 | * |
||
1222 | * @param int $key Primary key. |
||
1223 | * @return void |
||
1224 | */ |
||
1225 | public function setPrimaryKey($key) |
||
1229 | |||
1230 | /** |
||
1231 | * Returns true if the primary key for this object is null. |
||
1232 | * @return boolean |
||
1233 | */ |
||
1234 | public function isPrimaryKeyNull() |
||
1238 | |||
1239 | /** |
||
1240 | * Sets contents of passed object to values from current object. |
||
1241 | * |
||
1242 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
1243 | * objects. |
||
1244 | * |
||
1245 | * @param object $copyObj An object of \core\models\Route (or compatible) type. |
||
1246 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
1247 | * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. |
||
1248 | * @throws PropelException |
||
1249 | */ |
||
1250 | public function copyInto($copyObj, $deepCopy = false, $makeNew = true) |
||
1281 | |||
1282 | /** |
||
1283 | * Makes a copy of this object that will be inserted as a new row in table when saved. |
||
1284 | * It creates a new object filling in the simple attributes, but skipping any primary |
||
1285 | * keys that are defined for the table. |
||
1286 | * |
||
1287 | * If desired, this method can also make copies of all associated (fkey referrers) |
||
1288 | * objects. |
||
1289 | * |
||
1290 | * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. |
||
1291 | * @return \core\models\Route Clone of current object. |
||
1292 | * @throws PropelException |
||
1293 | */ |
||
1294 | View Code Duplication | public function copy($deepCopy = false) |
|
1303 | |||
1304 | |||
1305 | /** |
||
1306 | * Initializes a collection based on the name of a relation. |
||
1307 | * Avoids crafting an 'init[$relationName]s' method name |
||
1308 | * that wouldn't work when StandardEnglishPluralizer is used. |
||
1309 | * |
||
1310 | * @param string $relationName The name of the relation to initialize |
||
1311 | * @return void |
||
1312 | */ |
||
1313 | public function initRelation($relationName) |
||
1322 | |||
1323 | /** |
||
1324 | * Clears out the collSCategories collection |
||
1325 | * |
||
1326 | * This does not modify the database; however, it will remove any associated objects, causing |
||
1327 | * them to be refetched by subsequent calls to accessor method. |
||
1328 | * |
||
1329 | * @return void |
||
1330 | * @see addSCategories() |
||
1331 | */ |
||
1332 | public function clearSCategories() |
||
1336 | |||
1337 | /** |
||
1338 | * Reset is the collSCategories collection loaded partially. |
||
1339 | */ |
||
1340 | public function resetPartialSCategories($v = true) |
||
1344 | |||
1345 | /** |
||
1346 | * Initializes the collSCategories collection. |
||
1347 | * |
||
1348 | * By default this just sets the collSCategories collection to an empty array (like clearcollSCategories()); |
||
1349 | * however, you may wish to override this method in your stub class to provide setting appropriate |
||
1350 | * to your application -- for example, setting the initial array to the values stored in database. |
||
1351 | * |
||
1352 | * @param boolean $overrideExisting If set to true, the method call initializes |
||
1353 | * the collection even if it is not empty |
||
1354 | * |
||
1355 | * @return void |
||
1356 | */ |
||
1357 | View Code Duplication | public function initSCategories($overrideExisting = true) |
|
1368 | |||
1369 | /** |
||
1370 | * Gets an array of SCategory objects which contain a foreign key that references this object. |
||
1371 | * |
||
1372 | * If the $criteria is not null, it is used to always fetch the results from the database. |
||
1373 | * Otherwise the results are fetched from the database the first time, then cached. |
||
1374 | * Next time the same method is called without $criteria, the cached collection is returned. |
||
1375 | * If this ChildRoute is new, it will return |
||
1376 | * an empty collection or the current collection; the criteria is ignored on a new object. |
||
1377 | * |
||
1378 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
1379 | * @param ConnectionInterface $con optional connection object |
||
1380 | * @return ObjectCollection|SCategory[] List of SCategory objects |
||
1381 | * @throws PropelException |
||
1382 | */ |
||
1383 | View Code Duplication | public function getSCategories(Criteria $criteria = null, ConnectionInterface $con = null) |
|
1426 | |||
1427 | /** |
||
1428 | * Sets a collection of SCategory objects related by a one-to-many relationship |
||
1429 | * to the current object. |
||
1430 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted) |
||
1431 | * and new objects from the given Propel collection. |
||
1432 | * |
||
1433 | * @param Collection $sCategories A Propel collection. |
||
1434 | * @param ConnectionInterface $con Optional connection object |
||
1435 | * @return $this|ChildRoute The current object (for fluent API support) |
||
1436 | */ |
||
1437 | View Code Duplication | public function setSCategories(Collection $sCategories, ConnectionInterface $con = null) |
|
1459 | |||
1460 | /** |
||
1461 | * Returns the number of related BaseSCategory objects. |
||
1462 | * |
||
1463 | * @param Criteria $criteria |
||
1464 | * @param boolean $distinct |
||
1465 | * @param ConnectionInterface $con |
||
1466 | * @return int Count of related BaseSCategory objects. |
||
1467 | * @throws PropelException |
||
1468 | */ |
||
1469 | View Code Duplication | public function countSCategories(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) |
|
1493 | |||
1494 | /** |
||
1495 | * Method called to associate a SCategory object to this object |
||
1496 | * through the SCategory foreign key attribute. |
||
1497 | * |
||
1498 | * @param SCategory $l SCategory |
||
1499 | * @return $this|\core\models\Route The current object (for fluent API support) |
||
1500 | */ |
||
1501 | public function addSCategory(SCategory $l) |
||
1518 | |||
1519 | /** |
||
1520 | * @param SCategory $sCategory The SCategory object to add. |
||
1521 | */ |
||
1522 | protected function doAddSCategory(SCategory $sCategory) |
||
1527 | |||
1528 | /** |
||
1529 | * @param SCategory $sCategory The SCategory object to remove. |
||
1530 | * @return $this|ChildRoute The current object (for fluent API support) |
||
1531 | */ |
||
1532 | View Code Duplication | public function removeSCategory(SCategory $sCategory) |
|
1547 | |||
1548 | |||
1549 | /** |
||
1550 | * If this collection has already been initialized with |
||
1551 | * an identical criteria, it returns the collection. |
||
1552 | * Otherwise if this Route is new, it will return |
||
1553 | * an empty collection; or if this Route has previously |
||
1554 | * been saved, it will retrieve related SCategories from storage. |
||
1555 | * |
||
1556 | * This method is protected by default in order to keep the public |
||
1557 | * api reasonable. You can provide public methods for those you |
||
1558 | * actually need in Route. |
||
1559 | * |
||
1560 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
1561 | * @param ConnectionInterface $con optional connection object |
||
1562 | * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
||
1563 | * @return ObjectCollection|SCategory[] List of SCategory objects |
||
1564 | */ |
||
1565 | View Code Duplication | public function getSCategoriesJoinSCategory(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
1572 | |||
1573 | /** |
||
1574 | * Clears out the collSProductss collection |
||
1575 | * |
||
1576 | * This does not modify the database; however, it will remove any associated objects, causing |
||
1577 | * them to be refetched by subsequent calls to accessor method. |
||
1578 | * |
||
1579 | * @return void |
||
1580 | * @see addSProductss() |
||
1581 | */ |
||
1582 | public function clearSProductss() |
||
1586 | |||
1587 | /** |
||
1588 | * Reset is the collSProductss collection loaded partially. |
||
1589 | */ |
||
1590 | public function resetPartialSProductss($v = true) |
||
1594 | |||
1595 | /** |
||
1596 | * Initializes the collSProductss collection. |
||
1597 | * |
||
1598 | * By default this just sets the collSProductss collection to an empty array (like clearcollSProductss()); |
||
1599 | * however, you may wish to override this method in your stub class to provide setting appropriate |
||
1600 | * to your application -- for example, setting the initial array to the values stored in database. |
||
1601 | * |
||
1602 | * @param boolean $overrideExisting If set to true, the method call initializes |
||
1603 | * the collection even if it is not empty |
||
1604 | * |
||
1605 | * @return void |
||
1606 | */ |
||
1607 | View Code Duplication | public function initSProductss($overrideExisting = true) |
|
1618 | |||
1619 | /** |
||
1620 | * Gets an array of SProducts objects which contain a foreign key that references this object. |
||
1621 | * |
||
1622 | * If the $criteria is not null, it is used to always fetch the results from the database. |
||
1623 | * Otherwise the results are fetched from the database the first time, then cached. |
||
1624 | * Next time the same method is called without $criteria, the cached collection is returned. |
||
1625 | * If this ChildRoute is new, it will return |
||
1626 | * an empty collection or the current collection; the criteria is ignored on a new object. |
||
1627 | * |
||
1628 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
1629 | * @param ConnectionInterface $con optional connection object |
||
1630 | * @return ObjectCollection|SProducts[] List of SProducts objects |
||
1631 | * @throws PropelException |
||
1632 | */ |
||
1633 | View Code Duplication | public function getSProductss(Criteria $criteria = null, ConnectionInterface $con = null) |
|
1676 | |||
1677 | /** |
||
1678 | * Sets a collection of SProducts objects related by a one-to-many relationship |
||
1679 | * to the current object. |
||
1680 | * It will also schedule objects for deletion based on a diff between old objects (aka persisted) |
||
1681 | * and new objects from the given Propel collection. |
||
1682 | * |
||
1683 | * @param Collection $sProductss A Propel collection. |
||
1684 | * @param ConnectionInterface $con Optional connection object |
||
1685 | * @return $this|ChildRoute The current object (for fluent API support) |
||
1686 | */ |
||
1687 | View Code Duplication | public function setSProductss(Collection $sProductss, ConnectionInterface $con = null) |
|
1709 | |||
1710 | /** |
||
1711 | * Returns the number of related BaseSProducts objects. |
||
1712 | * |
||
1713 | * @param Criteria $criteria |
||
1714 | * @param boolean $distinct |
||
1715 | * @param ConnectionInterface $con |
||
1716 | * @return int Count of related BaseSProducts objects. |
||
1717 | * @throws PropelException |
||
1718 | */ |
||
1719 | View Code Duplication | public function countSProductss(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) |
|
1743 | |||
1744 | /** |
||
1745 | * Method called to associate a SProducts object to this object |
||
1746 | * through the SProducts foreign key attribute. |
||
1747 | * |
||
1748 | * @param SProducts $l SProducts |
||
1749 | * @return $this|\core\models\Route The current object (for fluent API support) |
||
1750 | */ |
||
1751 | public function addSProducts(SProducts $l) |
||
1768 | |||
1769 | /** |
||
1770 | * @param SProducts $sProducts The SProducts object to add. |
||
1771 | */ |
||
1772 | protected function doAddSProducts(SProducts $sProducts) |
||
1777 | |||
1778 | /** |
||
1779 | * @param SProducts $sProducts The SProducts object to remove. |
||
1780 | * @return $this|ChildRoute The current object (for fluent API support) |
||
1781 | */ |
||
1782 | View Code Duplication | public function removeSProducts(SProducts $sProducts) |
|
1797 | |||
1798 | |||
1799 | /** |
||
1800 | * If this collection has already been initialized with |
||
1801 | * an identical criteria, it returns the collection. |
||
1802 | * Otherwise if this Route is new, it will return |
||
1803 | * an empty collection; or if this Route has previously |
||
1804 | * been saved, it will retrieve related SProductss from storage. |
||
1805 | * |
||
1806 | * This method is protected by default in order to keep the public |
||
1807 | * api reasonable. You can provide public methods for those you |
||
1808 | * actually need in Route. |
||
1809 | * |
||
1810 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
1811 | * @param ConnectionInterface $con optional connection object |
||
1812 | * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
||
1813 | * @return ObjectCollection|SProducts[] List of SProducts objects |
||
1814 | */ |
||
1815 | View Code Duplication | public function getSProductssJoinBrand(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
1822 | |||
1823 | |||
1824 | /** |
||
1825 | * If this collection has already been initialized with |
||
1826 | * an identical criteria, it returns the collection. |
||
1827 | * Otherwise if this Route is new, it will return |
||
1828 | * an empty collection; or if this Route has previously |
||
1829 | * been saved, it will retrieve related SProductss from storage. |
||
1830 | * |
||
1831 | * This method is protected by default in order to keep the public |
||
1832 | * api reasonable. You can provide public methods for those you |
||
1833 | * actually need in Route. |
||
1834 | * |
||
1835 | * @param Criteria $criteria optional Criteria object to narrow the query |
||
1836 | * @param ConnectionInterface $con optional connection object |
||
1837 | * @param string $joinBehavior optional join type to use (defaults to Criteria::LEFT_JOIN) |
||
1838 | * @return ObjectCollection|SProducts[] List of SProducts objects |
||
1839 | */ |
||
1840 | View Code Duplication | public function getSProductssJoinMainCategory(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) |
|
1847 | |||
1848 | /** |
||
1849 | * Clears the current object, sets all attributes to their default values and removes |
||
1850 | * outgoing references as well as back-references (from other objects to this one. Results probably in a database |
||
1851 | * change of those foreign objects when you call `save` there). |
||
1852 | */ |
||
1853 | View Code Duplication | public function clear() |
|
1867 | |||
1868 | /** |
||
1869 | * Resets all references and back-references to other model objects or collections of model objects. |
||
1870 | * |
||
1871 | * This method is used to reset all php object references (not the actual reference in the database). |
||
1872 | * Necessary for object serialisation. |
||
1873 | * |
||
1874 | * @param boolean $deep Whether to also clear the references on all referrer objects. |
||
1875 | */ |
||
1876 | public function clearAllReferences($deep = false) |
||
1894 | |||
1895 | /** |
||
1896 | * Return the string representation of this object |
||
1897 | * |
||
1898 | * @return string |
||
1899 | */ |
||
1900 | public function __toString() |
||
1904 | |||
1905 | /** |
||
1906 | * Code to be run before persisting the object |
||
1907 | * @param ConnectionInterface $con |
||
1908 | * @return boolean |
||
1909 | */ |
||
1910 | public function preSave(ConnectionInterface $con = null) |
||
1917 | |||
1918 | /** |
||
1919 | * Code to be run after persisting the object |
||
1920 | * @param ConnectionInterface $con |
||
1921 | */ |
||
1922 | public function postSave(ConnectionInterface $con = null) |
||
1928 | |||
1929 | /** |
||
1930 | * Code to be run before inserting to database |
||
1931 | * @param ConnectionInterface $con |
||
1932 | * @return boolean |
||
1933 | */ |
||
1934 | public function preInsert(ConnectionInterface $con = null) |
||
1941 | |||
1942 | /** |
||
1943 | * Code to be run after inserting to database |
||
1944 | * @param ConnectionInterface $con |
||
1945 | */ |
||
1946 | public function postInsert(ConnectionInterface $con = null) |
||
1952 | |||
1953 | /** |
||
1954 | * Code to be run before updating the object in database |
||
1955 | * @param ConnectionInterface $con |
||
1956 | * @return boolean |
||
1957 | */ |
||
1958 | public function preUpdate(ConnectionInterface $con = null) |
||
1965 | |||
1966 | /** |
||
1967 | * Code to be run after updating the object in database |
||
1968 | * @param ConnectionInterface $con |
||
1969 | */ |
||
1970 | public function postUpdate(ConnectionInterface $con = null) |
||
1976 | |||
1977 | /** |
||
1978 | * Code to be run before deleting the object in database |
||
1979 | * @param ConnectionInterface $con |
||
1980 | * @return boolean |
||
1981 | */ |
||
1982 | public function preDelete(ConnectionInterface $con = null) |
||
1989 | |||
1990 | /** |
||
1991 | * Code to be run after deleting the object in database |
||
1992 | * @param ConnectionInterface $con |
||
1993 | */ |
||
1994 | public function postDelete(ConnectionInterface $con = null) |
||
2000 | |||
2001 | |||
2002 | /** |
||
2003 | * Derived method to catches calls to undefined methods. |
||
2004 | * |
||
2005 | * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). |
||
2006 | * Allows to define default __call() behavior if you overwrite __call() |
||
2007 | * |
||
2008 | * @param string $name |
||
2009 | * @param mixed $params |
||
2010 | * |
||
2011 | * @return array|string |
||
2012 | */ |
||
2013 | View Code Duplication | public function __call($name, $params) |
|
2042 | |||
2043 | } |
||
2044 |
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.