/** * Do an optimized search of an element * * @param object $element * @return bool */ public function contains($element) { if ($this->isInitialized()) { return $this->collection->contains($element); } return $this->entityPersister->exists($element, $this->criteria); }