/**
  * Add portfolio
  *
  * @param \AppBundle\Entity\Portfolio $portfolio
  *
  * @return EconomicUser
  */
 public function addPortfolio(\AppBundle\Entity\Portfolio $portfolio)
 {
     $portfolio->setEconomicUser($this);
     $this->portfolios->add($portfolio);
 }
 /**
  * @Route("/profile_attachment/new", name="user_profile_attachment_new")
  * @Template()
  * @Security("has_role('ROLE_ECONOMIC')")
  */
 public function profileAttachmentNewAction(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $user = $this->get('security.token_storage')->getToken()->getUser();
     $portfolio = new Portfolio();
     $portfolio->setEconomicUser($user);
     $form = $this->createForm(PortfolioType::class, $portfolio);
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $data = $form->getData();
         $em->persist($data);
         $em->flush();
         //Audit
         $audit = new Audit();
         $audit->setUsername($user->getUsername());
         $audit->setName($user->getFirstname() . " " . $user->getLastname());
         $audit->setFunctionType("Economic");
         $audit->setEventType("New profile attachment");
         $em->persist($audit);
         $em->flush();
         return $this->redirect($this->generateUrl('user_profile_attachment_view'));
     }
     $engine = $this->container->get('templating');
     $content = $engine->render('AppBundle:User:new_profile_attachment.html.twig', array('form' => $form->createView()));
     return $response = new Response($content);
 }