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


PHP ORM\EntityManagerInterface類代碼示例

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


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

示例1: createActivityType

 private function createActivityType(EntityManagerInterface $em)
 {
     $activityType = new ResourceType();
     $activityType->setName('activity');
     $em->persist($activityType);
     $em->flush();
 }
開發者ID:stefk,項目名稱:CompetencyBundle,代碼行數:7,代碼來源:AdditionalInstallerTest.php

示例2: __construct

 /**
  * @param EntityManager $em
  * @param Cache $cache
  * @param CacheHitsContainer $hitsContainer
  */
 public function __construct(EntityManagerInterface $em, Cache $cache, CacheHitsContainer $hitsContainer)
 {
     $this->em = $em;
     $this->connection = $em->getConnection();
     $this->cache = $cache;
     $this->hitsContainer = $hitsContainer;
 }
開發者ID:lsnova,項目名稱:simple-query-executor,代碼行數:12,代碼來源:DbCacheableExecutor.php

示例3: uniqueNameExists

 /**
  * @param $fileName
  * @return bool
  */
 protected function uniqueNameExists($fileName, EntityManagerInterface $em)
 {
     $dql = "SELECT COUNT(image) FROM EDVFileBundle:EdImage AS image WHERE image.hashString = :name";
     $query = $em->createQuery($dql)->setParameters(array('name' => $fileName));
     $result = $query->getSingleScalarResult();
     return $result > 0;
 }
開發者ID:vlatosev,項目名稱:filebundle,代碼行數:11,代碼來源:ImageManager.php

示例4: it_performs_a_fulltext_query

 public function it_performs_a_fulltext_query(EntityManagerInterface $entityManager, AbstractQuery $query, $result = [])
 {
     $entityManager->createQuery(Argument::any())->shouldBeCalled()->willReturn($query);
     $query->setParameter(Argument::any(), Argument::any())->shouldBeCalled()->willReturn($query);
     $query->getResult()->shouldBeCalled()->willReturn($result);
     $this->query('black', $entityManager)->shouldBeArray();
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:7,代碼來源:OrmFinderSpec.php

示例5: getEntityManager

 /**
  * Returns the global entity manager.
  *
  * @return \Doctrine\ORM\EntityManagerInterface
  */
 public function getEntityManager()
 {
     if ($this->entityManager === null || !$this->entityManager->isOpen()) {
         $this->entityManager = $this->createEntityManager();
     }
     return $this->entityManager;
 }
開發者ID:ableron,項目名稱:ableron-core,代碼行數:12,代碼來源:PersistenceManager.php

示例6:

 function it_handles_a_delete_command(Entity $entity, Delete $command, EntityManagerInterface $em)
 {
     $command->getEntity()->willReturn($entity);
     $em->remove($entity)->shouldBeCalled();
     $em->flush()->shouldBeCalled();
     $this->handle($command);
 }
開發者ID:indigophp,項目名稱:crud-doctrine,代碼行數:7,代碼來源:RemoverSpec.php

示例7: isUsedCode

 /**
  * @param string $token
  *
  * @return Boolean
  */
 protected function isUsedCode($token)
 {
     $this->manager->getFilters()->disable('softdeleteable');
     $isUsed = null !== $this->repository->findOneBy(array('confirmationToken' => $token));
     $this->manager->getFilters()->enable('softdeleteable');
     return $isUsed;
 }
開發者ID:Strontium-90,項目名稱:Sylius,代碼行數:12,代碼來源:TokenProvider.php

示例8: convert

 /**
  * {@inheritdoc}
  */
 public function convert($value)
 {
     if ($value) {
         return $this->em->getReference($this->entityClass, $value);
     }
     return null;
 }
開發者ID:Exanrus,項目名稱:crm-bundle,代碼行數:10,代碼來源:AbstractEntityConverter.php

示例9: createDoctrineSchema

 /**
  * Creates schema for doctrine entities
  *
  * @throws \Doctrine\ORM\Tools\ToolsException
  */
 protected function createDoctrineSchema()
 {
     $metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();
     $tool = new SchemaTool($this->entityManager);
     $tool->dropSchema($metadata);
     $tool->createSchema($metadata);
 }
開發者ID:silversolutions,項目名稱:content-loader-bundle,代碼行數:12,代碼來源:DatabaseSchemaCreator.php

示例10: delete

 /**
  * @inheritdoc
  */
 public function delete(UserModel $user) : UserModel
 {
     $user->delete();
     $this->em->persist($user);
     $this->em->flush();
     return $user;
 }
開發者ID:mrprompt,項目名稱:silex-api-skel,代碼行數:10,代碼來源:User.php

示例11: tryDelete

 /**
  * @param Category $category
  * @throws \Exception
  */
 public function tryDelete(Category $category)
 {
     $this->tryValidate($category);
     $this->em->transactional(function () use($category) {
         $this->em->remove($category);
     });
 }
開發者ID:pinekta,項目名稱:mysymfonysample,代碼行數:11,代碼來源:CategoryManager.php

示例12: onRender

 public function onRender(RendererEvent $event)
 {
     $renderer = $event->getRenderer();
     $content = $renderer->getObject();
     $links = $content->getParamValue('link');
     $link = ['url' => '', 'title' => 'Visit', 'target' => '_self'];
     if (!empty($links)) {
         $links = reset($links);
         if (isset($links['pageUid']) && !empty($links['pageUid'])) {
             $page = $this->entityManager->getRepository('BackBee\\CoreDomain\\NestedNode\\Page')->find($links['pageUid']);
             if ($page !== null) {
                 $link['url'] = $page->getUrl();
             }
         }
         if (empty($link['url']) && isset($links['url'])) {
             $link['url'] = $links['url'];
         }
         if (isset($links['title'])) {
             $link['title'] = $links['title'];
         }
         if (isset($links['target'])) {
             $link['target'] = $links['target'];
         }
     }
     $renderer->assign('link', $link);
 }
開發者ID:ReissClothing,項目名稱:BackBee,代碼行數:26,代碼來源:QuoteListener.php

示例13: renewRental

 /**
  * Renueva el alquiler.
  *
  * @param Rental $rental
  *
  * @return Rental
  */
 public function renewRental(Rental $rental)
 {
     if ($rental->getReturnAt()) {
         throw new FinishedRentalException();
     }
     if ($rental->getUser()->getIsPenalized()) {
         throw new PenalizedUserException();
     }
     if ($rental->getUser()->getFaculty()->getIsEnabled() === false) {
         throw new PenalizedFacultyException();
     }
     if (!$rental->getIsRenewable()) {
         throw new NotRenewableRentalException();
     }
     if ($rental->getIsExpired()) {
         throw new ExpiredRentalException();
     }
     if ($rental->getDaysLeft() > $this->days_before_renovation) {
         throw new TooEarlyRenovationException();
     }
     $left = $rental->getDaysLeft() + $this->days_length_rental;
     $rental->setEndAt(new \DateTime($left . ' days midnight'));
     $this->manager->persist($rental);
     $this->manager->flush();
     $event = new RentalEvent($rental);
     $this->dispatcher->dispatch(RentalEvents::LOCKER_RENEWED, $event);
     return $rental;
 }
開發者ID:aulasoftwarelibre,項目名稱:seta,代碼行數:35,代碼來源:RenewService.php

示例14: activate

 /**
  * Activates new user by activation code
  *
  * @param string $code
  *
  * @throws IOException
  */
 public function activate($code)
 {
     $user = $this->userRepository->findOneBy(['code' => $code, 'frozen' => true]);
     $user->activate();
     $this->entityManager->persist($user);
     $this->entityManager->flush();
 }
開發者ID:janlavicka,項目名稱:devstack,代碼行數:14,代碼來源:RegistrationService.php

示例15: getFreeWorkTimes

 public function getFreeWorkTimes(User $user, \DateTime $date = null)
 {
     $allTimes = [];
     //if($date)
     //{
     $startTime = new \DateTime($date->format('Y-m-d H:i'));
     $endTime = new \DateTime($date->format('Y-m-d H:i'));
     $startTime->setTime($user->getStartTime()->format('H'), $user->getStartTime()->format('i'));
     $endTime->setTime($user->getEndTime()->format('H'), $user->getEndTime()->format('i'));
     //}else
     //{
     //    $startTime = new \DateTime($user->getStartTime()->format('H:i'));
     //    $endTime = new \DateTime($user->getEndTime()->format('H:i'));
     //}
     $busyTimes = $this->em->getRepository('WorkerBundle:WorkTime')->getUserBusyTimes($user->getId());
     while ($startTime < $endTime) {
         if ($startTime > new \DateTime()) {
             //    if ($date) {
             $allTimes[] = $startTime->format('Y-m-d H:i');
             //    } else {
             //          $allTimes[] = date('Y-m-d') . ' ' . $startTime->format('H:i');
             //   }
         }
         $startTime->modify('+1hour');
     }
     return $this->removeBlockedTimes($allTimes, $busyTimes);
 }
開發者ID:deileo,項目名稱:Autoservisas_Kursinis,代碼行數:27,代碼來源:WorkTimeService.php


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