本文整理汇总了PHP中Doctrine\ORM\Event\PreUpdateEventArgs类的典型用法代码示例。如果您正苦于以下问题:PHP PreUpdateEventArgs类的具体用法?PHP PreUpdateEventArgs怎么用?PHP PreUpdateEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PreUpdateEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: preUpdate
/**
* @param PreUpdateEventArgs $event
*/
public function preUpdate(PreUpdateEventArgs $event)
{
$user = $event->getEntity();
if (!$user instanceof User) {
return;
}
$this->updateUser($user);
}
开发者ID:mikegibson,项目名称:sentient,代码行数:11,代码来源:UserListener.php
示例17: preUpdate
public function preUpdate(PreUpdateEventArgs $args)
{
//return;
$em = $args->getEntityManager();
$entity = $args->getEntity();
if ($entity instanceof Invoice && $entity->needsNumber()) {
$entity->setNumber($em->getRepository('SiwappInvoiceBundle:Invoice')->getNextNumber($entity->getSerie()));
}
}
开发者ID:rvdavid,项目名称:siwapp-sf2,代码行数:9,代码来源:InvoiceSaveListener.php
示例18: preUpdate
public function preUpdate(PreUpdateEventArgs $args)
{
$entity = $args->getEntity();
if ($entity instanceof Issue) {
if ($args->hasChangedField('assignee')) {
$entity->addCollaborator($entity->getAssignee());
}
}
}
开发者ID:DenysZakharov,项目名称:task-tracker,代码行数:9,代码来源:CollaboratorEventListener.php
示例19: preUpdate
public function preUpdate(PreUpdateEventArgs $args)
{
$entity = $args->getEntity();
if ($entity instanceof $this->orderClass) {
$entity->setUpdatedAt(new \DateTime());
$this->updatePrices($entity);
$this->updateFields($entity);
}
}
开发者ID:hunter686,项目名称:hitechonline,代码行数:9,代码来源:OrderListener.php
示例20: preUpdate
/**
* Delete old avatar image from disk if it has been changed
*
* @param User $user
* @param PreUpdateEventArgs $event
*/
public function preUpdate(User $user, PreUpdateEventArgs $event)
{
if ($event->hasChangedField('avatarImage')) {
$oldAvatarImage = $event->getOldValue('avatarImage');
if (!empty($oldAvatarImage)) {
$this->userService->deleteAvatar($oldAvatarImage);
}
}
}
开发者ID:CampaignChain,项目名称:core,代码行数:15,代码来源:UserAvatarListener.php
注:本文中的Doctrine\ORM\Event\PreUpdateEventArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论