1 | <?php |
||
50 | abstract class AbstractManyRelation extends AbstractRelation implements |
||
51 | \ArrayAccess, \Countable |
||
52 | { |
||
53 | /** |
||
54 | * Name of the column to be used as the index for this relation's entities |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | protected $reference; |
||
59 | |||
60 | /** |
||
61 | * Name of the column to use for sorting this relation's entities |
||
62 | * |
||
63 | * @var array |
||
64 | */ |
||
65 | protected $orderBy; |
||
66 | |||
67 | /** |
||
68 | * Test if an entity is present in this relation. |
||
69 | * Triggers a fetch if the relation is FETCH_LAZY |
||
70 | * |
||
71 | * @param string|integer $offset The index key |
||
72 | * |
||
73 | * @return boolean |
||
74 | */ |
||
75 | public function offsetExists($offset) |
||
82 | |||
83 | /** |
||
84 | * Returns the entity at the given index (reference) if any, or null. |
||
85 | * Triggers a fetch if the relation is FETCH_LAZY |
||
86 | * |
||
87 | * @param string|integer $offset The index key |
||
88 | * |
||
89 | * @return object|null |
||
90 | */ |
||
91 | public function offsetGet($offset) |
||
98 | |||
99 | /** |
||
100 | * Adds an entity to this relation at the given index |
||
101 | * |
||
102 | * @param string|integer $offset The index key |
||
103 | * @param object $value The entity |
||
104 | * |
||
105 | * @return RelationInterface|void |
||
106 | */ |
||
107 | public function offsetSet($offset, $value) |
||
113 | |||
114 | /** |
||
115 | * Removes an entity at the given index |
||
116 | * Triggers a fetch if the relation is FETCH_LAZY |
||
117 | * |
||
118 | * @param string|integer $offset The index key |
||
119 | * |
||
120 | * @return void |
||
121 | */ |
||
122 | public function offsetUnset($offset) |
||
133 | |||
134 | /** |
||
135 | * Count entities in this relation. |
||
136 | * Triggers a fetch if the relation is FETCH_LAZY |
||
137 | * |
||
138 | * @return int |
||
139 | */ |
||
140 | public function count() |
||
146 | |||
147 | /** |
||
148 | * Defines the column to use as index for this relation's entities |
||
149 | * |
||
150 | * @param string $column The column's name |
||
151 | * |
||
152 | * @return RelationInterface |
||
153 | */ |
||
154 | public function setReference($column) |
||
160 | |||
161 | /** |
||
162 | * Defines the column to use to sort entities in this relation |
||
163 | * |
||
164 | * @param string $column The column's name |
||
165 | * @param string $direction The direction (asc or desc) |
||
166 | * |
||
167 | * @return RelationInterface |
||
168 | */ |
||
169 | public function setOrderBy($column, $direction = null) |
||
175 | |||
176 | /** |
||
177 | * Returns the column used as reference (index) |
||
178 | * |
||
179 | * @return string |
||
180 | */ |
||
181 | public function getReference() |
||
185 | |||
186 | /** |
||
187 | * Returns the orderBy for this relation |
||
188 | * |
||
189 | * @return array |
||
190 | */ |
||
191 | public function getOrderBy() |
||
195 | |||
196 | /** |
||
197 | * Adds an entity to the collection |
||
198 | * |
||
199 | * @param object $object The entity |
||
200 | * @param array $identifiers List of identifiers (PK) for this entity |
||
201 | * |
||
202 | * @return void |
||
203 | */ |
||
204 | public function add($object, array $identifiers = array()) |
||
224 | |||
225 | /** |
||
226 | * Adds a set of objects to this relation |
||
227 | * |
||
228 | * @param array $objects List of entities |
||
229 | * |
||
230 | * @return RelationInterface |
||
231 | */ |
||
232 | public function addAll(array $objects) |
||
240 | |||
241 | /** |
||
242 | * Returns an array of all entities in this relation |
||
243 | * |
||
244 | * @return array |
||
245 | */ |
||
246 | public function toArray() |
||
268 | } |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.