public function replace(Entity $entity) { if (!$this->exists($entity->id())) { throw new NotExists("Entity" . $entity->id()->serialize() . " does not exist in this index."); } $this->index[$entity->id()->serialize()] = $entity; }
public function equals(Entity $other) { return $this->id === $other->id(); }