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


PHP LifecycleEventArgs::getObjectManager方法代碼示例

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


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

示例1: postLoad

 /**
  * Load translatable.
  *
  * @param LifecycleEventArgs $args
  */
 public function postLoad(LifecycleEventArgs $args)
 {
     $entity = $args->getEntity();
     if (!$entity instanceof JobInterface || null === ($translatableClass = $entity->getTranslatableClass())) {
         return;
     }
     $translatable = $args->getObjectManager()->getRepository($translatableClass)->find($entity->getTranslatableId());
     $entity->setTranslatable($translatable);
 }
開發者ID:worldia,項目名稱:textmaster-bundle,代碼行數:14,代碼來源:JobListener.php

示例2: postUpdate

 /**
  * @param \Doctrine\ORM\Event\LifecycleEventArgs $args
  */
 public function postUpdate(LifecycleEventArgs $args)
 {
     $entity = $args->getEntity();
     $em = $args->getObjectManager();
     if ($entity instanceof VersionableInterface) {
         if (!$entity->hasListener()) {
             $this->makeSnapshot($entity, $em);
         }
     }
 }
開發者ID:networking,項目名稱:init-cms-bundle,代碼行數:13,代碼來源:VersionListener.php

示例3: postPersist

 public function postPersist(LifecycleEventArgs $args)
 {
     $entity = $args->getObject();
     $entityManager = $args->getObjectManager();
     if ($entity instanceof Article) {
         NumeratorHelper::numerateArticle($entity, $entityManager);
     } else {
         if ($entity instanceof Issue) {
             NumeratorHelper::numerateIssue($entity, $entityManager);
         }
     }
 }
開發者ID:beyzakokcan,項目名稱:ojs,代碼行數:12,代碼來源:NumeratorOrmSubscriber.php

示例4: let

 function let(Reader $reader, LdapManager $ldap, LifecycleEventArgs $eventArgs, ObjectManager $om, ClassMetadata $metadata, LdapObjectSchemaFactory $schemaFactory, LdapConnectionInterface $connection, LdapObjectSchema $schema, LdapQueryBuilder $qb, LdapQuery $query, $entity)
 {
     $rc = new \ReflectionClass('Doctrine\\Common\\Persistence\\Event\\LifecycleEventArgs');
     if ($rc->hasMethod('getObjectManager')) {
         $eventArgs->getObjectManager()->willReturn($om);
         $eventArgs->getObject()->willReturn($entity);
     } else {
         $eventArgs->getEntityManager()->willReturn($om);
         $eventArgs->getEntity()->willReturn($entity);
     }
     $om->getClassMetadata(Argument::any())->willReturn($metadata);
     $this->config = new DomainConfiguration('foo.bar');
     $connection->getConfig()->willReturn($this->config);
     $ldap->getDomainContext()->willReturn('foo.bar');
     $ldap->getSchemaFactory()->willReturn($schemaFactory);
     $ldap->getConnection()->willReturn($connection);
     $ldap->buildLdapQuery()->willReturn($qb);
     $qb->getLdapQuery()->willReturn($query);
     $this->beConstructedWith($reader, $ldap);
 }
開發者ID:ldaptools,項目名稱:ldaptools-bundle,代碼行數:20,代碼來源:LdapObjectSubscriberSpec.php

示例5: postLoad

 /**
  * @param LifecycleEventArgs $args
  */
 public function postLoad(LifecycleEventArgs $args)
 {
     $layoutBlock = $args->getEntity();
     if ($layoutBlock instanceof LayoutBlock) {
         if ($layoutBlock->getClassType() || $layoutBlock->getObjectId()) {
             /** @var EntityManager $em */
             $em = $args->getObjectManager();
             if ($layoutBlock->getObjectId()) {
                 /** @var ContentInterface $content */
                 $content = $em->getRepository($layoutBlock->getClassType())->find($layoutBlock->getObjectId());
                 if ($content) {
                     $layoutBlock->setContent($content);
                 }
             } else {
                 $em->remove($layoutBlock);
                 $em->flush($layoutBlock);
             }
         }
     }
 }
開發者ID:networking,項目名稱:init-cms-bundle,代碼行數:23,代碼來源:LayoutBlockListener.php

示例6: postPersist

 public function postPersist(LifecycleEventArgs $args)
 {
     if (!$args->getObject() instanceof Payment) {
         return;
     }
     /** @var Payment $entity */
     $entity = $args->getObject();
     $entityManager = $args->getObjectManager();
     $mail = $entityManager->getRepository("BdEMainBundle:Mail")->getMail($entity->getStudent(), $entity->getProduct());
     if ($mail) {
         $mailgun = $this->containerInterface->get("bde.mailgun");
         $mailer = $this->containerInterface->get("bde.main.mailer_service");
         $mail_data = $mailer->generateMailFromData($mail, $entity->getStudent());
         $mb = $mailgun->MessageBuilder();
         $mb->setSubject($mail_data['subject']);
         $mb->setHtmlBody($mail_data['body']);
         $mb->setFromAddress($entityManager->getRepository("BdEMainBundle:Config")->get("bde.mail.sender", "OrgaIf BdE <bde.if@insa-lyon.fr>"));
         $mb->addToRecipient($entity->getStudent()->getMail());
         $mailgun->sendMessage($entityManager->getRepository("BdEMainBundle:Config")->get("mailgun.domain", "mail.vienne.me"), $mb->getMessage());
     }
 }
開發者ID:PhilippeGeek,項目名稱:adhesion,代碼行數:21,代碼來源:MailProductSender.php

示例7: prePersist

 /**
  * @ORM\PrePersist()
  */
 public function prePersist(LifecycleEventArgs $event)
 {
     $this->dealWithAtLeastOneTranslation($event->getObjectManager());
 }
開發者ID:claroline,項目名稱:distribution,代碼行數:7,代碼來源:Badge.php

示例8: postUpdate

 /**
  * Handles postUpdate event triggered by doctrine.
  *
  * @param \Doctrine\ORM\Event\LifecycleEventArgs $args The lifecycle event arguments
  */
 public function postUpdate(LifecycleEventArgs $args)
 {
     $this->handleEvent('postUpdate', $args->getObject(), $args->getObjectManager());
 }
開發者ID:cespedosa,項目名稱:kreta,代碼行數:9,代碼來源:DoctrineEventSubscriber.php

示例9: stdClass

 function it_handles_post_update(NotifiableEventRegistryInterface $notifiableEventRegistry, NotifierRegistryInterface $notifierRegistry, NotifiableEventInterface $notifiableEvent, NotifierInterface $notifier, NotificationInterface $notification, EntityManager $manager, LifecycleEventArgs $args)
 {
     $object = new stdClass();
     $this->handleEventConfig('postUpdate', $object, $notifiableEventRegistry, $notifierRegistry, $notifiableEvent, $notifier, $notification);
     $args->getObject()->willReturn(new stdClass());
     $args->getObjectManager()->willReturn($manager);
     $this->postUpdate($args);
 }
開發者ID:dasklney,項目名稱:kreta,代碼行數:8,代碼來源:DoctrineEventSubscriberSpec.php

示例10: getOmFromLifeCycleArgs

 /**
  * Avoid calling deprecated methods if possible.
  *
  * @param LifecycleEventArgs $args
  * @return \Doctrine\Common\Persistence\ObjectManager|\Doctrine\ORM\EntityManager
  */
 protected function getOmFromLifeCycleArgs(LifecycleEventArgs $args)
 {
     $rc = new \ReflectionClass('Doctrine\\Common\\Persistence\\Event\\LifecycleEventArgs');
     if ($rc->hasMethod('getObjectManager')) {
         return $args->getObjectManager();
     } else {
         return $args->getEntityManager();
     }
 }
開發者ID:ldaptools,項目名稱:ldaptools-bundle,代碼行數:15,代碼來源:LdapObjectSubscriber.php

示例11: postLoad

 /**
  * @param $entity
  * @param ORM\Event\LifecycleEventArgs $eventArgs
  *
  * @throws Phone\Exceptions\NoValidCountryException
  * @throws Phone\Exceptions\NoValidPhoneException
  */
 public function postLoad($entity, ORM\Event\LifecycleEventArgs $eventArgs)
 {
     $this->postLoadAndPreFlush($entity, $eventArgs->getObjectManager());
 }
開發者ID:iPublikuj,項目名稱:doctrine-phone,代碼行數:11,代碼來源:PhoneObjectSubscriber.php


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