當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EntityManagerInterface::clear方法代碼示例

本文整理匯總了PHP中Doctrine\ORM\EntityManagerInterface::clear方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityManagerInterface::clear方法的具體用法?PHP EntityManagerInterface::clear怎麽用?PHP EntityManagerInterface::clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\ORM\EntityManagerInterface的用法示例。


在下文中一共展示了EntityManagerInterface::clear方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: purgeDatabase

 /**
  * @BeforeScenario
  */
 public function purgeDatabase()
 {
     $this->entityManager->getConnection()->getConfiguration()->setSQLLogger(null);
     $purger = new ORMPurger($this->entityManager);
     $purger->purge();
     $this->entityManager->clear();
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:10,代碼來源:DoctrineORMContext.php

示例2: startJobs

 /**
  * {@inheritdoc}
  */
 public function startJobs(ProjectInterface $project)
 {
     $query = 'UPDATE Worldia\\Bundle\\TextmasterBundle\\Entity\\Job j ' . 'SET j.status = :status ' . 'WHERE j.projectId = :projectId ';
     $q = $this->entityManager->createQuery($query)->setParameter('status', JobInterface::STATUS_STARTED)->setParameter('projectId', $project->getId());
     $q->execute();
     $this->entityManager->clear();
 }
開發者ID:worldia,項目名稱:textmaster-bundle,代碼行數:10,代碼來源:JobManager.php

示例3: purgeDatabase

 /**
  * @BeforeScenario
  */
 public function purgeDatabase()
 {
     if (null === $this->entityManager) {
         throw new \RuntimeException('Cannot purge database. Entity manager is not set');
     }
     $this->entityManager->getConnection()->getConfiguration()->setSQLLogger(null);
     $purger = new ORMPurger($this->entityManager);
     $purger->purge();
     $this->entityManager->clear();
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:13,代碼來源:DoctrineORMContext.php

示例4: getEntityManager

 /**
  * @return EntityManagerInterface
  * @throws \PHPUnit_Framework_SkippedTestError
  * @throws \InvalidArgumentException
  * @throws \Doctrine\ORM\ORMException
  */
 public static function getEntityManager()
 {
     if (null === self::$entityManager) {
         if (!extension_loaded('ibm_db2')) {
             throw new \PHPUnit_Framework_SkippedTestError('DB2 connection is unavailable, skipping test');
         }
         $configuration = Setup::createAnnotationMetadataConfiguration([__DIR__ . '/entity/'], true);
         if (!file_exists(__DIR__ . '/config/local.php')) {
             throw new \PHPUnit_Framework_SkippedTestError('test/config/local.php not found');
         }
         $connection = (require __DIR__ . '/config/local.php');
         self::$entityManager = EntityManager::create($connection, $configuration);
     }
     self::$entityManager->clear();
     return self::$entityManager;
 }
開發者ID:alanseiden,項目名稱:doctrine-dbal-ibmi,代碼行數:22,代碼來源:bootstrap.php

示例5: removeVisitor

 /**
  * @param $ticketDetail
  */
 private function removeVisitor()
 {
     self::$entityManager->clear();
     $ticketDetail = self::$entityManager->getRepository('AppBundle:TicketDetail')->find(self::$ticketDetailId);
     $visitor = $ticketDetail->getVisitor();
     $ticketDetail->setVisitor();
     self::$entityManager->remove($visitor);
     self::$entityManager->flush();
 }
開發者ID:famfij,項目名稱:TP-BilletsDuLouvre,代碼行數:12,代碼來源:VisitorsControllerTest.php

示例6: finishBatch

 /**
  * @param array  $selectedIds
  * @param string $value
  *
  * @return int
  */
 protected function finishBatch(array &$selectedIds, $value)
 {
     $qBuilder = $this->entityManager->createQueryBuilder();
     $entitiesCount = $qBuilder->update($this->entityName, 'e')->set('e.' . $this->fieldName, ':value')->where($qBuilder->expr()->in('e.' . $this->identifierName, $selectedIds))->getQuery()->setParameter('value', $value)->execute();
     $this->entityManager->flush();
     if ($this->entityManager->getConnection()->getTransactionNestingLevel() == 1) {
         $this->entityManager->clear();
     }
     $selectedIds = [];
     return $entitiesCount;
 }
開發者ID:trustify,項目名稱:oroplatform-mass-update-bundle,代碼行數:17,代碼來源:ActionRepository.php

示例7: orderHasTheFollowingProducts

 /**
  * @Given /^order "([^"]*)" has the following products:$/
  *
  * @param $orderNumber
  * @param TableNode $table
  */
 public function orderHasTheFollowingProducts($orderNumber, TableNode $table)
 {
     /** @var OrderInterface $order */
     $order = $this->orderRepository->findOneBy(['number' => $orderNumber]);
     foreach ($table->getHash() as $row) {
         $product = $this->productRepository->findOneByName($row['name']);
         /** @var OrderItemInterface $orderItem */
         $orderItem = $this->orderItemFactory->createNew();
         $orderItem->setVariant($product->getFirstVariant());
         $order->addItem($orderItem);
     }
     $this->entityManager->flush();
     $this->entityManager->clear();
 }
開發者ID:webburza,項目名稱:sylius-order-association-bundle,代碼行數:20,代碼來源:FeatureContext.php

示例8: clear

 public function clear()
 {
     $this->em->clear();
 }
開發者ID:ffff5912,項目名稱:antena,代碼行數:4,代碼來源:ArticleRepository.php

示例9: clear

 /**
  *
  */
 public function clear()
 {
     $this->entityManager->clear();
 }
開發者ID:keylightberlin,項目名稱:util,代碼行數:7,代碼來源:EntityManager.php

示例10: clean

 protected function clean()
 {
     $em = $this->em;
     $reflectedEm = new \ReflectionClass($em);
     if ($reflectedEm->hasProperty('repositories')) {
         $property = $reflectedEm->getProperty('repositories');
         $property->setAccessible(true);
         $property->setValue($em, []);
     }
     $this->em->clear();
 }
開發者ID:solutionDrive,項目名稱:Codeception,代碼行數:11,代碼來源:Doctrine2.php

示例11: flush

 /**
  * Flush and clear the entity manager
  */
 public function flush()
 {
     $this->entityManager->flush();
     $this->entityManager->clear($this->entityName);
 }
開發者ID:megamanhxh,項目名稱:data-import,代碼行數:8,代碼來源:DoctrineWriter.php

示例12: clear

 public function clear()
 {
     $this->entityManager->clear();
     $this->fingersCrossedHandler->clear();
 }
開發者ID:pauci,項目名稱:cqrs-job-manager,代碼行數:5,代碼來源:GarbageCollector.php

示例13: findAllEntity

 private function findAllEntity(EntityManagerInterface $em, $label)
 {
     $times = 100;
     $size = 50;
     $startPersist = microtime(true);
     $rep = $em->getRepository(Country::CLASSNAME);
     echo PHP_EOL . $label;
     for ($i = 0; $i < $size; $i++) {
         $em->persist(new Country("Country {$i}"));
     }
     $em->flush();
     $em->clear();
     printf("\n[%s] persist %s countries", number_format(microtime(true) - $startPersist, 6), $size);
     $startFind = microtime(true);
     for ($i = 0; $i <= $times; $i++) {
         $list = $rep->findAll();
         $em->clear();
         $this->assertCount($size, $list);
     }
     printf("\n[%s] find %s countries (%s times)", number_format(microtime(true) - $startFind, 6), $size, $times);
     printf("\n%s\n", str_repeat('-', 50));
 }
開發者ID:selimcr,項目名稱:servigases,代碼行數:22,代碼來源:SecondLevelCacheTest.php

示例14: next

 /**
  * We need to clear identity map before navigating to next record.
  */
 public function next()
 {
     $this->manager->clear();
     parent::next();
 }
開發者ID:asev,項目名稱:ConnectionsBundle,代碼行數:8,代碼來源:DoctrineImportIterator.php

示例15: flushAndClearEntityManager

 /**
  * @return void
  */
 private function flushAndClearEntityManager()
 {
     $this->entityManager->flush();
     $this->entityManager->clear();
 }
開發者ID:Ocramius,項目名稱:DoctrineBatchUtils,代碼行數:8,代碼來源:SimpleBatchIteratorAggregate.php


注:本文中的Doctrine\ORM\EntityManagerInterface::clear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。