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