Commit 7f94616f277036162281b1c76b65fad26414d3a1

Authored by MAIKEL NOGUERA
1 parent f038995f58
Exists in feature/jacqueline

Creacion de formularios, fomularios embebido

Showing 34 changed files with 1325 additions and 33 deletions   Show diff stats
.gitignore
... ... @@ -10,3 +10,4 @@
10 10 /vendor/
11 11 /bin/
12 12 /composer.phar
  13 +/nbproject/private/
13 14 \ No newline at end of file
... ...
app/Resources/views/banco/edit.html.twig
1 1 {% extends 'base.html.twig' %}
2 2  
3 3 {% block body %}
4   - <h1>Banco edit</h1>
  4 + <h1>Banco editar</h1>
5 5  
6   - {{ form_start(edit_form) }}
  6 +
  7 +<form action="{{ path('banco_edit', { 'id': banco.id }) }}" id="form_banco" novalidate method="POST" {{ form_enctype(edit_form)}}>
  8 +
  9 +
  10 +
  11 + <form class="form-inline" role="form">
  12 + <div class="form-group">
  13 + </div>
  14 +
  15 +<div class="form-group{% if edit_form.descripcion.vars.errors[0].message is defined %} has-error{% endif %}">
  16 +
  17 +
  18 +<div class="row">
  19 +<div class="col-xs-4">
  20 +
  21 + {{ form_label(edit_form.descripcion) }}
  22 +{{ form_widget( edit_form.descripcion ) }}
  23 +
  24 +
  25 +
  26 +{% if form.descripcion.vars.errors[0].message is defined %}
  27 +<span class="help-block">
  28 +{{ form.descripcion.vars.errors[0].message }}
  29 +</span>
  30 +</div>
  31 +{% endif %}
  32 +
  33 + <div class="form-group">
  34 + </div>
  35 +
  36 +<div class="form-group{% if edit_form.codigo.vars.errors[0].message is defined %} has-error{% endif %}">
  37 +
  38 +
  39 +
  40 + {{ form_label(edit_form.codigo) }}
  41 +{{ form_widget(edit_form.codigo) }}
  42 +
  43 +{% if form.codigo.vars.errors[0].message is defined %}
  44 +<span class="help-block">
  45 +{{ form.codigo.vars.errors[0].message }}
  46 +</span>
  47 +</div>
  48 +{% endif %}
  49 +
  50 +<br /r>
  51 +
  52 + {{ form_start(edit_form) }}
7 53 {{ form_widget(edit_form) }}
8   - <input type="submit" value="Edit" />
  54 + <br /r>
  55 + <input type="submit" value="Editar" />
9 56 {{ form_end(edit_form) }}
10 57  
  58 + <br /r>
  59 +
11 60 <ul>
  61 +
  62 + <br /r>
12 63 <li>
13   - <a href="{{ path('banco_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) }}
  64 +
  65 + <a class="btn btn-success" href="{{ path('banco_index') }}">Volver al listado</a>
  66 +
19 67 </li>
  68 +
20 69 </ul>
21 70 {% endblock %}
  71 +
  72 +
  73 +
  74 +
22 75 \ No newline at end of file
... ...
app/Resources/views/banco/index.html.twig
1 1 {% extends 'base.html.twig' %}
2 2  
3 3 {% block body %}
  4 +{% for type, flashMessage in app.session.flashbag.all() %}
  5 +<div class="alert alert-{{ type }} fade in">
  6 +<button class="close" data-dismiss="alert" type="button">ร—</button>
  7 +{% if flashMessage.title is defined %}
  8 +<strong>{{ flashMessage.title }}</strong>
  9 +{{ flashMessage.message }}
  10 +{% else %}
  11 +{{ type }}
  12 +{% endif %}
  13 +</div>
  14 +{% endfor %}
  15 +
4 16 <h1>Bancos list</h1>
  17 + <h2>Listado Varibles </h2>
5 18  
6   - <table>
  19 +
  20 + <table class="table table-bordered">
7 21 <thead>
8 22 <tr>
9   - <th>Id</th>
10   - <th>Descripcion</th>
11   - <th>Codigo</th>
12   - <th>Actions</th>
  23 + <th> Id</th>
  24 + <th> Descripcion </th>
  25 + <th> Codigo </th>
  26 + <th> Actions</th>
  27 +
13 28 </tr>
14   - </thead>
  29 + </thead>
15 30 <tbody>
16 31 {% for banco in bancos %}
17 32 <tr>
18 33 <td><a href="{{ path('banco_show', { 'id': banco.id }) }}">{{ banco.id }}</a></td>
19   - <td>{{ banco.descripcion }}</td>
  34 + <td>{{ banco.descripcion | capitalize }}</td>
20 35 <td>{{ banco.codigo }}</td>
21 36 <td>
22 37 <ul>
23 38 <li>
24   - <a href="{{ path('banco_show', { 'id': banco.id }) }}">show</a>
  39 + <a href="{{ path('banco_show', { 'id': banco.id }) }}"><span class="glyphicon glyphicon-eye-open"></span></a><span
25 40 </li>
26 41 <li>
27   - <a href="{{ path('banco_edit', { 'id': banco.id }) }}">edit</a>
  42 +
  43 + <a href="{{ path('banco_edit', { 'id': banco.id }) }}"> <span class="glyphicon glyphicon-pencil"></spa.glyphicon-pencil</a><span
  44 +
  45 +
  46 +
28 47 </li>
29 48 </ul>
30 49 </td>
... ... @@ -35,7 +54,10 @@
35 54  
36 55 <ul>
37 56 <li>
38   - <a href="{{ path('banco_new') }}">Create a new banco</a>
  57 +
  58 +
  59 + <a class="btn btn-default" href="{{ path('banco_new') }}">Create a new banco</a>
  60 +
39 61 </li>
40 62 </ul>
41 63 {% endblock %}
... ...
app/Resources/views/banco/new.html.twig
... ... @@ -2,15 +2,57 @@
2 2  
3 3 {% block body %}
4 4 <h1>Banco creation</h1>
  5 +
  6 + {# {{ form_start(form) }}
  7 + {{ form_widget(form) }}#}
  8 +
  9 +
  10 +
  11 +{{ form_start(form, {'attr': {'novalidate': 'novalidate'}, 'action': path('banco_new')}) }}
  12 +
  13 +<form class="form-inline" role="form">
  14 + <div class="form-group">
  15 + </div>
  16 +
  17 + {{ form_label(form.descripcion) }}
  18 +{{ form_widget(form.descripcion) }}
  19 +
  20 +{% if form.descripcion.vars.errors[0].message is defined %}
  21 +<span class="help-block">
  22 +{{ form.descripcion.vars.errors[0].message }}
  23 +</span>
  24 +</div>
  25 +
  26 +{% endif %}
  27 +
5 28  
6   - {{ form_start(form) }}
7   - {{ form_widget(form) }}
8   - <input type="submit" value="Create" />
9   - {{ form_end(form) }}
10 29  
  30 + <div class="form-group">
  31 + </div>
  32 +
  33 +
  34 + {{ form_label(form.codigo) }}
  35 +{{ form_widget(form.codigo) }}
  36 +
  37 +{% if form.codigo.vars.errors[0].message is defined %}
  38 +<span class="help-block">
  39 +{{ form.codigo.vars.errors[0].message }}
  40 +</span>
  41 +</div>
  42 +
  43 +
  44 +{% endif %}
  45 +
11 46 <ul>
12 47 <li>
13   - <a href="{{ path('banco_index') }}">Back to the list</a>
  48 +
  49 +
  50 + <br /r>
  51 + <a a class="btn btn-default" href="{{ path('banco_index') }}">regresar</a>
  52 +
  53 + <input type="submit" value="Create" />
  54 + {{ form_end(form) }}
14 55 </li>
15 56 </ul>
16 57 {% endblock %}
  58 +
17 59 \ No newline at end of file
... ...
app/Resources/views/banco/show.html.twig
... ... @@ -19,18 +19,22 @@
19 19 </tr>
20 20 </tbody>
21 21 </table>
22   -
  22 + <br /r>
23 23 <ul>
24 24 <li>
25   - <a href="{{ path('banco_index') }}">Back to the list</a>
  25 +
  26 + <a class="btn btn-success" href="{{ path('banco_index') }}">Volver al listado</a>
  27 +
26 28 </li>
27 29 <li>
28   - <a href="{{ path('banco_edit', { 'id': banco.id }) }}">Edit</a>
29   - </li>
  30 + <a class="btn btn-danger" href="{{ path('banco_edit', { 'id': banco.id }) }}">Editar</a>
30 31 <li>
  32 +
31 33 {{ form_start(delete_form) }}
32 34 <input type="submit" value="Delete">
33 35 {{ form_end(delete_form) }}
  36 +
  37 +
34 38 </li>
35 39 </ul>
36 40 {% endblock %}
... ...
app/Resources/views/estado/edit.html.twig
... ... @@ -0,0 +1,23 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>Estado editar</h1>
  5 +
  6 + {{ form_start(edit_form) }}
  7 + {{ form_widget(edit_form) }}
  8 + <br /r>
  9 + <input type="submit" value="Editar" />
  10 + {{ form_end(edit_form) }}
  11 + <br /r>
  12 +
  13 + <ul>
  14 + <li>
  15 + <a class="btn btn-success" href="{{ path('estado_index') }}">Volver listado</a>
  16 + </li>
  17 + <li>
  18 + {{ form_start(delete_form) }}
  19 + <input type="submit" value="Delete">
  20 + {{ form_end(delete_form) }}
  21 + </li>
  22 + </ul>
  23 +{% endblock %}
... ...
app/Resources/views/estado/index.html.twig
... ... @@ -0,0 +1,41 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>Estados list</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>Actions</th>
  13 + </tr>
  14 + </thead>
  15 + <tbody>
  16 + {% for estado in estados %}
  17 + <tr>
  18 + <td><a href="{{ path('estado_show', { 'id': estado.id }) }}">{{ estado.id }}</a></td>
  19 + <td>{{ estado.descripcion | capitalize }}</td>
  20 + <td>{{ estado.codigo }}</td>
  21 + <td>
  22 + <ul>
  23 + <li>
  24 + <a href="{{ path('estado_show', { 'id': estado.id }) }}"><span class="glyphicon glyphicon-eye-open"></span></a>
  25 + </li>
  26 + <li>
  27 + <a href="{{ path('estado_edit', { 'id': estado.id }) }}"><span class="glyphicon glyphicon-pencil"></spa.glyphicon-pencil</a>
  28 + </li>
  29 + </ul>
  30 + </td>
  31 + </tr>
  32 + {% endfor %}
  33 + </tbody>
  34 + </table>
  35 +
  36 + <ul>
  37 + <li>
  38 + <a class="btn btn-primary btn-lg active" href="{{ path('estado_new') }}">Registrar estado</a>
  39 + </li>
  40 + </ul>
  41 +{% endblock %}
... ...
app/Resources/views/estado/new.html.twig
... ... @@ -0,0 +1,16 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>Estado 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 + <a href="{{ path('estado_index') }}">Back to the list</a>
  14 + </li>
  15 + </ul>
  16 +{% endblock %}
... ...
app/Resources/views/estado/show.html.twig
... ... @@ -0,0 +1,36 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>Estado</h1>
  5 +
  6 + <table>
  7 + <tbody>
  8 + <tr>
  9 + <th>Id</th>
  10 + <td>{{ estado.id }}</td>
  11 + </tr>
  12 + <tr>
  13 + <th>Descripcion</th>
  14 + <td>{{ estado.descripcion }}</td>
  15 + </tr>
  16 + <tr>
  17 + <th>Codigo</th>
  18 + <td>{{ estado.codigo }}</td>
  19 + </tr>
  20 + </tbody>
  21 + </table>
  22 +
  23 + <ul>
  24 + <li>
  25 + <a class="btn btn-success" href="{{ path('estado_index') }}">Volver al listado</a>
  26 + </li>
  27 + <li>
  28 + <a class="btn btn-warning" href="{{ path('estado_edit', { 'id': estado.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 %}
... ...
app/Resources/views/municipio/edit.html.twig
... ... @@ -0,0 +1,24 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>Municipio editar</h1>
  5 +
  6 + {{ form_start(edit_form) }}
  7 + {{ form_widget(edit_form) }}
  8 +
  9 + <br /r>
  10 + <input type="submit" value="Editar" />
  11 + {{ form_end(edit_form) }}
  12 +
  13 + <br /r>
  14 + <ul>
  15 + <li>
  16 + <a class="btn btn-success" href="{{ path('municipio_index') }}">Volver listado</a>
  17 + </li>
  18 + <li>
  19 + {{ form_start(delete_form) }}
  20 + <input type="submit" value="Delete">
  21 + {{ form_end(delete_form) }}
  22 + </li>
  23 + </ul>
  24 +{% endblock %}
... ...
app/Resources/views/municipio/index.html.twig
... ... @@ -0,0 +1,43 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>Municipios list</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>Estado</th>
  13 + <th>Actions</th>
  14 + </tr>
  15 + </thead>
  16 + <tbody>
  17 + {% for municipio in municipios %}
  18 + <tr>
  19 + <td><a href="{{ path('municipio_show', { 'id': municipio.id }) }}">{{ municipio.id }}</a></td>
  20 + <td>{{ municipio.descripcion | capitalize }}</td>
  21 + <td>{{ municipio.codigo }}</td>
  22 + <td>{{ municipio.Estado | capitalize}}</td>
  23 + <td>
  24 + <ul>
  25 + <li>
  26 + <a href="{{ path('municipio_show', { 'id': municipio.id }) }}"><span class="glyphicon glyphicon-eye-open"></span></a>
  27 + </li>
  28 + <li>
  29 + <a href="{{ path('municipio_edit', { 'id': municipio.id }) }}"><span class="glyphicon glyphicon-pencil"></spa.glyphicon-pencil</a>
  30 + </li>
  31 + </ul>
  32 + </td>
  33 + </tr>
  34 + {% endfor %}
  35 + </tbody>
  36 + </table>
  37 +
  38 + <ul>
  39 + <li>
  40 + <a class="btn btn-primary btn-lg active" href="{{ path('municipio_new') }}">Registrar municipio</a>
  41 + </li>
  42 + </ul>
  43 +{% endblock %}
... ...
app/Resources/views/municipio/new.html.twig
... ... @@ -0,0 +1,16 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>Municipio 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 + <a href="{{ path('municipio_index') }}">Back to the list</a>
  14 + </li>
  15 + </ul>
  16 +{% endblock %}
... ...
app/Resources/views/municipio/show.html.twig
... ... @@ -0,0 +1,38 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>Municipio</h1>
  5 +
  6 + <table class="table">
  7 +
  8 + <tbody>
  9 + <tr>
  10 + <th>Id</th>
  11 +
  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 + </table>
  24 +
  25 + <ul>
  26 + <li>
  27 + <a class="btn btn-success" href="{{ path('municipio_index') }}">Volver al listado</a>
  28 + </li>
  29 + <li>
  30 + <a class="btn btn-warning" href="{{ path('municipio_edit', { 'id': municipio.id }) }}">Editar</a>
  31 + </li>
  32 + <li>
  33 + {{ form_start(delete_form) }}
  34 + <input type="submit" value="Delete">
  35 + {{ form_end(delete_form) }}
  36 + </li>
  37 + </ul>
  38 +{% endblock %}
... ...
app/Resources/views/parroquia/edit.html.twig
... ... @@ -0,0 +1,24 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>Parroquia editar</h1>
  5 +
  6 +
  7 + {{ form_start(edit_form) }}
  8 + {{ form_widget(edit_form) }}
  9 + <br /r>
  10 + <input type="submit" value="Editar" />
  11 + {{ form_end(edit_form) }}
  12 +
  13 + <br /r>
  14 + <ul>
  15 + <li>
  16 + <a class="btn btn-success" href="{{ path('parroquia_index') }}">Volver listado</a>
  17 + </li>
  18 + <li>
  19 + {{ form_start(delete_form) }}
  20 + <input type="submit" value="Delete">
  21 + {{ form_end(delete_form) }}
  22 + </li>
  23 + </ul>
  24 +{% endblock %}
... ...
app/Resources/views/parroquia/index.html.twig
... ... @@ -0,0 +1,44 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>Parroquias list</h1>
  5 +
  6 + <table class="table table-bordered">
  7 +
  8 + <thead>
  9 + <tr>
  10 + <th>Id</th>
  11 + <th> Descripcion</th>
  12 + <th>Codigo</th>
  13 + <th>Municipio</th>
  14 + <th>Actions</th>
  15 + </tr>
  16 + </thead>
  17 + <tbody>
  18 + {% for parroquia in parroquias %}
  19 + <tr>
  20 + <td><a href="{{ path('parroquia_show', { 'id': parroquia.id }) }}">{{ parroquia.id }}</a></td>
  21 + <td>{{ parroquia.descripcion | capitalize}}</td>
  22 + <td>{{ parroquia.codigo }}</td>
  23 + <td>{{ parroquia.Municipio | capitalize }}</td>
  24 + <td>
  25 + <ul>
  26 + <li>
  27 + <a href="{{ path('parroquia_show', { 'id': parroquia.id }) }}"><span class="glyphicon glyphicon-eye-open"></span></a>
  28 + </li>
  29 + <li>
  30 + <a href="{{ path('parroquia_edit', { 'id': parroquia.id }) }}"><span class="glyphicon glyphicon-pencil"></spa.glyphicon-pencil</a>
  31 + </li>
  32 + </ul>
  33 + </td>
  34 + </tr>
  35 + {% endfor %}
  36 + </tbody>
  37 + </table>
  38 +
  39 + <ul>
  40 + <li>
  41 + <a class="btn btn-primary btn-lg active" href="{{ path('parroquia_new') }}">Registrar parroquia</a>
  42 + </li>
  43 + </ul>
  44 +{% endblock %}
... ...
app/Resources/views/parroquia/new.html.twig
... ... @@ -0,0 +1,16 @@
  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 + <a class="btn btn-warning" href="{{ path('parroquia_index') }}">Volver al listado</a>
  14 + </li>
  15 + </ul>
  16 +{% endblock %}
... ...
app/Resources/views/parroquia/show.html.twig
... ... @@ -0,0 +1,36 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>Parroquia</h1>
  5 +
  6 + <table>
  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 class="btn btn-success" href="{{ path('parroquia_index') }}">Volver al listado</a>
  26 + </li>
  27 + <li>
  28 + <a class="btn btn-warning" 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 %}
... ...
nbproject/project.properties
... ... @@ -0,0 +1,7 @@
  1 +include.path=${php.global.include.path}
  2 +php.version=PHP_56
  3 +source.encoding=UTF-8
  4 +src.dir=.
  5 +tags.asp=false
  6 +tags.short=false
  7 +web.root=.
... ...
nbproject/project.xml
... ... @@ -0,0 +1,9 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://www.netbeans.org/ns/project/1">
  3 + <type>org.netbeans.modules.php.project</type>
  4 + <configuration>
  5 + <data xmlns="http://www.netbeans.org/ns/php-project/1">
  6 + <name>PhpProject1</name>
  7 + </data>
  8 + </configuration>
  9 +</project>
... ...
src/UBV/PracticaBundle/Controller/BancoController.php
... ... @@ -46,9 +46,11 @@ class BancoController extends Controller
46 46 if ($form->isSubmitted() && $form->isValid()) {
47 47 $em = $this->getDoctrine()->getManager();
48 48 $em->persist($banco);
49   - $em->flush(); $this->get('session')->getFlashBag()->set( 'success', array( 'title' => 'Guardado!', 'message' => 'Estado creado satisfactoriamente.' ) );
  49 + $em->flush();
  50 +
  51 + $this->get('session')->getFlashBag()->set( 'success', array( 'title' => 'Guardado!', 'message' => 'Estado creado satisfactoriamente.' ) );
50 52  
51   - return $this->redirectToRoute('<banco_index', array('id' => $banco->getId()));
  53 + return $this->redirectToRoute('banco_index', array('id' => $banco->getId()));
52 54 }
53 55  
54 56 return $this->render('banco/new.html.twig', array(
... ... @@ -88,7 +90,9 @@ class BancoController extends Controller
88 90 if ($editForm->isSubmitted() && $editForm->isValid()) {
89 91 $this->getDoctrine()->getManager()->flush();
90 92 $this->get('session')->getFlashBag()->set( 'success', array( 'title' => 'Guardado!', 'message' => 'Estado editado satisfactoriamente.' ) );
91   - return $this->redirectToRoute('banco_edit', array('id' => $banco->getId()));
  93 +
  94 +
  95 + return $this->redirectToRoute('banco_index', array('id' => $banco->getId()));
92 96 }
93 97  
94 98 return $this->render('banco/edit.html.twig', array(
... ...
src/UBV/PracticaBundle/Controller/estadoController.php
... ... @@ -0,0 +1,143 @@
  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;use Symfony\Component\HttpFoundation\Request;
  9 +
  10 +
  11 +/**
  12 + * Estado controller.
  13 + *
  14 + * @Route("estado")
  15 + */
  16 +class estadoController extends Controller
  17 +
  18 +
  19 +{
  20 + /**
  21 + * Lists all estado entities.
  22 + *
  23 + * @Route("/", name="estado_index")
  24 + * @Method("GET")
  25 + */
  26 + public function indexAction()
  27 + {
  28 + $em = $this->getDoctrine()->getManager();
  29 +
  30 + $estados = $em->getRepository('UBVPracticaBundle:estado')->findAll();
  31 +
  32 + return $this->render('estado/index.html.twig', array(
  33 + 'estados' => $estados,
  34 + ));
  35 + }
  36 +
  37 + /**
  38 + * Creates a new estado entity.
  39 + *
  40 + * @Route("/new", name="estado_new")
  41 + * @Method({"GET", "POST"})
  42 + */
  43 + public function newAction(Request $request)
  44 + {
  45 + $estado = new Estado();
  46 + $form = $this->createForm('UBV\PracticaBundle\Form\estadoType', $estado);
  47 + $form->handleRequest($request);
  48 +
  49 + if ($form->isSubmitted() && $form->isValid()) {
  50 + $em = $this->getDoctrine()->getManager();
  51 + $em->persist($estado);
  52 + $em->flush();
  53 +
  54 + return $this->redirectToRoute('estado_show', array('id' => $estado->getId()));
  55 + }
  56 +
  57 + return $this->render('estado/new.html.twig', array(
  58 + 'estado' => $estado,
  59 + 'form' => $form->createView(),
  60 + ));
  61 + }
  62 +
  63 + /**
  64 + * Finds and displays a estado entity.
  65 + *
  66 + * @Route("/{id}", name="estado_show")
  67 + * @Method("GET")
  68 + */
  69 + public function showAction(estado $estado)
  70 + {
  71 + $deleteForm = $this->createDeleteForm($estado);
  72 +
  73 + return $this->render('estado/show.html.twig', array(
  74 + 'estado' => $estado,
  75 + 'delete_form' => $deleteForm->createView(),
  76 + ));
  77 + }
  78 +
  79 + /**
  80 + * Displays a form to edit an existing estado entity.
  81 + *
  82 + * @Route("/{id}/edit", name="estado_edit")
  83 + * @Method({"GET", "POST"})
  84 + */
  85 + public function editAction(Request $request, estado $estado)
  86 + {
  87 + $deleteForm = $this->createDeleteForm($estado);
  88 + $editForm = $this->createForm('UBV\PracticaBundle\Form\estadoType', $estado);
  89 + $editForm->handleRequest($request);
  90 +
  91 + if ($editForm->isSubmitted() && $editForm->isValid()) {
  92 + $this->getDoctrine()->getManager()->flush();
  93 +
  94 + return $this->redirectToRoute('estado_edit', array('id' => $estado->getId()));
  95 + }
  96 +
  97 + return $this->render('estado/edit.html.twig', array(
  98 + 'estado' => $estado,
  99 + 'edit_form' => $editForm->createView(),
  100 + 'delete_form' => $deleteForm->createView(),
  101 + ));
  102 + }
  103 +
  104 + /**
  105 + * Deletes a estado entity.
  106 + *
  107 + * @Route("/{id}", name="estado_delete")
  108 + * @Method("DELETE")
  109 + */
  110 + public function deleteAction(Request $request, estado $estado)
  111 + {
  112 + $form = $this->createDeleteForm($estado);
  113 + $form->handleRequest($request);
  114 +
  115 + if ($form->isSubmitted() && $form->isValid()) {
  116 + $em = $this->getDoctrine()->getManager();
  117 + $em->remove($estado);
  118 + $em->flush();
  119 + }
  120 +
  121 + return $this->redirectToRoute('estado_index');
  122 + }
  123 +
  124 + /**
  125 + * Creates a form to delete a estado entity.
  126 + *
  127 + * @param estado $estado The estado entity
  128 + *
  129 + * @return \Symfony\Component\Form\Form The form
  130 + */
  131 + private function createDeleteForm(estado $estado)
  132 + {
  133 + return $this->createFormBuilder()
  134 + ->setAction($this->generateUrl('estado_delete', array('id' => $estado->getId())))
  135 + ->setMethod('DELETE')
  136 + ->getForm()
  137 + ;
  138 +
  139 + }
  140 +
  141 +
  142 +
  143 +}
... ...
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 $parroquium 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/Banco.php
... ... @@ -30,7 +30,7 @@ class Banco
30 30 * max = 150,
31 31 * minMessage = "Por favor introduzca un Nombre de Banco mรกs especรญfico. Mรญnimo {{ limit }} caracteres",
32 32 * maxMessage = "Por favor introduzca un Nombre de Banco mรกs breve. Mรกximo {{ limit }} caracteres",
33   -*)
  33 +*)
34 34 * @var string
35 35 *
36 36 * @ORM\Column(name="descripcion", type="string", length=255)
... ...
src/UBV/PracticaBundle/Entity/estado.php
... ... @@ -4,12 +4,16 @@ namespace UBV\PracticaBundle\Entity;
4 4  
5 5 use Doctrine\ORM\Mapping as ORM;
6 6  
  7 +
  8 +
  9 +
7 10 /**
8 11 * estado
9 12 *
10 13 * @ORM\Table(name="estado")
11 14 * @ORM\Entity(repositoryClass="UBV\PracticaBundle\Repository\estadoRepository")
12 15 */
  16 +
13 17 class estado
14 18 {
15 19 /**
... ... @@ -19,6 +23,7 @@ class estado
19 23 * @ORM\Id
20 24 * @ORM\GeneratedValue(strategy="AUTO")
21 25 */
  26 +
22 27 private $id;
23 28  
24 29 /**
... ... @@ -36,6 +41,8 @@ class estado
36 41 private $codigo;
37 42  
38 43  
  44 +
  45 +
39 46 /**
40 47 * Get id
41 48 *
... ... @@ -93,5 +100,14 @@ class estado
93 100 {
94 101 return $this->codigo;
95 102 }
  103 +
  104 + public function __toString () {
  105 +
  106 + return $this->getDescripcion();
  107 +}
  108 +
  109 +
96 110 }
97 111  
  112 +
  113 +
... ...
src/UBV/PracticaBundle/Entity/municipio.php
... ... @@ -35,6 +35,14 @@ class municipio
35 35 */
36 36 private $codigo;
37 37  
  38 + /**
  39 + * @ var\Estado
  40 + *
  41 + * @ORM\ManyToOne(targetEntity="estado", inversedBy="municipios", cascade={"persist", "remove"})
  42 + * @ORM\JoinColumn(name="estado_id", referencedColumnName="id", nullable=false)
  43 + */
  44 +
  45 + private $estado;
38 46  
39 47 /**
40 48 * Get id
... ... @@ -46,6 +54,8 @@ class municipio
46 54 return $this->id;
47 55 }
48 56  
  57 +
  58 +
49 59 /**
50 60 * Set descripcion
51 61 *
... ... @@ -93,5 +103,37 @@ class municipio
93 103 {
94 104 return $this->codigo;
95 105 }
  106 +
  107 + /**
  108 + * Set estado
  109 + *
  110 + * @param \UBV\PracticaBundle\Entity\Estado $estado
  111 + *
  112 + * @return municipio
  113 + */
  114 + public function setEstado(\UBV\PracticaBundle\Entity\Estado $estado=null)
  115 + {
  116 + $this->estado = $estado;
  117 +
  118 + return $this;
  119 + }
  120 +
  121 + /**
  122 + * Get estado
  123 + *
  124 + * @return \UBV\PracticaBundle\Entity\Estado
  125 + */
  126 + public function getEstado()
  127 + {
  128 + return $this->estado;
  129 + }
  130 +
  131 + public function __toString (){
  132 +
  133 + return $this->getDescripcion();
  134 +}
  135 +
  136 +
  137 +
96 138 }
97 139  
... ...
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,33 @@ 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  
  132 +
  133 +
... ...
src/UBV/PracticaBundle/Form/BancoType.php
... ... @@ -15,8 +15,8 @@ class BancoType extends AbstractType
15 15 {
16 16 $builder
17 17 ->add('descripcion','text', array( 'label'=> 'Descripciรณn del Estado', 'attr' => array('class' => 'form-control','placeholder'=>'Descripcion del Estado'), 'label_attr' => array('class' => 'control-label'), ))
18   -
19 18 ->add('codigo', 'integer',array( 'attr' => array('class' => 'form-control','placeholder'=>'codigo del Estado'), 'label_attr' => array('class' => 'control-label'), ));
  19 +
20 20 }/**
21 21 * {@inheritdoc}
22 22 */
... ...
src/UBV/PracticaBundle/Form/estadoType.php
... ... @@ -0,0 +1,47 @@
  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 + $builder
  20 + ->add('descripcion')
  21 + ->add('codigo', new municipioType())
  22 + ->getForm();
  23 +
  24 + }/**
  25 +
  26 +
  27 +* {@inheritdoc}
  28 +*/
  29 +public function configureOptions(OptionsResolver $resolver)
  30 +{
  31 +$resolver->setDefaults(array(
  32 +'data_class' => 'UBV\PracticaBundle\Entity\estado'
  33 +));
  34 +}
  35 +
  36 +/**
  37 +* {@inheritdoc}
  38 +*/
  39 +public function getBlockPrefix()
  40 +{
  41 +return 'ubv_practicabundle_estado';
  42 +}
  43 +
  44 +
  45 +
  46 +
  47 +}
0 48 \ No newline at end of file
... ...
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 +}
... ...