Commit 1e55fda26630eec448c860e5a9f2eeae0331dd87
1 parent
3c11f32e61
Exists in
master
creadas las estrategias y los recursos de la planificacion
Showing
11 changed files
with
387 additions
and
106 deletions
Show diff stats
app/Resources/views/planificacionseccion/new.html.twig
| ... | ... | @@ -16,6 +16,10 @@ |
| 16 | 16 | |
| 17 | 17 | </ul> |
| 18 | 18 | |
| 19 | + <ul class="estrategia" data-prototype="{{ form_widget(form.estrategia.vars.prototype)|e('html_attr') }}"> | |
| 20 | + | |
| 21 | + </ul> | |
| 22 | + | |
| 19 | 23 | <input type="submit" value="Create" /> |
| 20 | 24 | {{ form_end(form) }} |
| 21 | 25 | |
| ... | ... | @@ -35,25 +39,29 @@ |
| 35 | 39 | // setup an "add a tag" link |
| 36 | 40 | var $addEspecificoLink = $('<a href="#" class="add_especifico_link">Añadir Objetivos Especificos</a>'); |
| 37 | 41 | var $addContenidoLink = $('<a href="#" class="add_contenido_link">Añadir conceptos</a>'); |
| 42 | + var $addEstrategiaLink = $('<a href="#" class="add_estrategia_link">Añadir estrategias</a>'); | |
| 38 | 43 | var $RemoveContenidoLink = $('<a href="#" class="remove_contenido_link">Quitar Conceptos</a>'); |
| 39 | 44 | |
| 40 | 45 | var $newLinkLiContenido = $('<li></li>').append($addContenidoLink); |
| 41 | 46 | var $newLinkLiEspecifico = $('<li></li>').append($addEspecificoLink); |
| 42 | - //$newLinkLi. = $('<li></li>').append($RemoveContenidoLink); | |
| 47 | + var $newLinkLiEstrategia = $('<li></li>').append($addEstrategiaLink); | |
| 43 | 48 | |
| 44 | 49 | |
| 45 | 50 | jQuery(document).ready(function() { |
| 46 | 51 | // Get the ul that holds the collection of tags |
| 47 | 52 | $contenidoHolder = $('ul.contenido'); |
| 48 | 53 | $especificoHolder = $('ul.objetivoEspecifico'); |
| 54 | + $estrategiaHolder = $('ul.estrategia'); | |
| 49 | 55 | // add the "add a tag" anchor and li to the tags ul |
| 50 | 56 | $contenidoHolder.append($newLinkLiContenido); |
| 51 | 57 | $especificoHolder.append($newLinkLiEspecifico); |
| 58 | + $estrategiaHolder.append($newLinkLiEstrategia); | |
| 52 | 59 | |
| 53 | 60 | // count the current form inputs we have (e.g. 2), use that as the new |
| 54 | 61 | // index when inserting a new item (e.g. 2) |
| 55 | 62 | $contenidoHolder.data('index', $contenidoHolder.find(':input').length); |
| 56 | 63 | $especificoHolder.data('index', $especificoHolder.find(':input').length); |
| 64 | + $estrategiaHolder.data('index', $estrategiaHolder.find(':input').length); | |
| 57 | 65 | |
| 58 | 66 | $addContenidoLink.on('click', function(e) { |
| 59 | 67 | // prevent the link from creating a "#" on the URL |
| ... | ... | @@ -71,6 +79,15 @@ |
| 71 | 79 | addEspecificoForm($especificoHolder, $newLinkLiEspecifico); |
| 72 | 80 | }); |
| 73 | 81 | |
| 82 | + | |
| 83 | + $addEstrategiaLink.on('click', function(e) { | |
| 84 | + // prevent the link from creating a "#" on the URL | |
| 85 | + e.preventDefault(); | |
| 86 | + | |
| 87 | + // add a new tag form (see next code block) | |
| 88 | + addEstrategiaForm($estrategiaHolder, $newLinkLiEstrategia); | |
| 89 | + }); | |
| 90 | + | |
| 74 | 91 | |
| 75 | 92 | |
| 76 | 93 | function addContenidoForm($contenidoHolder, $newLinkLiContenido) { |
| ... | ... | @@ -108,6 +125,7 @@ |
| 108 | 125 | } |
| 109 | 126 | |
| 110 | 127 | |
| 128 | + | |
| 111 | 129 | function addEspecificoForm($especificoHolder, $newLinkLiEspecifico) { |
| 112 | 130 | // Get the data-prototype explained earlier |
| 113 | 131 | var prototype = $especificoHolder.data('prototype'); |
| ... | ... | @@ -142,6 +160,40 @@ |
| 142 | 160 | |
| 143 | 161 | } |
| 144 | 162 | |
| 163 | + function addEstrategiaForm($estrategiaHolder, $newLinkLiEstrategia) { | |
| 164 | + // Get the data-prototype explained earlier | |
| 165 | + var prototype = $estrategiaHolder.data('prototype'); | |
| 166 | + | |
| 167 | + // get the new index | |
| 168 | + var index = $estrategiaHolder.data('index'); | |
| 169 | + | |
| 170 | + // Replace '$$name$$' in the prototype's HTML to | |
| 171 | + // instead be a number based on how many items we have | |
| 172 | + var newFormEstrategia = prototype.replace(/__name__/g, index); | |
| 173 | + | |
| 174 | + // increase the index with one for the next item | |
| 175 | + $estrategiaHolder.data('index', index + 1); | |
| 176 | + | |
| 177 | + // Display the form in the page in an li, before the "Add a tag" link li | |
| 178 | + var $newFormLiEstrategia = $('<li></li>').append(newFormEstrategia); | |
| 179 | + | |
| 180 | + // also add a remove button, just for this example | |
| 181 | + $newFormLiEstrategia.append('<a href="#" class="remove-tag">x</a>'); | |
| 182 | + | |
| 183 | + $newLinkLiEstrategia.before($newFormLiEstrategia); | |
| 184 | + | |
| 185 | + // handle the removal, just for this example | |
| 186 | + $('.remove-tag').click(function(e) { | |
| 187 | + e.preventDefault(); | |
| 188 | + | |
| 189 | + $(this).parent().remove(); | |
| 190 | + | |
| 191 | + return false; | |
| 192 | + }); | |
| 193 | + | |
| 194 | + | |
| 195 | + } | |
| 196 | + | |
| 145 | 197 | |
| 146 | 198 | |
| 147 | 199 | }); | ... | ... |
src/AppBundle/Controller/PlanificacionSeccionController.php
| ... | ... | @@ -68,6 +68,10 @@ class PlanificacionSeccionController extends Controller |
| 68 | 68 | $especifico->setPlanificacionSeccionId($planificacionSeccion); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | + foreach($planificacionSeccion->getEstrategia() as $estrategias){ | |
| 72 | + $estrategias->setPlanificacionSeccionId($planificacionSeccion); | |
| 73 | + } | |
| 74 | + | |
| 71 | 75 | //var_dump($seccion->getPlanificacion()->count()); exit; |
| 72 | 76 | $em = $this->getDoctrine()->getManager(); |
| 73 | 77 | $em->persist($planificacionSeccion); | ... | ... |
src/AppBundle/Entity/PlanificacionSeccion.php
| ... | ... | @@ -49,7 +49,7 @@ class PlanificacionSeccion |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * @ORM\OneToMany(targetEntity="PlanificacionSeccionEstrategia", mappedBy="idPlanificacionEstrategia") | |
| 52 | + * @ORM\OneToMany(targetEntity="PlanificacionSeccionEstrategia", mappedBy="planificacionSeccionId", cascade={"all"}) | |
| 53 | 53 | */ |
| 54 | 54 | private $estrategia; |
| 55 | 55 | ... | ... |
src/AppBundle/Entity/PlanificacionSeccionEstrategia.php
| ... | ... | @@ -7,31 +7,13 @@ use Doctrine\ORM\Mapping as ORM; |
| 7 | 7 | /** |
| 8 | 8 | * PlanificacionSeccionEstrategia |
| 9 | 9 | * |
| 10 | - * @ORM\Table(name="planificacion_seccion_estrategia", | |
| 11 | - * uniqueConstraints= | |
| 12 | - * {@ORM\UniqueConstraint(name="uq_planificacion_estrategia", | |
| 13 | - * columns={"id_planificacion_seccion"}) | |
| 14 | - * }, | |
| 15 | - * indexes={ | |
| 16 | - * @ORM\Index(name="fki_id_planificacion_estrategia", | |
| 17 | - * columns={"id_planificacion_seccion"}) | |
| 18 | - * } | |
| 19 | - * ) | |
| 10 | + * @ORM\Table(name="planificacion_seccion_estrategia" ) | |
| 20 | 11 | * @ORM\Entity |
| 21 | 12 | */ |
| 22 | 13 | class PlanificacionSeccionEstrategia |
| 23 | 14 | { |
| 24 | 15 | |
| 25 | - /** | |
| 26 | - * @var \AppBundle\Entity\PlanificacionSeccion | |
| 27 | - * | |
| 28 | - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PlanificacionSeccion") | |
| 29 | - * @ORM\JoinColumns({ | |
| 30 | - * @ORM\JoinColumn(name="id_planificacion_seccion", referencedColumnName="id", nullable=false) | |
| 31 | - * }) | |
| 32 | - */ | |
| 33 | - private $idPlanificacionSeccion; | |
| 34 | - | |
| 16 | + | |
| 35 | 17 | /** |
| 36 | 18 | * @var integer |
| 37 | 19 | * |
| ... | ... | @@ -42,26 +24,36 @@ class PlanificacionSeccionEstrategia |
| 42 | 24 | */ |
| 43 | 25 | private $id; |
| 44 | 26 | |
| 45 | - /** | |
| 46 | - * @var text | |
| 27 | + /** | |
| 28 | + * @var \AppBundle\Entity\TecnicasPlanificacion | |
| 47 | 29 | * |
| 48 | - * @ORM\Column(name="tipo_estrategia", type="text", nullable=false, options={"comment" = "Tipos de estrategia a utilizar"}) | |
| 30 | + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\TecnicasPlanificacion") | |
| 31 | + * @ORM\JoinColumns({ | |
| 32 | + * @ORM\JoinColumn(name="id_tecnicas_planificacion", referencedColumnName="id", nullable=false) | |
| 33 | + * }) | |
| 49 | 34 | */ |
| 50 | - private $tipoEstrategia; | |
| 35 | + private $idTecnicasPlanificacion; | |
| 51 | 36 | |
| 52 | 37 | |
| 53 | 38 | /** |
| 54 | - * @var text | |
| 39 | + * @var \AppBundle\Entity\RecursosPlanificacion | |
| 55 | 40 | * |
| 56 | - * @ORM\Column(name="tipoRecurso", type="text", nullable=false, options={"comment" = "Recursos necesarios para el tema"}) | |
| 41 | + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\RecursosPlanificacion") | |
| 42 | + * @ORM\JoinColumns({ | |
| 43 | + * @ORM\JoinColumn(name="id_recursos_planificacion", referencedColumnName="id", nullable=false) | |
| 44 | + * }) | |
| 57 | 45 | */ |
| 58 | - private $tipoRecurso; | |
| 46 | + private $idRecursosPlanificacion; | |
| 47 | + | |
| 59 | 48 | |
| 49 | + | |
| 60 | 50 | /** |
| 61 | 51 | * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="estrategia") |
| 62 | - * @ORM\JoinColumn(name="id_planificacion_estrategia", referencedColumnName="id") | |
| 52 | + * @ORM\JoinColumn(name="planificacion_seccion_id", referencedColumnName="id") | |
| 63 | 53 | */ |
| 64 | - private $idPlanificacionEstrategia; | |
| 54 | + private $planificacionSeccionId; | |
| 55 | + | |
| 56 | + | |
| 65 | 57 | |
| 66 | 58 | |
| 67 | 59 | |
| ... | ... | @@ -78,94 +70,71 @@ class PlanificacionSeccionEstrategia |
| 78 | 70 | } |
| 79 | 71 | |
| 80 | 72 | /** |
| 81 | - * Set tipoEstrategia | |
| 82 | - * | |
| 83 | - * @param string $tipoEstrategia | |
| 84 | - * @return PlanificacionSeccionEstrategia | |
| 85 | - */ | |
| 86 | - public function setTipoEstrategia($tipoEstrategia) | |
| 87 | - { | |
| 88 | - $this->tipoEstrategia = $tipoEstrategia; | |
| 89 | - | |
| 90 | - return $this; | |
| 91 | - } | |
| 92 | - | |
| 93 | - /** | |
| 94 | - * Get tipoEstrategia | |
| 73 | + * Set idTecnicasPlanificacion | |
| 95 | 74 | * |
| 96 | - * @return string | |
| 97 | - */ | |
| 98 | - public function getTipoEstrategia() | |
| 99 | - { | |
| 100 | - return $this->tipoEstrategia; | |
| 101 | - } | |
| 102 | - | |
| 103 | - /** | |
| 104 | - * Set tipoRecurso | |
| 105 | - * | |
| 106 | - * @param string $tipoRecurso | |
| 75 | + * @param \AppBundle\Entity\TecnicasPlanificacion $idTecnicasPlanificacion | |
| 107 | 76 | * @return PlanificacionSeccionEstrategia |
| 108 | 77 | */ |
| 109 | - public function setTipoRecurso($tipoRecurso) | |
| 78 | + public function setIdTecnicasPlanificacion(\AppBundle\Entity\TecnicasPlanificacion $idTecnicasPlanificacion) | |
| 110 | 79 | { |
| 111 | - $this->tipoRecurso = $tipoRecurso; | |
| 80 | + $this->idTecnicasPlanificacion = $idTecnicasPlanificacion; | |
| 112 | 81 | |
| 113 | 82 | return $this; |
| 114 | 83 | } |
| 115 | 84 | |
| 116 | 85 | /** |
| 117 | - * Get tipoRecurso | |
| 86 | + * Get idTecnicasPlanificacion | |
| 118 | 87 | * |
| 119 | - * @return string | |
| 88 | + * @return \AppBundle\Entity\TecnicasPlanificacion | |
| 120 | 89 | */ |
| 121 | - public function getTipoRecurso() | |
| 90 | + public function getIdTecnicasPlanificacion() | |
| 122 | 91 | { |
| 123 | - return $this->tipoRecurso; | |
| 92 | + return $this->idTecnicasPlanificacion; | |
| 124 | 93 | } |
| 125 | 94 | |
| 126 | 95 | /** |
| 127 | - * Set idPlanificacionSeccion | |
| 96 | + * Set idRecursosPlanificacion | |
| 128 | 97 | * |
| 129 | - * @param \AppBundle\Entity\PlanificacionSeccion $idPlanificacionSeccion | |
| 98 | + * @param \AppBundle\Entity\RecursosPlanificacion $idRecursosPlanificacion | |
| 130 | 99 | * @return PlanificacionSeccionEstrategia |
| 131 | 100 | */ |
| 132 | - public function setIdPlanificacionSeccion(\AppBundle\Entity\PlanificacionSeccion $idPlanificacionSeccion) | |
| 101 | + public function setIdRecursosPlanificacion(\AppBundle\Entity\RecursosPlanificacion $idRecursosPlanificacion) | |
| 133 | 102 | { |
| 134 | - $this->idPlanificacionSeccion = $idPlanificacionSeccion; | |
| 103 | + $this->idRecursosPlanificacion = $idRecursosPlanificacion; | |
| 135 | 104 | |
| 136 | 105 | return $this; |
| 137 | 106 | } |
| 138 | 107 | |
| 139 | 108 | /** |
| 140 | - * Get idPlanificacionSeccion | |
| 109 | + * Get idRecursosPlanificacion | |
| 141 | 110 | * |
| 142 | - * @return \AppBundle\Entity\PlanificacionSeccion | |
| 111 | + * @return \AppBundle\Entity\RecursosPlanificacion | |
| 143 | 112 | */ |
| 144 | - public function getIdPlanificacionSeccion() | |
| 113 | + public function getIdRecursosPlanificacion() | |
| 145 | 114 | { |
| 146 | - return $this->idPlanificacionSeccion; | |
| 115 | + return $this->idRecursosPlanificacion; | |
| 147 | 116 | } |
| 148 | 117 | |
| 149 | 118 | /** |
| 150 | - * Set idPlanificacionEstrategia | |
| 119 | + * Set planificacionSeccionId | |
| 151 | 120 | * |
| 152 | - * @param \AppBundle\Entity\PlanificacionSeccion $idPlanificacionEstrategia | |
| 121 | + * @param \AppBundle\Entity\PlanificacionSeccion $planificacionSeccionId | |
| 153 | 122 | * @return PlanificacionSeccionEstrategia |
| 154 | 123 | */ |
| 155 | - public function setIdPlanificacionEstrategia(\AppBundle\Entity\PlanificacionSeccion $idPlanificacionEstrategia = null) | |
| 124 | + public function setPlanificacionSeccionId(\AppBundle\Entity\PlanificacionSeccion $planificacionSeccionId = null) | |
| 156 | 125 | { |
| 157 | - $this->idPlanificacionEstrategia = $idPlanificacionEstrategia; | |
| 126 | + $this->planificacionSeccionId = $planificacionSeccionId; | |
| 158 | 127 | |
| 159 | 128 | return $this; |
| 160 | 129 | } |
| 161 | 130 | |
| 162 | 131 | /** |
| 163 | - * Get idPlanificacionEstrategia | |
| 132 | + * Get planificacionSeccionId | |
| 164 | 133 | * |
| 165 | 134 | * @return \AppBundle\Entity\PlanificacionSeccion |
| 166 | 135 | */ |
| 167 | - public function getIdPlanificacionEstrategia() | |
| 136 | + public function getPlanificacionSeccionId() | |
| 168 | 137 | { |
| 169 | - return $this->idPlanificacionEstrategia; | |
| 138 | + return $this->planificacionSeccionId; | |
| 170 | 139 | } |
| 171 | 140 | } | ... | ... |
src/AppBundle/Entity/PlanificacionSeccionEstrategia.php~
| ... | ... | @@ -7,31 +7,13 @@ use Doctrine\ORM\Mapping as ORM; |
| 7 | 7 | /** |
| 8 | 8 | * PlanificacionSeccionEstrategia |
| 9 | 9 | * |
| 10 | - * @ORM\Table(name="planificacion_seccion_estrategia", | |
| 11 | - * uniqueConstraints= | |
| 12 | - * {@ORM\UniqueConstraint(name="uq_planificacion_estrategia", | |
| 13 | - * columns={"id_planificacion_seccion"}) | |
| 14 | - * }, | |
| 15 | - * indexes={ | |
| 16 | - * @ORM\Index(name="fki_id_planificacion_estrategia", | |
| 17 | - * columns={"id_planificacion_seccion"}) | |
| 18 | - * } | |
| 19 | - * ) | |
| 10 | + * @ORM\Table(name="planificacion_seccion_estrategia" ) | |
| 20 | 11 | * @ORM\Entity |
| 21 | 12 | */ |
| 22 | 13 | class PlanificacionSeccionEstrategia |
| 23 | 14 | { |
| 24 | 15 | |
| 25 | - /** | |
| 26 | - * @var \AppBundle\Entity\PlanificacionSeccion | |
| 27 | - * | |
| 28 | - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PlanificacionSeccion") | |
| 29 | - * @ORM\JoinColumns({ | |
| 30 | - * @ORM\JoinColumn(name="id_planificacion_seccion", referencedColumnName="id", nullable=false) | |
| 31 | - * }) | |
| 32 | - */ | |
| 33 | - private $idPlanificacionSeccion; | |
| 34 | - | |
| 16 | + | |
| 35 | 17 | /** |
| 36 | 18 | * @var integer |
| 37 | 19 | * |
| ... | ... | @@ -42,26 +24,36 @@ class PlanificacionSeccionEstrategia |
| 42 | 24 | */ |
| 43 | 25 | private $id; |
| 44 | 26 | |
| 45 | - /** | |
| 46 | - * @var text | |
| 27 | + /** | |
| 28 | + * @var \AppBundle\Entity\TecnicasPlanificacion | |
| 47 | 29 | * |
| 48 | - * @ORM\Column(name="tipo_estrategia", type="text", nullable=false, options={"comment" = "Tipos de estrategia a utilizar"}) | |
| 30 | + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\TecnicasPlanificacion") | |
| 31 | + * @ORM\JoinColumns({ | |
| 32 | + * @ORM\JoinColumn(name="id_tecnicas_planificacion", referencedColumnName="id", nullable=false) | |
| 33 | + * }) | |
| 49 | 34 | */ |
| 50 | - private $tipoEstrategia; | |
| 35 | + private $idTecnicasPlanificacion; | |
| 51 | 36 | |
| 52 | 37 | |
| 53 | 38 | /** |
| 54 | - * @var text | |
| 39 | + * @var \AppBundle\Entity\RecursosPlanificacion | |
| 55 | 40 | * |
| 56 | - * @ORM\Column(name="tipoRecurso", type="text", nullable=false, options={"comment" = "Recursos necesarios para el tema"}) | |
| 41 | + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\RecursosPlanificacion") | |
| 42 | + * @ORM\JoinColumns({ | |
| 43 | + * @ORM\JoinColumn(name="id_recursos_planificacion", referencedColumnName="id", nullable=false) | |
| 44 | + * }) | |
| 57 | 45 | */ |
| 58 | - private $tipoRecurso; | |
| 46 | + private $idRecursosPlanificacion; | |
| 59 | 47 | |
| 48 | + | |
| 49 | + | |
| 60 | 50 | /** |
| 61 | 51 | * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="estrategia") |
| 62 | - * @ORM\JoinColumn(name="id_planificacion_estrategia", referencedColumnName="id") | |
| 52 | + * @ORM\JoinColumn(name="planificacion_seccion_id", referencedColumnName="id") | |
| 63 | 53 | */ |
| 64 | - private $idPlanificacionEstrategia; | |
| 54 | + private $planificacionSeccionId; | |
| 55 | + | |
| 56 | + | |
| 65 | 57 | |
| 66 | 58 | |
| 67 | 59 | ... | ... |
src/AppBundle/Entity/RecursosPlanificacion.php
| ... | ... | @@ -0,0 +1,74 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace AppBundle\Entity; | |
| 4 | + | |
| 5 | +use Doctrine\ORM\Mapping as ORM; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * RecursosPlanificacion | |
| 9 | + * | |
| 10 | + * @ORM\Table(name="recursos_planficacion", uniqueConstraints={@ORM\UniqueConstraint(name="uq_recursos", columns={"nombre"})}) | |
| 11 | + * @ORM\Entity | |
| 12 | + */ | |
| 13 | +class RecursosPlanificacion | |
| 14 | +{ | |
| 15 | + /** | |
| 16 | + * @var string | |
| 17 | + * | |
| 18 | + * @ORM\Column(name="nombre", type="string", length=100, nullable=false, options={"comment" = "Nombre del municipio"}) | |
| 19 | + */ | |
| 20 | + private $nombre; | |
| 21 | + | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * @var integer | |
| 25 | + * | |
| 26 | + * @ORM\Column(name="id", type="integer", nullable=false, options={"comment" = "Identificador del municipio"}) | |
| 27 | + * @ORM\Id | |
| 28 | + * @ORM\GeneratedValue(strategy="IDENTITY") | |
| 29 | + * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) | |
| 30 | + */ | |
| 31 | + private $id; | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * @return string | |
| 37 | + */ | |
| 38 | + public function __toString() { | |
| 39 | + return $this->getNombre(); | |
| 40 | + } | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * Set nombre | |
| 44 | + * | |
| 45 | + * @param string $nombre | |
| 46 | + * @return RecursosPlanificacion | |
| 47 | + */ | |
| 48 | + public function setNombre($nombre) | |
| 49 | + { | |
| 50 | + $this->nombre = $nombre; | |
| 51 | + | |
| 52 | + return $this; | |
| 53 | + } | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Get nombre | |
| 57 | + * | |
| 58 | + * @return string | |
| 59 | + */ | |
| 60 | + public function getNombre() | |
| 61 | + { | |
| 62 | + return $this->nombre; | |
| 63 | + } | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * Get id | |
| 67 | + * | |
| 68 | + * @return integer | |
| 69 | + */ | |
| 70 | + public function getId() | |
| 71 | + { | |
| 72 | + return $this->id; | |
| 73 | + } | |
| 74 | +} | ... | ... |
src/AppBundle/Entity/RecursosPlanificacion.php~
| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace AppBundle\Entity; | |
| 4 | + | |
| 5 | +use Doctrine\ORM\Mapping as ORM; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * RecursosPlanificacion | |
| 9 | + * | |
| 10 | + * @ORM\Table(name="recursos_planficacion", uniqueConstraints={@ORM\UniqueConstraint(name="uq_recursos", columns={"nombre"})}) | |
| 11 | + * @ORM\Entity | |
| 12 | + */ | |
| 13 | +class RecursosPlanificacion | |
| 14 | +{ | |
| 15 | + /** | |
| 16 | + * @var string | |
| 17 | + * | |
| 18 | + * @ORM\Column(name="nombre", type="string", length=100, nullable=false, options={"comment" = "Nombre del municipio"}) | |
| 19 | + */ | |
| 20 | + private $nombre; | |
| 21 | + | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * @var integer | |
| 25 | + * | |
| 26 | + * @ORM\Column(name="id", type="integer", nullable=false, options={"comment" = "Identificador del municipio"}) | |
| 27 | + * @ORM\Id | |
| 28 | + * @ORM\GeneratedValue(strategy="IDENTITY") | |
| 29 | + * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) | |
| 30 | + */ | |
| 31 | + private $id; | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * @return string | |
| 39 | + */ | |
| 40 | + public function __toString() { | |
| 41 | + return $this->getNombre(); | |
| 42 | + } | |
| 43 | +} | ... | ... |
src/AppBundle/Entity/TecnicasPlanificacion.php
| ... | ... | @@ -0,0 +1,74 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace AppBundle\Entity; | |
| 4 | + | |
| 5 | +use Doctrine\ORM\Mapping as ORM; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * TecnicasPlanificacion | |
| 9 | + * | |
| 10 | + * @ORM\Table(name="tecnicas_planficacion", uniqueConstraints={@ORM\UniqueConstraint(name="uq_tecnica", columns={"nombre"})}) | |
| 11 | + * @ORM\Entity | |
| 12 | + */ | |
| 13 | +class TecnicasPlanificacion | |
| 14 | +{ | |
| 15 | + /** | |
| 16 | + * @var string | |
| 17 | + * | |
| 18 | + * @ORM\Column(name="nombre", type="string", length=100, nullable=false, options={"comment" = "Nombre del municipio"}) | |
| 19 | + */ | |
| 20 | + private $nombre; | |
| 21 | + | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * @var integer | |
| 25 | + * | |
| 26 | + * @ORM\Column(name="id", type="integer", nullable=false, options={"comment" = "Identificador del municipio"}) | |
| 27 | + * @ORM\Id | |
| 28 | + * @ORM\GeneratedValue(strategy="IDENTITY") | |
| 29 | + * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) | |
| 30 | + */ | |
| 31 | + private $id; | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * Set nombre | |
| 37 | + * | |
| 38 | + * @param string $nombre | |
| 39 | + * @return TecnicasPlanificacion | |
| 40 | + */ | |
| 41 | + public function setNombre($nombre) | |
| 42 | + { | |
| 43 | + $this->nombre = $nombre; | |
| 44 | + | |
| 45 | + return $this; | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * Get nombre | |
| 50 | + * | |
| 51 | + * @return string | |
| 52 | + */ | |
| 53 | + public function getNombre() | |
| 54 | + { | |
| 55 | + return $this->nombre; | |
| 56 | + } | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * Get id | |
| 60 | + * | |
| 61 | + * @return integer | |
| 62 | + */ | |
| 63 | + public function getId() | |
| 64 | + { | |
| 65 | + return $this->id; | |
| 66 | + } | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * @return string | |
| 70 | + */ | |
| 71 | + public function __toString() { | |
| 72 | + return $this->getNombre(); | |
| 73 | + } | |
| 74 | +} | ... | ... |
src/AppBundle/Entity/TecnicasPlanificacion.php~
| ... | ... | @@ -0,0 +1,34 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace AppBundle\Entity; | |
| 4 | + | |
| 5 | +use Doctrine\ORM\Mapping as ORM; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * TecnicasPlanificacion | |
| 9 | + * | |
| 10 | + * @ORM\Table(name="tecnicas_planficacion", uniqueConstraints={@ORM\UniqueConstraint(name="uq_tecnica", columns={"nombre"})}) | |
| 11 | + * @ORM\Entity | |
| 12 | + */ | |
| 13 | +class TecnicasPlanificacion | |
| 14 | +{ | |
| 15 | + /** | |
| 16 | + * @var string | |
| 17 | + * | |
| 18 | + * @ORM\Column(name="nombre", type="string", length=100, nullable=false, options={"comment" = "Nombre del municipio"}) | |
| 19 | + */ | |
| 20 | + private $nombre; | |
| 21 | + | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * @var integer | |
| 25 | + * | |
| 26 | + * @ORM\Column(name="id", type="integer", nullable=false, options={"comment" = "Identificador del municipio"}) | |
| 27 | + * @ORM\Id | |
| 28 | + * @ORM\GeneratedValue(strategy="IDENTITY") | |
| 29 | + * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1) | |
| 30 | + */ | |
| 31 | + private $id; | |
| 32 | + | |
| 33 | + | |
| 34 | +} | |
| 0 | 35 | \ No newline at end of file | ... | ... |
src/AppBundle/Form/PlanificacionSeccionEstrategiaType.php
| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace AppBundle\Form; | |
| 4 | + | |
| 5 | +use Symfony\Component\Form\AbstractType; | |
| 6 | +use Symfony\Component\Form\FormBuilderInterface; | |
| 7 | +use Symfony\Component\OptionsResolver\OptionsResolver; | |
| 8 | + | |
| 9 | +class PlanificacionSeccionEstrategiaType extends AbstractType | |
| 10 | +{ | |
| 11 | + /** | |
| 12 | + * @param FormBuilderInterface $builder | |
| 13 | + * @param array $options | |
| 14 | + */ | |
| 15 | + public function buildForm(FormBuilderInterface $builder, array $options) | |
| 16 | + { | |
| 17 | + $builder | |
| 18 | + ->add('idTecnicasPlanificacion') | |
| 19 | + ->add('idRecursosPlanificacion') | |
| 20 | + | |
| 21 | + ; | |
| 22 | + } | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * @param OptionsResolver $resolver | |
| 26 | + */ | |
| 27 | + public function configureOptions(OptionsResolver $resolver) | |
| 28 | + { | |
| 29 | + $resolver->setDefaults(array( | |
| 30 | + 'data_class' => 'AppBundle\Entity\PlanificacionSeccionEstrategia' | |
| 31 | + )); | |
| 32 | + } | |
| 33 | +} | ... | ... |
src/AppBundle/Form/PlanificacionSeccionType.php
| ... | ... | @@ -67,6 +67,12 @@ class PlanificacionSeccionType extends AbstractType |
| 67 | 67 | 'allow_add' => true, |
| 68 | 68 | 'label' => false |
| 69 | 69 | )) |
| 70 | + | |
| 71 | + ->add('estrategia', CollectionType::class, array( | |
| 72 | + 'entry_type' => PlanificacionSeccionEstrategiaType::class, | |
| 73 | + 'allow_add' => true, | |
| 74 | + 'label' => false | |
| 75 | + )) | |
| 70 | 76 | ; |
| 71 | 77 | } |
| 72 | 78 | ... | ... |