Commit 6153231177837e50143b063f545c93e6819cbdb0

Authored by Wilmer
1 parent 65ea160827
Exists in master

añadido el servicio a la solicitud del pida

src/AppBundle/Controller/AdscripcionController.php
@@ -456,7 +456,7 @@ class AdscripcionController extends Controller @@ -456,7 +456,7 @@ class AdscripcionController extends Controller
456 'idRolInstitucion' => $this->getUser()->getIdRolInstitucion()->getId() 456 'idRolInstitucion' => $this->getUser()->getIdRolInstitucion()->getId()
457 )); 457 ));
458 458
459 - $serv = ""; 459 + $serv = false;
460 460
461 if($pid){ 461 if($pid){
462 $serv = $this->getDoctrine()->getRepository('AppBundle:DocenteServicio')-> 462 $serv = $this->getDoctrine()->getRepository('AppBundle:DocenteServicio')->
@@ -487,19 +487,20 @@ class AdscripcionController extends Controller @@ -487,19 +487,20 @@ class AdscripcionController extends Controller
487 if ($form->isSubmitted() && $form->isValid()) { 487 if ($form->isSubmitted() && $form->isValid()) {
488 $em = $this->getDoctrine()->getManager(); 488 $em = $this->getDoctrine()->getManager();
489 //Crear la solicitud de Servicio 489 //Crear la solicitud de Servicio
490 - if(!$pid) {  
491 - $servicios = new DocenteServicio(); 490 + if(!$serv) {
  491 + $serv = new DocenteServicio();
492 492
493 - $servicios->setIdRolInstitucion($this->getUser()->getIdRolInstitucion());  
494 - $servicios->setIdServicioCe($this->getDoctrine()->getRepository('AppBundle:ServiciosCe')->findOneById(4));  
495 - $servicios->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:estatus')->findOneById(2));  
496 - $em->persist($servicios); 493 + $serv->setIdRolInstitucion($this->getUser()->getIdRolInstitucion());
  494 + $serv->setIdServicioCe($this->getDoctrine()->getRepository('AppBundle:ServiciosCe')->findOneById(4));
  495 + $serv->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:estatus')->findOneById(2));
  496 + $em->persist($serv);
497 } 497 }
498 498
499 499
500 500
501 $pida->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); 501 $pida->setIdRolInstitucion($this->getUser()->getIdRolInstitucion());
502 $pida->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(2)); 502 $pida->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(2));
  503 + $pida->setIdDocenteServicio($serv);
503 foreach($pida->getPidaTareaEspecifico() as $especifico){ 504 foreach($pida->getPidaTareaEspecifico() as $especifico){
504 //var_dump($especifico); exit; 505 //var_dump($especifico); exit;
505 $especifico->setAdscripcionPidaId($pida); 506 $especifico->setAdscripcionPidaId($pida);
src/AppBundle/Entity/AdscripcionPida.php
@@ -45,6 +45,18 @@ class AdscripcionPida @@ -45,6 +45,18 @@ class AdscripcionPida
45 * }) 45 * })
46 */ 46 */
47 protected $idRolInstitucion; 47 protected $idRolInstitucion;
  48 +
  49 +
  50 + /**
  51 + * @var \AppBundle\Entity\DocenteServicio
  52 + *
  53 + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\DocenteServicio")
  54 + * @ORM\JoinColumns({
  55 + * @ORM\JoinColumn(name="id_docente_servicio", referencedColumnName="id", nullable=true)
  56 + * })
  57 + */
  58 + protected $idDocenteServicio;
  59 +
48 60
49 61
50 62
@@ -296,4 +308,27 @@ class AdscripcionPida @@ -296,4 +308,27 @@ class AdscripcionPida
296 public function __toString() { 308 public function __toString() {
297 return $this->getIdRolInstitucion()->getIdRol()->getIdPersona()->getPrimerNombre(); 309 return $this->getIdRolInstitucion()->getIdRol()->getIdPersona()->getPrimerNombre();
298 } 310 }
  311 +
  312 + /**
  313 + * Set idDocenteServicio
  314 + *
  315 + * @param \AppBundle\Entity\DocenteServicio $idDocenteServicio
  316 + * @return AdscripcionPida
  317 + */
  318 + public function setIdDocenteServicio(\AppBundle\Entity\DocenteServicio $idDocenteServicio)
  319 + {
  320 + $this->idDocenteServicio = $idDocenteServicio;
  321 +
  322 + return $this;
  323 + }
  324 +
  325 + /**
  326 + * Get idDocenteServicio
  327 + *
  328 + * @return \AppBundle\Entity\DocenteServicio
  329 + */
  330 + public function getIdDocenteServicio()
  331 + {
  332 + return $this->idDocenteServicio;
  333 + }
299 } 334 }