/** * @inheritdoc */ public function getById(\string $id) : CustomerView { $key = self::KEY . ':' . $id; if ($this->client->exists($key)) { $item = $this->client->hgetall($key); $model = $this->createViewModel($item); } else { $model = $this->repository->getById($id); $this->save($model); } return $model; }
public function notify(ProfileUpdatedEvent $event) { $user = $event->getUser(); $view = CustomerView::create($user->getId(), $user->getUsername(), $user->getAddress()->getCountry(), $user->getAddress()->getCity(), $user->getAddress()->getStreet(), $user->getAddress()->getZipCode()); $this->repository->save($view); }
public function getActualCustomer(GetActualCustomerQuery $query) { $user = $this->getActualUser(); $result = $this->viewRepository->getById($user->getId()); $query->setResult($result); }