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


PHP Entity::isFieldChanged方法代码示例

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


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

示例1: afterSave

 public function afterSave(Entity $entity)
 {
     if ($this->getConfig()->get('assignmentEmailNotifications') && in_array($entity->getEntityName(), $this->getConfig()->get('assignmentEmailNotificationsEntityList', array()))) {
         $userId = $entity->get('assignedUserId');
         if (!empty($userId) && $userId != $this->getUser()->id && $entity->isFieldChanged('assignedUserId')) {
             $job = $this->getEntityManager()->getEntity('Job');
             $job->set(array('serviceName' => 'EmailNotification', 'method' => 'notifyAboutAssignmentJob', 'data' => json_encode(array('userId' => $userId, 'assignerUserId' => $this->getUser()->id, 'entityId' => $entity->id, 'entityType' => $entity->getEntityName())), 'executeTime' => date('Y-m-d H:i:s')));
             $this->getEntityManager()->saveEntity($job);
         }
     }
 }
开发者ID:lucasmattos,项目名称:crm,代码行数:11,代码来源:AssignmentEmailNotification.php

示例2: process

 public function process(Entity $entity)
 {
     if ($entity->has('assignedUserId') && $entity->get('assignedUserId')) {
         $assignedUserId = $entity->get('assignedUserId');
         if ($assignedUserId != $this->getUser()->id && $entity->isFieldChanged('assignedUserId')) {
             $notification = $this->getEntityManager()->getEntity('Notification');
             $notification->set(array('type' => 'Assign', 'userId' => $assignedUserId, 'data' => array('entityType' => $entity->getEntityType(), 'entityId' => $entity->id, 'entityName' => $entity->get('name'), 'isNew' => $entity->isNew(), 'userId' => $this->getUser()->id, 'userName' => $this->getUser()->get('name'))));
             $this->getEntityManager()->saveEntity($notification);
         }
     }
 }
开发者ID:naushrambo,项目名称:espocrm,代码行数:11,代码来源:Base.php

示例3: beforeSave

 protected function beforeSave(Entity $entity)
 {
     if ($entity->isNew()) {
         $userName = $entity->get('userName');
         if (empty($userName)) {
             throw new Error();
         }
         $user = $this->where(array('userName' => $userName))->findOne();
         if ($user) {
             throw new Error();
         }
     } else {
         if ($entity->isFieldChanged('userName')) {
             $userName = $entity->get('userName');
             if (empty($userName)) {
                 throw new Error();
             }
             $user = $this->where(array('userName' => $userName, 'id!=' => $entity->id))->findOne();
             if ($user) {
                 throw new Error();
             }
         }
     }
 }
开发者ID:lucasmattos,项目名称:crm,代码行数:24,代码来源:User.php

示例4: isPermittedAssignedUser

 public function isPermittedAssignedUser(Entity $entity)
 {
     if (!$entity->hasField('assignedUserId')) {
         return true;
     }
     $assignedUserId = $entity->get('assignedUserId');
     if (empty($assignedUserId)) {
         return true;
     }
     $assignmentPermission = $this->getAcl()->get('assignmentPermission');
     if (empty($assignmentPermission) || $assignmentPermission === true || !in_array($assignmentPermission, ['team', 'no'])) {
         return true;
     }
     $toProcess = false;
     if (!$entity->isNew()) {
         if ($entity->isFieldChanged('assignedUserId')) {
             $toProcess = true;
         }
     } else {
         $toProcess = true;
     }
     if ($toProcess) {
         if ($assignmentPermission == 'no') {
             if ($this->getUser()->id != $assignedUserId) {
                 return false;
             }
         } else {
             if ($assignmentPermission == 'team') {
                 $teamIds = $this->getUser()->get('teamsIds');
                 if (!$this->getEntityManager()->getRepository('User')->checkBelongsToAnyOfTeams($assignedUserId, $teamIds)) {
                     return false;
                 }
             }
         }
     }
     return true;
 }
开发者ID:naushrambo,项目名称:espocrm,代码行数:37,代码来源:Record.php


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