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


PHP LifecycleEventArgs::getObject方法代码示例

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


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

示例1: postRemove

 /**
  * @param LifecycleEventArgs $event The event.
  */
 public function postRemove(LifecycleEventArgs $event)
 {
     if ($event->getObject() instanceof ResourceObjectInterface) {
         /** @var ResourceObjectInterface $resource */
         $resource = $event->getObject();
         if ($resource->getLocation() && $resource->getMapping()) {
             $resolverName = $this->getLocationConfig('resolver', $resource->getLocation(), $this->config);
             $resolver = $this->resolverManager->get($resolverName);
             $resolver->setConfig($this->config);
             $this->loadResource($resource);
             $this->remove($resource, $resolver);
         }
     }
 }
开发者ID:rafrsr,项目名称:resource-bundle,代码行数:17,代码来源:ResourceORMSubscriber.php

示例2: postLoad

 /**
  * Inject Translator locale into loaded object.
  *
  * @param LifecycleEventArgs $args
  */
 public function postLoad(LifecycleEventArgs $args)
 {
     $object = $args->getObject();
     if ($object instanceof LocaleAware) {
         $object->setCurrentLocale($this->translator->getLocale());
     }
 }
开发者ID:nkt,项目名称:translate-bundle,代码行数:12,代码来源:LocaleEventSubscriber.php

示例3: postLoad

 public function postLoad(LifecycleEventArgs $args)
 {
     $entity = $args->getObject();
     if ($entity instanceof ServiceAwareEntityInterface) {
         $entity->setServiceLocator($this->serviceManager);
     }
 }
开发者ID:fousheezy,项目名称:common,代码行数:7,代码来源:ServiceAwareEntity.php

示例4: postLoad

 /**
  * Post load
  *
  * @param LifecycleEventArgs $args
  */
 public function postLoad(LifecycleEventArgs $args)
 {
     $entity = $args->getObject();
     if ($entity instanceof DocumentNode) {
         $entity->setUserNode($this->nodeProvider->isUserNode($entity));
     }
 }
开发者ID:DavidG04,项目名称:ErichardDmsBundle,代码行数:12,代码来源:DmsNodeEvent.php

示例5: postLoad

 /**
  * @param LifecycleEventArgs $event The event.
  */
 public function postLoad(LifecycleEventArgs $event)
 {
     $object = $event->getObject();
     if ($object instanceof ProxyServiceInterface && $object->getServiceName()) {
         $object->setService($this->container->get($object->getServiceName()));
     }
 }
开发者ID:rafrsr,项目名称:doctrine-extra-bundle,代码行数:10,代码来源:ProxyServiceSubscriber.php

示例6: preUpdate

 /**
  * @param LifecycleEventArgs $event The event.
  */
 public function preUpdate(LifecycleEventArgs $event)
 {
     $object = $event->getObject();
     if ($object instanceof TimestampableInterface) {
         $object->setUpdatedAt(new \DateTime());
     }
 }
开发者ID:rafrsr,项目名称:doctrine-extra-bundle,代码行数:10,代码来源:TimestampableSubscriber.php

示例7: preRemove

 public function preRemove(LifecycleEventArgs $event)
 {
     $object = $event->getObject();
     if ($this->isReferenceable($object)) {
         $this->objectAdapterManager->removeReference($object);
     }
 }
开发者ID:joschi127,项目名称:DoctrineOrmOdmAdapter,代码行数:7,代码来源:OrmLifecycleListener.php

示例8: postLoad

 /**
  * @param LifecycleEventArgs $event
  */
 public function postLoad(LifecycleEventArgs $event)
 {
     $settings = $event->getObject();
     if ($settings instanceof SettingsInterface) {
         $this->reverseTransform($settings);
     }
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:10,代码来源:ParameterTransformerListener.php

示例9: prePersist

 public function prePersist(LifecycleEventArgs $args)
 {
     $object = $args->getObject();
     if ($object instanceof UserInterface) {
         $this->updatePassword($object);
     }
 }
开发者ID:stefuyt,项目名称:formation-symfony,代码行数:7,代码来源:UserSecurity.php

示例10: postRemove

 /**
  * @param LifecycleEventArgs $args
  */
 public function postRemove(LifecycleEventArgs $args)
 {
     $entity = $args->getObject();
     $em = $args->getEntityManager();
     $meta = $em->getClassMetadata(get_class($entity));
     $this->logEntityChange('removed', $meta, $entity);
 }
开发者ID:binaryfr3ak,项目名称:sfitixi,代码行数:10,代码来源:EntityChangeListener.php

示例11: preUpdate

 public function preUpdate(LifecycleEventArgs $args)
 {
     $entity = $args->getObject();
     if ($entity instanceof PlaceAddress) {
         $this->insertTranslation($entity);
     }
 }
开发者ID:krombox,项目名称:motion,代码行数:7,代码来源:AddressListener.php

示例12: prePersist

 public function prePersist(LifecycleEventArgs $event)
 {
     $object = $event->getObject();
     if ($object instanceof UuidAwareInterface and !$object->getId()) {
         $object->setId((new UuidGenerator())->generate($event->getEntityManager(), $object));
     }
 }
开发者ID:liverbool,项目名称:dos-resource-bundle,代码行数:7,代码来源:UuidGeneratorListener.php

示例13: preRemove

 public function preRemove(LifecycleEventArgs $event)
 {
     $objectAdapterManager = $this->container->get('doctrine_orm_phpcr_adapter.adapter.default_adapter_manager');
     $object = $event->getObject();
     if ($this->isReferenceable($object, $objectAdapterManager)) {
         $objectAdapterManager->removeReference($object);
     }
 }
开发者ID:joschi127,项目名称:DoctrineOrmPhpcrAdapterBundle,代码行数:8,代码来源:OrmListener.php

示例14: postUpdate

 public function postUpdate(LifecycleEventArgs $event)
 {
     $object = $event->getObject();
     if ($object instanceof User && $object->isEmailChanged()) {
         $this->container->get('stats_system')->postRequest($object);
         $this->container->get('marketing_system')->postRequest($object);
         $this->container->get('logger')->info("New email for user with id {$object->getId()}: {$object->getEmail()}");
     }
 }
开发者ID:jszutkowski,项目名称:example,代码行数:9,代码来源:DoctrineEventListener.php

示例15: preUpdate

 /**
  * sets Traceable dateTime and user information when updating entity
  *
  * @param LifecycleEventArgs $eventArgs
  */
 public function preUpdate(LifecycleEventArgs $eventArgs)
 {
     $entity = $eventArgs->getObject();
     if (!$this->hasTrait($entity, 'Librinfo\\DoctrineBundle\\Entity\\Traits\\Traceable')) {
         return;
     }
     $this->logger->debug("[TraceableListener] Entering TraceableListener for « preUpdate » event");
     $now = new DateTime('NOW');
     $entity->setUpdatedAt($now);
 }
开发者ID:libre-informatique,项目名称:SymfonyLibrinfoDoctrineBundle,代码行数:15,代码来源:TraceableListener.php


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