/** * Do the initialization logic * * @return void * @throws RpcExceptionInterface */ protected function doInitialize() { $persister = $this->manager->getUnitOfWork()->getEntityPersister($this->metadata->getName()); /** @var Collection $collection */ $collection = call_user_func_array([$persister, 'loadAll'], $this->searchArgs); if ($collection instanceof AbstractLazyCollection && $this->owner) { $collection = $persister->loadOneToManyCollection($this->association, $this->owner, $collection); } $this->collection = $collection; }
/** {@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; }