public function __construct(UserHelpAlert $helpAlertDTO) { $this->id = $helpAlertDTO->getId(); $this->user = new UserDTO($helpAlertDTO->getUser()); $this->isDeprecated = $helpAlertDTO->isDeprecated(); $this->hasCalledPolice = $helpAlertDTO->hasCalledPolice(); }
/** * @param UserHelpAlert $userHelpAlert * @param User $user * @param Alert $alert * * @return UserHelpAlertDTO */ public function createUserHelpAlert(UserHelpAlert $userHelpAlert, User $user, Alert $alert) { $userHelpAlert->setAlert($alert); $userHelpAlert->setUser($user); $this->em->persist($userHelpAlert); $this->em->flush(); return new UserHelpAlertDTO($userHelpAlert); }