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


PHP Entity::getEntityType方法代码示例

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


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

示例1: 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

示例2: afterSave

 public function afterSave(Entity $entity, array $options = [])
 {
     if (!empty($options['silent']) || !empty($options['noNotifications'])) {
         return;
     }
     if ($this->getConfig()->get('assignmentEmailNotifications') && $entity->has('assignedUserId') && in_array($entity->getEntityType(), $this->getConfig()->get('assignmentEmailNotificationsEntityList', []))) {
         $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:mehulsbhatt,项目名称:espocrm,代码行数:14,代码来源:AssignmentEmailNotification.php

示例3: getEntityReminders

 public function getEntityReminders(Entity $entity)
 {
     $pdo = $this->getEntityManager()->getPDO();
     $reminders = array();
     $sql = "\n            SELECT id, `seconds`, `type`\n            FROM `reminder`\n            WHERE\n                `entity_type` = " . $pdo->quote($entity->getEntityType()) . " AND\n                `entity_id` = " . $pdo->quote($entity->id) . " AND\n                `deleted` = 0\n                ORDER BY `seconds` ASC\n        ";
     $sth = $pdo->prepare($sql);
     $sth->execute();
     $rows = $sth->fetchAll(\PDO::FETCH_ASSOC);
     foreach ($rows as $row) {
         $o = new \StdClass();
         $o->seconds = intval($row['seconds']);
         $o->type = $row['type'];
         $reminders[] = $o;
     }
     return $reminders;
 }
开发者ID:naushrambo,项目名称:espocrm,代码行数:16,代码来源:Meeting.php

示例4: afterUnrelateCases

 protected function afterUnrelateCases(Entity $entity, $foreign)
 {
     $case = null;
     if ($foreign instanceof Entity) {
         $case = $foreign;
     } else {
         if (is_string($foreign)) {
             $case = $this->getEntityManager()->getEntity('Case', $foreign);
         }
     }
     if (!$case) {
         return;
     }
     $note = $this->getEntityManager()->getRepository('Note')->where(array('type' => 'Relate', 'parentId' => $case->id, 'parentType' => 'Case', 'relatedId' => $entity->id, 'relatedType' => $entity->getEntityType()))->findOne();
     if (!$note) {
         return;
     }
     $this->getEntityManager()->removeEntity($note);
 }
开发者ID:houzhenggang,项目名称:espocrm,代码行数:19,代码来源:KnowledgeBaseArticle.php

示例5: 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

示例6: logClicked

 public function logClicked($campaignId, $queueItemId = null, Entity $target, Entity $trackingUrl, $actionDate = null)
 {
     $this->logOpened($campaignId, $queueItemId, $target);
     if ($queueItemId && $this->getEntityManager()->getRepository('CampaignLogRecord')->where(array('queueItemId' => $queueItemId, 'action' => 'Clicked', 'objectId' => $trackingUrl->id, 'objectType' => $trackingUrl->getEntityType()))->findOne()) {
         return;
     }
     if (empty($actionDate)) {
         $actionDate = date('Y-m-d H:i:s');
     }
     $logRecord = $this->getEntityManager()->getEntity('CampaignLogRecord');
     $logRecord->set(array('campaignId' => $campaignId, 'actionDate' => $actionDate, 'parentId' => $target->id, 'parentType' => $target->getEntityType(), 'action' => 'Clicked', 'objectId' => $trackingUrl->id, 'objectType' => $trackingUrl->getEntityType(), 'queueItemId' => $queueItemId));
     $this->getEntityManager()->saveEntity($logRecord);
 }
开发者ID:herrminni,项目名称:espocrm,代码行数:13,代码来源:Campaign.php

示例7: fetchFromMailServer

 public function fetchFromMailServer(Entity $emailAccount)
 {
     if ($emailAccount->get('status') != 'Active') {
         throw new Error();
     }
     $importer = new \Espo\Core\Mail\Importer($this->getEntityManager(), $this->getFileManager(), $this->getConfig());
     $maxSize = $this->getConfig()->get('emailMessageMaxSize');
     $user = $this->getEntityManager()->getEntity('User', $emailAccount->get('assignedUserId'));
     if (!$user) {
         throw new Error();
     }
     $userId = $user->id;
     $teamId = $user->get('defaultTeamId');
     $teamIds = array();
     if (!empty($teamId)) {
         $teamIds[] = $teamId;
     }
     $filterCollection = $this->getEntityManager()->getRepository('EmailFilter')->where(['OR' => [['parentType' => $emailAccount->getEntityType(), 'parentId' => $emailAccount->id], ['parentId' => null]]])->find();
     $fetchData = json_decode($emailAccount->get('fetchData'), true);
     if (empty($fetchData)) {
         $fetchData = array();
     }
     if (!array_key_exists('lastUID', $fetchData)) {
         $fetchData['lastUID'] = array();
     }
     if (!array_key_exists('lastUID', $fetchData)) {
         $fetchData['lastDate'] = array();
     }
     $storage = $this->getStorage($emailAccount);
     $monitoredFolders = $emailAccount->get('monitoredFolders');
     if (empty($monitoredFolders)) {
         throw new Error();
     }
     $portionLimit = $this->getConfig()->get('personalEmailMaxPortionSize', self::PORTION_LIMIT);
     $monitoredFoldersArr = explode(',', $monitoredFolders);
     foreach ($monitoredFoldersArr as $folder) {
         $folder = mb_convert_encoding(trim($folder), 'UTF7-IMAP', 'UTF-8');
         try {
             $storage->selectFolder($folder);
         } catch (\Exception $e) {
             $GLOBALS['log']->error('EmailAccount ' . $emailAccount->id . ' (Select Folder) [' . $e->getCode() . '] ' . $e->getMessage());
             continue;
         }
         $lastUID = 0;
         $lastDate = 0;
         if (!empty($fetchData['lastUID'][$folder])) {
             $lastUID = $fetchData['lastUID'][$folder];
         }
         if (!empty($fetchData['lastDate'][$folder])) {
             $lastDate = $fetchData['lastDate'][$folder];
         }
         if (!empty($lastUID)) {
             $ids = $storage->getIdsFromUID($lastUID);
         } else {
             $dt = new \DateTime($emailAccount->get('fetchSince'));
             if ($dt) {
                 $ids = $storage->getIdsFromDate($dt->format('d-M-Y'));
             } else {
                 return false;
             }
         }
         if (count($ids) == 1 && !empty($lastUID)) {
             if ($storage->getUniqueId($ids[0]) == $lastUID) {
                 continue;
             }
         }
         $k = 0;
         foreach ($ids as $i => $id) {
             if ($k == count($ids) - 1) {
                 $lastUID = $storage->getUniqueId($id);
             }
             if ($maxSize) {
                 if ($storage->getSize($id) > $maxSize * 1024 * 1024) {
                     $k++;
                     continue;
                 }
             }
             $message = null;
             $email = null;
             try {
                 $message = $storage->getMessage($id);
                 if ($message && $emailAccount->get('keepFetchedEmailsUnread')) {
                     $flags = $message->getFlags();
                 }
                 try {
                     $email = $importer->importMessage($message, $userId, $teamIds, $filterCollection);
                 } catch (\Exception $e) {
                     $GLOBALS['log']->error('EmailAccount ' . $emailAccount->id . ' (Import Message): [' . $e->getCode() . '] ' . $e->getMessage());
                 }
                 if ($emailAccount->get('keepFetchedEmailsUnread')) {
                     if (is_array($flags) && empty($flags[Storage::FLAG_SEEN])) {
                         $storage->setFlags($id, $flags);
                     }
                 }
             } catch (\Exception $e) {
                 $GLOBALS['log']->error('EmailAccount ' . $emailAccount->id . ' (Get Message): [' . $e->getCode() . '] ' . $e->getMessage());
             }
             if (!empty($email)) {
                 $this->noteAboutEmail($email);
             }
//.........这里部分代码省略.........
开发者ID:blackmode,项目名称:espocrm,代码行数:101,代码来源:EmailAccount.php

示例8: parseText

 protected function parseText($type, Entity $entity, $text)
 {
     $fieldList = array_keys($entity->getFields());
     foreach ($fieldList as $field) {
         $value = $entity->get($field);
         if (is_object($value)) {
             continue;
         }
         $fieldType = $this->getMetadata()->get('entityDefs.' . $entity->getEntityType() . '.fields.' . $field . '.type');
         if ($fieldType === 'enum') {
             $value = $this->getLanguage()->translateOption($value, $field, $entity->getEntityType());
         } else {
             if ($entity->fields[$field]['type'] == 'date') {
                 $value = $this->getDateTime()->convertSystemDateToGlobal($value);
             } else {
                 if ($entity->fields[$field]['type'] == 'datetime') {
                     $value = $this->getDateTime()->convertSystemDateTimeToGlobal($value);
                 }
             }
         }
         $text = str_replace('{' . $type . '.' . $field . '}', $value, $text);
     }
     return $text;
 }
开发者ID:disearth,项目名称:espocrm,代码行数:24,代码来源:EmailTemplate.php

示例9: checkEntity

 public function checkEntity(User $user, Entity $entity, $action)
 {
     $scope = $entity->getEntityType();
     $data = $this->getTable($user)->getScopeData($scope);
     $impl = $this->getImplementation($scope);
     $methodName = 'checkEntity' . ucfirst($action);
     if (method_exists($impl, $methodName)) {
         return $impl->{$methodName}($user, $entity, $data);
     }
     return $impl->checkEntity($user, $entity, $data, $action);
 }
开发者ID:disearth,项目名称:espocrm,代码行数:11,代码来源:AclManager.php

示例10: checkEntity

 public function checkEntity(User $user, Entity $entity, $action)
 {
     if ($user->isAdmin()) {
         return true;
     }
     $data = $this->getTable($user)->getScopeData($entity->getEntityType());
     return $this->getImplementation($entity->getEntityType())->checkEntity($user, $entity, $data, $action);
 }
开发者ID:naushrambo,项目名称:espocrm,代码行数:8,代码来源:AclManager.php

示例11: fetchFromMailServer

 public function fetchFromMailServer(Entity $emailAccount)
 {
     if ($emailAccount->get('status') != 'Active') {
         throw new Error();
     }
     $importer = new \Espo\Core\Mail\Importer($this->getEntityManager(), $this->getFileManager(), $this->getConfig());
     $maxSize = $this->getConfig()->get('emailMessageMaxSize');
     $teamId = $emailAccount->get('teamId');
     $userId = $this->getUser()->id;
     if ($emailAccount->get('assignToUserId')) {
         $userId = $emailAccount->get('assignToUserId');
     }
     $teamIds = array();
     if (!empty($teamId)) {
         $teamIds[] = $teamId;
     }
     $filterCollection = $this->getEntityManager()->getRepository('EmailFilter')->where(['OR' => [['parentType' => $emailAccount->getEntityType(), 'parentId' => $emailAccount->id], ['parentId' => null]]])->find();
     $fetchData = json_decode($emailAccount->get('fetchData'), true);
     if (empty($fetchData)) {
         $fetchData = array();
     }
     if (!array_key_exists('lastUID', $fetchData)) {
         $fetchData['lastUID'] = array();
     }
     if (!array_key_exists('lastUID', $fetchData)) {
         $fetchData['lastDate'] = array();
     }
     $imapParams = array('host' => $emailAccount->get('host'), 'port' => $emailAccount->get('port'), 'user' => $emailAccount->get('username'), 'password' => $this->getCrypt()->decrypt($emailAccount->get('password')));
     if ($emailAccount->get('ssl')) {
         $imapParams['ssl'] = 'SSL';
     }
     $storage = new \Espo\Core\Mail\Mail\Storage\Imap($imapParams);
     $monitoredFolders = $emailAccount->get('monitoredFolders');
     if (empty($monitoredFolders)) {
         $monitoredFolders = 'INBOX';
     }
     $monitoredFoldersArr = explode(',', $monitoredFolders);
     foreach ($monitoredFoldersArr as $folder) {
         $folder = mb_convert_encoding(trim($folder), 'UTF7-IMAP', 'UTF-8');
         try {
             $storage->selectFolder($folder);
         } catch (\Exception $e) {
             $GLOBALS['log']->error('InboundEmail ' . $emailAccount->id . ' (Select Folder) [' . $e->getCode() . '] ' . $e->getMessage());
             continue;
         }
         $lastUID = 0;
         $lastDate = 0;
         if (!empty($fetchData['lastUID'][$folder])) {
             $lastUID = $fetchData['lastUID'][$folder];
         }
         if (!empty($fetchData['lastDate'][$folder])) {
             $lastDate = $fetchData['lastDate'][$folder];
         }
         $ids = $storage->getIdsFromUID($lastUID);
         if (count($ids) == 1 && !empty($lastUID)) {
             if ($storage->getUniqueId($ids[0]) == $lastUID) {
                 continue;
             }
         }
         $k = 0;
         foreach ($ids as $i => $id) {
             $toSkip = false;
             if ($k == count($ids) - 1) {
                 $lastUID = $storage->getUniqueId($id);
             }
             if ($maxSize) {
                 if ($storage->getSize($id) > $maxSize * 1024 * 1024) {
                     $k++;
                     continue;
                 }
             }
             $message = null;
             $email = null;
             try {
                 $message = $storage->getMessage($id);
                 if ($message && isset($message->from)) {
                     $fromString = $message->from;
                     if (preg_match('/MAILER-DAEMON|POSTMASTER/i', $fromString)) {
                         $toSkip = true;
                         try {
                             $this->processBouncedMessage($message);
                         } catch (\Exception $e) {
                             $GLOBALS['log']->error('InboundEmail ' . $emailAccount->id . ' (Process Bounced Message: [' . $e->getCode() . '] ' . $e->getMessage());
                         }
                     }
                 }
                 if (!$toSkip) {
                     try {
                         $email = $importer->importMessage($message, $userId, $teamIds, $filterCollection);
                     } catch (\Exception $e) {
                         $GLOBALS['log']->error('InboundEmail ' . $emailAccount->id . ' (Import Message): [' . $e->getCode() . '] ' . $e->getMessage());
                     }
                 }
             } catch (\Exception $e) {
                 $GLOBALS['log']->error('InboundEmail ' . $emailAccount->id . ' (Get Message): [' . $e->getCode() . '] ' . $e->getMessage());
             }
             if (!empty($email)) {
                 if (!$emailAccount->get('createCase')) {
                     $this->noteAboutEmail($email);
                 }
//.........这里部分代码省略.........
开发者ID:sanduhrs,项目名称:espocrm,代码行数:101,代码来源:InboundEmail.php

示例12: beforeRemove

 public function beforeRemove(Entity $entity, array $options = array())
 {
     if (!empty($options['silent']) && !empty($options['noNotifications'])) {
         return;
     }
     $entityType = $entity->getEntityType();
     if ($this->checkHasStream($entityType)) {
         $followersData = $this->getStreamService()->getEntityFollowers($entity);
         foreach ($followersData['idList'] as $userId) {
             if ($userId === $this->getUser()->id) {
                 continue;
             }
             $notification = $this->getEntityManager()->getEntity('Notification');
             $notification->set(array('userId' => $userId, 'type' => 'EntityRemoved', 'data' => array('entityType' => $entity->getEntityType(), 'entityId' => $entity->id, 'entityName' => $entity->get('name'), 'userId' => $this->getUser()->id, 'userName' => $this->getUser()->get('name'))));
             $this->getEntityManager()->saveEntity($notification);
         }
     }
 }
开发者ID:naushrambo,项目名称:espocrm,代码行数:18,代码来源:Notifications.php

示例13: handleSpecifiedRelations

 protected function handleSpecifiedRelations(Entity $entity)
 {
     $relationTypeList = [$entity::HAS_MANY, $entity::MANY_MANY, $entity::HAS_CHILDREN];
     foreach ($entity->getRelations() as $name => $defs) {
         if (in_array($defs['type'], $relationTypeList)) {
             $fieldName = $name . 'Ids';
             $columnsFieldsName = $name . 'Columns';
             if ($entity->has($fieldName) || $entity->has($columnsFieldsName)) {
                 if ($this->getMetadata()->get("entityDefs." . $entity->getEntityType() . ".fields.{$name}.noSave")) {
                     continue;
                 }
                 if ($entity->has($fieldName)) {
                     $specifiedIds = $entity->get($fieldName);
                 } else {
                     $specifiedIds = array();
                     foreach ($entity->get($columnsFieldsName) as $id => $d) {
                         $specifiedIds[] = $id;
                     }
                 }
                 if (is_array($specifiedIds)) {
                     $toRemoveIds = array();
                     $existingIds = array();
                     $toUpdateIds = array();
                     $existingColumnsData = new \stdClass();
                     $defs = array();
                     $columns = $this->getMetadata()->get("entityDefs." . $entity->getEntityType() . ".fields.{$name}.columns");
                     if (!empty($columns)) {
                         $columnData = $entity->get($columnsFieldsName);
                         $defs['additionalColumns'] = $columns;
                     }
                     $foreignCollection = $entity->get($name, $defs);
                     if ($foreignCollection) {
                         foreach ($foreignCollection as $foreignEntity) {
                             $existingIds[] = $foreignEntity->id;
                             if (!empty($columns)) {
                                 $data = new \stdClass();
                                 foreach ($columns as $columnName => $columnField) {
                                     $foreignId = $foreignEntity->id;
                                     $data->{$columnName} = $foreignEntity->get($columnField);
                                 }
                                 $existingColumnsData->{$foreignId} = $data;
                                 $entity->setFetched($columnsFieldsName, $existingColumnsData);
                             }
                         }
                     }
                     if ($entity->has($fieldName)) {
                         $entity->setFetched($fieldName, $existingIds);
                     }
                     if ($entity->has($columnsFieldsName) && !empty($columns)) {
                         $entity->setFetched($columnsFieldsName, $existingColumnsData);
                     }
                     foreach ($existingIds as $id) {
                         if (!in_array($id, $specifiedIds)) {
                             $toRemoveIds[] = $id;
                         } else {
                             if (!empty($columns)) {
                                 foreach ($columns as $columnName => $columnField) {
                                     if ($columnData->{$id}->{$columnName} != $existingColumnsData->{$id}->{$columnName}) {
                                         $toUpdateIds[] = $id;
                                     }
                                 }
                             }
                         }
                     }
                     foreach ($specifiedIds as $id) {
                         if (!in_array($id, $existingIds)) {
                             $data = null;
                             if (!empty($columns) && isset($columnData->{$id})) {
                                 $data = $columnData->{$id};
                             }
                             $this->relate($entity, $name, $id, $data);
                         }
                     }
                     foreach ($toRemoveIds as $id) {
                         $this->unrelate($entity, $name, $id);
                     }
                     if (!empty($columns)) {
                         foreach ($toUpdateIds as $id) {
                             $data = $columnData->{$id};
                             $this->updateRelation($entity, $name, $id, $data);
                         }
                     }
                 }
             }
         } else {
             if ($defs['type'] === $entity::HAS_ONE) {
                 if (empty($defs['entity']) || empty($defs['foreignKey'])) {
                     return;
                 }
                 if ($this->getMetadata()->get("entityDefs." . $entity->getEntityType() . ".fields.{$name}.noSave")) {
                     continue;
                 }
                 $foreignEntityType = $defs['entity'];
                 $foreignKey = $defs['foreignKey'];
                 $idFieldName = $name . 'Id';
                 $nameFieldName = $name . 'Name';
                 if (!$entity->has($idFieldName)) {
                     return;
                 }
                 $where = array();
//.........这里部分代码省略.........
开发者ID:disearth,项目名称:espocrm,代码行数:101,代码来源:RDB.php

示例14: afterSave

 public function afterSave(Entity $entity, array $options = array())
 {
     $entityName = $entity->getEntityType();
     if ($this->checkHasStream($entity)) {
         if ($entity->isNew()) {
             $userIdList = [];
             $assignedUserId = $entity->get('assignedUserId');
             $createdById = $entity->get('createdById');
             if ($this->getConfig()->get('followCreatedEntities') && !empty($createdById)) {
                 $userIdList[] = $createdById;
             }
             if (!empty($assignedUserId) && !in_array($assignedUserId, $userIdList)) {
                 $userIdList[] = $assignedUserId;
             }
             if (!empty($userIdList)) {
                 $this->getStreamService()->followEntityMass($entity, $userIdList);
             }
             if (empty($options['noStream']) && empty($options['silent'])) {
                 $this->getStreamService()->noteCreate($entity);
             }
             if (in_array($this->getUser()->id, $userIdList)) {
                 $entity->set('isFollowed', true);
             }
             $autofollowUserIdList = $this->getAutofollowUserIdList($entity, $userIdList);
             foreach ($autofollowUserIdList as $i => $userId) {
                 if (in_array($userId, $userIdList)) {
                     unset($autofollowUserIdList[$i]);
                 }
             }
             $autofollowUserIdList = array_values($autofollowUserIdList);
             if (!empty($autofollowUserIdList)) {
                 $job = $this->getEntityManager()->getEntity('Job');
                 $job->set(array('serviceName' => 'Stream', 'method' => 'afterRecordCreatedJob', 'data' => array('userIdList' => $autofollowUserIdList, 'entityType' => $entity->getEntityType(), 'entityId' => $entity->id)));
                 $this->getEntityManager()->saveEntity($job);
             }
         } else {
             if (empty($options['noStream']) && empty($options['silent'])) {
                 if ($entity->isFieldChanged('assignedUserId')) {
                     $assignedUserId = $entity->get('assignedUserId');
                     if (!empty($assignedUserId)) {
                         $this->getStreamService()->followEntity($entity, $assignedUserId);
                         $this->getStreamService()->noteAssign($entity);
                         if ($this->getUser()->id === $assignedUserId) {
                             $entity->set('isFollowed', true);
                         }
                     }
                 }
                 $this->getStreamService()->handleAudited($entity);
                 $statusFields = $this->getStatusFields();
                 if (array_key_exists($entityName, $this->statusFields)) {
                     $field = $this->statusFields[$entityName];
                     $value = $entity->get($field);
                     if (!empty($value) && $value != $entity->getFetched($field)) {
                         $this->getStreamService()->noteStatus($entity, $field);
                     }
                 }
             }
         }
     }
     if ($entity->isNew() && empty($options['noStream']) && empty($options['silent']) && $this->getMetadata()->get("scopes.{$entityName}.tab")) {
         $this->handleCreateRelated($entity);
     }
 }
开发者ID:mehulsbhatt,项目名称:espocrm,代码行数:63,代码来源:Stream.php

示例15: getEntityFollowers

 public function getEntityFollowers(Entity $entity, $offset = 0, $limit = false)
 {
     $query = $this->getEntityManager()->getQuery();
     $pdo = $this->getEntityManager()->getPDO();
     if (!$limit) {
         $limit = 200;
     }
     $sql = $query->createSelectQuery('User', array('select' => ['id', 'name'], 'customJoin' => "\n                JOIN subscription AS `subscription` ON\n                    subscription.user_id = user.id AND\n                    subscription.entity_id = " . $query->quote($entity->id) . " AND\n                    subscription.entity_type = " . $query->quote($entity->getEntityType()) . "\n            ", 'offset' => $offset, 'limit' => $limit, 'whereClause' => array('isActive' => true), 'orderBy' => [['LIST:id:' . $this->getUser()->id, 'DESC'], ['name']]));
     $sth = $pdo->prepare($sql);
     $sth->execute();
     $data = array('idList' => [], 'nameMap' => new \StdClass());
     while ($row = $sth->fetch(\PDO::FETCH_ASSOC)) {
         $id = $row['id'];
         $data['idList'][] = $id;
         $data['nameMap']->{$id} = $row['name'];
     }
     return $data;
 }
开发者ID:naushrambo,项目名称:espocrm,代码行数:18,代码来源:Stream.php


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