| @@ 33-53 (lines=21) @@ | ||
| 30 | $this->type = $type; |
|
| 31 | } |
|
| 32 | ||
| 33 | public function ForgetDaftObject( |
|
| 34 | DefinesOwnIdPropertiesInterface $object |
|
| 35 | ) : void { |
|
| 36 | if (false === is_a($object, $this->type, true)) { |
|
| 37 | throw new DaftObjectRepositoryTypeByClassMethodAndTypeException( |
|
| 38 | 1, |
|
| 39 | static::class, |
|
| 40 | __FUNCTION__, |
|
| 41 | $this->type, |
|
| 42 | get_class($object) |
|
| 43 | ); |
|
| 44 | } |
|
| 45 | ||
| 46 | $id = []; |
|
| 47 | ||
| 48 | foreach ($object::DaftObjectIdProperties() as $prop) { |
|
| 49 | $id[] = $object->$prop; |
|
| 50 | } |
|
| 51 | ||
| 52 | $this->ForgetDaftObjectById($id); |
|
| 53 | } |
|
| 54 | ||
| 55 | public function RemoveDaftObject( |
|
| 56 | DefinesOwnIdPropertiesInterface $object |
|
| @@ 55-75 (lines=21) @@ | ||
| 52 | $this->ForgetDaftObjectById($id); |
|
| 53 | } |
|
| 54 | ||
| 55 | public function RemoveDaftObject( |
|
| 56 | DefinesOwnIdPropertiesInterface $object |
|
| 57 | ) : void { |
|
| 58 | if (false === is_a($object, $this->type, true)) { |
|
| 59 | throw new DaftObjectRepositoryTypeByClassMethodAndTypeException( |
|
| 60 | 1, |
|
| 61 | static::class, |
|
| 62 | __FUNCTION__, |
|
| 63 | $this->type, |
|
| 64 | get_class($object) |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | ||
| 68 | $id = []; |
|
| 69 | ||
| 70 | foreach ($object::DaftObjectIdProperties() as $prop) { |
|
| 71 | $id[] = $object->$prop; |
|
| 72 | } |
|
| 73 | ||
| 74 | $this->RemoveDaftObjectById($id); |
|
| 75 | } |
|
| 76 | ||
| 77 | public static function DaftObjectRepositoryByType( |
|
| 78 | string $type |
|