当前位置: 首页>>代码示例>>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;未经允许,请勿转载。