public function invalidate()
 {
     $ormConfig = $this->entityManager->getConfiguration();
     $dbalConfig = $this->entityManager->getConnection()->getConfiguration();
     $cache = array($ormConfig->getHydrationCacheImpl(), $ormConfig->getMetadataCacheImpl(), $ormConfig->getQueryCacheImpl(), $ormConfig->getResultCacheImpl(), $dbalConfig->getResultCacheImpl());
     foreach ($cache as $impl) {
         if (!$impl instanceof CacheProvider) {
             continue;
         }
         $impl->deleteAll();
     }
 }
 public function invalidate()
 {
     $ormConfig = $this->entityManager->getConfiguration();
     $dbalConfig = $this->entityManager->getConnection()->getConfiguration();
     $cache = $this->cacheStorages;
     $cache[] = $ormConfig->getHydrationCacheImpl();
     $cache[] = $ormConfig->getMetadataCacheImpl();
     $cache[] = $ormConfig->getQueryCacheImpl();
     $cache[] = $ormConfig->getResultCacheImpl();
     $cache[] = $dbalConfig->getResultCacheImpl();
     foreach ($cache as $impl) {
         if (!$impl instanceof ClearableCache) {
             continue;
         }
         $impl->deleteAll();
     }
 }
 /**
  * @param EntityManager $em
  */
 public function __construct(EntityManager $em)
 {
     $this->em = $em;
     $this->db = $em->getConnection();
     $this->platform = $this->db->getDatabasePlatform();
     $this->quotes = $em->getConfiguration()->getQuoteStrategy();
     $this->uow = $this->em->getUnitOfWork();
 }
 /**
  * @param EntityManager $entityManager
  * @param string $repositoryName
  */
 public function __construct(EntityManager $entityManager, $repositoryName)
 {
     $entityManager->getConfiguration()->addCustomNumericFunction("greatest", 'App\\Doctrine\\Greatest');
     $entityManager->getConfiguration()->addCustomNumericFunction("least", 'App\\Doctrine\\Least');
     $entityManager->getConfiguration()->addCustomNumericFunction("rand", 'App\\Doctrine\\Rand');
     $entityManager->getConfiguration()->addCustomNumericFunction("countif", 'App\\Doctrine\\CountIf');
     $entityManager->getConfiguration()->addCustomNumericFunction("round", 'App\\Doctrine\\Round');
     $entityManager->getConfiguration()->addCustomNumericFunction("date", 'App\\Doctrine\\Date');
     $this->entityManager = $entityManager;
     $this->repositoryName = $repositoryName;
 }
 public function indexEntities(ClassMetadata $searchMeta)
 {
     foreach ($this->searchManager->getMetadataFactory()->getAllMetadata() as $otherMeta) {
         if ($searchMeta->className === $otherMeta->className) {
             continue;
         }
         if (is_subclass_of($searchMeta->className, $otherMeta->className)) {
             $this->onChildSkipped($this, $searchMeta, $otherMeta);
             return;
         }
     }
     if ($searchMeta->riverImplementation) {
         $river = $this->serviceLocator->getByType($searchMeta->riverImplementation);
     } else {
         /** @var River\DefaultEntityRiver $river */
         $river = $this->serviceLocator->createInstance('Kdyby\\DoctrineSearch\\River\\DefaultEntityRiver');
     }
     if (!$river instanceof EntityRiver) {
         throw new UnexpectedValueException('The river must implement Doctrine\\Search\\EntityRiver.');
     }
     if (property_exists($river, 'onIndexStart')) {
         $river->onIndexStart[] = function (EntityRiver $river, $paginator, ORMMetadata $class) {
             $this->onIndexStart($this, $paginator, $river, $class);
         };
     }
     if (property_exists($river, 'onItemsIndexed')) {
         $river->onItemsIndexed[] = function ($self, $entities) {
             $this->onItemsIndexed($this, $entities);
         };
     }
     if (property_exists($river, 'onIndexStats')) {
         $river->onIndexStats[] = function ($self, ORMMetadata $class, $timeToIndex, $timeToRead) {
             $this->onIndexStats($this, $class, $timeToIndex, $timeToRead);
         };
     }
     // disable logger
     $config = $this->entityManager->getConfiguration();
     $oldLogger = $config->getSQLLogger();
     $config->setSQLLogger(NULL);
     $river->transfuse($searchMeta);
     $config->setSQLLogger($oldLogger);
 }
Exemple #6
0
 public function removeCacheTag($tag)
 {
     $this->em->getConfiguration()->getResultCacheImpl()->delete($tag);
 }
 private function addFunctions()
 {
     $emConfig = $this->entityManager->getConfiguration();
     $emConfig->addCustomNumericFunction('RAND', 'DoctrineExtensions\\Query\\Mysql\\Rand');
 }