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


PHP Entity::clear方法代码示例

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


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

示例1: loadUserColumnFields

 public function loadUserColumnFields(Entity $entity)
 {
     $pdo = $this->getEntityManager()->getPDO();
     $sql = "\n            SELECT is_read AS 'isRead', is_important AS 'isImportant' FROM email_user\n            WHERE\n                deleted = 0 AND\n                user_id = " . $pdo->quote($this->getUser()->id) . " AND\n                email_id = " . $pdo->quote($entity->id) . "\n        ";
     $sth = $pdo->prepare($sql);
     $sth->execute();
     if ($row = $sth->fetch(\PDO::FETCH_ASSOC)) {
         $isRead = !empty($row['isRead']) ? true : false;
         $isImportant = !empty($row['isImportant']) ? true : false;
         $entity->set('isRead', $isRead);
         $entity->set('isImportant', $isImportant);
     } else {
         $entity->set('isRead', null);
         $entity->clear('isImportant');
     }
 }
开发者ID:blackmode,项目名称:espocrm,代码行数:16,代码来源:Email.php

示例2: prepareEntityForOutput

 public function prepareEntityForOutput(Entity $entity)
 {
     foreach ($this->internalFields as $field) {
         $entity->clear($field);
     }
 }
开发者ID:naushrambo,项目名称:espocrm,代码行数:6,代码来源:Record.php

示例3: prepareEntityForOutput

 public function prepareEntityForOutput(Entity $entity)
 {
     foreach ($this->internalAttributeList as $field) {
         $entity->clear($field);
     }
     foreach ($this->getAcl()->getScopeForbiddenAttributeList($entity->getEntityType(), 'read') as $attribute) {
         $entity->clear($attribute);
     }
 }
开发者ID:disearth,项目名称:espocrm,代码行数:9,代码来源:Record.php

示例4: save

 public function save(Entity $entity, array $options = array())
 {
     $nowString = date('Y-m-d H:i:s', time());
     $restoreData = array();
     if ($entity->isNew()) {
         if (!$entity->has('id')) {
             $entity->set('id', Util::generateId());
         }
         if ($entity->hasField('createdAt')) {
             $entity->set('createdAt', $nowString);
         }
         if ($entity->hasField('modifiedAt')) {
             $entity->set('modifiedAt', $nowString);
         }
         if ($entity->hasField('createdById')) {
             $entity->set('createdById', $this->entityManager->getUser()->id);
         }
         if ($entity->has('modifiedById')) {
             $restoreData['modifiedById'] = $entity->get('modifiedById');
         }
         if ($entity->has('modifiedAt')) {
             $restoreData['modifiedAt'] = $entity->get('modifiedAt');
         }
         $entity->clear('modifiedById');
     } else {
         if (empty($options['silent'])) {
             if ($entity->hasField('modifiedAt')) {
                 $entity->set('modifiedAt', $nowString);
             }
             if ($entity->hasField('modifiedById')) {
                 $entity->set('modifiedById', $this->entityManager->getUser()->id);
             }
         }
         if ($entity->has('createdById')) {
             $restoreData['createdById'] = $entity->get('createdById');
         }
         if ($entity->has('createdAt')) {
             $restoreData['createdAt'] = $entity->get('createdAt');
         }
         $entity->clear('createdById');
         $entity->clear('createdAt');
     }
     $this->restoreData = $restoreData;
     $result = parent::save($entity, $options);
     return $result;
 }
开发者ID:naushrambo,项目名称:espocrm,代码行数:46,代码来源:RDB.php

示例5: save

 public function save(Entity $entity)
 {
     $nowString = date('Y-m-d H:i:s', time());
     $restoreData = array();
     if ($entity->isNew()) {
         if (!$entity->has('id')) {
             $entity->set('id', uniqid());
         }
         if ($entity->hasField('createdAt')) {
             $entity->set('createdAt', $nowString);
         }
         if ($entity->hasField('createdById')) {
             $entity->set('createdById', $this->entityManager->getUser()->id);
         }
         if ($entity->has('modifiedById')) {
             $restoreData['modifiedById'] = $entity->get('modifiedById');
         }
         if ($entity->has('modifiedAt')) {
             $restoreData['modifiedAt'] = $entity->get('modifiedAt');
         }
         $entity->clear('modifiedById');
         $entity->clear('modifiedAt');
     } else {
         if ($entity->hasField('modifiedAt')) {
             $entity->set('modifiedAt', $nowString);
         }
         if ($entity->hasField('modifiedById')) {
             $entity->set('modifiedById', $this->entityManager->getUser()->id);
         }
         if ($entity->has('createdById')) {
             $restoreData['createdById'] = $entity->get('createdById');
         }
         if ($entity->has('createdAt')) {
             $restoreData['createdAt'] = $entity->get('createdAt');
         }
         $entity->clear('createdById');
         $entity->clear('createdAt');
     }
     $result = parent::save($entity);
     $entity->set($restoreData);
     $this->handleEmailAddressSave($entity);
     $this->handlePhoneNumberSave($entity);
     $this->handleSpecifiedRelations($entity);
     return $result;
 }
开发者ID:jdavis593,项目名称:appitechture,代码行数:45,代码来源:RDB.php


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