| 1 | <?php |
||
| 22 | abstract class Entity extends Base implements EntityInterface |
||
| 23 | { |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Saves current entity state |
||
| 27 | * |
||
| 28 | * Optionally saves only the partial data if $data argument is passed. If |
||
| 29 | * no data is given al the field properties will be updated. |
||
| 30 | * |
||
| 31 | * @param array $data Partial data to save |
||
| 32 | * |
||
| 33 | * @return mixed |
||
| 34 | */ |
||
| 35 | 2 | public function save(array $data = []) |
|
| 41 | |||
| 42 | /** |
||
| 43 | * Deletes current entity from its storage |
||
| 44 | * |
||
| 45 | * @return self|$this|EntityInterface |
||
| 46 | */ |
||
| 47 | 2 | public function delete() |
|
| 48 | { |
||
| 49 | 2 | return $this->getMapper() |
|
| 50 | 2 | ->delete($this); |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Retrieves the data mapper for this entity |
||
| 55 | */ |
||
| 56 | 2 | public function getMapper() |
|
| 60 | |||
| 61 | } |