@@ 230-241 (lines=12) @@ | ||
227 | * На успешное сохранение |
|
228 | * @param \SimpleORM\EntityInterface $Entity |
|
229 | */ |
|
230 | protected function onSaveSuccess(EntityInterface $Entity){ |
|
231 | ||
232 | ||
233 | foreach ($this->relations as $alias => $mapper) { |
|
234 | $Entity = $Entity->{'get'.$alias}(); |
|
235 | if(!$mapper->save($Entity)){ |
|
236 | throw new \Autoprice\Exceptions\EntityNotSaveException('Unable to save Entity!'); |
|
237 | } |
|
238 | } |
|
239 | ||
240 | return true; |
|
241 | } |
|
242 | ||
243 | /** |
|
244 | * На успешное удаление |
|
@@ 247-256 (lines=10) @@ | ||
244 | * На успешное удаление |
|
245 | * @param \SimpleORM\EntityInterface $Entity |
|
246 | */ |
|
247 | protected function onDeleteSuccess(EntityInterface $Entity) { |
|
248 | foreach ($this->relations as $alias => $mapper) { |
|
249 | $Entity = $Entity->{'get'.$alias}(); |
|
250 | if(!$mapper->delete($Entity)){ |
|
251 | throw new \Autoprice\Exceptions\EntityNotDeleteException('Unable to delete Entity!'); |
|
252 | } |
|
253 | } |
|
254 | ||
255 | return true; |
|
256 | } |
|
257 | } |
|
258 |