public function estuPnfEntity(Request $request, Estudiante $entity)
 {
     if (is_array($request->request->get('estuPnf'))) {
         $pnf = $request->request->get('estuPnf');
         $em = $this->getDoctrine()->getManager();
         $entityEstuPnf = $em->getRepository('AppBundle:EstuPnf')->findBy(array('estu' => $entity->getCedu()));
         $estuPnfIds = array();
         foreach ($entityEstuPnf as $key => $enti) {
             $pnfId = $enti->getPnf()->getPnfId();
             if (in_array($pnfId, $pnf)) {
                 if (($key = array_search($pnfId, $pnf)) !== false) {
                     unset($pnf[$key]);
                     sort($pnf);
                 }
             } else {
                 $estuPnfIds[] = $enti;
             }
         }
         //delete entity
         foreach ($estuPnfIds as $key => $value) {
             $em->remove($value);
         }
         if ($estuPnfIds) {
             $em->flush();
         }
         //add entity
         foreach ($pnf as $key => $value) {
             $entityPnf = $em->getRepository('AppBundle:Pnf')->find($value);
             if ($entityPnf) {
                 $entityEstuPnf = new EstuPnf();
                 $entityEstuPnf->setPnf($entityPnf);
                 $entity->addEstuPnf($entityEstuPnf);
             }
         }
     }
 }