public function process() { if ($this->form->isValid()) { if ('POST' == $this->request->getMethod()) { /** @var User $user */ $user = $this->form->getData(); // Check if user already registred if (!$user->getId() && $user->getEmail()) { $user_db = $this->em->getRepository('ESNUserBundle:User')->findOneBy(array("email" => $user->getEmail())); if ($user_db) { $this->form->get('email')->addError(new FormError('Email already used')); return false; } } if ($this->form->has('sendmail') && $this->form->get('sendmail')->getData()) { $this->sendEmail($user); } if ($this->form->has('trial') && $this->form->get('trial')->getData()) { $follow = new EsnerFollow(); $follow->setTrialstarted($this->form->get('trial')->getData()); $this->em->persist($follow); $user->setFollow($follow); } $this->onSuccess($user); return true; } } return false; }
public function process() { if ($this->form->isValid()) { if ('POST' == $this->request->getMethod()) { /** @var User $user */ $user = $this->form->getData(); if ($this->form->has('sendmail') && $this->form->get('sendmail')->getData()) { $this->sendEmail($user); } if ($this->form->has('trial') && $this->form->get('trial')->getData()) { $follow = new EsnerFollow(); $follow->setTrialstarted($this->form->get('trial')->getData()); $this->em->persist($follow); $user->setFollow($follow); } $this->onSuccess($user); return true; } } return false; }