/** * @return UserId */ public function userId() { if (is_null($this->userId)) { $this->userId = UserId::fromString($this->aggregateId()); } return $this->userId; }
/** * @return UserId */ public function assigneeId() { if (is_null($this->assigneeId)) { $this->assigneeId = UserId::fromString($this->payload['assignee_id']); } return $this->assigneeId; }
/** * @param UserId $userId * @return UserNotFound */ public static function withUserId(UserId $userId) { return new self(sprintf('User with id %s cannot be found.', $userId->toString())); }
/** * @return string representation of the unique identifier of the aggregate root */ protected function aggregateId() { return $this->userId->toString(); }
/** * @return UserId */ public function assigneeId() { return UserId::fromString($this->payload['assignee_id']); }
/** * @return UserId */ public function userId() { return UserId::fromString($this->payload['user_id']); }
/** * @param UserId $other * @return bool */ public function sameValueAs(UserId $other) { return $this->toString() === $other->toString(); }
/** * @param UserId $userId * @return User */ public function get(UserId $userId) { return $this->getAggregateRoot($userId->toString()); }