/** * {@inheritdoc} */ public function __call($method, $arguments) { if ($this->enableDeleted) { $this->entityManager->getFilters()->disable('cdsrc.libraries.softdeletable.filter'); } $result = parent::__call($method, $arguments); $this->enableDeleted = false; $this->entityManager->getFilters()->enable('cdsrc.libraries.softdeletable.filter'); return $result; }
/** * Retrieves a FilterCollection instance from the given ObjectManager. * * @param \Doctrine\Common\Persistence\ObjectManager $om * @throws \Gedmo\Exception\InvalidArgumentException * @return mixed */ private function getFilterCollectionFromObjectManager(ObjectManager $om) { if (is_callable(array($om, 'getFilters'))) { return $om->getFilters(); } else { if (is_callable(array($om, 'getFilterCollection'))) { return $om->getFilterCollection(); } } throw new \Gedmo\Exception\InvalidArgumentException("ObjectManager does not support filters"); }