Commit 787682fa6d92e1996ce58ee10919d0b43e22caec
1 parent
fa45985288
Exists in
feature/juan
creacion de crub y formularios embebidos
Showing
29 changed files
with
1362 additions
and
75 deletions
Show diff stats
app/Resources/views/ambiente/edit.html.twig
| 1 | 1 | {% extends 'base.html.twig' %} |
| 2 | 2 | |
| 3 | 3 | {% block body %} |
| 4 | - <h1>Ambiente edit</h1> | |
| 5 | - | |
| 6 | - {{ form_start(edit_form) }} | |
| 7 | - {{ form_widget(edit_form) }} | |
| 8 | - <input type="submit" value="Edit" /> | |
| 9 | - {{ form_end(edit_form) }} | |
| 10 | - | |
| 11 | - <ul> | |
| 12 | - <li> | |
| 13 | - <a href="{{ path('ambiente_index') }}">Back to the list</a> | |
| 14 | - </li> | |
| 15 | - <li> | |
| 16 | - {{ form_start(delete_form) }} | |
| 17 | - <input type="submit" value="Delete"> | |
| 18 | - {{ form_end(delete_form) }} | |
| 19 | - </li> | |
| 20 | - </ul> | |
| 21 | -{% endblock %} | |
| 4 | + <h1>Editar Ambiente </h1> | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + <form action="{{ path('ambiente_edit', { 'id': ambiente.id }) }}" id="form_ambiente" novalidate method="POST" {{ form_enctype(edit_form)}}> | |
| 9 | + | |
| 10 | + <div class="form-group{% if edit_form.descripcion.vars.errors[0].message is defined %} has-error{% endif %}"> | |
| 11 | + {{ form_label(edit_form.descripcion) }} | |
| 12 | + {{ form_widget(edit_form.descripcion) }} | |
| 13 | + </div class="form-group"> | |
| 14 | + | |
| 15 | + {% if form.descripcion.vars.errors[0].message is defined %} | |
| 16 | + <span class="help-block"> | |
| 17 | + {{ form.descripcion.vars.errors[0].message }} | |
| 18 | + </span> | |
| 19 | + | |
| 20 | + {% endif %} | |
| 21 | + | |
| 22 | + <div class="form-group{% if edit_form.codigo.vars.errors[0].message is defined %} has-error{% endif %}"> | |
| 23 | + {{ form_label(edit_form.codigo) }} | |
| 24 | + {{ form_widget(edit_form.codigo) }} | |
| 25 | + </div class="form-group"> | |
| 26 | + | |
| 27 | + {% if form.codigo.vars.errors[0].message is defined %} | |
| 28 | + <span class="help-block"> | |
| 29 | + {{ form.codigo.vars.errors[0].message }} | |
| 30 | + </span> | |
| 31 | + | |
| 32 | + {% endif %} | |
| 33 | + | |
| 34 | + <div class="form-group{% if edit_form.direccion.vars.errors[0].message is defined %} has-error{% endif %}"> | |
| 35 | + {{ form_label(edit_form.direccion) }} | |
| 36 | + {{ form_widget(edit_form.direccion) }} | |
| 37 | + </div class="form-group"> | |
| 38 | + | |
| 39 | + {% if form.direccion.vars.errors[0].message is defined %} | |
| 40 | + <span class="help-block"> | |
| 41 | + {{ form.direccion.vars.errors[0].message }} | |
| 42 | + </span> | |
| 43 | + | |
| 44 | + {% endif %} | |
| 45 | + | |
| 46 | + <div class="form-group{% if edit_form.coordenadaUtmNorte.vars.errors[0].message is defined %} has-error{% endif %}"> | |
| 47 | + {{ form_label(edit_form.coordenadaUtmNorte) }} | |
| 48 | + {{ form_widget(edit_form.coordenadaUtmNorte) }} | |
| 49 | + </div class="form-group"> | |
| 50 | + | |
| 51 | + {% if form.coordenadaUtmNorte.vars.errors[0].message is defined %} | |
| 52 | + <span class="help-block"> | |
| 53 | + {{ form.coordenadaUtmNorte.vars.errors[0].message }} | |
| 54 | + </span> | |
| 55 | + | |
| 56 | + {% endif %} | |
| 57 | + | |
| 58 | + <div class="form-group{% if edit_form.coordenadaUtmOeste.vars.errors[0].message is defined %} has-error{% endif %}"> | |
| 59 | + {{ form_label(edit_form.coordenadaUtmOeste) }} | |
| 60 | + {{ form_widget(edit_form.coordenadaUtmOeste) }} | |
| 61 | + </div class="form-group"> | |
| 62 | + | |
| 63 | + {% if form.coordenadaUtmOeste.vars.errors[0].message is defined %} | |
| 64 | + <span class="help-block"> | |
| 65 | + {{ form.coordenadaUtmOeste.vars.errors[0].message }} | |
| 66 | + </span> | |
| 67 | + | |
| 68 | + {% endif %} | |
| 69 | +<ul> | |
| 70 | + <ul> | |
| 71 | + | |
| 72 | + <a href={{ path('ambiente_index') }}><span class="glyphicon glyphicon-step-backward">Atras</span> | |
| 73 | +         | |
| 74 | + {{form_widget(edit_form._token)}} | |
| 75 | + <input type="submit" value="Editar"/> | |
| 76 | + <ul> | |
| 77 | + <ul> | |
| 78 | + <ul> | |
| 79 | + | |
| 80 | + | |
| 81 | + {% endblock %} | ... | ... |
app/Resources/views/ambiente/index.html.twig
| ... | ... | @@ -17,8 +17,8 @@ |
| 17 | 17 | |
| 18 | 18 | <h1>Ambientes list</h1> |
| 19 | 19 | |
| 20 | - <div class="table-responsive"> | |
| 21 | - <table class="table"> | |
| 20 | + <table class="table table-responsive table-hover"> | |
| 21 | + <thead> | |
| 22 | 22 | <thead> |
| 23 | 23 | |
| 24 | 24 | <tr> |
| ... | ... | @@ -35,18 +35,20 @@ |
| 35 | 35 | {% for ambiente in ambientes %} |
| 36 | 36 | <tr> |
| 37 | 37 | <td><a href="{{ path('ambiente_show', { 'id': ambiente.id }) }}">{{ ambiente.id }}</a></td> |
| 38 | - <td>{{ ambiente.descripcion }}</td> | |
| 39 | - <td>{{ ambiente.codigo }}</td> | |
| 40 | - <td>{{ ambiente.direccion }}</td> | |
| 41 | - <td>{{ ambiente.coordenadaUtmNorte }}</td> | |
| 42 | - <td>{{ ambiente.coordenadaUtmOeste }}</td> | |
| 38 | + <td>{{ ambiente.descripcion | capitalize }}</td> | |
| 39 | + <td>{{ ambiente.codigo}}</td> | |
| 40 | + <td>{{ ambiente.direccion | capitalize}}</td> | |
| 41 | + <td>{{ ambiente.coordenadaUtmNorte}}</td> | |
| 42 | + <td>{{ ambiente.coordenadaUtmOeste}}</td> | |
| 43 | 43 | <td> |
| 44 | 44 | <ul> |
| 45 | 45 | <li> |
| 46 | - <a class="btn btn-default" href="{{ path('ambiente_show', { 'id': ambiente.id }) }}">show</a> | |
| 46 | + | |
| 47 | + <a href="{{ path('ambiente_show', { 'id': ambiente.id }) }}"> <span class="glyphicon glyphicon-eye-open"></span> | |
| 47 | 48 | </li> |
| 48 | 49 | <li> |
| 49 | - <a class="btn btn-default" href="{{ path('ambiente_edit', { 'id': ambiente.id }) }}">edit</a> | |
| 50 | + | |
| 51 | + <a href="{{ path('ambiente_edit', { 'id': ambiente.id }) }}"> <span class="glyphicon glyphicon-pencil"></span> | |
| 50 | 52 | </li> |
| 51 | 53 | </ul> |
| 52 | 54 | </td> |
| ... | ... | @@ -54,13 +56,16 @@ |
| 54 | 56 | {% endfor %} |
| 55 | 57 | </tbody> |
| 56 | 58 | </table> |
| 57 | -</div> | |
| 59 | + | |
| 58 | 60 | <ul> |
| 59 | 61 | <br> |
| 60 | 62 | <br> |
| 61 | 63 | <br> |
| 62 | - | |
| 63 | - <a class="btn btn-default" href="{{ path('ambiente_new') }}">Agregar</a> | |
| 64 | + <a href="{{ path('ambiente_new') }}"><span class="glyphicon glyphicon-play">Agregar</span></a> | |
| 65 | +     | |
| 66 | + <span class="glyphicon glyphicon-trash">Eliminar</span> | |
| 67 | + | |
| 68 | + | |
| 64 | 69 | <br> |
| 65 | 70 | <br> |
| 66 | 71 | </li> | ... | ... |
app/Resources/views/ambiente/new.html.twig
| ... | ... | @@ -4,33 +4,29 @@ |
| 4 | 4 | |
| 5 | 5 | <h1>Creacion del Ambiente</h1> |
| 6 | 6 | |
| 7 | - {#{{ form_start(form) }} | |
| 8 | - {{ form_widget(form) }} | |
| 9 | - <input type="submit" value="Create" /> | |
| 10 | - {{ form_end(form) }}#} | |
| 11 | 7 | |
| 8 | +{#para desactivar verificacion con el servidor#} | |
| 12 | 9 | {{ form_start(form, {'attr': {'novalidate': 'novalidate'}, 'action': path('ambiente_new')}) }} |
| 13 | 10 | |
| 14 | - <form class="form-inline"> | |
| 15 | - <div class="form-group"> | |
| 11 | + <br> | |
| 12 | + | |
| 16 | 13 | {{ form_label(form.descripcion) }} |
| 17 | - {{ form_widget(form.descripcion) }} | |
| 18 | -</div> | |
| 19 | -</div class="form-group"> | |
| 14 | + {{ form_widget(form.descripcion) }} | |
| 15 | + | |
| 20 | 16 | |
| 21 | -{% if form.descripcion.vars.errors[0].message is defined %} | |
| 17 | + {% if form.descripcion.vars.errors[0].message is defined %} | |
| 22 | 18 | <span class="help-block"> |
| 23 | 19 | {{ form.descripcion.vars.errors[0].message }} |
| 24 | 20 | </span> |
| 25 | 21 | |
| 26 | 22 | {% endif %} |
| 23 | + | |
| 24 | +<br> | |
| 27 | 25 | |
| 28 | - <form class="form-inline"> | |
| 29 | - <div class="form-group"> | |
| 30 | 26 | {{ form_label(form.codigo) }} |
| 31 | - {{ form_widget(form.codigo) }} | |
| 32 | -</div> | |
| 33 | - <div class="form-group"> | |
| 27 | + {{ form_widget(form.codigo)}} | |
| 28 | + | |
| 29 | + | |
| 34 | 30 | {% if form.codigo.vars.errors[0].message is defined %} |
| 35 | 31 | <span class="help-block"> |
| 36 | 32 | {{ form.codigo.vars.errors[0].message }} |
| ... | ... | @@ -38,12 +34,11 @@ |
| 38 | 34 | |
| 39 | 35 | {% endif %} |
| 40 | 36 | |
| 41 | -<form class="form-inline"> | |
| 42 | - <div class="form-group"> | |
| 37 | +<br> | |
| 38 | + | |
| 43 | 39 | {{ form_label(form.direccion) }} |
| 44 | 40 | {{ form_widget(form.direccion) }} |
| 45 | -</div> | |
| 46 | - <div class="form-group"> | |
| 41 | + | |
| 47 | 42 | {% if form.direccion.vars.errors[0].message is defined %} |
| 48 | 43 | <span class="help-block"> |
| 49 | 44 | {{ form.direccion.vars.errors[0].message }} |
| ... | ... | @@ -51,12 +46,11 @@ |
| 51 | 46 | |
| 52 | 47 | |
| 53 | 48 | {% endif %} |
| 54 | -<form class="form-inline"> | |
| 55 | - <div class="form-group"> | |
| 49 | +<br> | |
| 50 | + | |
| 56 | 51 | {{ form_label(form.coordenadaUtmNorte) }} |
| 57 | 52 | {{ form_widget(form.coordenadaUtmNorte) }} |
| 58 | -</div> | |
| 59 | - <div class="form-group"> | |
| 53 | + | |
| 60 | 54 | {% if form.coordenadaUtmNorte.vars.errors[0].message is defined %} |
| 61 | 55 | <span class="help-block"> |
| 62 | 56 | {{ form.coordenadaUtmNorte.vars.errors[0].message }} |
| ... | ... | @@ -64,12 +58,11 @@ |
| 64 | 58 | |
| 65 | 59 | |
| 66 | 60 | {% endif %} |
| 67 | -<form class="form-inline"> | |
| 68 | - <div class="form-group"> | |
| 61 | +<br> | |
| 62 | + | |
| 69 | 63 | {{ form_label(form.coordenadaUtmOeste) }} |
| 70 | 64 | {{ form_widget(form.coordenadaUtmOeste) }} |
| 71 | -</div> | |
| 72 | - <div class="form-group"> | |
| 65 | + | |
| 73 | 66 | {% if form.coordenadaUtmOeste.vars.errors[0].message is defined %} |
| 74 | 67 | <span class="help-block"> |
| 75 | 68 | {{ form.coordenadaUtmOeste.vars.errors[0].message }} |
| ... | ... | @@ -79,13 +72,13 @@ |
| 79 | 72 | {% endif %} |
| 80 | 73 | |
| 81 | 74 | <u1> |
| 82 | - <li> | |
| 83 | 75 | |
| 76 | + <br> | |
| 77 | + <a href={{ path('ambiente_index') }}><span class="glyphicon glyphicon-step-backward">Atras</span> | |
| 78 | +     | |
| 84 | 79 | <input type="submit" value="Crear"/> |
| 85 | 80 | {{form_end(form)}} |
| 86 | - | |
| 87 | - {#<a class="btn btn-default" href="{{ path('ambiente_index') }}">Crear</a>#} | |
| 88 | - <a class="btn btn-default" href="{{ path('ambiente_index') }}">Volver al Listado</a> | |
| 81 | + | |
| 89 | 82 | </li> |
| 90 | 83 | </ul> |
| 91 | 84 | {% endblock %} | ... | ... |
app/Resources/views/ambiente/show.html.twig
| ... | ... | @@ -3,7 +3,8 @@ |
| 3 | 3 | {% block body %} |
| 4 | 4 | <h1>Ambiente</h1> |
| 5 | 5 | |
| 6 | - <table> | |
| 6 | + <table class="table table-bordered"> | |
| 7 | + | |
| 7 | 8 | <tbody> |
| 8 | 9 | <tr> |
| 9 | 10 | <th>Id</th> |
| ... | ... | @@ -30,19 +31,20 @@ |
| 30 | 31 | <td>{{ ambiente.coordenadaUtmOeste }}</td> |
| 31 | 32 | </tr> |
| 32 | 33 | </tbody> |
| 33 | - </table> | |
| 34 | + </table> | |
| 34 | 35 | |
| 35 | 36 | <ul> |
| 36 | - <li> | |
| 37 | - <a href="{{ path('ambiente_index') }}">Back to the list</a> | |
| 38 | - </li> | |
| 39 | - <li> | |
| 40 | - <a href="{{ path('ambiente_edit', { 'id': ambiente.id }) }}">Edit</a> | |
| 41 | - </li> | |
| 42 | - <li> | |
| 43 | - {{ form_start(delete_form) }} | |
| 44 | - <input type="submit" value="Delete"> | |
| 37 | + | |
| 38 | + <a href="{{ path('ambiente_index') }}" <span class="glyphicon glyphicon-arrow-left">Atras</span></a> | |
| 39 | +     | |
| 40 | + <a href="{{ path('ambiente_edit', { 'id': ambiente.id }) }}"><span class="glyphicon glyphicon-edit">Editar</span></a> | |
| 41 | +     | |
| 42 | + <a href="{{ path('ambiente_edit', { 'id': ambiente.id }) }}"><span class="glyphicon glyphicon-trash">Eliminar </span></a> | |
| 45 | 43 | {{ form_end(delete_form) }} |
| 44 | + | |
| 45 | + | |
| 46 | + {#<input type="submit" value="Eliminar"> | |
| 47 | + {{ form_end(delete_form) }}#} | |
| 46 | 48 | </li> |
| 47 | 49 | </ul> |
| 48 | 50 | {% endblock %} | ... | ... |
app/Resources/views/estado/edit.html.twig
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +{% extends 'base.html.twig' %} | |
| 2 | + | |
| 3 | +{% block body %} | |
| 4 | + <h1>Estado edit</h1> | |
| 5 | + | |
| 6 | + {{ form_start(edit_form) }} | |
| 7 | + <br> | |
| 8 | + {{ form_widget(edit_form) }} | |
| 9 | + <input type="submit" value="Editar" /> | |
| 10 | + {{ form_end(edit_form) }} | |
| 11 | + | |
| 12 | + <ul> | |
| 13 | + <li> | |
| 14 | + <a href="{{ path('estado_index') }}">Volver al Listado</a> | |
| 15 | + {{ form_start(delete_form) }}<input type="submit" value="Eliminar"> | |
| 16 | + {{ form_end(delete_form) }} | |
| 17 | + </li> | |
| 18 | + </ul> | |
| 19 | +{% endblock %} | ... | ... |
app/Resources/views/estado/index.html.twig
| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | +{% extends 'base.html.twig' %} | |
| 2 | + | |
| 3 | +{% block body %} | |
| 4 | + <h1>Estados list</h1> | |
| 5 | + | |
| 6 | + <table class="table"> | |
| 7 | + <thead> | |
| 8 | + <tr> | |
| 9 | + <th>Id</th> | |
| 10 | + <th>Descripcion</th> | |
| 11 | + <th>Codigo</th> | |
| 12 | + <th>Actions</th> | |
| 13 | + </tr> | |
| 14 | + </thead> | |
| 15 | + | |
| 16 | + <tbody> | |
| 17 | + {% for estado in estados %} | |
| 18 | + <tr> | |
| 19 | + <td><a href="{{ path('estado_show', { 'id': estado.id }) }}">{{ estado.id }}</a></td> | |
| 20 | + <td>{{ estado.descripcion | capitalize }}</td> | |
| 21 | + <td>{{ estado.codigo }}</td> | |
| 22 | + | |
| 23 | + <td> | |
| 24 | + <ul> | |
| 25 | + <li> | |
| 26 | + <a href="{{ path('estado_show', { 'id': estado.id }) }}"><span class="glyphicon glyphicon-eye-open"></span> | |
| 27 | + </li> | |
| 28 | + <li> | |
| 29 | + <a href="{{ path('estado_edit', { 'id': estado.id }) }}"><span class="glyphicon glyphicon-pencil"></span> | |
| 30 | + </li> | |
| 31 | + </ul> | |
| 32 | + </td> | |
| 33 | + </tr> | |
| 34 | + {% endfor %} | |
| 35 | + </tbody> | |
| 36 | + </table> | |
| 37 | + | |
| 38 | + <ul> | |
| 39 | + <li> | |
| 40 | + <a class="btn btn-default" href="{{ path('estado_new') }}">Crear Nuevo Estado</a> | |
| 41 | + </li> | |
| 42 | + </ul> | |
| 43 | +{% endblock %} | ... | ... |
app/Resources/views/estado/new.html.twig
| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | +{% extends 'base.html.twig' %} | |
| 2 | + | |
| 3 | +{% block body %} | |
| 4 | + <h1>Estado creation</h1> | |
| 5 | + | |
| 6 | + {{ form_start(form, {'attr': {'novalidate': 'novalidate'}, 'action': path('estado_new')}) }} | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + {% if form.codigo.vars.errors[0].message is defined %} | |
| 11 | + <span class="help-block"> | |
| 12 | + {{ form.codigo.vars.errors[0].message }} | |
| 13 | + </span> | |
| 14 | + | |
| 15 | + {% endif %} | |
| 16 | + <br> | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + <br> <br> | |
| 21 | + <br> | |
| 22 | + <ul> | |
| 23 | + <li> | |
| 24 | + <a href="{{ path('estado_index') }}">Volver al listado</a> | |
| 25 | +     | |
| 26 | + <input type="submit" value="Crear"/> | |
| 27 | + {{form_end(form)}} | |
| 28 | + </li> | |
| 29 | + </ul> | |
| 30 | + | |
| 31 | + {% endblock %} | ... | ... |
app/Resources/views/estado/show.html.twig
| ... | ... | @@ -0,0 +1,35 @@ |
| 1 | +{% extends 'base.html.twig' %} | |
| 2 | + | |
| 3 | +{% block body %} | |
| 4 | + <h1>Estado</h1> | |
| 5 | + | |
| 6 | + <table class="table table-bordered"> | |
| 7 | + <tbody> | |
| 8 | + <tr> | |
| 9 | + <th>Id</th> | |
| 10 | + <td>{{ estado.id }}</td> | |
| 11 | + </tr> | |
| 12 | + <tr> | |
| 13 | + <th>Codigo</th> | |
| 14 | + <td>{{ estado.codigo }}</td> | |
| 15 | + | |
| 16 | + </tr> | |
| 17 | + <tr> | |
| 18 | + <th>Descripcion</th> | |
| 19 | + <td>{{ estado.descripcion }}</td> | |
| 20 | + </tr> | |
| 21 | + </tbody> | |
| 22 | + </table> | |
| 23 | + | |
| 24 | + <ul> | |
| 25 | + <li> | |
| 26 | + <a class="btn btn-default" href="{{ path('estado_index') }}" role="button">Volver</a> | |
| 27 | + <a class="btn btn-default" href="{{ path('estado_edit', { 'id': estado.id }) }}">Editar</a> | |
| 28 | + | |
| 29 | + | |
| 30 | + {{ form_start(delete_form) }} | |
| 31 | + <input type="submit" value="Delete"> | |
| 32 | + {{ form_end(delete_form) }} | |
| 33 | + </li> | |
| 34 | + </ul> | |
| 35 | +{% endblock %} | ... | ... |
app/Resources/views/municipio/edit.html.twig
| ... | ... | @@ -0,0 +1,57 @@ |
| 1 | +{% extends 'base.html.twig' %} | |
| 2 | + | |
| 3 | +{% block body %} | |
| 4 | + <h1>Editar Municipio</h1> | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + <form action="{{ path('municipio_edit', { 'id': municipio.id }) }}" id="form_municipio" novalidate method="POST" {{ form_enctype(edit_form)}}> | |
| 9 | + | |
| 10 | + <div class="form-group{% if edit_form.descripcion.vars.errors[0].message is defined %} has-error{% endif %}"> | |
| 11 | + {{ form_label(edit_form.descripcion) }} | |
| 12 | + {{ form_widget(edit_form.descripcion) }} | |
| 13 | + </div class="form-group"> | |
| 14 | + | |
| 15 | + {% if form.descripcion.vars.errors[0].message is defined %} | |
| 16 | + <span class="help-block"> | |
| 17 | + {{ form.descripcion.vars.errors[0].message }} | |
| 18 | + </span> | |
| 19 | + | |
| 20 | + {% endif %} | |
| 21 | + | |
| 22 | + | |
| 23 | + <div class="form-group{% if edit_form.descripcion.vars.errors[0].message is defined %} has-error{% endif %}"> | |
| 24 | + {{ form_label(edit_form.codigo) }} | |
| 25 | + {{ form_widget(edit_form.codigo) }} | |
| 26 | + </div class="form-group"> | |
| 27 | + | |
| 28 | + {% if form.codigo.vars.errors[0].message is defined %} | |
| 29 | + <span class="help-block"> | |
| 30 | + {{ form.codigo.vars.errors[0].message }} | |
| 31 | + </span> | |
| 32 | + | |
| 33 | + {% endif %} | |
| 34 | + | |
| 35 | + | |
| 36 | + <div class="form-group{% if edit_form.estado.vars.errors[0].message is defined %} has-error{% endif %}"> | |
| 37 | + {{ form_label(edit_form.estado) }} | |
| 38 | + {{ form_widget(edit_form.estado) }} | |
| 39 | + </div class="form-group"> | |
| 40 | + | |
| 41 | + {% if form.estado.vars.errors[0].message is defined %} | |
| 42 | + <span class="help-block"> | |
| 43 | + {{ form.estado.vars.errors[0].message }} | |
| 44 | + </span> | |
| 45 | + | |
| 46 | + {% endif %} | |
| 47 | + | |
| 48 | + <a href="{{ path('municipio_index') }}"><button type="button" class="btn btn-info">Volver al Listado</button> | |
| 49 | + | |
| 50 | + <input type="submit" value="Editar" /> | |
| 51 | + {{ form_end(edit_form) }} | |
| 52 | + | |
| 53 | + {{ form_start(delete_form) }} | |
| 54 | + <input type="submit" value="Eliminar"> | |
| 55 | + {{ form_end(delete_form) }} | |
| 56 | + | |
| 57 | +{% endblock %} | ... | ... |
app/Resources/views/municipio/index.html.twig
| ... | ... | @@ -0,0 +1,47 @@ |
| 1 | +{% extends 'base.html.twig' %} | |
| 2 | + | |
| 3 | +{% block body %} | |
| 4 | + <h1>Municipios list</h1> | |
| 5 | + | |
| 6 | + | |
| 7 | + <table class="table"> | |
| 8 | + | |
| 9 | + <tbody> | |
| 10 | + <tr> | |
| 11 | + <tr> | |
| 12 | + <th>Id</th> | |
| 13 | + <th>Descripcion</th> | |
| 14 | + <th>Codigo</th> | |
| 15 | + <th>Estado</th> | |
| 16 | + <th>Actions</th> | |
| 17 | + </tr> | |
| 18 | + <tr> | |
| 19 | + </thead> | |
| 20 | + <tbody> | |
| 21 | + {% for municipio in municipios %} | |
| 22 | + <tr> | |
| 23 | + <td><a href="{{ path('municipio_show', { 'id': municipio.id }) }}">{{ municipio.id }}</a></td> | |
| 24 | + <td>{{ municipio.descripcion | capitalize }}</td> | |
| 25 | + <td>{{ municipio.codigo| capitalize}}</td> | |
| 26 | + <td>{{ municipio.Estado| capitalize }}</td> | |
| 27 | + <td> | |
| 28 | + <ul> | |
| 29 | + <li> | |
| 30 | + <a href="{{ path('municipio_show', { 'id': municipio.id }) }}"><span class="glyphicon glyphicon-eye-open"></span> | |
| 31 | + </li> | |
| 32 | + <li> | |
| 33 | + <a href="{{ path('municipio_edit', { 'id': municipio.id }) }}"><span class="glyphicon glyphicon-pencil"></span> | |
| 34 | + </li> | |
| 35 | + </ul> | |
| 36 | + </td> | |
| 37 | + </tr> | |
| 38 | + {% endfor %} | |
| 39 | + </tbody> | |
| 40 | + </table> | |
| 41 | + | |
| 42 | + <ul> | |
| 43 | + <li> | |
| 44 | + <a href="{{ path('municipio_new') }}"><button type="button" class="btn btn-info">Crear Nuevo Municipio</button> | |
| 45 | + </li> | |
| 46 | + </ul> | |
| 47 | +{% endblock %} | ... | ... |
app/Resources/views/municipio/new.html.twig
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +{% extends 'base.html.twig' %} | |
| 2 | + | |
| 3 | +{% block body %} | |
| 4 | + <h1>Crear un Municipio</h1> | |
| 5 | + | |
| 6 | + {{ form_start(form) }} | |
| 7 | + {{ form_widget(form) }} | |
| 8 | + <input type="submit" value="Crear" /> | |
| 9 | + | |
| 10 | + {{ form_end(form) }} | |
| 11 | + | |
| 12 | + <a href="{{ path('municipio_index') }}"><button type="button" class="btn btn-info">Volver al Listado</button> | |
| 13 | + </li> | |
| 14 | + </ul> | |
| 15 | +{% endblock %} | ... | ... |
app/Resources/views/municipio/show.html.twig
| ... | ... | @@ -0,0 +1,41 @@ |
| 1 | +{% extends 'base.html.twig' %} | |
| 2 | + | |
| 3 | +{% block body %} | |
| 4 | + <h1>Municipio</h1> | |
| 5 | + | |
| 6 | + | |
| 7 | + <table class="table"> | |
| 8 | + <thead class="blue-grey lighten-4"> | |
| 9 | + <tbody> | |
| 10 | + <tr> | |
| 11 | + <th>Id</th> | |
| 12 | + <td>{{ municipio.id }}</td> | |
| 13 | + </tr> | |
| 14 | + <tr> | |
| 15 | + <th>Descripcion</th> | |
| 16 | + <td>{{ municipio.descripcion }}</td> | |
| 17 | + </tr> | |
| 18 | + <tr> | |
| 19 | + <th>Codigo</th> | |
| 20 | + <td>{{ municipio.codigo }}</td> | |
| 21 | + </tr> | |
| 22 | + </tbody> | |
| 23 | + </thead> | |
| 24 | + </table> | |
| 25 | + | |
| 26 | + <ul> | |
| 27 | + | |
| 28 | + <a href="{{ path('municipio_index') }}" class="btn btn-info" role="button">Volver</a> | |
| 29 | + | |
| 30 | + <a href="{{ path('municipio_index') }}" class="btn btn-info" role="button">Editar</a> | |
| 31 | + | |
| 32 | + | |
| 33 | + {{ form_start(delete_form) }} | |
| 34 | +     | |
| 35 | + <input type="submit" value="Eliminar"> | |
| 36 | + {{ form_end(delete_form) }} | |
| 37 | + | |
| 38 | + </ul> | |
| 39 | + | |
| 40 | +</div> | |
| 41 | +{% endblock %} | ... | ... |
app/Resources/views/parroquia/edit.html.twig
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +{% extends 'base.html.twig' %} | |
| 2 | + | |
| 3 | +{% block body %} | |
| 4 | + <h1>Parroquia edit</h1> | |
| 5 | + | |
| 6 | + {{ form_start(edit_form) }} | |
| 7 | + {{ form_widget(edit_form) }} | |
| 8 | + <input type="submit" value="Edit" /> | |
| 9 | + {{ form_end(edit_form) }} | |
| 10 | + | |
| 11 | + <ul> | |
| 12 | + <li> | |
| 13 | + <a href="{{ path('parroquia_index') }}">Back to the list</a> | |
| 14 | + </li> | |
| 15 | + <li> | |
| 16 | + {{ form_start(delete_form) }} | |
| 17 | + <input type="submit" value="Delete"> | |
| 18 | + {{ form_end(delete_form) }} | |
| 19 | + </li> | |
| 20 | + </ul> | |
| 21 | +{% endblock %} | ... | ... |
app/Resources/views/parroquia/index.html.twig
| ... | ... | @@ -0,0 +1,44 @@ |
| 1 | +{% extends 'base.html.twig' %} | |
| 2 | + | |
| 3 | +{% block body %} | |
| 4 | + <h1>Parroquias lista</h1> | |
| 5 | + | |
| 6 | + <table class="table table-bordered"> | |
| 7 | + <thead> | |
| 8 | + <tr> | |
| 9 | + <th>Id</th> | |
| 10 | + <th>Descripcion</th> | |
| 11 | + <th>Codigo</th> | |
| 12 | + <th>Municipio</th> | |
| 13 | + <th>Actions</th> | |
| 14 | + </tr> | |
| 15 | + </thead> | |
| 16 | + <tbody> | |
| 17 | + {% for parroquia in parroquias %} | |
| 18 | + <tr> | |
| 19 | + <td><a href="{{ path('parroquia_show', { 'id': parroquia.id }) }}">{{ parroquia.id }}</a></td> | |
| 20 | + <td>{{ parroquia.descripcion | capitalize }}</td> | |
| 21 | + <td>{{ parroquia.codigo | capitalize }}</td> | |
| 22 | + <td>{{ parroquia.Municipio | capitalize }}</td> | |
| 23 | + <td> | |
| 24 | + <ul> | |
| 25 | + <li> | |
| 26 | + <a href="{{ path('parroquia_show', { 'id': parroquia.id }) }}"> <span class="glyphicon glyphicon-eye-open"></span> | |
| 27 | + </li> | |
| 28 | + <li> | |
| 29 | + | |
| 30 | + <a href="{{ path('parroquia_edit', { 'id': parroquia.id }) }}"> <span class="glyphicon glyphicon-pencil"></span> | |
| 31 | + </li> | |
| 32 | + </ul> | |
| 33 | + </td> | |
| 34 | + </tr> | |
| 35 | + {% endfor %} | |
| 36 | + </tbody> | |
| 37 | + </table> | |
| 38 | + | |
| 39 | + <ul> | |
| 40 | + <li> | |
| 41 | + <a href="{{ path('parroquia_new') }}"><button type="button" class="btn btn-info">Crear Nueva parroquia</button> | |
| 42 | + </li> | |
| 43 | + </ul> | |
| 44 | +{% endblock %} | ... | ... |
app/Resources/views/parroquia/new.html.twig
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +{% extends 'base.html.twig' %} | |
| 2 | + | |
| 3 | +{% block body %} | |
| 4 | + <h1>Parroquia creation</h1> | |
| 5 | + | |
| 6 | + {{ form_start(form) }} | |
| 7 | + {{ form_widget(form) }} | |
| 8 | + <input type="submit" value="Create" /> | |
| 9 | + {{ form_end(form) }} | |
| 10 | + | |
| 11 | + <ul> | |
| 12 | + <li> | |
| 13 | + | |
| 14 | + <a href="{{ path('parroquia_index') }}"><button type="button" class="btn btn-info">Volver al Listado</button> | |
| 15 | + </li> | |
| 16 | + </ul> | |
| 17 | +{% endblock %} | ... | ... |
app/Resources/views/parroquia/show.html.twig
| ... | ... | @@ -0,0 +1,36 @@ |
| 1 | +{% extends 'base.html.twig' %} | |
| 2 | + | |
| 3 | +{% block body %} | |
| 4 | + <h1>Parroquias</h1> | |
| 5 | + | |
| 6 | + <table class="table table-bordered"> | |
| 7 | + <tbody> | |
| 8 | + <tr> | |
| 9 | + <th>Id</th> | |
| 10 | + <td>{{ parroquia.id }}</td> | |
| 11 | + </tr> | |
| 12 | + <tr> | |
| 13 | + <th>Descripcion</th> | |
| 14 | + <td>{{ parroquia.descripcion }}</td> | |
| 15 | + </tr> | |
| 16 | + <tr> | |
| 17 | + <th>Codigo</th> | |
| 18 | + <td>{{ parroquia.codigo }}</td> | |
| 19 | + </tr> | |
| 20 | + </tbody> | |
| 21 | + </table> | |
| 22 | + | |
| 23 | + <ul> | |
| 24 | + <li> | |
| 25 | + <a href="{{ path('parroquia_index') }}">Volver al listado</a> | |
| 26 | + </li> | |
| 27 | + <li> | |
| 28 | + <a href="{{ path('parroquia_edit', { 'id': parroquia.id }) }}">Editar</a> | |
| 29 | + </li> | |
| 30 | + <li> | |
| 31 | + {{ form_start(delete_form) }} | |
| 32 | + <input type="submit" value="Delete"> | |
| 33 | + {{ form_end(delete_form) }} | |
| 34 | + </li> | |
| 35 | + </ul> | |
| 36 | +{% endblock %} | ... | ... |
src/UBV/PracticaBundle/Controller/ambienteController.php
| ... | ... | @@ -89,7 +89,7 @@ class ambienteController extends Controller |
| 89 | 89 | if ($editForm->isSubmitted() && $editForm->isValid()) { |
| 90 | 90 | $this->getDoctrine()->getManager()->flush(); |
| 91 | 91 | $this->get('session')->getFlashBag()->set( 'success', array( 'title' => 'Guardado!', 'message' => 'Estado editado satisfactoriamente.' ) ); |
| 92 | - return $this->redirectToRoute('ambiente_edit', array('id' => $ambiente->getId())); | |
| 92 | + return $this->redirectToRoute('ambiente_index', array('id' => $ambiente->getId())); | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | return $this->render('ambiente/edit.html.twig', array( | ... | ... |
src/UBV/PracticaBundle/Controller/estadoController.php
| ... | ... | @@ -0,0 +1,154 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace UBV\PracticaBundle\Controller; | |
| 4 | + | |
| 5 | +use UBV\PracticaBundle\Entity\estado; | |
| 6 | +use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
| 7 | +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; | |
| 8 | +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | |
| 9 | +use Symfony\Component\HttpFoundation\Request; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * Estado controller. | |
| 13 | + * | |
| 14 | + * @Route("estado") | |
| 15 | + */ | |
| 16 | +class estadoController extends Controller | |
| 17 | +{ | |
| 18 | + /** | |
| 19 | + * Lists all estado entities. | |
| 20 | + * | |
| 21 | + * @Route("/", name="estado_index") | |
| 22 | + * @Method("GET") | |
| 23 | + */ | |
| 24 | + public function indexAction() | |
| 25 | + { | |
| 26 | + $em = $this->getDoctrine()->getManager(); | |
| 27 | + | |
| 28 | + $estados = $em->getRepository('UBVPracticaBundle:estado')->findAll(); | |
| 29 | + | |
| 30 | + return $this->render('estado/index.html.twig', array( | |
| 31 | + 'estados' => $estados, | |
| 32 | + )); | |
| 33 | + } | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * Creates a new estado entity. | |
| 37 | + * | |
| 38 | + * @Route("/new", name="estado_new") | |
| 39 | + * @Method({"GET", "POST"}) | |
| 40 | + * | |
| 41 | + * | |
| 42 | + * | |
| 43 | + */ | |
| 44 | + public function newAction(Request $request) | |
| 45 | + { | |
| 46 | + $estado = new Estado(); | |
| 47 | + $form = $this->createForm('UBV\PracticaBundle\Form\estadoType', $estado); | |
| 48 | + $form->handleRequest($request); | |
| 49 | + | |
| 50 | + if ($form->isSubmitted() && $form->isValid()) { | |
| 51 | + $em = $this->getDoctrine()->getManager(); | |
| 52 | + $em->persist($estado); | |
| 53 | + $em->flush(); | |
| 54 | + | |
| 55 | + return $this->redirectToRoute('estado_show', array('id' => $estado->getId())); | |
| 56 | + | |
| 57 | + | |
| 58 | + } | |
| 59 | + | |
| 60 | + return $this->render('estado/new.html.twig', array( | |
| 61 | + 'estado' => $estado, | |
| 62 | + 'form' => $form->createView(), | |
| 63 | + )); | |
| 64 | + } | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * Finds and displays a estado entity. | |
| 68 | + * | |
| 69 | + * @Route("/{id}", name="estado_show") | |
| 70 | + * @Method("GET") | |
| 71 | + */ | |
| 72 | + public function showAction(estado $estado) | |
| 73 | + { | |
| 74 | + $deleteForm = $this->createDeleteForm($estado); | |
| 75 | + | |
| 76 | + return $this->render('estado/show.html.twig', array( | |
| 77 | + 'estado' => $estado, | |
| 78 | + 'delete_form' => $deleteForm->createView(), | |
| 79 | + )); | |
| 80 | + } | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * Displays a form to edit an existing estado entity. | |
| 84 | + * | |
| 85 | + * @Route("/{id}/edit", name="estado_edit") | |
| 86 | + * @Method({"GET", "POST"}) | |
| 87 | + */ | |
| 88 | + public function editAction(Request $request, estado $estado) | |
| 89 | + { | |
| 90 | + $deleteForm = $this->createDeleteForm($estado); | |
| 91 | + $editForm = $this->createForm('UBV\PracticaBundle\Form\estadoType', $estado); | |
| 92 | + $editForm->handleRequest($request); | |
| 93 | + | |
| 94 | + if ($editForm->isSubmitted() && $editForm->isValid()) { | |
| 95 | + $this->getDoctrine()->getManager()->flush(); | |
| 96 | + | |
| 97 | + return $this->redirectToRoute('estado_edit', array('id' => $estado->getId())); | |
| 98 | + } | |
| 99 | + | |
| 100 | + return $this->render('estado/edit.html.twig', array( | |
| 101 | + 'estado' => $estado, | |
| 102 | + 'edit_form' => $editForm->createView(), | |
| 103 | + 'delete_form' => $deleteForm->createView(), | |
| 104 | + )); | |
| 105 | + } | |
| 106 | + | |
| 107 | + /** | |
| 108 | + * Deletes a estado entity. | |
| 109 | + * | |
| 110 | + * @Route("/{id}", name="estado_delete") | |
| 111 | + * @Method("DELETE") | |
| 112 | + */ | |
| 113 | + public function deleteAction(Request $request, estado $estado) | |
| 114 | + { | |
| 115 | + $form = $this->createDeleteForm($estado); | |
| 116 | + $form->handleRequest($request); | |
| 117 | + | |
| 118 | + if ($form->isSubmitted() && $form->isValid()) { | |
| 119 | + $em = $this->getDoctrine()->getManager(); | |
| 120 | + $em->remove($estado); | |
| 121 | + $em->flush(); | |
| 122 | + } | |
| 123 | + | |
| 124 | + return $this->redirectToRoute('estado_index'); | |
| 125 | + } | |
| 126 | + | |
| 127 | + /** | |
| 128 | + * Creates a form to delete a estado entity. | |
| 129 | + * | |
| 130 | + * @param estado $estado The estado entity | |
| 131 | + * | |
| 132 | + * @return \Symfony\Component\Form\Form The form | |
| 133 | + */ | |
| 134 | + private function createDeleteForm(estado $estado) | |
| 135 | + { | |
| 136 | + return $this->createFormBuilder() | |
| 137 | + ->setAction($this->generateUrl('estado_delete', array('id' => $estado->getId()))) | |
| 138 | + ->setMethod('DELETE') | |
| 139 | + ->getForm() | |
| 140 | + ; | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + return array( | |
| 146 | + 'form' => $form->createView() | |
| 147 | + ); | |
| 148 | +} | |
| 149 | + | |
| 150 | + } | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | ... | ... |
src/UBV/PracticaBundle/Controller/municipioController.php
| ... | ... | @@ -0,0 +1,136 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace UBV\PracticaBundle\Controller; | |
| 4 | + | |
| 5 | +use UBV\PracticaBundle\Entity\municipio; | |
| 6 | +use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
| 7 | +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; | |
| 8 | +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Municipio controller. | |
| 12 | + * | |
| 13 | + * @Route("municipio") | |
| 14 | + */ | |
| 15 | +class municipioController extends Controller | |
| 16 | +{ | |
| 17 | + /** | |
| 18 | + * Lists all municipio entities. | |
| 19 | + * | |
| 20 | + * @Route("/", name="municipio_index") | |
| 21 | + * @Method("GET") | |
| 22 | + */ | |
| 23 | + public function indexAction() | |
| 24 | + { | |
| 25 | + $em = $this->getDoctrine()->getManager(); | |
| 26 | + | |
| 27 | + $municipios = $em->getRepository('UBVPracticaBundle:municipio')->findAll(); | |
| 28 | + | |
| 29 | + return $this->render('municipio/index.html.twig', array( | |
| 30 | + 'municipios' => $municipios, | |
| 31 | + )); | |
| 32 | + } | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * Creates a new municipio entity. | |
| 36 | + * | |
| 37 | + * @Route("/new", name="municipio_new") | |
| 38 | + * @Method({"GET", "POST"}) | |
| 39 | + */ | |
| 40 | + public function newAction(Request $request) | |
| 41 | + { | |
| 42 | + $municipio = new Municipio(); | |
| 43 | + $form = $this->createForm('UBV\PracticaBundle\Form\municipioType', $municipio); | |
| 44 | + $form->handleRequest($request); | |
| 45 | + | |
| 46 | + if ($form->isSubmitted() && $form->isValid()) { | |
| 47 | + $em = $this->getDoctrine()->getManager(); | |
| 48 | + $em->persist($municipio); | |
| 49 | + $em->flush(); | |
| 50 | + | |
| 51 | + return $this->redirectToRoute('municipio_show', array('id' => $municipio->getId())); | |
| 52 | + } | |
| 53 | + | |
| 54 | + return $this->render('municipio/new.html.twig', array( | |
| 55 | + 'municipio' => $municipio, | |
| 56 | + 'form' => $form->createView(), | |
| 57 | + )); | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * Finds and displays a municipio entity. | |
| 62 | + * | |
| 63 | + * @Route("/{id}", name="municipio_show") | |
| 64 | + * @Method("GET") | |
| 65 | + */ | |
| 66 | + public function showAction(municipio $municipio) | |
| 67 | + { | |
| 68 | + $deleteForm = $this->createDeleteForm($municipio); | |
| 69 | + | |
| 70 | + return $this->render('municipio/show.html.twig', array( | |
| 71 | + 'municipio' => $municipio, | |
| 72 | + 'delete_form' => $deleteForm->createView(), | |
| 73 | + )); | |
| 74 | + } | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * Displays a form to edit an existing municipio entity. | |
| 78 | + * | |
| 79 | + * @Route("/{id}/edit", name="municipio_edit") | |
| 80 | + * @Method({"GET", "POST"}) | |
| 81 | + */ | |
| 82 | + public function editAction(Request $request, municipio $municipio) | |
| 83 | + { | |
| 84 | + $deleteForm = $this->createDeleteForm($municipio); | |
| 85 | + $editForm = $this->createForm('UBV\PracticaBundle\Form\municipioType', $municipio); | |
| 86 | + $editForm->handleRequest($request); | |
| 87 | + | |
| 88 | + if ($editForm->isSubmitted() && $editForm->isValid()) { | |
| 89 | + $this->getDoctrine()->getManager()->flush(); | |
| 90 | + | |
| 91 | + return $this->redirectToRoute('municipio_edit', array('id' => $municipio->getId())); | |
| 92 | + } | |
| 93 | + | |
| 94 | + return $this->render('municipio/edit.html.twig', array( | |
| 95 | + 'municipio' => $municipio, | |
| 96 | + 'edit_form' => $editForm->createView(), | |
| 97 | + 'delete_form' => $deleteForm->createView(), | |
| 98 | + )); | |
| 99 | + } | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * Deletes a municipio entity. | |
| 103 | + * | |
| 104 | + * @Route("/{id}", name="municipio_delete") | |
| 105 | + * @Method("DELETE") | |
| 106 | + */ | |
| 107 | + public function deleteAction(Request $request, municipio $municipio) | |
| 108 | + { | |
| 109 | + $form = $this->createDeleteForm($municipio); | |
| 110 | + $form->handleRequest($request); | |
| 111 | + | |
| 112 | + if ($form->isSubmitted() && $form->isValid()) { | |
| 113 | + $em = $this->getDoctrine()->getManager(); | |
| 114 | + $em->remove($municipio); | |
| 115 | + $em->flush(); | |
| 116 | + } | |
| 117 | + | |
| 118 | + return $this->redirectToRoute('municipio_index'); | |
| 119 | + } | |
| 120 | + | |
| 121 | + /** | |
| 122 | + * Creates a form to delete a municipio entity. | |
| 123 | + * | |
| 124 | + * @param municipio $municipio The municipio entity | |
| 125 | + * | |
| 126 | + * @return \Symfony\Component\Form\Form The form | |
| 127 | + */ | |
| 128 | + private function createDeleteForm(municipio $municipio) | |
| 129 | + { | |
| 130 | + return $this->createFormBuilder() | |
| 131 | + ->setAction($this->generateUrl('municipio_delete', array('id' => $municipio->getId()))) | |
| 132 | + ->setMethod('DELETE') | |
| 133 | + ->getForm() | |
| 134 | + ; | |
| 135 | + } | |
| 136 | +} | ... | ... |
src/UBV/PracticaBundle/Controller/parroquiaController.php
| ... | ... | @@ -0,0 +1,136 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace UBV\PracticaBundle\Controller; | |
| 4 | + | |
| 5 | +use UBV\PracticaBundle\Entity\parroquia; | |
| 6 | +use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
| 7 | +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; | |
| 8 | +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Parroquia controller. | |
| 12 | + * | |
| 13 | + * @Route("parroquia") | |
| 14 | + */ | |
| 15 | +class parroquiaController extends Controller | |
| 16 | +{ | |
| 17 | + /** | |
| 18 | + * Lists all parroquia entities. | |
| 19 | + * | |
| 20 | + * @Route("/", name="parroquia_index") | |
| 21 | + * @Method("GET") | |
| 22 | + */ | |
| 23 | + public function indexAction() | |
| 24 | + { | |
| 25 | + $em = $this->getDoctrine()->getManager(); | |
| 26 | + | |
| 27 | + $parroquias = $em->getRepository('UBVPracticaBundle:parroquia')->findAll(); | |
| 28 | + | |
| 29 | + return $this->render('parroquia/index.html.twig', array( | |
| 30 | + 'parroquias' => $parroquias, | |
| 31 | + )); | |
| 32 | + } | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * Creates a new parroquia entity. | |
| 36 | + * | |
| 37 | + * @Route("/new", name="parroquia_new") | |
| 38 | + * @Method({"GET", "POST"}) | |
| 39 | + */ | |
| 40 | + public function newAction(Request $request) | |
| 41 | + { | |
| 42 | + $parroquia = new Parroquia(); | |
| 43 | + $form = $this->createForm('UBV\PracticaBundle\Form\parroquiaType', $parroquia); | |
| 44 | + $form->handleRequest($request); | |
| 45 | + | |
| 46 | + if ($form->isSubmitted() && $form->isValid()) { | |
| 47 | + $em = $this->getDoctrine()->getManager(); | |
| 48 | + $em->persist($parroquia); | |
| 49 | + $em->flush(); | |
| 50 | + | |
| 51 | + return $this->redirectToRoute('parroquia_show', array('id' => $parroquia->getId())); | |
| 52 | + } | |
| 53 | + | |
| 54 | + return $this->render('parroquia/new.html.twig', array( | |
| 55 | + 'parroquia' => $parroquia, | |
| 56 | + 'form' => $form->createView(), | |
| 57 | + )); | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * Finds and displays a parroquia entity. | |
| 62 | + * | |
| 63 | + * @Route("/{id}", name="parroquia_show") | |
| 64 | + * @Method("GET") | |
| 65 | + */ | |
| 66 | + public function showAction(parroquia $parroquia) | |
| 67 | + { | |
| 68 | + $deleteForm = $this->createDeleteForm($parroquia); | |
| 69 | + | |
| 70 | + return $this->render('parroquia/show.html.twig', array( | |
| 71 | + 'parroquia' => $parroquia, | |
| 72 | + 'delete_form' => $deleteForm->createView(), | |
| 73 | + )); | |
| 74 | + } | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * Displays a form to edit an existing parroquia entity. | |
| 78 | + * | |
| 79 | + * @Route("/{id}/edit", name="parroquia_edit") | |
| 80 | + * @Method({"GET", "POST"}) | |
| 81 | + */ | |
| 82 | + public function editAction(Request $request, parroquia $parroquia) | |
| 83 | + { | |
| 84 | + $deleteForm = $this->createDeleteForm($parroquia); | |
| 85 | + $editForm = $this->createForm('UBV\PracticaBundle\Form\parroquiaType', $parroquia); | |
| 86 | + $editForm->handleRequest($request); | |
| 87 | + | |
| 88 | + if ($editForm->isSubmitted() && $editForm->isValid()) { | |
| 89 | + $this->getDoctrine()->getManager()->flush(); | |
| 90 | + | |
| 91 | + return $this->redirectToRoute('parroquia_edit', array('id' => $parroquia->getId())); | |
| 92 | + } | |
| 93 | + | |
| 94 | + return $this->render('parroquia/edit.html.twig', array( | |
| 95 | + 'parroquium' => $parroquia, | |
| 96 | + 'edit_form' => $editForm->createView(), | |
| 97 | + 'delete_form' => $deleteForm->createView(), | |
| 98 | + )); | |
| 99 | + } | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * Deletes a parroquia entity. | |
| 103 | + * | |
| 104 | + * @Route("/{id}", name="parroquia_delete") | |
| 105 | + * @Method("DELETE") | |
| 106 | + */ | |
| 107 | + public function deleteAction(Request $request, parroquia $parroquia) | |
| 108 | + { | |
| 109 | + $form = $this->createDeleteForm($parroquia); | |
| 110 | + $form->handleRequest($request); | |
| 111 | + | |
| 112 | + if ($form->isSubmitted() && $form->isValid()) { | |
| 113 | + $em = $this->getDoctrine()->getManager(); | |
| 114 | + $em->remove($parroquia); | |
| 115 | + $em->flush(); | |
| 116 | + } | |
| 117 | + | |
| 118 | + return $this->redirectToRoute('parroquia_index'); | |
| 119 | + } | |
| 120 | + | |
| 121 | + /** | |
| 122 | + * Creates a form to delete a parroquia entity. | |
| 123 | + * | |
| 124 | + * @param parroquia $parroquia The parroquia entity | |
| 125 | + * | |
| 126 | + * @return \Symfony\Component\Form\Form The form | |
| 127 | + */ | |
| 128 | + private function createDeleteForm(parroquia $parroquia) | |
| 129 | + { | |
| 130 | + return $this->createFormBuilder() | |
| 131 | + ->setAction($this->generateUrl('parroquia_delete', array('id' => $parroquia->getId()))) | |
| 132 | + ->setMethod('DELETE') | |
| 133 | + ->getForm() | |
| 134 | + ; | |
| 135 | + } | |
| 136 | +} | ... | ... |
src/UBV/PracticaBundle/Entity/estado.php
| ... | ... | @@ -4,6 +4,8 @@ namespace UBV\PracticaBundle\Entity; |
| 4 | 4 | |
| 5 | 5 | use Doctrine\ORM\Mapping as ORM; |
| 6 | 6 | |
| 7 | + | |
| 8 | + | |
| 7 | 9 | /** |
| 8 | 10 | * estado |
| 9 | 11 | * |
| ... | ... | @@ -11,6 +13,7 @@ use Doctrine\ORM\Mapping as ORM; |
| 11 | 13 | * @ORM\Entity(repositoryClass="UBV\PracticaBundle\Repository\estadoRepository") |
| 12 | 14 | */ |
| 13 | 15 | class estado |
| 16 | + | |
| 14 | 17 | { |
| 15 | 18 | /** |
| 16 | 19 | * @var int |
| ... | ... | @@ -35,7 +38,8 @@ class estado |
| 35 | 38 | */ |
| 36 | 39 | private $codigo; |
| 37 | 40 | |
| 38 | - | |
| 41 | + | |
| 42 | + | |
| 39 | 43 | /** |
| 40 | 44 | * Get id |
| 41 | 45 | * |
| ... | ... | @@ -93,5 +97,12 @@ class estado |
| 93 | 97 | { |
| 94 | 98 | return $this->codigo; |
| 95 | 99 | } |
| 96 | -} | |
| 100 | + | |
| 101 | + public function __toString() { | |
| 102 | + | |
| 103 | + return $this->getDescripcion(); | |
| 104 | + | |
| 105 | + } | |
| 106 | + | |
| 107 | + } | |
| 97 | 108 | ... | ... |
src/UBV/PracticaBundle/Entity/municipio.php
| ... | ... | @@ -4,6 +4,7 @@ namespace UBV\PracticaBundle\Entity; |
| 4 | 4 | |
| 5 | 5 | use Doctrine\ORM\Mapping as ORM; |
| 6 | 6 | |
| 7 | + | |
| 7 | 8 | /** |
| 8 | 9 | * municipio |
| 9 | 10 | * |
| ... | ... | @@ -35,6 +36,17 @@ class municipio |
| 35 | 36 | */ |
| 36 | 37 | private $codigo; |
| 37 | 38 | |
| 39 | + /** | |
| 40 | + * @ var\Estado | |
| 41 | + * | |
| 42 | + * @ORM\ManyToOne(targetEntity="estado", inversedBy="municipios", cascade={"persist", "remove"}) | |
| 43 | + * @ORM\JoinColumn(name="estado_id", referencedColumnName="id", nullable=false) | |
| 44 | + */ | |
| 45 | + | |
| 46 | + private $estado; | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 38 | 50 | |
| 39 | 51 | /** |
| 40 | 52 | * Get id |
| ... | ... | @@ -46,6 +58,8 @@ class municipio |
| 46 | 58 | return $this->id; |
| 47 | 59 | } |
| 48 | 60 | |
| 61 | + | |
| 62 | + | |
| 49 | 63 | /** |
| 50 | 64 | * Set descripcion |
| 51 | 65 | * |
| ... | ... | @@ -93,5 +107,50 @@ class municipio |
| 93 | 107 | { |
| 94 | 108 | return $this->codigo; |
| 95 | 109 | } |
| 110 | + | |
| 111 | + /** | |
| 112 | + * Set estado | |
| 113 | + * | |
| 114 | + * @param \UBV\PracticaBundle\Entity\Estado $estado | |
| 115 | + * | |
| 116 | + * @return municipio | |
| 117 | + */ | |
| 118 | + public function setEstado(\UBV\PracticaBundle\Entity\Estado $estado=null) | |
| 119 | + { | |
| 120 | + $this->estado = $estado; | |
| 121 | + | |
| 122 | + return $this; | |
| 123 | + } | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * Get estado | |
| 127 | + * | |
| 128 | + * @return \UBV\PracticaBundle\Entity\Estado | |
| 129 | + */ | |
| 130 | + public function getEstado() | |
| 131 | + { | |
| 132 | + return $this->estado; | |
| 133 | + } | |
| 134 | + | |
| 135 | + public function __toString (){ | |
| 136 | + | |
| 137 | + return $this->getDescripcion(); | |
| 138 | +} | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 96 | 155 | } |
| 97 | 156 | ... | ... |
src/UBV/PracticaBundle/Entity/parroquia.php
| ... | ... | @@ -35,6 +35,14 @@ class parroquia |
| 35 | 35 | */ |
| 36 | 36 | private $codigo; |
| 37 | 37 | |
| 38 | + /** | |
| 39 | + * @ var\Estado | |
| 40 | + * | |
| 41 | + * @ORM\ManyToOne(targetEntity="municipio", inversedBy="parroquias", cascade={"persist", "remove"}) | |
| 42 | + * @ORM\JoinColumn(name="estado_id", referencedColumnName="id", nullable=false) | |
| 43 | + */ | |
| 44 | + | |
| 45 | + private $municipio; | |
| 38 | 46 | |
| 39 | 47 | /** |
| 40 | 48 | * Get id |
| ... | ... | @@ -93,5 +101,31 @@ class parroquia |
| 93 | 101 | { |
| 94 | 102 | return $this->codigo; |
| 95 | 103 | } |
| 104 | +/** | |
| 105 | + * Set municipio | |
| 106 | + * | |
| 107 | + * @param \UBV\PracticaBundle\Entity\Municipio $municipio | |
| 108 | + * | |
| 109 | + * @return parroquia | |
| 110 | + */ | |
| 111 | + public function setMunicipio(\UBV\PracticaBundle\Entity\Municipio $municipio=null) | |
| 112 | + { | |
| 113 | + $this->municipio = $municipio; | |
| 114 | + | |
| 115 | + return $this; | |
| 116 | + } | |
| 117 | + | |
| 118 | + /** | |
| 119 | + * Get municipio | |
| 120 | + * | |
| 121 | + * @return \UBV\PracticaBundle\Entity\Municipio | |
| 122 | + */ | |
| 123 | + public function getMunicipio() | |
| 124 | + { | |
| 125 | + return $this->municipio; | |
| 126 | + } | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 96 | 130 | } |
| 97 | 131 | ... | ... |
src/UBV/PracticaBundle/Form/estadoType.php
| ... | ... | @@ -0,0 +1,54 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace UBV\PracticaBundle\Form; | |
| 4 | + | |
| 5 | +use Symfony\Component\Form\AbstractType; | |
| 6 | +use Symfony\Component\Form\FormBuilderInterface; | |
| 7 | +use Symfony\Component\OptionsResolver\OptionsResolver; | |
| 8 | +use UBV\PracticaBundle\Entity\estado; | |
| 9 | +use UBV\PracticaBundle\Entity\municipio; | |
| 10 | + | |
| 11 | + | |
| 12 | +class estadoType extends AbstractType | |
| 13 | +{ | |
| 14 | + /** | |
| 15 | + * {@inheritdoc} | |
| 16 | + */ | |
| 17 | + public function buildForm(FormBuilderInterface $builder, array $options) | |
| 18 | + { | |
| 19 | + | |
| 20 | + | |
| 21 | + $builder | |
| 22 | + ->add('descripcion') | |
| 23 | + ->add('codigo', new municipioType()) | |
| 24 | + ->getForm(); | |
| 25 | + | |
| 26 | + } | |
| 27 | + /** | |
| 28 | + | |
| 29 | + * {@inheritdoc} | |
| 30 | + */ | |
| 31 | + public function configureOptions(OptionsResolver $resolver) | |
| 32 | + { | |
| 33 | + $resolver->setDefaults(array( | |
| 34 | + 'data_class' => 'UBV\PracticaBundle\Entity\estado' | |
| 35 | + )); | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * {@inheritdoc} | |
| 40 | + */ | |
| 41 | + public function getBlockPrefix() | |
| 42 | + { | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + return 'ubv_practicabundle_estado'; | |
| 47 | + } | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | +} | ... | ... |
src/UBV/PracticaBundle/Form/municipioType.php
| ... | ... | @@ -0,0 +1,36 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace UBV\PracticaBundle\Form; | |
| 4 | + | |
| 5 | +use Symfony\Component\Form\AbstractType; | |
| 6 | +use Symfony\Component\Form\FormBuilderInterface; | |
| 7 | +use Symfony\Component\OptionsResolver\OptionsResolver; | |
| 8 | + | |
| 9 | +class municipioType extends AbstractType | |
| 10 | +{ | |
| 11 | + /** | |
| 12 | + * {@inheritdoc} | |
| 13 | + */ | |
| 14 | + public function buildForm(FormBuilderInterface $builder, array $options) | |
| 15 | + { | |
| 16 | + $builder->add('descripcion')->add('codigo')->add('estado'); | |
| 17 | + }/** | |
| 18 | + * {@inheritdoc} | |
| 19 | + */ | |
| 20 | + public function configureOptions(OptionsResolver $resolver) | |
| 21 | + { | |
| 22 | + $resolver->setDefaults(array( | |
| 23 | + 'data_class' => 'UBV\PracticaBundle\Entity\municipio' | |
| 24 | + )); | |
| 25 | + } | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * {@inheritdoc} | |
| 29 | + */ | |
| 30 | + public function getBlockPrefix() | |
| 31 | + { | |
| 32 | + return 'ubv_practicabundle_municipio'; | |
| 33 | + } | |
| 34 | + | |
| 35 | + | |
| 36 | +} | ... | ... |
src/UBV/PracticaBundle/Form/parroquiaType.php
| ... | ... | @@ -0,0 +1,36 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace UBV\PracticaBundle\Form; | |
| 4 | + | |
| 5 | +use Symfony\Component\Form\AbstractType; | |
| 6 | +use Symfony\Component\Form\FormBuilderInterface; | |
| 7 | +use Symfony\Component\OptionsResolver\OptionsResolver; | |
| 8 | + | |
| 9 | +class parroquiaType extends AbstractType | |
| 10 | +{ | |
| 11 | + /** | |
| 12 | + * {@inheritdoc} | |
| 13 | + */ | |
| 14 | + public function buildForm(FormBuilderInterface $builder, array $options) | |
| 15 | + { | |
| 16 | + $builder->add('descripcion')->add('codigo')->add('municipio'); | |
| 17 | + }/** | |
| 18 | + * {@inheritdoc} | |
| 19 | + */ | |
| 20 | + public function configureOptions(OptionsResolver $resolver) | |
| 21 | + { | |
| 22 | + $resolver->setDefaults(array( | |
| 23 | + 'data_class' => 'UBV\PracticaBundle\Entity\parroquia' | |
| 24 | + )); | |
| 25 | + } | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * {@inheritdoc} | |
| 29 | + */ | |
| 30 | + public function getBlockPrefix() | |
| 31 | + { | |
| 32 | + return 'ubv_practicabundle_parroquia'; | |
| 33 | + } | |
| 34 | + | |
| 35 | + | |
| 36 | +} | ... | ... |
src/UBV/PracticaBundle/Tests/Controller/estadoControllerTest.php
| ... | ... | @@ -0,0 +1,55 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace UBV\PracticaBundle\Tests\Controller; | |
| 4 | + | |
| 5 | +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | |
| 6 | + | |
| 7 | +class estadoControllerTest extends WebTestCase | |
| 8 | +{ | |
| 9 | + /* | |
| 10 | + public function testCompleteScenario() | |
| 11 | + { | |
| 12 | + // Create a new client to browse the application | |
| 13 | + $client = static::createClient(); | |
| 14 | + | |
| 15 | + // Create a new entry in the database | |
| 16 | + $crawler = $client->request('GET', '/estado/'); | |
| 17 | + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /estado/"); | |
| 18 | + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); | |
| 19 | + | |
| 20 | + // Fill in the form and submit it | |
| 21 | + $form = $crawler->selectButton('Create')->form(array( | |
| 22 | + 'ubv_practicabundle_estado[field_name]' => 'Test', | |
| 23 | + // ... other fields to fill | |
| 24 | + )); | |
| 25 | + | |
| 26 | + $client->submit($form); | |
| 27 | + $crawler = $client->followRedirect(); | |
| 28 | + | |
| 29 | + // Check data in the show view | |
| 30 | + $this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")'); | |
| 31 | + | |
| 32 | + // Edit the entity | |
| 33 | + $crawler = $client->click($crawler->selectLink('Edit')->link()); | |
| 34 | + | |
| 35 | + $form = $crawler->selectButton('Update')->form(array( | |
| 36 | + 'ubv_practicabundle_estado[field_name]' => 'Foo', | |
| 37 | + // ... other fields to fill | |
| 38 | + )); | |
| 39 | + | |
| 40 | + $client->submit($form); | |
| 41 | + $crawler = $client->followRedirect(); | |
| 42 | + | |
| 43 | + // Check the element contains an attribute with value equals "Foo" | |
| 44 | + $this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]'); | |
| 45 | + | |
| 46 | + // Delete the entity | |
| 47 | + $client->submit($crawler->selectButton('Delete')->form()); | |
| 48 | + $crawler = $client->followRedirect(); | |
| 49 | + | |
| 50 | + // Check the entity has been delete on the list | |
| 51 | + $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); | |
| 52 | + } | |
| 53 | + | |
| 54 | + */ | |
| 55 | +} | ... | ... |
src/UBV/PracticaBundle/Tests/Controller/municipioControllerTest.php
| ... | ... | @@ -0,0 +1,55 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace UBV\PracticaBundle\Tests\Controller; | |
| 4 | + | |
| 5 | +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | |
| 6 | + | |
| 7 | +class municipioControllerTest extends WebTestCase | |
| 8 | +{ | |
| 9 | + /* | |
| 10 | + public function testCompleteScenario() | |
| 11 | + { | |
| 12 | + // Create a new client to browse the application | |
| 13 | + $client = static::createClient(); | |
| 14 | + | |
| 15 | + // Create a new entry in the database | |
| 16 | + $crawler = $client->request('GET', '/municipio/'); | |
| 17 | + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /municipio/"); | |
| 18 | + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); | |
| 19 | + | |
| 20 | + // Fill in the form and submit it | |
| 21 | + $form = $crawler->selectButton('Create')->form(array( | |
| 22 | + 'ubv_practicabundle_municipio[field_name]' => 'Test', | |
| 23 | + // ... other fields to fill | |
| 24 | + )); | |
| 25 | + | |
| 26 | + $client->submit($form); | |
| 27 | + $crawler = $client->followRedirect(); | |
| 28 | + | |
| 29 | + // Check data in the show view | |
| 30 | + $this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")'); | |
| 31 | + | |
| 32 | + // Edit the entity | |
| 33 | + $crawler = $client->click($crawler->selectLink('Edit')->link()); | |
| 34 | + | |
| 35 | + $form = $crawler->selectButton('Update')->form(array( | |
| 36 | + 'ubv_practicabundle_municipio[field_name]' => 'Foo', | |
| 37 | + // ... other fields to fill | |
| 38 | + )); | |
| 39 | + | |
| 40 | + $client->submit($form); | |
| 41 | + $crawler = $client->followRedirect(); | |
| 42 | + | |
| 43 | + // Check the element contains an attribute with value equals "Foo" | |
| 44 | + $this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]'); | |
| 45 | + | |
| 46 | + // Delete the entity | |
| 47 | + $client->submit($crawler->selectButton('Delete')->form()); | |
| 48 | + $crawler = $client->followRedirect(); | |
| 49 | + | |
| 50 | + // Check the entity has been delete on the list | |
| 51 | + $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); | |
| 52 | + } | |
| 53 | + | |
| 54 | + */ | |
| 55 | +} | ... | ... |
src/UBV/PracticaBundle/Tests/Controller/parroquiaControllerTest.php
| ... | ... | @@ -0,0 +1,55 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace UBV\PracticaBundle\Tests\Controller; | |
| 4 | + | |
| 5 | +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | |
| 6 | + | |
| 7 | +class parroquiaControllerTest extends WebTestCase | |
| 8 | +{ | |
| 9 | + /* | |
| 10 | + public function testCompleteScenario() | |
| 11 | + { | |
| 12 | + // Create a new client to browse the application | |
| 13 | + $client = static::createClient(); | |
| 14 | + | |
| 15 | + // Create a new entry in the database | |
| 16 | + $crawler = $client->request('GET', '/parroquia/'); | |
| 17 | + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /parroquia/"); | |
| 18 | + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); | |
| 19 | + | |
| 20 | + // Fill in the form and submit it | |
| 21 | + $form = $crawler->selectButton('Create')->form(array( | |
| 22 | + 'ubv_practicabundle_parroquia[field_name]' => 'Test', | |
| 23 | + // ... other fields to fill | |
| 24 | + )); | |
| 25 | + | |
| 26 | + $client->submit($form); | |
| 27 | + $crawler = $client->followRedirect(); | |
| 28 | + | |
| 29 | + // Check data in the show view | |
| 30 | + $this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")'); | |
| 31 | + | |
| 32 | + // Edit the entity | |
| 33 | + $crawler = $client->click($crawler->selectLink('Edit')->link()); | |
| 34 | + | |
| 35 | + $form = $crawler->selectButton('Update')->form(array( | |
| 36 | + 'ubv_practicabundle_parroquia[field_name]' => 'Foo', | |
| 37 | + // ... other fields to fill | |
| 38 | + )); | |
| 39 | + | |
| 40 | + $client->submit($form); | |
| 41 | + $crawler = $client->followRedirect(); | |
| 42 | + | |
| 43 | + // Check the element contains an attribute with value equals "Foo" | |
| 44 | + $this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]'); | |
| 45 | + | |
| 46 | + // Delete the entity | |
| 47 | + $client->submit($crawler->selectButton('Delete')->form()); | |
| 48 | + $crawler = $client->followRedirect(); | |
| 49 | + | |
| 50 | + // Check the entity has been delete on the list | |
| 51 | + $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); | |
| 52 | + } | |
| 53 | + | |
| 54 | + */ | |
| 55 | +} | ... | ... |