当前位置: 首页>>代码示例>>PHP>>正文


PHP EntityManager::getDao方法代码示例

本文整理汇总了PHP中Kdyby\Doctrine\EntityManager::getDao方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityManager::getDao方法的具体用法?PHP EntityManager::getDao怎么用?PHP EntityManager::getDao使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kdyby\Doctrine\EntityManager的用法示例。


在下文中一共展示了EntityManager::getDao方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initialize

 public function initialize(IIdentity $identity)
 {
     if ($identity instanceof EntityIdentity && !$identity->isLoaded()) {
         $identity->load($this->em->getDao($identity->getEntityClass()));
     }
     return $identity;
 }
开发者ID:librette,项目名称:security-extension,代码行数:7,代码来源:EntityIdentityInitializer.php

示例2: handle

 public function handle($name, array $options, ClassMetadata $classMetadata, Configuration $configuration)
 {
     if (!empty($options['control'])) {
         return NULL;
     }
     if (!($mapping = MetadataHelpers::getAssociationMapping($classMetadata, $name, ClassMetadata::ONE_TO_ONE))) {
         return NULL;
     }
     $targetMetadata = $this->entityManager->getDao($mapping['targetEntity'])->getClassMetadata();
     return new ContainerBuilder($targetMetadata, new Container(), $configuration);
 }
开发者ID:librette,项目名称:doctrine-forms,代码行数:11,代码来源:OneToOneHandler.php

示例3: getEvent

 /**
  * Get event
  * @param integer $eventId
  * @return Event
  */
 public function getEvent($eventId)
 {
     // Má právo na editaci? (výchozí: ano)
     $canAccess = FALSE;
     $hasAccess = FALSE;
     $hasShare = FALSE;
     /** @var null|Event $event */
     $event = $this->eventDao->find($eventId);
     if ($event->isDeleted()) {
         throw new Nette\Application\BadRequestException($this->translator->translate('event.general.noId'));
     }
     // Is this api call?
     if ($this->user->getId() === 0) {
         $canAccess = TRUE;
     } else {
         /** @var \App\Model\Entity\User $userEntity */
         $userEntity = $this->em->getDao('\\App\\Model\\Entity\\User')->find($this->user->getId());
         /** @var \App\Model\Entity\Client $client */
         $client = $userEntity->getClient();
         // je uživatel ADMIN?
         if (($this->user->isInRole('ADMIN') || $this->user->isInRole('ACCOUNTANT')) && $this->isClientsEvent($event, $client)) {
             $canAccess = TRUE;
         } elseif (($this->user->isInRole('USER') || $this->user->isInRole('ACCOUNTANT')) && $this->isClientsEvent($event, $client)) {
             //požadavek klienta, aby šel
             $canAccess = TRUE;
         } else {
             // pokud nemá přiřazené oprávnění, má přidělené sdílení?
             if ($event->getShares() !== NULL) {
                 $hasShare = FALSE;
                 foreach ($event->getShares() as $clientShare) {
                     if ($client->getId() == $clientShare->getClient()->getId()) {
                         $hasShare = TRUE;
                         break;
                     }
                 }
             }
             // pokud ano, má přiřazená oprávnění pro event?
             if ($event->getAccesses() !== NULL) {
                 foreach ($event->getAccesses() as $clientAccess) {
                     $hasAccess = FALSE;
                     if ($client->getId() == $clientAccess->getReceiver()->getId() || $client->getId() == $clientAccess->getCreator()->getId()) {
                         $hasAccess = TRUE;
                         break;
                     }
                 }
             }
             // pokud ne, patří událost klientovi nebo sdílení, anebo přístup?
             if ($hasAccess || $hasShare) {
                 $canAccess = TRUE;
             }
         }
     }
     if ($canAccess) {
         // má přístup do události?
         return $event;
     } else {
         // jinak je přesměrován na dashboard s tím, že je upozorněn na to, že nemá oprávnění
         throw new Nette\Application\ForbiddenRequestException($this->translator->translate('event.general.noRights'));
     }
 }
开发者ID:MrTommy1979,项目名称:reference,代码行数:65,代码来源:EventService.php

示例4: handle

 public function handle($name, array $options, ClassMetadata $classMetadata, Configuration $configuration)
 {
     if (!($mapping = MetadataHelpers::getAssociationMapping($classMetadata, $name, ClassMetadata::ONE_TO_MANY))) {
         return NULL;
     }
     $options += ['createDefault' => 0];
     $dao = $this->entityManager->getDao($mapping['targetEntity']);
     $containerPrototype = new Container();
     $replicator = new ClonnableReplicator(function (Container $container) use($containerPrototype) {
         $clone = function (Container $targetContainer, Container $sourceContainer) use(&$clone) {
             /** @var IComponent $component */
             foreach ($sourceContainer->getComponents() as $component) {
                 if ($component instanceof Container && !$component instanceof ClonnableReplicator) {
                     /** @var Container $component */
                     $container = new Container();
                     $container->setCurrentGroup($component->getCurrentGroup());
                     $container->onValidate = $component->onValidate;
                     $targetContainer[$component->getName()] = $container;
                     $clone($container, $component);
                 } else {
                     $targetContainer[$component->getName()] = $control = clone $component;
                     if ($control instanceof BaseControl) {
                         $clonner = function () {
                             /** @var BaseControl $this */
                             $this->control = clone $this->control;
                             $this->label = clone $this->label;
                         };
                         $clonner = $clonner->bindTo($control, $control);
                         $clonner();
                     }
                 }
             }
         };
         $clone($container, $containerPrototype);
     }, $options['createDefault']);
     return new ReplicatorBuilder($dao->getClassMetadata(), $replicator, $configuration, $containerPrototype);
 }
开发者ID:librette,项目名称:doctrine-forms,代码行数:37,代码来源:OneToManyHandler.php

示例5: create

 /**
  * @param $entityName
  * @param EntityManager $entityManager
  * @return \Kdyby\Doctrine\EntityDao
  */
 public static function create($entityName, EntityManager $entityManager)
 {
     return $entityManager->getDao($entityName);
 }
开发者ID:pecinaon,项目名称:sandbox,代码行数:9,代码来源:DaoFactory.php

示例6: fetchPairs

 /**
  * @param Relation $relation
  * @param $entityName
  * @return array
  */
 public function fetchPairs(Relation $relation, $entityName)
 {
     $criteria = array();
     return $this->entityManager->getDao($entityName)->findPairs($criteria, $relation->getSelectedBy());
 }
开发者ID:frosty22,项目名称:ale,代码行数:10,代码来源:DataFetcher.php


注:本文中的Kdyby\Doctrine\EntityManager::getDao方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。