public function __construct(UserInterface $user) { $this->userId = $user->getId(); $this->userType = $user->getType(); $this->createdAt = new \DateTime(); $this->generateToken(); }
/** * @param UserInterface $entity * @return $this */ public function setUserEntity(UserInterface $entity) { $method = 'set' . ucfirst($entity->getType()); $this->{$method}($entity); return $this; }
public static function getEntityClassByUser(UserInterface $user) { $type = ucfirst($user->getType()); return "Civix\\CoreBundle\\Entity\\Stripe\\Account{$type}"; }