1 | <?php |
||
28 | class EntityMapper implements EntityMapperInterface |
||
29 | { |
||
30 | /** |
||
31 | * @var EntityDescriptorInterface |
||
32 | */ |
||
33 | protected $descriptor; |
||
34 | |||
35 | /** |
||
36 | * @var EntityInterface |
||
37 | */ |
||
38 | protected $entity; |
||
39 | |||
40 | /** |
||
41 | * @var AdapterInterface |
||
42 | */ |
||
43 | protected $adapter; |
||
44 | |||
45 | /** |
||
46 | * Saves current entity object to database |
||
47 | * |
||
48 | * Optionally saves only the partial data if $data argument is passed. If |
||
49 | * no data is given al the field properties will be updated. |
||
50 | * |
||
51 | * @param array $data Partial data to save |
||
52 | * @param EntityInterface $entity |
||
53 | * |
||
54 | * @return self|$this|EntityMapperInterface |
||
55 | */ |
||
56 | 4 | public function save(EntityInterface $entity, array $data = []) |
|
64 | |||
65 | /** |
||
66 | * Get entity descriptor |
||
67 | * |
||
68 | * @return EntityDescriptorInterface |
||
69 | */ |
||
70 | 4 | public function getDescriptor() |
|
80 | |||
81 | /** |
||
82 | * Set entity descriptor |
||
83 | * |
||
84 | * @param EntityDescriptorInterface $descriptor |
||
85 | * |
||
86 | * @return $this|self|EntityMapper |
||
87 | */ |
||
88 | 4 | public function setDescriptor($descriptor) |
|
93 | |||
94 | /** |
||
95 | * Sets the adapter for this mapper |
||
96 | * |
||
97 | * @param AdapterInterface $adapter |
||
98 | * |
||
99 | * @return self|$this|EntityMapper |
||
100 | */ |
||
101 | 8 | public function setAdapter(AdapterInterface $adapter) |
|
106 | |||
107 | /** |
||
108 | * Retrieves the current adapter |
||
109 | * |
||
110 | * @return AdapterInterface |
||
111 | */ |
||
112 | 4 | public function getAdapter() |
|
116 | |||
117 | /** |
||
118 | * Creates the insert/update query for current entity state |
||
119 | * |
||
120 | * @return Sql\Insert|Sql\Update |
||
121 | */ |
||
122 | 4 | protected function getUpdateQuery() |
|
136 | |||
137 | /** |
||
138 | * Adds the update criteria for an update query |
||
139 | * |
||
140 | * @param Sql\Update $query |
||
141 | * @param string $primaryKey |
||
142 | * @param string $table |
||
143 | * |
||
144 | * @return Sql\Update |
||
145 | */ |
||
146 | 2 | protected function setUpdateCriteria( |
|
153 | |||
154 | /** |
||
155 | * Gets data to be used in queries |
||
156 | * |
||
157 | * @return array |
||
158 | */ |
||
159 | 4 | protected function getData() |
|
169 | |||
170 | /** |
||
171 | * Creates an entity object from provided data |
||
172 | * |
||
173 | * Data can be an array with single row fields or a RecordList from |
||
174 | * a query. |
||
175 | * |
||
176 | * @param array|RecordList $data |
||
177 | * |
||
178 | * @return EntityInterface|EntityMapperInterface[]|EntityCollection |
||
179 | */ |
||
180 | public function createFrom($data) |
||
187 | |||
188 | /** |
||
189 | * Creates an entity for provided row array |
||
190 | * |
||
191 | * @param array $source |
||
192 | * @return EntityInterface |
||
193 | */ |
||
194 | protected function createSingle(array $source) |
||
206 | |||
207 | /** |
||
208 | * Creates an entity collection for provided record list |
||
209 | * |
||
210 | * @param RecordList $source |
||
211 | * @return EntityCollection |
||
212 | */ |
||
213 | protected function createMultiple(RecordList $source) |
||
221 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: