當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。