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