/**
  * @param \Hatimeria\ExtJSBundle\Parameter\ParameterBag $params
  * @param mixed $user
  * @return \Hatimeria\ExtJSBundle\Response\Form
  */
 public function process($params, $user = null)
 {
     $validationGroup = 'Profile';
     if (null === $user) {
         $validationGroup = 'Registration';
         $user = $this->um->createUser();
     }
     $options = array('data_class' => $this->userClass, 'validation_groups' => array($validationGroup));
     $type = new UserFormType();
     $type->setExtend($this->extensionCollector->getExtensions());
     $form = $this->formFactory->create($type, $user, $options);
     $form->bind($params->all());
     $result = new Form($form);
     if ($result->isValid()) {
         $this->um->updateUser($user);
         return $user;
     }
     return $result;
 }
 /**
  * @param \Hatimeria\ExtJSBundle\Parameter\ParameterBag $params
  * @return bool|\Hatimeria\ExtJSBundle\Validation\FormResponse
  */
 public function process($params)
 {
     $options = array('data_class' => $this->dataClass);
     if ($params->get('id')) {
         $repository = $this->em->getRepository($this->repositoryClass);
         $object = $repository->find(array((int) $params->get('id')));
         if (!is_object($object)) {
             throw new NotFoundHttpException('Object with given id not found');
         }
     } else {
         $name = $this->dataClass;
         $object = new $name();
     }
     $form = $this->formFactory->create(new CmsPageEditFormType(), $object, $options);
     $form->bind($params->all());
     if ($form->isValid()) {
         $this->onSuccess($object);
         return true;
     }
     return new Form($form);
 }
 /**
  * @param \Hatimeria\ExtJSBundle\Parameter\ParameterBag $params
  * @return bool|\Hatimeria\ExtJSBundle\Validation\FormResponse
  */
 public function process($params)
 {
     $options = array('data_class' => 'Hatimeria\\NewsletterBundle\\Entity\\Mailing');
     /* @var \Hatimeria\NewsletterBundle\Entity\Mailing $object */
     if ($params->get('id')) {
         $repository = $this->em->getRepository('HatimeriaNewsletterBundle:Mailing');
         $object = $repository->find(array((int) $params->get('id')));
         if (!is_object($object)) {
             throw new NotFoundHttpException('Object with given id not found');
         }
     } else {
         $object = new Mailing();
     }
     $form = $this->formFactory->create(new NewsletterEditFormType(), $object, $options);
     $form->bind($params->all());
     if ($form->isValid()) {
         $this->onSuccess($object);
         return true;
     }
     return new Form($form);
 }