public function queryIds(AbstractQuery $query, $parent = null) { $xpath = $parent . $query->getXPath(); $ids = []; foreach ($this->query($xpath) as $index => $element) { $ids[] = "({$xpath})[" . ($index + 1) . "]"; } return $query->getFilters()->matchAll($this, $ids); }
/** * @param Query\AbstractQuery $query * @param string $parentId * @return array */ public function getChildElementIds(Query\AbstractQuery $query, $parentId) { $data = ['using' => 'xpath', 'value' => '.' . $query->getXPath()]; $response = $this->client->request('post', "element/{$parentId}/elements", ['body' => json_encode($data)]); $elements = $this->getJson($response); return array_map([$this, 'convertElement'], $elements); }
/** * @param Query\AbstractQuery $query * @param string $parentId * @return array */ public function getChildElementIds(Query\AbstractQuery $query, $parentId) { return $this->jsonResponse($this->client->request('post', "element/{$parentId}/elements", ['form_params' => ['value' => '.' . $query->getXPath()]])); }