/** {@inheritdoc} */ public function count(RpcClientInterface $client, ApiMetadata $metadata, array $parameters) { call_user_func_array([$this, 'configure'], $parameters); $parameters = $this->getSearchRequestParams(); $request = new RpcRequest($metadata->getMethodContainer()->getMethod('count'), $parameters); return (int) $client->invoke($request)->getResponse($request)->getBody(); }
/** {@inheritdoc} */ public function find(RpcClientInterface $client, ApiMetadata $metadata, array $identifiers) { $request = new RpcRequest($metadata->getMethodContainer()->getMethod('find'), $identifiers); $entityCache = $this->manager->getEntityCache(); if (null !== $entityCache) { $body = $entityCache->get($metadata->getName(), $identifiers); if (null !== $body) { return $body; } } $response = $client->invoke([$request])->getResponse($request); if (!$response->isSuccessful()) { return null; } $body = $response->getBody(); if (null !== $entityCache) { $entityCache->set($body, $metadata, $identifiers); } return $body; }