Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| Entity | |
0.00% |
0 / 4 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
| isNew | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setNew | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| beforeSaveEvent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| afterSaveEvent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Dynart\Micro\Entities; |
| 4 | |
| 5 | abstract class Entity { |
| 6 | |
| 7 | const EVENT_BEFORE_SAVE = 'before_save'; |
| 8 | const EVENT_AFTER_SAVE = 'after_save'; |
| 9 | |
| 10 | private bool $__isNew = true; |
| 11 | |
| 12 | public function isNew(): bool { |
| 13 | return $this->__isNew; |
| 14 | } |
| 15 | |
| 16 | public function setNew(bool $value): void { |
| 17 | $this->__isNew = $value; |
| 18 | } |
| 19 | |
| 20 | public function beforeSaveEvent(): string { |
| 21 | return get_class($this).':'.self::EVENT_BEFORE_SAVE; |
| 22 | } |
| 23 | |
| 24 | public function afterSaveEvent(): string { |
| 25 | return get_class($this).':'.self::EVENT_AFTER_SAVE; |
| 26 | } |
| 27 | } |