/** * {@inheritDoc} * @see \Fixin\Model\Repository\RepositoryInterface::refresh($entity) */ public function refresh(EntityInterface $entity) : RepositoryInterface { if ($entity->isStored()) { $request = $this->createRequest(); $request->getWhere()->id($entity->getEntityId()); $data = $request->fetchRawData()->current(); if ($data !== false) { $entity->exchangeArray($data); $this->getEntityCache()->update($entity); return $this; } throw new EntityRefreshFaultException(static::EXCEPTION_ENTITY_REFRESH_ERROR); } throw new EntityRefreshFaultException(static::EXCEPTION_NOT_STORED_ENTITY); }