/** * @param $name * @param User $user * @return TodoList */ public function create($name, User $user) { $todolist = new TodoList(); $todolist->name = $name; $user->todolist()->save($todolist); return $todolist; }
/** * @param UserRegistrationDTO $user * @return User */ public function saveUser(UserRegistrationDTO $user) { $newUser = new User(); $newUser->name = $user->getName(); $newUser->email = $user->getEmail(); $newUser->password = $user->getPassword(); $newUser->save(); return $newUser; }