public function remove(Entity $entity) { $entityKey = array_search($entity, $this->entities); if ($entityKey !== false) { $this->splice($this->entities, $entityKey, 1); } $entityIdKey = array_search($entity->getId(), $this->listEntityId); if ($entityIdKey !== false) { $this->splice($this->listEntityId, $entityIdKey, 1); } $entityLoadedKey = array_search($entity->getId(), $this->loadedListEntityId); if ($entityLoadedKey !== false) { $this->splice($this->loadedListEntityId, $entityLoadedKey, 1); } $this->mapper->updateAggregate($this); }