/**
  * {@inheritDoc}
  */
 public function setImage($image)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setImage', array($image));
     return parent::setImage($image);
 }
 public function testiaddAction(Request $request)
 {
     $testi = new \Acme\InfoBundle\Entity\Testimonials();
     $testi->setName('');
     $testi->setPost('');
     $testi->setDescription('');
     $testi->setImage('');
     $form = $this->createFormBuilder($testi)->add('name', 'text')->add('post', 'text')->add('description', 'textarea')->add('image', 'file')->add('save', 'submit', array('label' => 'Save'))->getForm();
     $form->handleRequest($request);
     $validator = $this->get('validator');
     $errors = $validator->validate($testi);
     if (count($errors) > 0) {
         return $this->render('AcmeInfoBundle:Default:testiadd.html.twig', array('form' => $form->createView()));
     } else {
         if ($request->isMethod('post') == 'save') {
             $a = $request->request->get('form');
             $img = $form['image']->getData()->getClientOriginalName();
             $em = $this->getDoctrine()->getManager();
             $a = $request->request->get('form');
             $testimonial = new \Acme\InfoBundle\Entity\Testimonials();
             $testimonial->setName($a['name']);
             $testimonial->setPost($a['post']);
             $testimonial->setDescription($a['description']);
             $testimonial->setImage($img);
             $em->persist($testimonial);
             $em->flush();
             $dir = $_SERVER['DOCUMENT_ROOT'] . '/uploads/testimonials/' . $testimonial->getId();
             mkdir($dir);
             $form->get('image')->getData()->move($dir, $img);
             $this->get('session')->getFlashBag()->set('notice', 'Your Record Add Successfully');
             return $this->redirect($this->generateUrl('acme_info_testimonials'));
         }
     }
     return $this->render('AcmeInfoBundle:Default:testiadd.html.twig', array('form' => $form->createView()));
 }