Commit 677ac06c7caa7e89ef279ffcbc395cd913e95b1d
1 parent
1e55fda266
Exists in
master
creada la estrategia y los recursos muchos a muchos dentro de la relacion uno a …
…muchos muchos a uno.... wow..... :) :) :) excelente
Showing
8 changed files
with
258 additions
and
74 deletions
Show diff stats
src/AppBundle/Controller/PlanificacionSeccionController.php
| @@ -56,7 +56,7 @@ class PlanificacionSeccionController extends Controller | @@ -56,7 +56,7 @@ class PlanificacionSeccionController extends Controller | ||
| 56 | 56 | ||
| 57 | if ($form->isSubmitted() && $form->isValid()) { | 57 | if ($form->isSubmitted() && $form->isValid()) { |
| 58 | 58 | ||
| 59 | - | 59 | + //var_dump($p->getId()); exit; |
| 60 | 60 | ||
| 61 | // ciclo a traves de las relaciones para cada contenido | 61 | // ciclo a traves de las relaciones para cada contenido |
| 62 | foreach($planificacionSeccion->getContenido() as $contenido){ | 62 | foreach($planificacionSeccion->getContenido() as $contenido){ |
| @@ -65,13 +65,29 @@ class PlanificacionSeccionController extends Controller | @@ -65,13 +65,29 @@ class PlanificacionSeccionController extends Controller | ||
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | foreach($planificacionSeccion->getObjetivoEspecifico() as $especifico){ | 67 | foreach($planificacionSeccion->getObjetivoEspecifico() as $especifico){ |
| 68 | - $especifico->setPlanificacionSeccionId($planificacionSeccion); | 68 | + $especifico->setPlanificacionSeccionId($planificacionSeccion); |
| 69 | + | ||
| 69 | } | 70 | } |
| 70 | 71 | ||
| 71 | - foreach($planificacionSeccion->getEstrategia() as $estrategias){ | ||
| 72 | - $estrategias->setPlanificacionSeccionId($planificacionSeccion); | 72 | + foreach ($planificacionSeccion->getEstrategia() as $estrategias){ |
| 73 | + $estrategias->setPlanificacionSeccionId($planificacionSeccion); | ||
| 74 | + | ||
| 75 | + | ||
| 73 | } | 76 | } |
| 74 | 77 | ||
| 78 | + /*foreach($planificacionSeccion->getEstrategia() as $estrategias){ | ||
| 79 | + $estrategias->setPlanificacionSeccionId($planificacionSeccion); | ||
| 80 | + foreach($estrategias->getTecnicasPlanificacion() as $t){ | ||
| 81 | + $estrategias->addTecnicasPlanificacion($t); | ||
| 82 | + } | ||
| 83 | + foreach($estrategias->getRecursosPlanificacion() as $r){ | ||
| 84 | + $estrategias->addRecursosPlanificacion($r); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + }*/ | ||
| 88 | + | ||
| 89 | + | ||
| 90 | + | ||
| 75 | //var_dump($seccion->getPlanificacion()->count()); exit; | 91 | //var_dump($seccion->getPlanificacion()->count()); exit; |
| 76 | $em = $this->getDoctrine()->getManager(); | 92 | $em = $this->getDoctrine()->getManager(); |
| 77 | $em->persist($planificacionSeccion); | 93 | $em->persist($planificacionSeccion); |
src/AppBundle/Entity/PlanificacionSeccionEstrategia.php
| @@ -20,33 +20,42 @@ class PlanificacionSeccionEstrategia | @@ -20,33 +20,42 @@ class PlanificacionSeccionEstrategia | ||
| 20 | * @ORM\Column(name="id", type="integer", nullable=false, options={"comment" = "Identificador del municipio"}) | 20 | * @ORM\Column(name="id", type="integer", nullable=false, options={"comment" = "Identificador del municipio"}) |
| 21 | * @ORM\Id | 21 | * @ORM\Id |
| 22 | * @ORM\GeneratedValue(strategy="IDENTITY") | 22 | * @ORM\GeneratedValue(strategy="IDENTITY") |
| 23 | - * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) | 23 | + * @ORM\SequenceGenerator(sequenceName="planificacion_seccion_estrategia_id_seq", allocationSize=1, initialValue=1) |
| 24 | */ | 24 | */ |
| 25 | private $id; | 25 | private $id; |
| 26 | 26 | ||
| 27 | - /** | ||
| 28 | - * @var \AppBundle\Entity\TecnicasPlanificacion | 27 | + /** |
| 28 | + * @var \Doctrine\Common\Collections\Collection | ||
| 29 | * | 29 | * |
| 30 | - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\TecnicasPlanificacion") | ||
| 31 | - * @ORM\JoinColumns({ | ||
| 32 | - * @ORM\JoinColumn(name="id_tecnicas_planificacion", referencedColumnName="id", nullable=false) | ||
| 33 | - * }) | 30 | + * @ORM\ManyToMany(targetEntity="AppBundle\Entity\TecnicasPlanificacion", inversedBy="estrategia") |
| 31 | + * @ORM\JoinTable(name="estrategia_tecnica", | ||
| 32 | + * joinColumns={ | ||
| 33 | + * @ORM\JoinColumn(name="estrategia_id", referencedColumnName="id", nullable=false) | ||
| 34 | + * }, | ||
| 35 | + * inverseJoinColumns={ | ||
| 36 | + * @ORM\JoinColumn(name="tecnica_id", referencedColumnName="id", nullable=false) | ||
| 37 | + * } | ||
| 38 | + * ) | ||
| 34 | */ | 39 | */ |
| 35 | - private $idTecnicasPlanificacion; | 40 | + protected $tecnicas; |
| 36 | 41 | ||
| 37 | 42 | ||
| 38 | /** | 43 | /** |
| 39 | - * @var \AppBundle\Entity\RecursosPlanificacion | 44 | + * @var \Doctrine\Common\Collections\Collection |
| 40 | * | 45 | * |
| 41 | - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\RecursosPlanificacion") | ||
| 42 | - * @ORM\JoinColumns({ | ||
| 43 | - * @ORM\JoinColumn(name="id_recursos_planificacion", referencedColumnName="id", nullable=false) | ||
| 44 | - * }) | 46 | + * @ORM\ManyToMany(targetEntity="AppBundle\Entity\RecursosPlanificacion", inversedBy="estrategia") |
| 47 | + * @ORM\JoinTable(name="estrategia_recurso", | ||
| 48 | + * joinColumns={ | ||
| 49 | + * @ORM\JoinColumn(name="estrategia_id", referencedColumnName="id", nullable=false) | ||
| 50 | + * }, | ||
| 51 | + * inverseJoinColumns={ | ||
| 52 | + * @ORM\JoinColumn(name="recurso_id", referencedColumnName="id", nullable=false) | ||
| 53 | + * } | ||
| 54 | + * ) | ||
| 45 | */ | 55 | */ |
| 46 | - private $idRecursosPlanificacion; | 56 | + protected $recursos; |
| 47 | 57 | ||
| 48 | - | ||
| 49 | - | 58 | + |
| 50 | /** | 59 | /** |
| 51 | * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="estrategia") | 60 | * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="estrategia") |
| 52 | * @ORM\JoinColumn(name="planificacion_seccion_id", referencedColumnName="id") | 61 | * @ORM\JoinColumn(name="planificacion_seccion_id", referencedColumnName="id") |
| @@ -54,10 +63,18 @@ class PlanificacionSeccionEstrategia | @@ -54,10 +63,18 @@ class PlanificacionSeccionEstrategia | ||
| 54 | private $planificacionSeccionId; | 63 | private $planificacionSeccionId; |
| 55 | 64 | ||
| 56 | 65 | ||
| 57 | - | ||
| 58 | 66 | ||
| 59 | - | ||
| 60 | 67 | ||
| 68 | + | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * Constructor | ||
| 72 | + */ | ||
| 73 | + public function __construct() | ||
| 74 | + { | ||
| 75 | + $this->tecnicas = new \Doctrine\Common\Collections\ArrayCollection(); | ||
| 76 | + $this->recursos = new \Doctrine\Common\Collections\ArrayCollection(); | ||
| 77 | + } | ||
| 61 | 78 | ||
| 62 | /** | 79 | /** |
| 63 | * Get id | 80 | * Get id |
| @@ -70,49 +87,69 @@ class PlanificacionSeccionEstrategia | @@ -70,49 +87,69 @@ class PlanificacionSeccionEstrategia | ||
| 70 | } | 87 | } |
| 71 | 88 | ||
| 72 | /** | 89 | /** |
| 73 | - * Set idTecnicasPlanificacion | 90 | + * Add tecnicas |
| 74 | * | 91 | * |
| 75 | - * @param \AppBundle\Entity\TecnicasPlanificacion $idTecnicasPlanificacion | 92 | + * @param \AppBundle\Entity\TecnicasPlanificacion $tecnicas |
| 76 | * @return PlanificacionSeccionEstrategia | 93 | * @return PlanificacionSeccionEstrategia |
| 77 | */ | 94 | */ |
| 78 | - public function setIdTecnicasPlanificacion(\AppBundle\Entity\TecnicasPlanificacion $idTecnicasPlanificacion) | 95 | + public function addTecnica(\AppBundle\Entity\TecnicasPlanificacion $tecnicas) |
| 79 | { | 96 | { |
| 80 | - $this->idTecnicasPlanificacion = $idTecnicasPlanificacion; | 97 | + $this->tecnicas[] = $tecnicas; |
| 81 | 98 | ||
| 82 | return $this; | 99 | return $this; |
| 83 | } | 100 | } |
| 84 | 101 | ||
| 85 | /** | 102 | /** |
| 86 | - * Get idTecnicasPlanificacion | 103 | + * Remove tecnicas |
| 87 | * | 104 | * |
| 88 | - * @return \AppBundle\Entity\TecnicasPlanificacion | 105 | + * @param \AppBundle\Entity\TecnicasPlanificacion $tecnicas |
| 89 | */ | 106 | */ |
| 90 | - public function getIdTecnicasPlanificacion() | 107 | + public function removeTecnica(\AppBundle\Entity\TecnicasPlanificacion $tecnicas) |
| 91 | { | 108 | { |
| 92 | - return $this->idTecnicasPlanificacion; | 109 | + $this->tecnicas->removeElement($tecnicas); |
| 93 | } | 110 | } |
| 94 | 111 | ||
| 95 | /** | 112 | /** |
| 96 | - * Set idRecursosPlanificacion | 113 | + * Get tecnicas |
| 97 | * | 114 | * |
| 98 | - * @param \AppBundle\Entity\RecursosPlanificacion $idRecursosPlanificacion | 115 | + * @return \Doctrine\Common\Collections\Collection |
| 116 | + */ | ||
| 117 | + public function getTecnicas() | ||
| 118 | + { | ||
| 119 | + return $this->tecnicas; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * Add recursos | ||
| 124 | + * | ||
| 125 | + * @param \AppBundle\Entity\RecursosPlanificacion $recursos | ||
| 99 | * @return PlanificacionSeccionEstrategia | 126 | * @return PlanificacionSeccionEstrategia |
| 100 | */ | 127 | */ |
| 101 | - public function setIdRecursosPlanificacion(\AppBundle\Entity\RecursosPlanificacion $idRecursosPlanificacion) | 128 | + public function addRecurso(\AppBundle\Entity\RecursosPlanificacion $recursos) |
| 102 | { | 129 | { |
| 103 | - $this->idRecursosPlanificacion = $idRecursosPlanificacion; | 130 | + $this->recursos[] = $recursos; |
| 104 | 131 | ||
| 105 | return $this; | 132 | return $this; |
| 106 | } | 133 | } |
| 107 | 134 | ||
| 108 | /** | 135 | /** |
| 109 | - * Get idRecursosPlanificacion | 136 | + * Remove recursos |
| 137 | + * | ||
| 138 | + * @param \AppBundle\Entity\RecursosPlanificacion $recursos | ||
| 139 | + */ | ||
| 140 | + public function removeRecurso(\AppBundle\Entity\RecursosPlanificacion $recursos) | ||
| 141 | + { | ||
| 142 | + $this->recursos->removeElement($recursos); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + /** | ||
| 146 | + * Get recursos | ||
| 110 | * | 147 | * |
| 111 | - * @return \AppBundle\Entity\RecursosPlanificacion | 148 | + * @return \Doctrine\Common\Collections\Collection |
| 112 | */ | 149 | */ |
| 113 | - public function getIdRecursosPlanificacion() | 150 | + public function getRecursos() |
| 114 | { | 151 | { |
| 115 | - return $this->idRecursosPlanificacion; | 152 | + return $this->recursos; |
| 116 | } | 153 | } |
| 117 | 154 | ||
| 118 | /** | 155 | /** |
src/AppBundle/Entity/PlanificacionSeccionEstrategia.php~
| @@ -20,33 +20,42 @@ class PlanificacionSeccionEstrategia | @@ -20,33 +20,42 @@ class PlanificacionSeccionEstrategia | ||
| 20 | * @ORM\Column(name="id", type="integer", nullable=false, options={"comment" = "Identificador del municipio"}) | 20 | * @ORM\Column(name="id", type="integer", nullable=false, options={"comment" = "Identificador del municipio"}) |
| 21 | * @ORM\Id | 21 | * @ORM\Id |
| 22 | * @ORM\GeneratedValue(strategy="IDENTITY") | 22 | * @ORM\GeneratedValue(strategy="IDENTITY") |
| 23 | - * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) | 23 | + * @ORM\SequenceGenerator(sequenceName="planificacion_seccion_estrategia_id_seq", allocationSize=1, initialValue=1) |
| 24 | */ | 24 | */ |
| 25 | private $id; | 25 | private $id; |
| 26 | 26 | ||
| 27 | - /** | ||
| 28 | - * @var \AppBundle\Entity\TecnicasPlanificacion | 27 | + /** |
| 28 | + * @var \Doctrine\Common\Collections\Collection | ||
| 29 | * | 29 | * |
| 30 | - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\TecnicasPlanificacion") | ||
| 31 | - * @ORM\JoinColumns({ | ||
| 32 | - * @ORM\JoinColumn(name="id_tecnicas_planificacion", referencedColumnName="id", nullable=false) | ||
| 33 | - * }) | 30 | + * @ORM\ManyToMany(targetEntity="AppBundle\Entity\TecnicasPlanificacion", inversedBy="estrategia") |
| 31 | + * @ORM\JoinTable(name="estrategia_tecnica", | ||
| 32 | + * joinColumns={ | ||
| 33 | + * @ORM\JoinColumn(name="estrategia_id", referencedColumnName="id", nullable=false) | ||
| 34 | + * }, | ||
| 35 | + * inverseJoinColumns={ | ||
| 36 | + * @ORM\JoinColumn(name="tecnica_id", referencedColumnName="id", nullable=false) | ||
| 37 | + * } | ||
| 38 | + * ) | ||
| 34 | */ | 39 | */ |
| 35 | - private $idTecnicasPlanificacion; | 40 | + protected $tecnicas; |
| 36 | 41 | ||
| 37 | 42 | ||
| 38 | /** | 43 | /** |
| 39 | - * @var \AppBundle\Entity\RecursosPlanificacion | 44 | + * @var \Doctrine\Common\Collections\Collection |
| 40 | * | 45 | * |
| 41 | - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\RecursosPlanificacion") | ||
| 42 | - * @ORM\JoinColumns({ | ||
| 43 | - * @ORM\JoinColumn(name="id_recursos_planificacion", referencedColumnName="id", nullable=false) | ||
| 44 | - * }) | 46 | + * @ORM\ManyToMany(targetEntity="AppBundle\Entity\RecursosPlanificacion", inversedBy="estrategia") |
| 47 | + * @ORM\JoinTable(name="estrategia_recurso", | ||
| 48 | + * joinColumns={ | ||
| 49 | + * @ORM\JoinColumn(name="estrategia_id", referencedColumnName="id", nullable=false) | ||
| 50 | + * }, | ||
| 51 | + * inverseJoinColumns={ | ||
| 52 | + * @ORM\JoinColumn(name="recurso_id", referencedColumnName="id", nullable=false) | ||
| 53 | + * } | ||
| 54 | + * ) | ||
| 45 | */ | 55 | */ |
| 46 | - private $idRecursosPlanificacion; | 56 | + protected $recursos; |
| 47 | 57 | ||
| 48 | - | ||
| 49 | - | 58 | + |
| 50 | /** | 59 | /** |
| 51 | * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="estrategia") | 60 | * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="estrategia") |
| 52 | * @ORM\JoinColumn(name="planificacion_seccion_id", referencedColumnName="id") | 61 | * @ORM\JoinColumn(name="planificacion_seccion_id", referencedColumnName="id") |
| @@ -54,8 +63,8 @@ class PlanificacionSeccionEstrategia | @@ -54,8 +63,8 @@ class PlanificacionSeccionEstrategia | ||
| 54 | private $planificacionSeccionId; | 63 | private $planificacionSeccionId; |
| 55 | 64 | ||
| 56 | 65 | ||
| 57 | - | ||
| 58 | 66 | ||
| 59 | - | 67 | + |
| 68 | + | ||
| 60 | 69 | ||
| 61 | } | 70 | } |
src/AppBundle/Entity/RecursosPlanificacion.php
| @@ -29,14 +29,26 @@ class RecursosPlanificacion | @@ -29,14 +29,26 @@ class RecursosPlanificacion | ||
| 29 | * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) | 29 | * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) |
| 30 | */ | 30 | */ |
| 31 | private $id; | 31 | private $id; |
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * @var \Doctrine\Common\Collections\Collection | ||
| 35 | + * | ||
| 36 | + * @ORM\ManyToMany(targetEntity="AppBundle\Entity\PlanificacionSeccionEstrategia", mappedBy="recursos") | ||
| 37 | + */ | ||
| 38 | + protected $estrategia; | ||
| 32 | 39 | ||
| 33 | 40 | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + | ||
| 44 | + | ||
| 34 | 45 | ||
| 35 | /** | 46 | /** |
| 36 | - * @return string | 47 | + * Constructor |
| 37 | */ | 48 | */ |
| 38 | - public function __toString() { | ||
| 39 | - return $this->getNombre(); | 49 | + public function __construct() |
| 50 | + { | ||
| 51 | + $this->estrategia = new \Doctrine\Common\Collections\ArrayCollection(); | ||
| 40 | } | 52 | } |
| 41 | 53 | ||
| 42 | /** | 54 | /** |
| @@ -71,4 +83,44 @@ class RecursosPlanificacion | @@ -71,4 +83,44 @@ class RecursosPlanificacion | ||
| 71 | { | 83 | { |
| 72 | return $this->id; | 84 | return $this->id; |
| 73 | } | 85 | } |
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * Add estrategia | ||
| 89 | + * | ||
| 90 | + * @param \AppBundle\Entity\PlanificacionSeccionEstrategia $estrategia | ||
| 91 | + * @return RecursosPlanificacion | ||
| 92 | + */ | ||
| 93 | + public function addEstrategium(\AppBundle\Entity\PlanificacionSeccionEstrategia $estrategia) | ||
| 94 | + { | ||
| 95 | + $this->estrategia[] = $estrategia; | ||
| 96 | + | ||
| 97 | + return $this; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + /** | ||
| 101 | + * Remove estrategia | ||
| 102 | + * | ||
| 103 | + * @param \AppBundle\Entity\PlanificacionSeccionEstrategia $estrategia | ||
| 104 | + */ | ||
| 105 | + public function removeEstrategium(\AppBundle\Entity\PlanificacionSeccionEstrategia $estrategia) | ||
| 106 | + { | ||
| 107 | + $this->estrategia->removeElement($estrategia); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * Get estrategia | ||
| 112 | + * | ||
| 113 | + * @return \Doctrine\Common\Collections\Collection | ||
| 114 | + */ | ||
| 115 | + public function getEstrategia() | ||
| 116 | + { | ||
| 117 | + return $this->estrategia; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + /** | ||
| 121 | + * @return string | ||
| 122 | + */ | ||
| 123 | + public function __toString() { | ||
| 124 | + return $this->getNombre(); | ||
| 125 | + } | ||
| 74 | } | 126 | } |
src/AppBundle/Entity/RecursosPlanificacion.php~
| @@ -29,15 +29,18 @@ class RecursosPlanificacion | @@ -29,15 +29,18 @@ class RecursosPlanificacion | ||
| 29 | * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) | 29 | * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) |
| 30 | */ | 30 | */ |
| 31 | private $id; | 31 | private $id; |
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * @var \Doctrine\Common\Collections\Collection | ||
| 35 | + * | ||
| 36 | + * @ORM\ManyToMany(targetEntity="AppBundle\Entity\PlanificacionSeccionEstrategia", mappedBy="tecnica") | ||
| 37 | + */ | ||
| 38 | + protected $estrategia; | ||
| 32 | 39 | ||
| 40 | + | ||
| 33 | 41 | ||
| 34 | - | ||
| 35 | 42 | ||
| 36 | 43 | ||
| 37 | - /** | ||
| 38 | - * @return string | ||
| 39 | - */ | ||
| 40 | - public function __toString() { | ||
| 41 | - return $this->getNombre(); | ||
| 42 | - } | 44 | + |
| 45 | + | ||
| 43 | } | 46 | } |
src/AppBundle/Entity/TecnicasPlanificacion.php
| @@ -29,8 +29,24 @@ class TecnicasPlanificacion | @@ -29,8 +29,24 @@ class TecnicasPlanificacion | ||
| 29 | * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) | 29 | * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) |
| 30 | */ | 30 | */ |
| 31 | private $id; | 31 | private $id; |
| 32 | - | ||
| 33 | - | 32 | + |
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * @var \Doctrine\Common\Collections\Collection | ||
| 36 | + * | ||
| 37 | + * @ORM\ManyToMany(targetEntity="AppBundle\Entity\PlanificacionSeccionEstrategia", mappedBy="tecnicas", cascade={"all"}) | ||
| 38 | + */ | ||
| 39 | + protected $estrategia; | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Constructor | ||
| 45 | + */ | ||
| 46 | + public function __construct() | ||
| 47 | + { | ||
| 48 | + $this->estrategia = new \Doctrine\Common\Collections\ArrayCollection(); | ||
| 49 | + } | ||
| 34 | 50 | ||
| 35 | /** | 51 | /** |
| 36 | * Set nombre | 52 | * Set nombre |
| @@ -64,6 +80,39 @@ class TecnicasPlanificacion | @@ -64,6 +80,39 @@ class TecnicasPlanificacion | ||
| 64 | { | 80 | { |
| 65 | return $this->id; | 81 | return $this->id; |
| 66 | } | 82 | } |
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * Add estrategia | ||
| 86 | + * | ||
| 87 | + * @param \AppBundle\Entity\PlanificacionSeccionEstrategia $estrategia | ||
| 88 | + * @return TecnicasPlanificacion | ||
| 89 | + */ | ||
| 90 | + public function addEstrategium(\AppBundle\Entity\PlanificacionSeccionEstrategia $estrategia) | ||
| 91 | + { | ||
| 92 | + $this->estrategia[] = $estrategia; | ||
| 93 | + | ||
| 94 | + return $this; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * Remove estrategia | ||
| 99 | + * | ||
| 100 | + * @param \AppBundle\Entity\PlanificacionSeccionEstrategia $estrategia | ||
| 101 | + */ | ||
| 102 | + public function removeEstrategium(\AppBundle\Entity\PlanificacionSeccionEstrategia $estrategia) | ||
| 103 | + { | ||
| 104 | + $this->estrategia->removeElement($estrategia); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + /** | ||
| 108 | + * Get estrategia | ||
| 109 | + * | ||
| 110 | + * @return \Doctrine\Common\Collections\Collection | ||
| 111 | + */ | ||
| 112 | + public function getEstrategia() | ||
| 113 | + { | ||
| 114 | + return $this->estrategia; | ||
| 115 | + } | ||
| 67 | 116 | ||
| 68 | /** | 117 | /** |
| 69 | * @return string | 118 | * @return string |
| @@ -72,3 +121,4 @@ class TecnicasPlanificacion | @@ -72,3 +121,4 @@ class TecnicasPlanificacion | ||
| 72 | return $this->getNombre(); | 121 | return $this->getNombre(); |
| 73 | } | 122 | } |
| 74 | } | 123 | } |
| 124 | + |
src/AppBundle/Entity/TecnicasPlanificacion.php~
| @@ -29,6 +29,15 @@ class TecnicasPlanificacion | @@ -29,6 +29,15 @@ class TecnicasPlanificacion | ||
| 29 | * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) | 29 | * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) |
| 30 | */ | 30 | */ |
| 31 | private $id; | 31 | private $id; |
| 32 | - | ||
| 33 | - | ||
| 34 | -} | ||
| 35 | \ No newline at end of file | 32 | \ No newline at end of file |
| 33 | + | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * @var \Doctrine\Common\Collections\Collection | ||
| 37 | + * | ||
| 38 | + * @ORM\ManyToMany(targetEntity="AppBundle\Entity\PlanificacionSeccionEstrategia", mappedBy="tecnica") | ||
| 39 | + */ | ||
| 40 | + protected $estrategia; | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + | ||
| 44 | +} |
src/AppBundle/Form/PlanificacionSeccionEstrategiaType.php
| @@ -5,6 +5,7 @@ namespace AppBundle\Form; | @@ -5,6 +5,7 @@ namespace AppBundle\Form; | ||
| 5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
| 6 | use Symfony\Component\Form\FormBuilderInterface; | 6 | use Symfony\Component\Form\FormBuilderInterface; |
| 7 | use Symfony\Component\OptionsResolver\OptionsResolver; | 7 | use Symfony\Component\OptionsResolver\OptionsResolver; |
| 8 | +use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||
| 8 | 9 | ||
| 9 | class PlanificacionSeccionEstrategiaType extends AbstractType | 10 | class PlanificacionSeccionEstrategiaType extends AbstractType |
| 10 | { | 11 | { |
| @@ -15,9 +16,16 @@ class PlanificacionSeccionEstrategiaType extends AbstractType | @@ -15,9 +16,16 @@ class PlanificacionSeccionEstrategiaType extends AbstractType | ||
| 15 | public function buildForm(FormBuilderInterface $builder, array $options) | 16 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 16 | { | 17 | { |
| 17 | $builder | 18 | $builder |
| 18 | - ->add('idTecnicasPlanificacion') | ||
| 19 | - ->add('idRecursosPlanificacion') | ||
| 20 | - | 19 | + ->add('tecnicas', EntityType::class, array( |
| 20 | + 'class' => 'AppBundle:TecnicasPlanificacion', | ||
| 21 | + 'multiple' => TRUE, | ||
| 22 | + 'expanded' => TRUE, | ||
| 23 | + )) | ||
| 24 | + ->add('recursos', EntityType::class, array( | ||
| 25 | + 'class' => 'AppBundle:RecursosPlanificacion', | ||
| 26 | + 'multiple' => TRUE, | ||
| 27 | + 'expanded' => TRUE, | ||
| 28 | + )) | ||
| 21 | ; | 29 | ; |
| 22 | } | 30 | } |
| 23 | 31 |