odata-1c icon indicating copy to clipboard operation
odata-1c copied to clipboard

как добавить select и orderby?

Open antonh2o opened this issue 2 years ago • 2 comments

Здравствуйте! Большое спасибо за библиотеку, пробую использовать для интеграции. Подскажете, как ограничить выборку по полям? (например как можно отобрать только поля Data,КрайнийСрокУстранения &$select=Data,КрайнийСрокУстранения и как сделать сортировку (&$orderby=Контрагент/ИНН asc )?

antonh2o avatar Feb 10 '23 11:02 antonh2o

Добавьте в класс метод:

    public function orderBy($orderby) {
        $this->request_options['query']['$orderby'] = $orderby;
        return $this;
    }

bigsiter avatar Apr 13 '23 08:04 bigsiter

в /vendor/kilylabs/odata-1c/src/OData/Client.php Добавить код:

public function select($name) { $this->request_options['query']['$select'] = $name; return $this; }

public function orderBy($orderby) { $this->request_options['query']['$orderby'] = $orderby; return $this; }

Вывод

$data = $client->{'Catalog_икЛицевыеСчета'}->select('Ref_Key,Description')->get()->values(); echo '<pre>'; print_r($data); echo '</pre>';

GrafTurbin avatar May 30 '23 08:05 GrafTurbin