public function getEntityByPrimary(\Bitrix\Main\Entity\Base $entity, $primary, $select) { $this->connectInternal(); $table = $entity->getDBTableName(); $sqlConfiguration = $entity->getConnection()->getConfiguration(); $primary = (array) $primary; if (count($primary) > 1) { throw new \Exception('HSPHP Read Socket doesn\'t support multiple select'); } $indexId = $this->resource->getIndexId($sqlConfiguration['database'], $table, '', join(',', (array) $select)); $this->resource->select($indexId, '=', $primary); $response = $this->resource->readResponse(); //foreach $result = array(); if (is_array($response)) { foreach ($response as $row) { $newRow = array(); foreach ($row as $k => $v) { $newRow[$select[$k]] = $v; } $result[] = $newRow; } } return $result; }