|
@@ 162-173 (lines=12) @@
|
| 159 |
|
* На успешное сохранение |
| 160 |
|
* @param \SimpleORM\EntityInterface $Entity |
| 161 |
|
*/ |
| 162 |
|
protected function onSaveSuccess(EntityInterface $Entity){ |
| 163 |
|
|
| 164 |
|
|
| 165 |
|
foreach ($this->relations as $alias => $mapper) { |
| 166 |
|
$Entity = $Entity->{'get'.$alias}(); |
| 167 |
|
if(!$mapper->save($Entity)){ |
| 168 |
|
throw new \Autoprice\Exceptions\EntityNotSaveException('Unable to save Entity!'); |
| 169 |
|
} |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
return true; |
| 173 |
|
} |
| 174 |
|
|
| 175 |
|
/** |
| 176 |
|
* На успешное удаление |
|
@@ 179-188 (lines=10) @@
|
| 176 |
|
* На успешное удаление |
| 177 |
|
* @param \SimpleORM\EntityInterface $Entity |
| 178 |
|
*/ |
| 179 |
|
protected function onDeleteSuccess(EntityInterface $Entity) { |
| 180 |
|
foreach ($this->relations as $alias => $mapper) { |
| 181 |
|
$Entity = $Entity->{'get'.$alias}(); |
| 182 |
|
if(!$mapper->delete($Entity)){ |
| 183 |
|
throw new \Autoprice\Exceptions\EntityNotDeleteException('Unable to delete Entity!'); |
| 184 |
|
} |
| 185 |
|
} |
| 186 |
|
|
| 187 |
|
return true; |
| 188 |
|
} |
| 189 |
|
|
| 190 |
|
|
| 191 |
|
|