public function __construct(UserInterface $user) { $this->userId = $user->getId(); $this->userType = $user->getType(); $this->createdAt = new \DateTime(); $this->generateToken(); }