@@ 207-218 (lines=12) @@ | ||
204 | * На успешное сохранение |
|
205 | * @param \SimpleORM\EntityInterface $Entity |
|
206 | */ |
|
207 | protected function onSaveSuccess(EntityInterface $Entity){ |
|
208 | ||
209 | ||
210 | foreach ($this->relations as $alias => $mapper) { |
|
211 | $Entity = $Entity->{'get'.$alias}(); |
|
212 | if(!$mapper->save($Entity)){ |
|
213 | throw new \Autoprice\Exceptions\EntityNotSaveException('Unable to save Entity!'); |
|
214 | } |
|
215 | } |
|
216 | ||
217 | return true; |
|
218 | } |
|
219 | ||
220 | /** |
|
221 | * На успешное удаление |
|
@@ 224-233 (lines=10) @@ | ||
221 | * На успешное удаление |
|
222 | * @param \SimpleORM\EntityInterface $Entity |
|
223 | */ |
|
224 | protected function onDeleteSuccess(EntityInterface $Entity) { |
|
225 | foreach ($this->relations as $alias => $mapper) { |
|
226 | $Entity = $Entity->{'get'.$alias}(); |
|
227 | if(!$mapper->delete($Entity)){ |
|
228 | throw new \Autoprice\Exceptions\EntityNotDeleteException('Unable to delete Entity!'); |
|
229 | } |
|
230 | } |
|
231 | ||
232 | return true; |
|
233 | } |
|
234 | } |
|
235 |