File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,28 @@ public function get(
5858 }
5959
6060
61+ public function remove (
62+ \Spameri \Elastic \Entity \AbstractElasticEntity $ entity ,
63+ ): void
64+ {
65+ if ($ entity ->id instanceof \Spameri \Elastic \Entity \Property \EmptyElasticId) {
66+ return ;
67+ }
68+
69+ unset($ this ->identityMap [$ entity ::class][$ entity ->id ()->value ()]);
70+ unset($ this ->persisted [$ entity ::class][$ entity ->id ()->value ()]);
71+
72+ /** @var string|false $parentClass */
73+ $ parentClass = \get_parent_class ($ entity );
74+ if (
75+ \is_string ($ parentClass ) === true
76+ && $ parentClass !== \Spameri \Elastic \Entity \AbstractElasticEntity::class
77+ ) {
78+ unset($ this ->identityMap [$ parentClass ][$ entity ->id ()->value ()]);
79+ }
80+ }
81+
82+
6183 public function markInserted (
6284 \Spameri \Elastic \Entity \AbstractElasticEntity $ entity ,
6385 ): void
You can’t perform that action at this time.
0 commit comments