%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 18.118.166.106 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/catalog/general/ |
Upload File : |
<? use Bitrix\Catalog; class CCatalogResult extends CDBResult { /** @var null|Catalog\Model\Entity $entity */ private $entity = null; private $fields = array(); private $resultKeys = array(); private $erasedKeys = array(); public function __construct($entity, $result = null) { parent::__construct($result); $this->entity = new $entity; $this->resultKeys = array(); $this->fields = $this->entity->getCachedFieldList(); if (!empty($this->fields)) $this->resultKeys = array_fill_keys($this->fields, true); } public function setResult($result) { parent::__construct($result); } public function prepareSelect(array $select) { $this->erasedKeys = array(); if ( empty($select) || (is_string($select) && $select == '*') || (is_array($select) && in_array('*', $select)) ) return $select; foreach ($this->fields as $field) { $index = array_search($field, $select); if ($index !== false) continue; $select[] = $field; $this->erasedKeys[$field] = true; } unset($index, $field); return $select; } public function Fetch() { $row = parent::Fetch(); if (!isset($this) || !is_object($this)) return $row; if (empty($row)) { $this->erasedKeys = array(); return $row; } if (empty($this->fields)) return $row; if (isset($row['ID'])) { $this->entity->setCacheItem($row['ID'], $row); if (!empty($this->erasedKeys)) $row = array_diff_key($row, $this->erasedKeys); } return $row; } }