Ejemplo n.º 1
0
 /**
  * @param Request $request
  * @param Application $app
  * @param $idbio
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function addAction(Request $request, Application $app, $idbio)
 {
     $diploma = new Diploma();
     $diploma->setBio($idbio);
     $diplomaForm = $app['form.factory']->create(new DiplomaForm(), $diploma);
     $diplomaForm->handleRequest($request);
     if ($diplomaForm->isValid()) {
         $this->repository['diplomaRepository']->save($diploma);
         $app['session']->getFlashBag()->add('success', 'The diploma was successfully created.');
         return $app->redirect($app["url_generator"]->generate('listBio'));
     }
     return $app['twig']->render('Pages/Diploma/Add.html.twig', array('title' => 'New diploma', 'diplomaForm' => $diplomaForm->createView()));
 }
Ejemplo n.º 2
0
 /**
  * Creates an Article object based on a DB row.
  *
  * @param array $row The DB row containing Article data.
  * @return \Portfolio\Domain\Model\Article
  */
 protected function buildDomainObject($row)
 {
     $diploma = new Diploma();
     $diploma->setId($row['id']);
     $diploma->setStartDate($row['startDate']);
     $diploma->setEndDate($row['endDate']);
     $diploma->setTitle($row['title']);
     $diploma->setDescription($row['description']);
     $diploma->setBio($row['bio']);
     return $diploma;
 }