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


PHP Event\PreUpdateEventArgs類代碼示例

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


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

示例1: preUpdate

 public function preUpdate(PreUpdateEventArgs $eventArgs)
 {
     $entity = $eventArgs->getEntity();
     if ($entity instanceof StampEntityInterface) {
         $entity->setModified(new \DateTime());
     }
 }
開發者ID:apitude,項目名稱:apitude,代碼行數:7,代碼來源:StampSubscriber.php

示例2: preUpdate

 /**
  * Before an update we check that the product categories are right.
  *
  * @param PreUpdateEventArgs $event The pre update event.
  */
 public function preUpdate(PreUpdateEventArgs $event)
 {
     $entity = $event->getEntity();
     if ($entity instanceof CategorizableInterface) {
         $this->categoryIntegrityFixer->fixCategoriesIntegrity($entity);
     }
 }
開發者ID:EmanueleMinotto,項目名稱:elcodi,代碼行數:12,代碼來源:CategoryIntegrityEventListener.php

示例3: preUpdate

 public function preUpdate(User $user, PreUpdateEventArgs $event)
 {
     if ($event->hasChangedField('email')) {
         $token = $this->tokenGenerator->generateEmailConfirmationToken($user);
         $this->emailDispatcher->sendEmailVerifyEmail($user, $token);
     }
 }
開發者ID:dstansby,項目名稱:camdram,代碼行數:7,代碼來源:UserListener.php

示例4: getChangesets

 private function getChangesets(PreUpdateEventArgs $args)
 {
     $oldValues = array();
     $newValues = array();
     $fields = array('avatar' => 'Фото', 'firstName' => 'Имя', 'lastName' => 'Фамилия', 'surName' => 'Отчество', 'birthdate' => 'Дата рождения', 'hideBirthdate' => 'Скрывать дату рождения', 'city' => 'Город', 'address' => 'Адрес', 'university' => 'ВУЗ', 'graduateYear' => 'Год окончания ВУЗа', 'primarySpecialty' => 'Основная специальность', 'secondarySpecialty' => 'Второстепенная специальность', 'specialization' => 'Специализация', 'academicTitle' => 'Звание', 'jobType' => 'Место работы', 'job' => 'Название организации', 'jobAlignment' => 'Место организации', 'phone' => 'Телефон', 'position' => 'Должность', 'diploma' => 'Диплом ВУЗа', 'achievements' => 'О себе', 'academicDegree' => 'Ученая степень', 'dissertation' => 'Тема диссертации', 'diplomaScientic' => 'Диплом ученой степени', 'digestSubscribed' => 'Подписка на дайджест', 'commentSubscribed' => 'Подписка ответов на комментарии');
     foreach ($fields as $field => $label) {
         if ($args->hasChangedField($field)) {
             $old = $args->getOldValue($field);
             $new = $args->getNewValue($field);
             if ($old == $new || is_array($old) && empty($new)) {
                 continue;
             }
             if ($new instanceof UploadedFile) {
                 $this->imgFields[$field] = $label;
                 $oldValues[] = "<b>{$label}:</b> ~";
             } else {
                 $oldValues[] = "<b>{$label}:</b> " . ($old instanceof \DateTime ? $old->format('d.m.Y') : $old);
                 $newValues[] = "<b>{$label}:</b> " . ($new instanceof \DateTime ? $new->format('d.m.Y') : $new);
             }
         }
     }
     if (count($oldValues)) {
         $oldValues = implode('<br/>', $oldValues);
         $newValues = implode('<br/>', $newValues);
         return array($oldValues, $newValues);
     }
     return array(null, null);
 }
開發者ID:Quiss,項目名稱:Evrika,代碼行數:28,代碼來源:ChangesSubscriber.php

示例5: preUpdate

 /**
  * @param PreUpdateEventArgs $args
  */
 public function preUpdate(PreUpdateEventArgs $args)
 {
     if (!$args->getEntity() instanceof User || !$args->hasChangedField('email')) {
         return;
     }
     $args->getEntity()->setGoogleId(null);
 }
開發者ID:Maksold,項目名稱:platform,代碼行數:10,代碼來源:UserEmailChangeListener.php

示例6: preUpdate

 /**
  * @ORM\PreUpdate
  */
 public function preUpdate(PreUpdateEventArgs $eventArgs)
 {
     if (!$this->isEdited) {
         $this->isEdited = true;
         $this->backupTime = $eventArgs->getOldValue('time');
     }
 }
開發者ID:allaniftrue,項目名稱:timr,代碼行數:10,代碼來源:Log.php

示例7: preUpdate

 /**
  * @ORM\PreUpdate
  */
 public function preUpdate($item, PreUpdateEventArgs $event)
 {
     if ($item->getLevel() > 0) {
         $item->setRootSequence(NULL);
     } elseif ($event->hasChangedField('parent') && is_null($event->getNewValue('parent')) && !is_null($event->getOldValue('parent'))) {
         $this->setMaxRootSequence($item, $event);
     } else {
         if (!$event->hasChangedField('rootSequence')) {
             return;
         }
         $oldSequence = $event->getOldValue('rootSequence');
         $newSequence = $event->getNewValue('rootSequence');
         if ($oldSequence === $newSequence) {
             return;
         }
         $em = $event->getEntityManager();
         $qb = $em->createQueryBuilder();
         $qb->update(get_class($item), 'i')->where('i.rootSequence = ' . $newSequence);
         if ($newSequence > $oldSequence) {
             $qb->set('i.rootSequence', 'i.rootSequence - 1');
         } elseif ($newSequence < $oldSequence) {
             $qb->set('i.rootSequence', 'i.rootSequence + 1');
         }
         $qb->getQuery()->execute();
     }
 }
開發者ID:jirinapravnik,項目名稱:common,代碼行數:29,代碼來源:RootSequenceListener.php

示例8: preUpdate

 /**
  * Before an update we check that the product categories are right.
  *
  * @param PreUpdateEventArgs $event The pre update event.
  */
 public function preUpdate(PreUpdateEventArgs $event)
 {
     $entity = $event->getEntity();
     if ($entity instanceof ProductInterface) {
         $this->categoryIntegrityFixer->fixProduct($entity);
     }
 }
開發者ID:axelvnk,項目名稱:elcodi,代碼行數:12,代碼來源:ProductCategoryIntegrityEventListener.php

示例9: preUpdate

 public function preUpdate(PreUpdateEventArgs $args)
 {
     $entity = $args->getEntity();
     if ($entity instanceof ContainerAwareInterface) {
         $entity->setContainer($this->container);
     }
 }
開發者ID:slim627,項目名稱:bellon,代碼行數:7,代碼來源:ContainerListener.php

示例10: preUpdate

 /**
  * sets the modification date
  */
 public function preUpdate(Domains $domain, PreUpdateEventArgs $event)
 {
     $domain->setModified(new \DateTime());
     if ($event->hasChangedField('name')) {
         $domain->setNeedsSoaUpdate(true);
     }
     return true;
 }
開發者ID:syseleven,項目名稱:powerdnsbundle,代碼行數:11,代碼來源:DomainListener.php

示例11: preUpdate

 public function preUpdate(PreUpdateEventArgs $event)
 {
     $file = $event->getEntity();
     if (!$file instanceof File) {
         return;
     }
     $this->updateFile($file);
 }
開發者ID:xavier-dubreuil,項目名稱:LightCMS,代碼行數:8,代碼來源:FileEventListener.php

示例12: preUpdate

 /**
  * Pre update event listener.
  *
  * @param PreUpdateEventArgs $eventArgs The pre update event args.
  *
  * @return $this Self object
  */
 public function preUpdate(PreUpdateEventArgs $eventArgs)
 {
     $entity = $eventArgs->getEntity();
     if ($entity instanceof CategoryInterface) {
         $this->removeParentCategoryForRootCategory($entity);
     }
     return $this;
 }
開發者ID:axelvnk,項目名稱:elcodi,代碼行數:15,代碼來源:RootCategoryEventListener.php

示例13: preUpdate

 public function preUpdate(PreUpdateEventArgs $eventArgs)
 {
     $entity = $eventArgs->getEntity();
     if (!$entity instanceof User) {
         return;
     }
     $this->encodePassword($entity);
 }
開發者ID:neandher,項目名稱:Symfony-Multiple-Authentication,代碼行數:8,代碼來源:EncodePasswordSubscriber.php

示例14: preUpdate

 /**
  * @param PreUpdateEventArgs $event
  */
 public function preUpdate(PreUpdateEventArgs $event)
 {
     $entity = $event->getEntity();
     // if subtotal or status has been changed
     if ($this->isOrderValid($entity) && array_intersect(['subtotalAmount', 'discountAmount', 'status'], array_keys($event->getEntityChangeSet()))) {
         $this->ordersForUpdate[$entity->getId()] = true;
     }
 }
開發者ID:antrampa,項目名稱:crm,代碼行數:11,代碼來源:OrderListener.php

示例15: preUpdate

 /**
  * Cleans the facebbok username.
  *
  * @param PreUpdateEventArgs $args
  */
 public function preUpdate(PreUpdateEventArgs $args)
 {
     $entity = $args->getEntity();
     if ($entity instanceof Plugin && $entity->getNamespace() == 'Elcodi\\Plugin\\TwitterBundle\\ElcodiTwitterBundle') {
         $twitterAccount = $entity->getConfiguration()->getFieldValue('twitter_account');
         $entity->getConfiguration()->setFieldValue('twitter_account', $this->twitterUsernameCleaner->clean($twitterAccount));
     }
 }
開發者ID:elcodi,項目名稱:bamboo,代碼行數:13,代碼來源:TwitterUsernameEventListener.php


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