diff --git a/app/Resources/views/cea/acta_defensa_mostar.html.twig b/app/Resources/views/cea/acta_defensa_mostar.html.twig
index ccfcb40..5d28600 100644
--- a/app/Resources/views/cea/acta_defensa_mostar.html.twig
+++ b/app/Resources/views/cea/acta_defensa_mostar.html.twig
@@ -163,7 +163,7 @@
{% set cantidadJurado = 6 %}
- {% for tutor in ascenso.tutoresAscenso %}
+ {% for tutor in ascenso.tutores %}
{% if loop.length == 6 %}
{% set anadirJurado = false %}
{% else %}
@@ -172,8 +172,8 @@
-
- {{ tutor.nombres }} {{ tutor.apellidos }}:
- {{ tutor.institucion }} -> {{ tutor.idEscala.nombre }}
+ {{ tutor.idTutor.nombres }} {{ tutor.idTutor.apellidos }}:
+ {{ tutor.idTutor.institucion }} -> {{ tutor.idTutor.idEscala.nombre }}
diff --git a/app/Resources/views/cea/ascenso_mostar.html.twig b/app/Resources/views/cea/ascenso_mostar.html.twig
index 0765560..8494dba 100644
--- a/app/Resources/views/cea/ascenso_mostar.html.twig
+++ b/app/Resources/views/cea/ascenso_mostar.html.twig
@@ -163,7 +163,7 @@
{% set cantidadJurado = 6 %}
- {% for tutor in ascenso.tutoresAscenso %}
+ {% for tutor in ascenso.tutores %}
{% if loop.length == 6 %}
{% set anadirJurado = false %}
{% else %}
@@ -172,8 +172,8 @@
-
- {{ tutor.nombres }} {{ tutor.apellidos }}:
- {{ tutor.institucion }} -> {{ tutor.idEscala.nombre }}
+ {{ tutor.idTutor.nombres }} {{ tutor.idTutor.apellidos }}:
+ {{ tutor.idTutor.institucion }} -> {{ tutor.idTutor.idEscala.nombre }}
@@ -380,7 +380,7 @@
cache: false,
data: ({ eliminar: eliminado, ascensoId: {{ ascenso.id }} }),
success: function (data) {
- alert(cantidad);
+ alert(cantidad);
console.log("esto es id: " + eliminado);
$("#well_" + eliminado).remove();
cantidad = cantidad + 1;
diff --git a/src/AppBundle/Controller/AjaxController.php b/src/AppBundle/Controller/AjaxController.php
index 8956a89..11a7455 100644
--- a/src/AppBundle/Controller/AjaxController.php
+++ b/src/AppBundle/Controller/AjaxController.php
@@ -7,6 +7,7 @@
*/
namespace AppBundle\Controller;
+use AppBundle\Entity\AscensoTutores;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
@@ -202,19 +203,25 @@ class AjaxController extends Controller {
$ascensoId = filter_input(INPUT_POST, 'ascensoId', FILTER_SANITIZE_SPECIAL_CHARS);
- $ascenso = $this->getDoctrine()->getRepository("AppBundle:Ascenso")->findOneById($ascensoId);
-
+ $ascenso = $this->getDoctrine()->getRepository("AppBundle:Ascenso")->findOneById($ascensoId);
+ $em = $this->getDoctrine()->getManager();
foreach ($jurados as $jurado){
$adicionar = $this->getDoctrine()->getRepository("AppBundle:TutoresAscenso")->findOneById($jurado);
- $ascenso->addTutoresAscenso($adicionar);
- $nuevos_nombres[] = $adicionar->getNombres() . " " . $adicionar->getApellidos();
- $nuevos_institucion[] = $adicionar->getInstitucion() . " -> " . $adicionar->getIdEscala()->getNombre();
- $nuevos_id[] = $adicionar->getId();
+ $ascensoTutor = new AscensoTutores();
+ $ascensoTutor->setIdAscenso($ascenso);
+ $ascensoTutor->setIdTutor($adicionar);
+ $ascensoTutor->setIdEstatus($em->getRepository("AppBundle:Estatus")->findOneById(2));
+ $em->persist($ascensoTutor);
+ $em->flush();
+
+ $nuevos_nombres[] = $ascensoTutor->getIdTutor()->getNombres() . " " . $ascensoTutor->getIdTutor()->getApellidos();
+ $nuevos_institucion[] = $ascensoTutor->getIdTutor()->getInstitucion() . " -> " . $ascensoTutor->getIdTutor()->getIdEscala()->getNombre();
+ $nuevos_id[] = $ascensoTutor->getIdTutor()->getId();
}
- $em = $this->getDoctrine()->getManager();
+
$em->persist($ascenso);
$em->flush();
@@ -370,19 +377,20 @@ class AjaxController extends Controller {
$eliminar = filter_input(INPUT_POST, 'eliminar', FILTER_SANITIZE_SPECIAL_CHARS);
$ascensoId = filter_input(INPUT_POST, 'ascensoId', FILTER_SANITIZE_SPECIAL_CHARS);
-
- $ascenso = $this->getDoctrine()->getRepository("AppBundle:Ascenso")->findOneById($ascensoId);
-
-
- $quitarJurado = $this->getDoctrine()->getRepository("AppBundle:TutoresAscenso")->findOneById($eliminar);
- $ascenso->removeTutoresAscenso($quitarJurado);
+
+
+ $quitarJurado = $this->getDoctrine()->getRepository("AppBundle:AscensoTutores")->findOneById($eliminar);
+
+ if (!$quitarJurado) {
+ throw $this->createNotFoundException('no se encontrĂ³ el jurado solicitado');
+ }
$em = $this->getDoctrine()->getManager();
- $em->persist($ascenso);
- $em->flush();
+ $em->remove($quitarJurado);
+ $em->flush();
$response = new JsonResponse();
$response->setStatusCode(200);
diff --git a/src/AppBundle/Controller/AscensoController.php b/src/AppBundle/Controller/AscensoController.php
index 9d1a465..82f2332 100644
--- a/src/AppBundle/Controller/AscensoController.php
+++ b/src/AppBundle/Controller/AscensoController.php
@@ -9,6 +9,7 @@
namespace AppBundle\Controller;
+use AppBundle\Entity\AscensoTutores;
use AppBundle\Entity\DocumentosVerificados;
use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
@@ -262,7 +263,12 @@ class AscensoController extends Controller
$tutores = $form->get('tutores_ascenso')->getData();
foreach ($tutores as $tutor){
- $ascenso->addTutoresAscenso($tutor);
+ $ascensoTutor = new AscensoTutores();
+ $ascensoTutor->setIdAscenso($ascenso);
+ $ascensoTutor->setIdTutor($tutor);
+ $ascensoTutor->setIdEstatus($em->getRepository("AppBundle:Estatus")->findOneById(2));
+ $em->persist($ascensoTutor);
+ $em->flush();
}
diff --git a/src/AppBundle/Entity/Ascenso.php b/src/AppBundle/Entity/Ascenso.php
index c1c44b8..1f96b7d 100644
--- a/src/AppBundle/Entity/Ascenso.php
+++ b/src/AppBundle/Entity/Ascenso.php
@@ -48,6 +48,11 @@ class Ascenso
* })
*/
protected $idEscalafones;
+
+ /**
+ * @ORM\OneToMany(targetEntity="AppBundle\Entity\AscensoTutores", mappedBy="idAscenso")
+ */
+ private $tutores;
@@ -113,21 +118,6 @@ class Ascenso
protected $idEstatus;
- /**
- * @var \Doctrine\Common\Collections\Collection
- *
- * @ORM\ManyToMany(targetEntity="AppBundle\Entity\TutoresAscenso", inversedBy="ascenso")
- * @ORM\JoinTable(name="ascenso_tutor",
- * joinColumns={
- * @ORM\JoinColumn(name="ascenso_id", referencedColumnName="id", nullable=false)
- * },
- * inverseJoinColumns={
- * @ORM\JoinColumn(name="tutor_id", referencedColumnName="id", nullable=false)
- * }
- * )
- */
- protected $tutoresAscenso;
-
/**
* @ORM\PrePersist
@@ -299,47 +289,6 @@ class Ascenso
/**
- * Constructor
- */
- public function __construct()
- {
- $this->tutoresAscenso = new \Doctrine\Common\Collections\ArrayCollection();
- }
-
- /**
- * Add tutoresAscenso
- *
- * @param \AppBundle\Entity\TutoresAscenso $tutoresAscenso
- * @return Ascenso
- */
- public function addTutoresAscenso(\AppBundle\Entity\TutoresAscenso $tutoresAscenso)
- {
- $this->tutoresAscenso[] = $tutoresAscenso;
-
- return $this;
- }
-
- /**
- * Remove tutoresAscenso
- *
- * @param \AppBundle\Entity\TutoresAscenso $tutoresAscenso
- */
- public function removeTutoresAscenso(\AppBundle\Entity\TutoresAscenso $tutoresAscenso)
- {
- $this->tutoresAscenso->removeElement($tutoresAscenso);
- }
-
- /**
- * Get tutoresAscenso
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getTutoresAscenso()
- {
- return $this->tutoresAscenso;
- }
-
- /**
*
* @return string
*/
@@ -442,4 +391,44 @@ class Ascenso
{
return $this->tesisUbv;
}
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ $this->tutores = new \Doctrine\Common\Collections\ArrayCollection();
+ }
+
+ /**
+ * Add tutores
+ *
+ * @param \AppBundle\Entity\AscensoTutores $tutores
+ * @return Ascenso
+ */
+ public function addTutore(\AppBundle\Entity\AscensoTutores $tutores)
+ {
+ $this->tutores[] = $tutores;
+
+ return $this;
+ }
+
+ /**
+ * Remove tutores
+ *
+ * @param \AppBundle\Entity\AscensoTutores $tutores
+ */
+ public function removeTutore(\AppBundle\Entity\AscensoTutores $tutores)
+ {
+ $this->tutores->removeElement($tutores);
+ }
+
+ /**
+ * Get tutores
+ *
+ * @return \Doctrine\Common\Collections\Collection
+ */
+ public function getTutores()
+ {
+ return $this->tutores;
+ }
}
diff --git a/src/AppBundle/Entity/AscensoTutores.php b/src/AppBundle/Entity/AscensoTutores.php
new file mode 100644
index 0000000..fe585ef
--- /dev/null
+++ b/src/AppBundle/Entity/AscensoTutores.php
@@ -0,0 +1,185 @@
+id;
+ }
+
+ /**
+ * Set idAscenso
+ *
+ * @param \AppBundle\Entity\Ascenso $idAscenso
+ * @return AscensoTutores
+ */
+ public function setIdAscenso(\AppBundle\Entity\Ascenso $idAscenso)
+ {
+ $this->idAscenso = $idAscenso;
+
+ return $this;
+ }
+
+ /**
+ * Get idAscenso
+ *
+ * @return \AppBundle\Entity\Ascenso
+ */
+ public function getIdAscenso()
+ {
+ return $this->idAscenso;
+ }
+
+ /**
+ * Set idTutor
+ *
+ * @param \AppBundle\Entity\TutoresAscenso $idTutor
+ * @return AscensoTutores
+ */
+ public function setIdTutor(\AppBundle\Entity\TutoresAscenso $idTutor)
+ {
+ $this->idTutor = $idTutor;
+
+ return $this;
+ }
+
+ /**
+ * Get idTutor
+ *
+ * @return \AppBundle\Entity\TutoresAscenso
+ */
+ public function getIdTutor()
+ {
+ return $this->idTutor;
+ }
+
+ /**
+ * Set idEstatusTutor
+ *
+ * @param \AppBundle\Entity\EstatusTutor $idEstatusTutor
+ * @return AscensoTutores
+ */
+ public function setIdEstatusTutor(\AppBundle\Entity\EstatusTutor $idEstatusTutor)
+ {
+ $this->idEstatusTutor = $idEstatusTutor;
+
+ return $this;
+ }
+
+ /**
+ * Get idEstatusTutor
+ *
+ * @return \AppBundle\Entity\EstatusTutor
+ */
+ public function getIdEstatusTutor()
+ {
+ return $this->idEstatusTutor;
+ }
+
+ /**
+ * Set idEstatus
+ *
+ * @param \AppBundle\Entity\Estatus $idEstatus
+ * @return AscensoTutores
+ */
+ public function setIdEstatus(\AppBundle\Entity\Estatus $idEstatus)
+ {
+ $this->idEstatus = $idEstatus;
+
+ return $this;
+ }
+
+ /**
+ * Get idEstatus
+ *
+ * @return \AppBundle\Entity\Estatus
+ */
+ public function getIdEstatus()
+ {
+ return $this->idEstatus;
+ }
+}
diff --git a/src/AppBundle/Entity/EstatusTutor.php b/src/AppBundle/Entity/EstatusTutor.php
new file mode 100644
index 0000000..49660b0
--- /dev/null
+++ b/src/AppBundle/Entity/EstatusTutor.php
@@ -0,0 +1,107 @@
+nombre = $nombre;
+
+ return $this;
+ }
+
+ /**
+ * Get nombre
+ *
+ * @return string
+ */
+ public function getNombre()
+ {
+ return $this->nombre;
+ }
+
+ /**
+ * Set descripcion
+ *
+ * @param string $descripcion
+ * @return Estatus
+ */
+ public function setDescripcion($descripcion)
+ {
+ $this->descripcion = $descripcion;
+
+ return $this;
+ }
+
+ /**
+ * Get descripcion
+ *
+ * @return string
+ */
+ public function getDescripcion()
+ {
+ return $this->descripcion;
+ }
+
+ /**
+ * Get id
+ *
+ * @return integer
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ public function __toString() {
+ return $this->getNombre();
+ }
+}
\ No newline at end of file
diff --git a/src/AppBundle/Entity/TutoresAscenso.php b/src/AppBundle/Entity/TutoresAscenso.php
index 7808025..98e181d 100644
--- a/src/AppBundle/Entity/TutoresAscenso.php
+++ b/src/AppBundle/Entity/TutoresAscenso.php
@@ -100,13 +100,7 @@ class TutoresAscenso
protected $idEscala;
- /**
- * @var \Doctrine\Common\Collections\Collection
- *
- * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Ascenso", mappedBy="tutoresAscenso")
- */
- protected $ascenso;
-
+
@@ -317,44 +311,5 @@ class TutoresAscenso
return $this->idEstado;
}
- /**
- * Constructor
- */
- public function __construct()
- {
- $this->ascenso = new \Doctrine\Common\Collections\ArrayCollection();
- }
-
- /**
- * Add ascenso
- *
- * @param \AppBundle\Entity\Ascenso $ascenso
- * @return TutoresAscenso
- */
- public function addAscenso(\AppBundle\Entity\Ascenso $ascenso)
- {
- $this->ascenso[] = $ascenso;
- return $this;
- }
-
- /**
- * Remove ascenso
- *
- * @param \AppBundle\Entity\Ascenso $ascenso
- */
- public function removeAscenso(\AppBundle\Entity\Ascenso $ascenso)
- {
- $this->ascenso->removeElement($ascenso);
- }
-
- /**
- * Get ascenso
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getAscenso()
- {
- return $this->ascenso;
- }
}