Compare View
Commits (2)
Showing
39 changed files
Show diff stats
app/Resources/views/candidato/edit.html.twig
@@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
1 | +{% extends 'base.html.twig' %} | ||
2 | + | ||
3 | +{% block body %} | ||
4 | + <h1>Editar Candidato</h1> | ||
5 | + | ||
6 | + {{ form_start(edit_form) }} | ||
7 | + {{ form_widget(edit_form) }} | ||
8 | + <input type="submit" value="Editar" /> | ||
9 | + {{ form_end(edit_form) }} | ||
10 | + | ||
11 | + <ul> | ||
12 | + <li> | ||
13 | + <a href="{{ path('candidato_index') }}">Volver</a> | ||
14 | + </li> | ||
15 | + <li> | ||
16 | + {{ form_start(delete_form) }} | ||
17 | + <input type="submit" value="Eliminar"> | ||
18 | + {{ form_end(delete_form) }} | ||
19 | + </li> | ||
20 | + </ul> | ||
21 | +{% endblock %} |
app/Resources/views/candidato/index.html.twig
@@ -0,0 +1,50 @@ | @@ -0,0 +1,50 @@ | ||
1 | +{% extends 'base.html.twig' %} | ||
2 | + | ||
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 | + <h1>Formulario de Candidatos</h1> | ||
16 | + | ||
17 | +<ul> | ||
18 | + <a class="btn btn-info" role="button" href="{{ path('candidato_new') }}"><span class="glyphicon glyphicon-plus"></span></a> | ||
19 | +</ul> | ||
20 | + | ||
21 | + <table class="table table-bordered"> | ||
22 | + <thead> | ||
23 | + <tr> | ||
24 | + <th>Cedula</th> | ||
25 | + <th>Nombre</th> | ||
26 | + <th>Apellido</th> | ||
27 | + <th>Pais</th> | ||
28 | + <th>Estado</th> | ||
29 | + <th>Acciones</th> | ||
30 | + </tr> | ||
31 | + </thead> | ||
32 | + <tbody> | ||
33 | + {% for candidato in candidatos %} | ||
34 | + <tr> | ||
35 | + <td><a href="{{ path('candidato_show', { 'id': candidato.id }) }}">{{ candidato.cedula }}</a></td> | ||
36 | + <td>{{ candidato.nombre }}</td> | ||
37 | + <td>{{ candidato.apellido }}</td> | ||
38 | + <td>{{ candidato.pais }}</td> | ||
39 | + <td>{{ candidato.estado }}</td> | ||
40 | + <td> | ||
41 | + <ul> | ||
42 | + <a class="btn btn-info" role="button" href="{{ path('candidato_show', { 'id': candidato.id }) }}"><span class="glyphicon glyphicon-eye-open"></span></a> | ||
43 | + <a class="btn btn-danger" role="button" href="{{ path('candidato_edit', { 'id': candidato.id }) }}"><span class="glyphicon glyphicon-pencil"></span></a> | ||
44 | + </ul> | ||
45 | + </td> | ||
46 | + </tr> | ||
47 | + {% endfor %} | ||
48 | + </tbody> | ||
49 | + </table> | ||
50 | +{% endblock %} |
app/Resources/views/candidato/new.html.twig
@@ -0,0 +1,157 @@ | @@ -0,0 +1,157 @@ | ||
1 | +{% extends 'base.html.twig' %} | ||
2 | + | ||
3 | +{% block body %} | ||
4 | +<h1 style="text-align:center">Formulario para crear un candidato</h1> | ||
5 | +<div class="container"> | ||
6 | + <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">Datos Personales</button> | ||
7 | + <div id="demo" class="collapse"> | ||
8 | + {{ form_start(form, {'attr': {'novalidate': 'novalidate'}, 'action': path('candidato_new')}) }} | ||
9 | +<div class="row 12"> | ||
10 | + <div class="col-xs-6"> | ||
11 | + {{ form_label(form.nombre) }} | ||
12 | + {{ form_widget(form.nombre) }} | ||
13 | + {% if form.nombre.vars.errors[0].message is defined %} | ||
14 | + <span class="help-block"> | ||
15 | + {{ form.nombre.vars.errors[0].message }} | ||
16 | + {% endif %} | ||
17 | + </div> | ||
18 | + | ||
19 | + <div class="col-xs-6"> | ||
20 | + {{ form_label(form.apellido) }} | ||
21 | + {{ form_widget(form.apellido) }} | ||
22 | + {% if form.apellido.vars.errors[0].message is defined %} | ||
23 | + <span class="help-block"> | ||
24 | + {{ form.apellido.vars.errors[0].message }} | ||
25 | + {% endif %} | ||
26 | + </div> | ||
27 | +</div> | ||
28 | + | ||
29 | +<div class="row 12"> | ||
30 | + <div class="col-xs-4"> | ||
31 | + {{ form_label(form.cedula) }} | ||
32 | + {{ form_widget(form.cedula) }} | ||
33 | + {% if form.cedula.vars.errors[0].message is defined %} | ||
34 | + <span class="help-block"> | ||
35 | + {{ form.cedula.vars.errors[0].message }} | ||
36 | + {% endif %} | ||
37 | + </div> | ||
38 | + | ||
39 | + <div class="col-xs-4"> | ||
40 | + {{ form_label(form.edad) }} | ||
41 | + {{ form_widget(form.edad) }} | ||
42 | + {% if form.edad.vars.errors[0].message is defined %} | ||
43 | + <span class="help-block"> | ||
44 | + {{ form.edad.vars.errors[0].message }} | ||
45 | + {% endif %} | ||
46 | + </div> | ||
47 | + | ||
48 | + <div class="col-xs-4"> | ||
49 | + <div class="form-group"> | ||
50 | + <label for="sel1">Género:</label> | ||
51 | + {{ form_widget(form.sexo) }} | ||
52 | + </div> | ||
53 | + </div> | ||
54 | +</div> | ||
55 | +<div class="row 12"> | ||
56 | + <div class="col-xs-6"> | ||
57 | + {{ form_label(form.estadoCivil) }} | ||
58 | + {{ form_widget(form.estadoCivil) }} | ||
59 | + {% if form.estadoCivil.vars.errors[0].message is defined %} | ||
60 | + <span class="help-block"> | ||
61 | + {{ form.estadoCivil.vars.errors[0].message }} | ||
62 | + {% endif %} | ||
63 | + </br> | ||
64 | + </div> | ||
65 | +</div> | ||
66 | + | ||
67 | + </div> | ||
68 | +</div> | ||
69 | +<div class="container"> | ||
70 | + <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo1">Datos Académicos</button> | ||
71 | + <div id="demo1" class="collapse"> | ||
72 | +<div class="row 12"> | ||
73 | + <div class="col-xs-4"> | ||
74 | + {{ form_label(form.primaria) }} | ||
75 | + {{ form_widget(form.primaria) }} | ||
76 | + {% if form.primaria.vars.errors[0].message is defined %} | ||
77 | + <span class="help-block"> | ||
78 | + {{ form.primaria.vars.errors[0].message }} | ||
79 | + {% endif %} | ||
80 | + </div> | ||
81 | + | ||
82 | + <div class="col-xs-4"> | ||
83 | + {{ form_label(form.secundaria) }} | ||
84 | + {{ form_widget(form.secundaria) }} | ||
85 | + {% if form.secundaria.vars.errors[0].message is defined %} | ||
86 | + <span class="help-block"> | ||
87 | + {{ form.secundaria.vars.errors[0].message }} | ||
88 | + {% endif %} | ||
89 | + </div> | ||
90 | + | ||
91 | + <div class="col-xs-4"> | ||
92 | + {{ form_label(form.terciaria) }} | ||
93 | + {{ form_widget(form.terciaria) }} | ||
94 | + {% if form.terciaria.vars.errors[0].message is defined %} | ||
95 | + <span class="help-block"> | ||
96 | + {{ form.terciaria.vars.errors[0].message }} | ||
97 | + {% endif %} | ||
98 | + </br> | ||
99 | + </div> | ||
100 | +</div> | ||
101 | +<div class="row 12"> | ||
102 | + <div class="col-xs-6"> | ||
103 | + {{ form_label(form.aldea) }} | ||
104 | + {{ form_widget(form.aldea) }} | ||
105 | + {% if form.aldea.vars.errors[0].message is defined %} | ||
106 | + <span class="help-block"> | ||
107 | + {{ form.aldea.vars.errors[0].message }} | ||
108 | + {% endif %} | ||
109 | + </br> | ||
110 | + </div> | ||
111 | +</div> | ||
112 | + </div> | ||
113 | +</div> | ||
114 | + | ||
115 | +<div class="container"> | ||
116 | + <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo2">Datos de Ubicación</button> | ||
117 | + <div id="demo2" class="collapse"> | ||
118 | +<div class="row 12"> | ||
119 | + <div class="col-xs-4"> | ||
120 | + {{ form_label(form.estado) }} | ||
121 | + {{ form_widget(form.estado) }} | ||
122 | + {% if form.estado.vars.errors[0].message is defined %} | ||
123 | + <span class="help-block"> | ||
124 | + {{ form.estado.vars.errors[0].message }} | ||
125 | + {% endif %} | ||
126 | + </div> | ||
127 | + | ||
128 | + <div class="col-xs-4"> | ||
129 | + {{ form_label(form.municipio) }} | ||
130 | + {{ form_widget(form.municipio) }} | ||
131 | + {% if form.municipio.vars.errors[0].message is defined %} | ||
132 | + <span class="help-block"> | ||
133 | + {{ form.municipio.vars.errors[0].message }} | ||
134 | + {% endif %} | ||
135 | + </div> | ||
136 | + | ||
137 | + <div class="col-xs-4"> | ||
138 | + {{ form_label(form.parroquia) }} | ||
139 | + {{ form_widget(form.parroquia) }} | ||
140 | + {% if form.parroquia.vars.errors[0].message is defined %} | ||
141 | + <span class="help-block"> | ||
142 | + {{ form.parroquia.vars.errors[0].message }} | ||
143 | + {% endif %} | ||
144 | + </div> | ||
145 | +</div> | ||
146 | + </div> | ||
147 | +</div> | ||
148 | +<div style="text-align:right"> | ||
149 | + <ul> | ||
150 | + <input type="submit" class="btn btn-primary" value="Crear" /> | ||
151 | + | ||
152 | + <a class="btn btn-primary" role="button" href="{{ path('candidato_index') }}"><span class="glyphicon glyphicon-arrow-left"></span></a> | ||
153 | + </ul> | ||
154 | +</div> | ||
155 | +</body> | ||
156 | +</html> | ||
157 | +{% endblock %} |
app/Resources/views/candidato/show.html.twig
@@ -0,0 +1,74 @@ | @@ -0,0 +1,74 @@ | ||
1 | +{% extends 'base.html.twig' %} | ||
2 | + | ||
3 | +{% block body %} | ||
4 | + | ||
5 | + <h1 class="modal-title">Ver Candidato</h1> | ||
6 | + <table class="table table-bordered"> | ||
7 | + <tbody> | ||
8 | + <tr> | ||
9 | + <th>Id</th> | ||
10 | + <td>{{ candidato.id }}</td> | ||
11 | + </tr> | ||
12 | + <tr> | ||
13 | + <th>Nombre</th> | ||
14 | + <td>{{ candidato.nombre }}</td> | ||
15 | + </tr> | ||
16 | + <tr> | ||
17 | + <th>Apellido</th> | ||
18 | + <td>{{ candidato.apellido }}</td> | ||
19 | + </tr> | ||
20 | + <tr> | ||
21 | + <th>Cedula</th> | ||
22 | + <td>{{ candidato.cedula }}</td> | ||
23 | + </tr> | ||
24 | + <tr> | ||
25 | + <th>Edad</th> | ||
26 | + <td>{{ candidato.edad }}</td> | ||
27 | + </tr> | ||
28 | + <tr> | ||
29 | + <th>Sexo</th> | ||
30 | + <td>{% if candidato.sexo %}Yes{% else %}No{% endif %}</td> | ||
31 | + </tr> | ||
32 | + <tr> | ||
33 | + <th>Primaria</th> | ||
34 | + <td>{{ candidato.primaria }}</td> | ||
35 | + </tr> | ||
36 | + <tr> | ||
37 | + <th>Secundaria</th> | ||
38 | + <td>{{ candidato.secundaria }}</td> | ||
39 | + </tr> | ||
40 | + <tr> | ||
41 | + <th>Terciaria</th> | ||
42 | + <td>{{ candidato.terciaria }}</td> | ||
43 | + </tr> | ||
44 | + <tr> | ||
45 | + <th>Pais</th> | ||
46 | + <td>{{ candidato.pais }}</td> | ||
47 | + </tr> | ||
48 | + <tr> | ||
49 | + <th>Estado</th> | ||
50 | + <td>{{ candidato.estado }}</td> | ||
51 | + </tr> | ||
52 | + <tr> | ||
53 | + <th>Municipio</th> | ||
54 | + <td>{{ candidato.municipio }}</td> | ||
55 | + </tr> | ||
56 | + <tr> | ||
57 | + <th>Parroquia</th> | ||
58 | + <td>{{ candidato.parroquia }}</td> | ||
59 | + </tr> | ||
60 | + </tbody> | ||
61 | + </table> | ||
62 | +<div style="text-align:right"> | ||
63 | + <ul> | ||
64 | + <a class="btn btn-primary" role="button" href="{{ path('candidato_index') }}"><span class="glyphicon glyphicon-circle-arrow-left"></span></a> | ||
65 | + | ||
66 | + <a class="btn btn-primary" role="button" href="{{ path('candidato_edit', { 'id': candidato.id }) }}"><span class="glyphicon glyphicon-pencil"></span></a> | ||
67 | + | ||
68 | + {{ form_start(delete_form) }} | ||
69 | + <input type="submit" class="btn btn-primary" value="Eliminar"/> | ||
70 | + {{ form_end(delete_form) }} | ||
71 | + | ||
72 | + </ul> | ||
73 | +</div> | ||
74 | +{% endblock %} |
app/Resources/views/estado/edit.html.twig
@@ -0,0 +1,21 @@ | @@ -0,0 +1,21 @@ | ||
1 | +{% extends 'base.html.twig' %} | ||
2 | + | ||
3 | +{% block body %} | ||
4 | + <h1>Estado 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('estado_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/estado/index.html.twig
@@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
1 | +{% extends 'base.html.twig' %} | ||
2 | + | ||
3 | +{% block body %} | ||
4 | + <h1>Estados list</h1> | ||
5 | + | ||
6 | + <table> | ||
7 | + <thead> | ||
8 | + <tr> | ||
9 | + <th>Id</th> | ||
10 | + <th>Description</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 }}</td> | ||
20 | + <td>{{ estado.codigo }}</td> | ||
21 | + <td> | ||
22 | + <ul> | ||
23 | + <li> | ||
24 | + <a href="{{ path('estado_show', { 'id': estado.id }) }}">show</a> | ||
25 | + </li> | ||
26 | + <li> | ||
27 | + <a href="{{ path('estado_edit', { 'id': estado.id }) }}">edit</a> | ||
28 | + </li> | ||
29 | + </ul> | ||
30 | + </td> | ||
31 | + </tr> | ||
32 | + {% endfor %} | ||
33 | + </tbody> | ||
34 | + </table> | ||
35 | + | ||
36 | + <ul> | ||
37 | + <li> | ||
38 | + <a href="{{ path('estado_new') }}">Create a new estado</a> | ||
39 | + </li> | ||
40 | + </ul> | ||
41 | +{% endblock %} |
app/Resources/views/estado/new.html.twig
@@ -0,0 +1,16 @@ | @@ -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') }}">Volver</a> | ||
14 | + </li> | ||
15 | + </ul> | ||
16 | +{% endblock %} |
app/Resources/views/estado/show.html.twig
@@ -0,0 +1,36 @@ | @@ -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 href="{{ path('estado_index') }}">Back to the list</a> | ||
26 | + </li> | ||
27 | + <li> | ||
28 | + <a href="{{ path('estado_edit', { 'id': estado.id }) }}">Edit</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,21 @@ | @@ -0,0 +1,21 @@ | ||
1 | +{% extends 'base.html.twig' %} | ||
2 | + | ||
3 | +{% block body %} | ||
4 | + <h1>Municipio 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('municipio_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/municipio/index.html.twig
@@ -0,0 +1,42 @@ | @@ -0,0 +1,42 @@ | ||
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>Acciones</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 }}</td> | ||
21 | + <td>{{ municipio.codigo }}</td> | ||
22 | + <td>{{ municipio.estado }}</td> | ||
23 | + <td> | ||
24 | + <ul> | ||
25 | + <li> | ||
26 | + <a href="{{ path('municipio_show', { 'id': municipio.id }) }}">show</a> | ||
27 | + </li> | ||
28 | + <li> | ||
29 | + <a href="{{ path('municipio_edit', { 'id': municipio.id }) }}">edit</a> | ||
30 | + </li> | ||
31 | + </ul> | ||
32 | + </td> | ||
33 | + </tr> | ||
34 | + {% endfor %} | ||
35 | + </tbody> | ||
36 | + </table> | ||
37 | + <ul> | ||
38 | + <li> | ||
39 | + <a href="{{ path('municipio_new') }}">Create a new municipio</a> | ||
40 | + </li> | ||
41 | + </ul> | ||
42 | +{% endblock %} |
app/Resources/views/municipio/new.html.twig
@@ -0,0 +1,16 @@ | @@ -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 %} | ||
0 | \ No newline at end of file | 17 | \ No newline at end of file |
app/Resources/views/municipio/show.html.twig
@@ -0,0 +1,36 @@ | @@ -0,0 +1,36 @@ | ||
1 | +{% extends 'base.html.twig' %} | ||
2 | + | ||
3 | +{% block body %} | ||
4 | + <h1>Municipio</h1> | ||
5 | + | ||
6 | + <table> | ||
7 | + <tbody> | ||
8 | + <tr> | ||
9 | + <th>Id</th> | ||
10 | + <td>{{ municipio.id }}</td> | ||
11 | + </tr> | ||
12 | + <tr> | ||
13 | + <th>Descripcion</th> | ||
14 | + <td>{{ municipio.descripcion }}</td> | ||
15 | + </tr> | ||
16 | + <tr> | ||
17 | + <th>Codigo</th> | ||
18 | + <td>{{ municipio.codigo }}</td> | ||
19 | + </tr> | ||
20 | + </tbody> | ||
21 | + </table> | ||
22 | + | ||
23 | + <ul> | ||
24 | + <li> | ||
25 | + <a href="{{ path('municipio_index') }}">Back to the list</a> | ||
26 | + </li> | ||
27 | + <li> | ||
28 | + <a href="{{ path('municipio_edit', { 'id': municipio.id }) }}">Edit</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/persona/edit.html.twig
@@ -0,0 +1,51 @@ | @@ -0,0 +1,51 @@ | ||
1 | +{% extends 'base.html.twig' %} | ||
2 | + | ||
3 | +{% block body %} | ||
4 | + <h1>Editar Persona</h1> | ||
5 | + | ||
6 | +<form action="{{ path('persona_edit', { 'id': persona.id }) }}" id="form_persona" novalidate method="POST" {{ form_enctype(edit_form)}}> | ||
7 | + | ||
8 | + <div class="row 12"> | ||
9 | + <div class="col-xs-4"> | ||
10 | + <div class="form-group{% if edit_form.nombre.vars.errors[0].message is defined %} has-error{% endif %}"></div> | ||
11 | + {{ form_label(edit_form.nombre) }} | ||
12 | + {{ form_widget(edit_form.nombre) }} | ||
13 | + | ||
14 | + {% if edit_form.nombre.vars.errors[0].message is defined %} | ||
15 | + <span class="help-block"> | ||
16 | + {{ edit_form.nombre.vars.errors[0].message }} | ||
17 | + {% endif %} | ||
18 | + </div> | ||
19 | + | ||
20 | + <div class="col-xs-4"> | ||
21 | + <div class="form-group{% if edit_form.apelido.vars.errors[0].message is defined %} has-error{% endif %}"></div> | ||
22 | + {{ form_label(edit_form.apellido) }} | ||
23 | + {{ form_widget(edit_form.apellido) }} | ||
24 | + {% if edit_form.apellido.vars.errors[0].message is defined %} | ||
25 | + <span class="help-block"> | ||
26 | + {{ edit_form.apellido.vars.errors[0].message }} | ||
27 | + {% endif %} | ||
28 | + </div> | ||
29 | +</div> | ||
30 | + | ||
31 | +<div class="row 12"> | ||
32 | + <div class="col-xs-6"> | ||
33 | + <div class="form-group{% if edit_form.cedula.vars.errors[0].message is defined %} has-error{% endif %}"></div> | ||
34 | + {{ form_label(edit_form.cedula) }} | ||
35 | + {{ form_widget(edit_form.cedula) }} | ||
36 | + {% if edit_form.cedula.vars.errors[0].message is defined %} | ||
37 | + <span class="help-block"> | ||
38 | + {{ edit_form.cedula.vars.errors[0].message }} | ||
39 | + {% endif %} | ||
40 | + </div> | ||
41 | +</div> | ||
42 | + | ||
43 | +<div style="text-align:right"> | ||
44 | + <ul> | ||
45 | + <input type="submit" class="btn btn-primary" value="Guardar" /> | ||
46 | + {{form_widget(edit_form._token)}} | ||
47 | + <a class="btn btn-primary" role="button" href="{{ path('persona_index') }}"><span class="glyphicon glyphicon-arrow-left"></span></a> | ||
48 | + </ul> | ||
49 | +</div> | ||
50 | + | ||
51 | +{% endblock %} |
app/Resources/views/persona/index.html.twig
@@ -0,0 +1,48 @@ | @@ -0,0 +1,48 @@ | ||
1 | +{% extends 'base.html.twig' %} | ||
2 | + | ||
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 | + | ||
16 | + <h1>Lista de personas</h1> | ||
17 | + | ||
18 | + <ul> | ||
19 | + <a class="btn btn-info" role="button" href="{{ path('persona_new') }}"><span class="glyphicon glyphicon-plus"></span></a> | ||
20 | + </ul> | ||
21 | + | ||
22 | + <table class="table table-bordered"> | ||
23 | + <thead> | ||
24 | + <tr class="info"> | ||
25 | + <th>Id</th> | ||
26 | + <th>Nombre</th> | ||
27 | + <th>Apellido</th> | ||
28 | + <th>Cedula</th> | ||
29 | + <th>Acciones</th> | ||
30 | + </thead> | ||
31 | + <tbody> | ||
32 | + {% for persona in personas %} | ||
33 | + <tr> | ||
34 | + <td><a href="{{ path('persona_show', { 'id': persona.id }) }}">{{ persona.id }}</a></td> | ||
35 | + <td>{{ persona.nombre }}</td> | ||
36 | + <td>{{ persona.apellido }}</td> | ||
37 | + <td><a href="{{ path('persona_show', { 'id': persona.id }) }}">{{ persona.cedula }}</td></a> | ||
38 | + <td> | ||
39 | + <ul> | ||
40 | + <a class="btn btn-info" role="button" href="{{ path('persona_show', { 'id': persona.id }) }}"><span class="glyphicon glyphicon-eye-open"></span></a> | ||
41 | + <a class="btn btn-danger" role="button" href="{{ path('persona_edit', { 'id': persona.id }) }}"><span class="glyphicon glyphicon-pencil"></span></a> | ||
42 | + </ul> | ||
43 | + </td> | ||
44 | + </tr> | ||
45 | + {% endfor %} | ||
46 | + </tbody> | ||
47 | + </table> | ||
48 | +{% endblock %} |
app/Resources/views/persona/new.html.twig
@@ -0,0 +1,47 @@ | @@ -0,0 +1,47 @@ | ||
1 | +{% extends 'base.html.twig' %} | ||
2 | + | ||
3 | +{% block body %} | ||
4 | + <h1>Formulario para crear persona</h1> | ||
5 | + | ||
6 | + <div class="row 12"> | ||
7 | + <div class="col-xs-4"> | ||
8 | + {{ form_start(form, {'attr': {'novalidate': 'novalidate'}, 'action': path('persona_new')}) }} | ||
9 | + {{ form_label(form.nombre) }} | ||
10 | + {{ form_widget(form.nombre) }} | ||
11 | + {% if form.nombre.vars.errors[0].message is defined %} | ||
12 | + <span class="help-block"> | ||
13 | + {{ form.nombre.vars.errors[0].message }} | ||
14 | + {% endif %} | ||
15 | + </div> | ||
16 | + | ||
17 | + <div class="col-xs-4"> | ||
18 | + {{ form_start(form, {'attr': {'novalidate': 'novalidate'}, 'action': path('persona_new')}) }} | ||
19 | + {{ form_label(form.apellido) }} | ||
20 | + {{ form_widget(form.apellido) }} | ||
21 | + {% if form.apellido.vars.errors[0].message is defined %} | ||
22 | + <span class="help-block"> | ||
23 | + {{ form.apellido.vars.errors[0].message }} | ||
24 | + {% endif %} | ||
25 | + </div> | ||
26 | +</div> | ||
27 | + | ||
28 | +<div class="row 12"> | ||
29 | + <div class="col-xs-6"> | ||
30 | + {{ form_start(form, {'attr': {'novalidate': 'novalidate'}, 'action': path('persona_new')}) }} | ||
31 | + {{ form_label(form.cedula) }} | ||
32 | + {{ form_widget(form.cedula) }} | ||
33 | + {% if form.cedula.vars.errors[0].message is defined %} | ||
34 | + <span class="help-block"> | ||
35 | + {{ form.cedula.vars.errors[0].message }} | ||
36 | + {% endif %} | ||
37 | + </div> | ||
38 | +</div> | ||
39 | + | ||
40 | +<div style="text-align:right"> | ||
41 | + <ul> | ||
42 | + <input type="submit" class="btn btn-primary" value="Crear" /> | ||
43 | + {{form_end(form)}} | ||
44 | + <a class="btn btn-primary" role="button" href="{{ path('persona_index') }}"><span class="glyphicon glyphicon-arrow-left"></span></a> | ||
45 | + </ul> | ||
46 | +</div> | ||
47 | +{% endblock %} |
app/Resources/views/persona/show.html.twig
@@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
1 | +{% extends 'base.html.twig' %} | ||
2 | + | ||
3 | +{% block body %} | ||
4 | + <h1>Ver Persona</h1> | ||
5 | + | ||
6 | + <table class="table table-bordered"> | ||
7 | + <tbody> | ||
8 | + <tr> | ||
9 | + <th>Id</th> | ||
10 | + <td><input disabled value="{{ persona.id }}"></input></td> | ||
11 | + </tr> | ||
12 | + <tr> | ||
13 | + <th>Nombre</th> | ||
14 | + <td><input disabled value="{{ persona.nombre }}"></input></td> | ||
15 | + </tr> | ||
16 | + <tr> | ||
17 | + <th>Apellido</th> | ||
18 | + <td><input disabled value="{{ persona.apellido }}"></input></td> | ||
19 | + </tr> | ||
20 | + <tr> | ||
21 | + <th>Cedula</th> | ||
22 | + <td><input disabled value="{{ persona.cedula }}"></input></td> | ||
23 | + </tr> | ||
24 | + </tbody> | ||
25 | + </table> | ||
26 | +<div style="text-align:right"> | ||
27 | + <ul> | ||
28 | + <a class="btn btn-primary" role="button" href="{{ path('persona_index') }}"><span class="glyphicon glyphicon-circle-arrow-left"></span></a> | ||
29 | + | ||
30 | + <a class="btn btn-primary" role="button" href="{{ path('persona_edit', { 'id': persona.id }) }}"><span class="glyphicon glyphicon-pencil"></span></a> | ||
31 | + | ||
32 | + {{ form_start(delete_form) }} | ||
33 | + <input type="submit" class="btn btn-primary" value="Eliminar"/> | ||
34 | + {{ form_end(delete_form) }} | ||
35 | + | ||
36 | + </ul> | ||
37 | +</div> | ||
38 | +{% endblock %} |
src/UBV/PracticaBundle/Controller/candidatoController.php
@@ -0,0 +1,137 @@ | @@ -0,0 +1,137 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace UBV\PracticaBundle\Controller; | ||
4 | + | ||
5 | +use UBV\PracticaBundle\Entity\candidato; | ||
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 | + * Candidato controller. | ||
13 | + * | ||
14 | + * @Route("candidato") | ||
15 | + */ | ||
16 | +class candidatoController extends Controller | ||
17 | +{ | ||
18 | + /** | ||
19 | + * Lists all candidato entities. | ||
20 | + * | ||
21 | + * @Route("/", name="candidato_index") | ||
22 | + * @Method("GET") | ||
23 | + */ | ||
24 | + public function indexAction() | ||
25 | + { | ||
26 | + $em = $this->getDoctrine()->getManager(); | ||
27 | + | ||
28 | + $candidatos = $em->getRepository('UBVPracticaBundle:candidato')->findAll(); | ||
29 | + | ||
30 | + return $this->render('candidato/index.html.twig', array( | ||
31 | + 'candidatos' => $candidatos, | ||
32 | + )); | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * Creates a new candidato entity. | ||
37 | + * | ||
38 | + * @Route("/new", name="candidato_new") | ||
39 | + * @Method({"GET", "POST"}) | ||
40 | + */ | ||
41 | + public function newAction(Request $request) | ||
42 | + { | ||
43 | + $candidato = new Candidato(); | ||
44 | + $form = $this->createForm('UBV\PracticaBundle\Form\candidatoType', $candidato); | ||
45 | + $form->handleRequest($request); | ||
46 | + | ||
47 | + if ($form->isSubmitted() && $form->isValid()) { | ||
48 | + $em = $this->getDoctrine()->getManager(); | ||
49 | + $em->persist($candidato); | ||
50 | + $em->flush(); | ||
51 | + | ||
52 | + return $this->redirectToRoute('candidato_show', array('id' => $candidato->getId())); | ||
53 | + } | ||
54 | + | ||
55 | + return $this->render('candidato/new.html.twig', array( | ||
56 | + 'candidato' => $candidato, | ||
57 | + 'form' => $form->createView(), | ||
58 | + )); | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * Finds and displays a candidato entity. | ||
63 | + * | ||
64 | + * @Route("/{id}", name="candidato_show") | ||
65 | + * @Method("GET") | ||
66 | + */ | ||
67 | + public function showAction(candidato $candidato) | ||
68 | + { | ||
69 | + $deleteForm = $this->createDeleteForm($candidato); | ||
70 | + | ||
71 | + return $this->render('candidato/show.html.twig', array( | ||
72 | + 'candidato' => $candidato, | ||
73 | + 'delete_form' => $deleteForm->createView(), | ||
74 | + )); | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * Displays a form to edit an existing candidato entity. | ||
79 | + * | ||
80 | + * @Route("/{id}/edit", name="candidato_edit") | ||
81 | + * @Method({"GET", "POST"}) | ||
82 | + */ | ||
83 | + public function editAction(Request $request, candidato $candidato) | ||
84 | + { | ||
85 | + $deleteForm = $this->createDeleteForm($candidato); | ||
86 | + $editForm = $this->createForm('UBV\PracticaBundle\Form\candidatoType', $candidato); | ||
87 | + $editForm->handleRequest($request); | ||
88 | + | ||
89 | + if ($editForm->isSubmitted() && $editForm->isValid()) { | ||
90 | + $this->getDoctrine()->getManager()->flush(); | ||
91 | + | ||
92 | + return $this->redirectToRoute('candidato_edit', array('id' => $candidato->getId())); | ||
93 | + } | ||
94 | + | ||
95 | + return $this->render('candidato/edit.html.twig', array( | ||
96 | + 'candidato' => $candidato, | ||
97 | + 'edit_form' => $editForm->createView(), | ||
98 | + 'delete_form' => $deleteForm->createView(), | ||
99 | + )); | ||
100 | + } | ||
101 | + | ||
102 | + /** | ||
103 | + * Deletes a candidato entity. | ||
104 | + * | ||
105 | + * @Route("/{id}", name="candidato_delete") | ||
106 | + * @Method("DELETE") | ||
107 | + */ | ||
108 | + public function deleteAction(Request $request, candidato $candidato) | ||
109 | + { | ||
110 | + $form = $this->createDeleteForm($candidato); | ||
111 | + $form->handleRequest($request); | ||
112 | + | ||
113 | + if ($form->isSubmitted() && $form->isValid()) { | ||
114 | + $em = $this->getDoctrine()->getManager(); | ||
115 | + $em->remove($candidato); | ||
116 | + $em->flush(); | ||
117 | + } | ||
118 | + | ||
119 | + return $this->redirectToRoute('candidato_index'); | ||
120 | + } | ||
121 | + | ||
122 | + /** | ||
123 | + * Creates a form to delete a candidato entity. | ||
124 | + * | ||
125 | + * @param candidato $candidato The candidato entity | ||
126 | + * | ||
127 | + * @return \Symfony\Component\Form\Form The form | ||
128 | + */ | ||
129 | + private function createDeleteForm(candidato $candidato) | ||
130 | + { | ||
131 | + return $this->createFormBuilder() | ||
132 | + ->setAction($this->generateUrl('candidato_delete', array('id' => $candidato->getId()))) | ||
133 | + ->setMethod('DELETE') | ||
134 | + ->getForm() | ||
135 | + ; | ||
136 | + } | ||
137 | +} |
src/UBV/PracticaBundle/Controller/estadoController.php
@@ -0,0 +1,136 @@ | @@ -0,0 +1,136 @@ | ||
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 | + * Estado controller. | ||
12 | + * | ||
13 | + * @Route("estado") | ||
14 | + */ | ||
15 | +class estadoController extends Controller | ||
16 | +{ | ||
17 | + /** | ||
18 | + * Lists all estado entities. | ||
19 | + * | ||
20 | + * @Route("/", name="estado_index") | ||
21 | + * @Method("GET") | ||
22 | + */ | ||
23 | + public function indexAction() | ||
24 | + { | ||
25 | + $em = $this->getDoctrine()->getManager(); | ||
26 | + | ||
27 | + $estados = $em->getRepository('UBVPracticaBundle:estado')->findAll(); | ||
28 | + | ||
29 | + return $this->render('estado/index.html.twig', array( | ||
30 | + 'estados' => $estados, | ||
31 | + )); | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Creates a new estado entity. | ||
36 | + * | ||
37 | + * @Route("/new", name="estado_new") | ||
38 | + * @Method({"GET", "POST"}) | ||
39 | + */ | ||
40 | + public function newAction(Request $request) | ||
41 | + { | ||
42 | + $estado = new Estado(); | ||
43 | + $form = $this->createForm('UBV\PracticaBundle\Form\estadoType', $estado); | ||
44 | + $form->handleRequest($request); | ||
45 | + | ||
46 | + if ($form->isSubmitted() && $form->isValid()) { | ||
47 | + $em = $this->getDoctrine()->getManager(); | ||
48 | + $em->persist($estado); | ||
49 | + $em->flush(); | ||
50 | + | ||
51 | + return $this->redirectToRoute('estado_show', array('id' => $estado->getId())); | ||
52 | + } | ||
53 | + | ||
54 | + return $this->render('estado/new.html.twig', array( | ||
55 | + 'estado' => $estado, | ||
56 | + 'form' => $form->createView(), | ||
57 | + )); | ||
58 | + } | ||
59 | + | ||
60 | + /** | ||
61 | + * Finds and displays a estado entity. | ||
62 | + * | ||
63 | + * @Route("/{id}", name="estado_show") | ||
64 | + * @Method("GET") | ||
65 | + */ | ||
66 | + public function showAction(estado $estado) | ||
67 | + { | ||
68 | + $deleteForm = $this->createDeleteForm($estado); | ||
69 | + | ||
70 | + return $this->render('estado/show.html.twig', array( | ||
71 | + 'estado' => $estado, | ||
72 | + 'delete_form' => $deleteForm->createView(), | ||
73 | + )); | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * Displays a form to edit an existing estado entity. | ||
78 | + * | ||
79 | + * @Route("/{id}/edit", name="estado_edit") | ||
80 | + * @Method({"GET", "POST"}) | ||
81 | + */ | ||
82 | + public function editAction(Request $request, estado $estado) | ||
83 | + { | ||
84 | + $deleteForm = $this->createDeleteForm($estado); | ||
85 | + $editForm = $this->createForm('UBV\PracticaBundle\Form\estadoType', $estado); | ||
86 | + $editForm->handleRequest($request); | ||
87 | + | ||
88 | + if ($editForm->isSubmitted() && $editForm->isValid()) { | ||
89 | + $this->getDoctrine()->getManager()->flush(); | ||
90 | + | ||
91 | + return $this->redirectToRoute('estado_edit', array('id' => $estado->getId())); | ||
92 | + } | ||
93 | + | ||
94 | + return $this->render('estado/edit.html.twig', array( | ||
95 | + 'estado' => $estado, | ||
96 | + 'edit_form' => $editForm->createView(), | ||
97 | + 'delete_form' => $deleteForm->createView(), | ||
98 | + )); | ||
99 | + } | ||
100 | + | ||
101 | + /** | ||
102 | + * Deletes a estado entity. | ||
103 | + * | ||
104 | + * @Route("/{id}", name="estado_delete") | ||
105 | + * @Method("DELETE") | ||
106 | + */ | ||
107 | + public function deleteAction(Request $request, estado $estado) | ||
108 | + { | ||
109 | + $form = $this->createDeleteForm($estado); | ||
110 | + $form->handleRequest($request); | ||
111 | + | ||
112 | + if ($form->isSubmitted() && $form->isValid()) { | ||
113 | + $em = $this->getDoctrine()->getManager(); | ||
114 | + $em->remove($estado); | ||
115 | + $em->flush(); | ||
116 | + } | ||
117 | + | ||
118 | + return $this->redirectToRoute('estado_index'); | ||
119 | + } | ||
120 | + | ||
121 | + /** | ||
122 | + * Creates a form to delete a estado entity. | ||
123 | + * | ||
124 | + * @param estado $estado The estado entity | ||
125 | + * | ||
126 | + * @return \Symfony\Component\Form\Form The form | ||
127 | + */ | ||
128 | + private function createDeleteForm(estado $estado) | ||
129 | + { | ||
130 | + return $this->createFormBuilder() | ||
131 | + ->setAction($this->generateUrl('estado_delete', array('id' => $estado->getId()))) | ||
132 | + ->setMethod('DELETE') | ||
133 | + ->getForm() | ||
134 | + ; | ||
135 | + } | ||
136 | +} |
src/UBV/PracticaBundle/Controller/municipioController.php
@@ -0,0 +1,136 @@ | @@ -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/personaController.php
@@ -0,0 +1,148 @@ | @@ -0,0 +1,148 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace UBV\PracticaBundle\Controller; | ||
4 | + | ||
5 | +use UBV\PracticaBundle\Entity\persona; | ||
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 | + * Persona controller. | ||
12 | + * | ||
13 | + * @Route("persona") | ||
14 | + */ | ||
15 | +class personaController extends Controller | ||
16 | +{ | ||
17 | + /** | ||
18 | + * Lists all persona entities. | ||
19 | + * | ||
20 | + * @Route("/", name="persona_index") | ||
21 | + * @Method("GET") | ||
22 | + */ | ||
23 | + public function indexAction() | ||
24 | + { | ||
25 | + $em = $this->getDoctrine()->getManager(); | ||
26 | + | ||
27 | + $personas = $em->getRepository('UBVPracticaBundle:persona')->findAll(); | ||
28 | + | ||
29 | + return $this->render('persona/index.html.twig', array( | ||
30 | + 'personas' => $personas, | ||
31 | + )); | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Creates a new persona entity. | ||
36 | + * | ||
37 | + * @Route("/new", name="persona_new") | ||
38 | + * @Method({"GET", "POST"}) | ||
39 | + */ | ||
40 | + public function newAction(Request $request) | ||
41 | + { | ||
42 | + $persona = new Persona(); | ||
43 | + $form = $this->createForm('UBV\PracticaBundle\Form\personaType', $persona); | ||
44 | + $form->handleRequest($request); | ||
45 | + | ||
46 | + if ($form->isSubmitted() && $form->isValid()) { | ||
47 | + $em = $this->getDoctrine()->getManager(); | ||
48 | + $em->persist($persona); | ||
49 | + $em->flush(); | ||
50 | + $this->get('session')->getFlashBag()->set( | ||
51 | + 'success', array( | ||
52 | + 'title' => 'Guardado!', | ||
53 | + 'message' => 'Persona Guardada satisfactoriamente.' | ||
54 | + ) | ||
55 | + ); | ||
56 | + | ||
57 | + return $this->redirectToRoute('persona_index', array('id' => $persona->getId())); | ||
58 | + } | ||
59 | + | ||
60 | + return $this->render('persona/new.html.twig', array( | ||
61 | + 'persona' => $persona, | ||
62 | + 'form' => $form->createView(), | ||
63 | + )); | ||
64 | + } | ||
65 | + | ||
66 | + /** | ||
67 | + * Finds and displays a persona entity. | ||
68 | + * | ||
69 | + * @Route("/{id}", name="persona_show") | ||
70 | + * @Method("GET") | ||
71 | + */ | ||
72 | + public function showAction(persona $persona) | ||
73 | + { | ||
74 | + $deleteForm = $this->createDeleteForm($persona); | ||
75 | + | ||
76 | + return $this->render('persona/show.html.twig', array( | ||
77 | + 'persona' => $persona, | ||
78 | + 'delete_form' => $deleteForm->createView(), | ||
79 | + )); | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * Displays a form to edit an existing persona entity. | ||
84 | + * | ||
85 | + * @Route("/{id}/edit", name="persona_edit") | ||
86 | + * @Method({"GET", "POST"}) | ||
87 | + */ | ||
88 | + public function editAction(Request $request, persona $persona) | ||
89 | + { | ||
90 | + $deleteForm = $this->createDeleteForm($persona); | ||
91 | + $editForm = $this->createForm('UBV\PracticaBundle\Form\personaType', $persona); | ||
92 | + $editForm->handleRequest($request); | ||
93 | + | ||
94 | + if ($editForm->isSubmitted() && $editForm->isValid()) { | ||
95 | + $this->getDoctrine()->getManager()->flush(); | ||
96 | + $this->get('session')->getFlashBag()->set( | ||
97 | + 'success', array( | ||
98 | + 'title' => 'Editado!', | ||
99 | + 'message' => 'Persona Editada satisfactoriamente.' | ||
100 | + ) | ||
101 | + ); | ||
102 | + | ||
103 | + return $this->redirectToRoute('persona_index', array('id' => $persona->getId())); | ||
104 | + } | ||
105 | + | ||
106 | + return $this->render('persona/edit.html.twig', array( | ||
107 | + 'persona' => $persona, | ||
108 | + 'edit_form' => $editForm->createView(), | ||
109 | + 'delete_form' => $deleteForm->createView(), | ||
110 | + )); | ||
111 | + } | ||
112 | + | ||
113 | + /** | ||
114 | + * Deletes a persona entity. | ||
115 | + * | ||
116 | + * @Route("/{id}", name="persona_delete") | ||
117 | + * @Method("DELETE") | ||
118 | + */ | ||
119 | + public function deleteAction(Request $request, persona $persona) | ||
120 | + { | ||
121 | + $form = $this->createDeleteForm($persona); | ||
122 | + $form->handleRequest($request); | ||
123 | + | ||
124 | + if ($form->isSubmitted() && $form->isValid()) { | ||
125 | + $em = $this->getDoctrine()->getManager(); | ||
126 | + $em->remove($persona); | ||
127 | + $em->flush(); | ||
128 | + } | ||
129 | + | ||
130 | + return $this->redirectToRoute('persona_index'); | ||
131 | + } | ||
132 | + | ||
133 | + /** | ||
134 | + * Creates a form to delete a persona entity. | ||
135 | + * | ||
136 | + * @param persona $persona The persona entity | ||
137 | + * | ||
138 | + * @return \Symfony\Component\Form\Form The form | ||
139 | + */ | ||
140 | + private function createDeleteForm(persona $persona) | ||
141 | + { | ||
142 | + return $this->createFormBuilder() | ||
143 | + ->setAction($this->generateUrl('persona_delete', array('id' => $persona->getId()))) | ||
144 | + ->setMethod('DELETE') | ||
145 | + ->getForm() | ||
146 | + ; | ||
147 | + } | ||
148 | +} |
src/UBV/PracticaBundle/Entity/aldea.php
src/UBV/PracticaBundle/Entity/candidato.php
@@ -0,0 +1,469 @@ | @@ -0,0 +1,469 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace UBV\PracticaBundle\Entity; | ||
4 | + | ||
5 | +use Doctrine\ORM\Mapping as ORM; | ||
6 | + | ||
7 | +/** | ||
8 | + * candidato | ||
9 | + * | ||
10 | + * @ORM\Table(name="candidato") | ||
11 | + * @ORM\Entity(repositoryClass="UBV\PracticaBundle\Repository\candidatoRepository") | ||
12 | + */ | ||
13 | +class candidato | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @var int | ||
17 | + * | ||
18 | + * @ORM\Column(name="id", type="integer") | ||
19 | + * @ORM\Id | ||
20 | + * @ORM\GeneratedValue(strategy="AUTO") | ||
21 | + */ | ||
22 | + private $id; | ||
23 | + | ||
24 | + /** | ||
25 | + * @var string | ||
26 | + * | ||
27 | + * @ORM\Column(name="nombre", type="string", length=255) | ||
28 | + */ | ||
29 | + private $nombre; | ||
30 | + | ||
31 | + /** | ||
32 | + * @var string | ||
33 | + * | ||
34 | + * @ORM\Column(name="apellido", type="string", length=255) | ||
35 | + */ | ||
36 | + private $apellido; | ||
37 | + | ||
38 | + /** | ||
39 | + * @var string | ||
40 | + * | ||
41 | + * @ORM\Column(name="cedula", type="string", length=255, unique=true) | ||
42 | + */ | ||
43 | + private $cedula; | ||
44 | + | ||
45 | + /** | ||
46 | + * @var int | ||
47 | + * | ||
48 | + * @ORM\Column(name="edad", type="integer") | ||
49 | + */ | ||
50 | + private $edad; | ||
51 | + | ||
52 | + /** | ||
53 | + * @var bool | ||
54 | + * | ||
55 | + * @ORM\Column(name="sexo", type="boolean") | ||
56 | + */ | ||
57 | + private $sexo; | ||
58 | + | ||
59 | + /** | ||
60 | + * @var string | ||
61 | + * | ||
62 | + * @ORM\Column(name="primaria", type="string", length=255) | ||
63 | + */ | ||
64 | + private $primaria; | ||
65 | + | ||
66 | + /** | ||
67 | + * @var string | ||
68 | + * | ||
69 | + * @ORM\Column(name="secundaria", type="string", length=255) | ||
70 | + */ | ||
71 | + private $secundaria; | ||
72 | + | ||
73 | + /** | ||
74 | + * @var string | ||
75 | + * | ||
76 | + * @ORM\Column(name="terciaria", type="string", length=255) | ||
77 | + */ | ||
78 | + private $terciaria; | ||
79 | + | ||
80 | + /** | ||
81 | + * @var string | ||
82 | + * | ||
83 | + * @ORM\Column(name="pais", type="string", length=255) | ||
84 | + */ | ||
85 | + private $pais; | ||
86 | + | ||
87 | + /** | ||
88 | + * @var string | ||
89 | + * | ||
90 | + * @ORM\Column(name="estado", type="string", length=255) | ||
91 | + */ | ||
92 | + private $estado; | ||
93 | + | ||
94 | + /** | ||
95 | + * @var string | ||
96 | + * | ||
97 | + * @ORM\Column(name="municipio", type="string", length=255) | ||
98 | + */ | ||
99 | + private $municipio; | ||
100 | + | ||
101 | + /** | ||
102 | + * @var string | ||
103 | + * | ||
104 | + * @ORM\Column(name="parroquia", type="string", length=255) | ||
105 | + */ | ||
106 | + private $parroquia; | ||
107 | + | ||
108 | + /** | ||
109 | + * @ORM\ManyToOne(targetEntity="aldea", inversedBy="candidato", cascade={"persist", "remove"}) | ||
110 | + * @ORM\JoinColumn(name="aldea_id", referencedColumnName="id", nullable=true) | ||
111 | + * }) | ||
112 | + */ | ||
113 | + private $aldea; | ||
114 | + | ||
115 | + /** | ||
116 | + * @ORM\ManyToOne(targetEntity="estadoCivil", inversedBy="candidato", cascade={"persist", "remove"}) | ||
117 | + * @ORM\JoinColumn(name="estadoCivil_id", referencedColumnName="id", nullable=true) | ||
118 | + * }) | ||
119 | + */ | ||
120 | + private $estadoCivil; | ||
121 | + | ||
122 | + | ||
123 | + /** | ||
124 | + * Get id | ||
125 | + * | ||
126 | + * @return int | ||
127 | + */ | ||
128 | + public function getId() | ||
129 | + { | ||
130 | + return $this->id; | ||
131 | + } | ||
132 | + | ||
133 | + /** | ||
134 | + * Set nombre | ||
135 | + * | ||
136 | + * @param string $nombre | ||
137 | + * | ||
138 | + * @return candidato | ||
139 | + */ | ||
140 | + public function setNombre($nombre) | ||
141 | + { | ||
142 | + $this->nombre = $nombre; | ||
143 | + | ||
144 | + return $this; | ||
145 | + } | ||
146 | + | ||
147 | + /** | ||
148 | + * Get nombre | ||
149 | + * | ||
150 | + * @return string | ||
151 | + */ | ||
152 | + public function getNombre() | ||
153 | + { | ||
154 | + return $this->nombre; | ||
155 | + } | ||
156 | + | ||
157 | + /** | ||
158 | + * Set apellido | ||
159 | + * | ||
160 | + * @param string $apellido | ||
161 | + * | ||
162 | + * @return candidato | ||
163 | + */ | ||
164 | + public function setApellido($apellido) | ||
165 | + { | ||
166 | + $this->apellido = $apellido; | ||
167 | + | ||
168 | + return $this; | ||
169 | + } | ||
170 | + | ||
171 | + /** | ||
172 | + * Get apellido | ||
173 | + * | ||
174 | + * @return string | ||
175 | + */ | ||
176 | + public function getApellido() | ||
177 | + { | ||
178 | + return $this->apellido; | ||
179 | + } | ||
180 | + | ||
181 | + /** | ||
182 | + * Set cedula | ||
183 | + * | ||
184 | + * @param string $cedula | ||
185 | + * | ||
186 | + * @return candidato | ||
187 | + */ | ||
188 | + public function setCedula($cedula) | ||
189 | + { | ||
190 | + $this->cedula = $cedula; | ||
191 | + | ||
192 | + return $this; | ||
193 | + } | ||
194 | + | ||
195 | + /** | ||
196 | + * Get cedula | ||
197 | + * | ||
198 | + * @return string | ||
199 | + */ | ||
200 | + public function getCedula() | ||
201 | + { | ||
202 | + return $this->cedula; | ||
203 | + } | ||
204 | + | ||
205 | + /** | ||
206 | + * Set edad | ||
207 | + * | ||
208 | + * @param integer $edad | ||
209 | + * | ||
210 | + * @return candidato | ||
211 | + */ | ||
212 | + public function setEdad($edad) | ||
213 | + { | ||
214 | + $this->edad = $edad; | ||
215 | + | ||
216 | + return $this; | ||
217 | + } | ||
218 | + | ||
219 | + /** | ||
220 | + * Get edad | ||
221 | + * | ||
222 | + * @return int | ||
223 | + */ | ||
224 | + public function getEdad() | ||
225 | + { | ||
226 | + return $this->edad; | ||
227 | + } | ||
228 | + | ||
229 | + /** | ||
230 | + * Set sexo | ||
231 | + * | ||
232 | + * @param boolean $sexo | ||
233 | + * | ||
234 | + * @return candidato | ||
235 | + */ | ||
236 | + public function setSexo($sexo) | ||
237 | + { | ||
238 | + $this->sexo = $sexo; | ||
239 | + | ||
240 | + return $this; | ||
241 | + } | ||
242 | + | ||
243 | + /** | ||
244 | + * Get sexo | ||
245 | + * | ||
246 | + * @return bool | ||
247 | + */ | ||
248 | + public function getSexo() | ||
249 | + { | ||
250 | + return $this->sexo; | ||
251 | + } | ||
252 | + | ||
253 | + /** | ||
254 | + * Set primaria | ||
255 | + * | ||
256 | + * @param string $primaria | ||
257 | + * | ||
258 | + * @return candidato | ||
259 | + */ | ||
260 | + public function setPrimaria($primaria) | ||
261 | + { | ||
262 | + $this->primaria = $primaria; | ||
263 | + | ||
264 | + return $this; | ||
265 | + } | ||
266 | + | ||
267 | + /** | ||
268 | + * Get primaria | ||
269 | + * | ||
270 | + * @return string | ||
271 | + */ | ||
272 | + public function getPrimaria() | ||
273 | + { | ||
274 | + return $this->primaria; | ||
275 | + } | ||
276 | + | ||
277 | + /** | ||
278 | + * Set secundaria | ||
279 | + * | ||
280 | + * @param string $secundaria | ||
281 | + * | ||
282 | + * @return candidato | ||
283 | + */ | ||
284 | + public function setSecundaria($secundaria) | ||
285 | + { | ||
286 | + $this->secundaria = $secundaria; | ||
287 | + | ||
288 | + return $this; | ||
289 | + } | ||
290 | + | ||
291 | + /** | ||
292 | + * Get secundaria | ||
293 | + * | ||
294 | + * @return string | ||
295 | + */ | ||
296 | + public function getSecundaria() | ||
297 | + { | ||
298 | + return $this->secundaria; | ||
299 | + } | ||
300 | + | ||
301 | + /** | ||
302 | + * Set terciaria | ||
303 | + * | ||
304 | + * @param string $terciaria | ||
305 | + * | ||
306 | + * @return candidato | ||
307 | + */ | ||
308 | + public function setTerciaria($terciaria) | ||
309 | + { | ||
310 | + $this->terciaria = $terciaria; | ||
311 | + | ||
312 | + return $this; | ||
313 | + } | ||
314 | + | ||
315 | + /** | ||
316 | + * Get terciaria | ||
317 | + * | ||
318 | + * @return string | ||
319 | + */ | ||
320 | + public function getTerciaria() | ||
321 | + { | ||
322 | + return $this->terciaria; | ||
323 | + } | ||
324 | + | ||
325 | + /** | ||
326 | + * Set pais | ||
327 | + * | ||
328 | + * @param string $pais | ||
329 | + * | ||
330 | + * @return candidato | ||
331 | + */ | ||
332 | + public function setPais($pais) | ||
333 | + { | ||
334 | + $this->pais = $pais; | ||
335 | + | ||
336 | + return $this; | ||
337 | + } | ||
338 | + | ||
339 | + /** | ||
340 | + * Get pais | ||
341 | + * | ||
342 | + * @return string | ||
343 | + */ | ||
344 | + public function getPais() | ||
345 | + { | ||
346 | + return $this->pais; | ||
347 | + } | ||
348 | + | ||
349 | + /** | ||
350 | + * Set estado | ||
351 | + * | ||
352 | + * @param string $estado | ||
353 | + * | ||
354 | + * @return candidato | ||
355 | + */ | ||
356 | + public function setEstado($estado) | ||
357 | + { | ||
358 | + $this->estado = $estado; | ||
359 | + | ||
360 | + return $this; | ||
361 | + } | ||
362 | + | ||
363 | + /** | ||
364 | + * Get estado | ||
365 | + * | ||
366 | + * @return string | ||
367 | + */ | ||
368 | + public function getEstado() | ||
369 | + { | ||
370 | + return $this->estado; | ||
371 | + } | ||
372 | + | ||
373 | + /** | ||
374 | + * Set municipio | ||
375 | + * | ||
376 | + * @param string $municipio | ||
377 | + * | ||
378 | + * @return candidato | ||
379 | + */ | ||
380 | + public function setMunicipio($municipio) | ||
381 | + { | ||
382 | + $this->municipio = $municipio; | ||
383 | + | ||
384 | + return $this; | ||
385 | + } | ||
386 | + | ||
387 | + /** | ||
388 | + * Get municipio | ||
389 | + * | ||
390 | + * @return string | ||
391 | + */ | ||
392 | + public function getMunicipio() | ||
393 | + { | ||
394 | + return $this->municipio; | ||
395 | + } | ||
396 | + | ||
397 | + /** | ||
398 | + * Set parroquia | ||
399 | + * | ||
400 | + * @param string $parroquia | ||
401 | + * | ||
402 | + * @return candidato | ||
403 | + */ | ||
404 | + public function setParroquia($parroquia) | ||
405 | + { | ||
406 | + $this->parroquia = $parroquia; | ||
407 | + | ||
408 | + return $this; | ||
409 | + } | ||
410 | + | ||
411 | + /** | ||
412 | + * Get parroquia | ||
413 | + * | ||
414 | + * @return string | ||
415 | + */ | ||
416 | + public function getParroquia() | ||
417 | + { | ||
418 | + return $this->parroquia; | ||
419 | + } | ||
420 | + | ||
421 | + /** | ||
422 | + * Set aldea | ||
423 | + * | ||
424 | + * @param \UBV\PracticaBundle\Entity\Aldea $aldea | ||
425 | + * | ||
426 | + * @return candidato | ||
427 | + */ | ||
428 | + public function setAldea(\UBV\PracticaBundle\Entity\Aldea $aldea=null) | ||
429 | + { | ||
430 | + $this->aldea = $aldea; | ||
431 | + | ||
432 | + return $this; | ||
433 | + } | ||
434 | + | ||
435 | + /** | ||
436 | + * Get aldea | ||
437 | + * | ||
438 | + * @return string\UBV\PracticaBundle\Entity\Aldea | ||
439 | + */ | ||
440 | + public function getAldea() | ||
441 | + { | ||
442 | + return $this->aldea; | ||
443 | + } | ||
444 | + | ||
445 | + /** | ||
446 | + * Set estadoCivil | ||
447 | + * | ||
448 | + * @param \UBV\PracticaBundle\Entity\EstadoCivil $estadoCivil | ||
449 | + * | ||
450 | + * @return candidato | ||
451 | + */ | ||
452 | + public function setEstadoCivil(\UBV\PracticaBundle\Entity\EstadoCivil $estadoCivil=null) | ||
453 | + { | ||
454 | + $this->estadoCivil = $estadoCivil; | ||
455 | + | ||
456 | + return $this; | ||
457 | + } | ||
458 | + | ||
459 | + /** | ||
460 | + * Get estadoCivil | ||
461 | + * | ||
462 | + * @return string\UBV\PracticaBundle\Entity\EstadoCivil | ||
463 | + */ | ||
464 | + public function getestadoCivil() | ||
465 | + { | ||
466 | + return $this->estadoCivil; | ||
467 | + } | ||
468 | +} | ||
469 | + |
src/UBV/PracticaBundle/Entity/estado.php
@@ -93,5 +93,57 @@ class estado | @@ -93,5 +93,57 @@ class estado | ||
93 | { | 93 | { |
94 | return $this->codigo; | 94 | return $this->codigo; |
95 | } | 95 | } |
96 | + | ||
97 | + public function __toString(){ | ||
98 | + | ||
99 | + return $this->getDescripcion(); | ||
100 | + } | ||
101 | + | ||
102 | + /** | ||
103 | + * @ORM\OneToMany(targetEntity="estado", mappedBy="estado", cascade={"persist", "remove"}) | ||
104 | + * @Assert\Valid() | ||
105 | + */ | ||
106 | + protected $municipio; | ||
107 | + | ||
108 | + /** | ||
109 | + * Constructor | ||
110 | + */ | ||
111 | + public function __construct() | ||
112 | + { | ||
113 | + $this->municipio = new \Doctrine\Common\Collections\ArrayCollection(); | ||
114 | + } | ||
115 | + | ||
116 | + public function setMunicipio(\Doctrine\Common\Collections\Collection $municipio) | ||
117 | + { | ||
118 | + $this->municipio = $municipio; | ||
119 | + foreach ($municipio as $municipio) { | ||
120 | + $municipio->setEstado($this); | ||
121 | + } | ||
122 | + } | ||
123 | +} | ||
124 | +class Municipio | ||
125 | +{ | ||
126 | + | ||
127 | + /** | ||
128 | + * @var string $descripcion | ||
129 | + * | ||
130 | + * @ORM\Column(name="descripcion", type="string", length=255) | ||
131 | + * @Assert\NotBlank() | ||
132 | + */ | ||
133 | + protected $descripcion; | ||
134 | + | ||
135 | + /** | ||
136 | + * @var string $codigo | ||
137 | + * | ||
138 | + * @ORM\Column(name="codigo", type="string", length=255) | ||
139 | + * @Assert\NotBlank() | ||
140 | + */ | ||
141 | + protected $codigo; | ||
142 | + | ||
143 | + /** | ||
144 | + * @ORM\ManyToOne(targetEntity="estado", inversedBy="municipio") | ||
145 | + * @ORM\JoinColumn(name="estado_id", referencedColumnName="id") | ||
146 | + */ | ||
147 | + private $estado; | ||
96 | } | 148 | } |
97 | 149 |
src/UBV/PracticaBundle/Entity/estadoCivil.php
src/UBV/PracticaBundle/Entity/municipio.php
@@ -35,6 +35,13 @@ class municipio | @@ -35,6 +35,13 @@ class municipio | ||
35 | */ | 35 | */ |
36 | private $codigo; | 36 | private $codigo; |
37 | 37 | ||
38 | + /** | ||
39 | + * @ORM\ManyToOne(targetEntity="estado", inversedBy="municipios", cascade={"persist", "remove"}) | ||
40 | + * @ORM\JoinColumn(name="estado_id", referencedColumnName="id", nullable=false) | ||
41 | + * }) | ||
42 | + */ | ||
43 | + private $estado; | ||
44 | + | ||
38 | 45 | ||
39 | /** | 46 | /** |
40 | * Get id | 47 | * Get id |
@@ -93,5 +100,35 @@ class municipio | @@ -93,5 +100,35 @@ class municipio | ||
93 | { | 100 | { |
94 | return $this->codigo; | 101 | return $this->codigo; |
95 | } | 102 | } |
103 | + | ||
104 | + /** | ||
105 | + * Set estado | ||
106 | + * | ||
107 | + * @param \UBV\PracticaBundle\Entity\Estado $estado | ||
108 | + * | ||
109 | + * @return municipio | ||
110 | + */ | ||
111 | + public function setEstado(\UBV\PracticaBundle\Entity\Estado $estado=null) | ||
112 | + { | ||
113 | + $this->estado = $estado; | ||
114 | + | ||
115 | + return $this; | ||
116 | + } | ||
117 | + | ||
118 | + /** | ||
119 | + * Get estado | ||
120 | + * | ||
121 | + * @return string\UBV\PracticaBundle\Entity\Estado | ||
122 | + */ | ||
123 | + public function getEStado() | ||
124 | + { | ||
125 | + return $this->estado; | ||
126 | + } | ||
127 | + | ||
128 | + public function __toString(){ | ||
129 | + | ||
130 | + return $this->getDescripcion(); | ||
131 | + } | ||
132 | + | ||
96 | } | 133 | } |
97 | 134 |
src/UBV/PracticaBundle/Entity/persona.php
@@ -0,0 +1,163 @@ | @@ -0,0 +1,163 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace UBV\PracticaBundle\Entity; | ||
4 | + | ||
5 | +use Doctrine\ORM\Mapping as ORM; | ||
6 | +use Symfony\Component\Validator\Constraints as Assert; | ||
7 | + | ||
8 | +/** | ||
9 | + * persona | ||
10 | + * | ||
11 | + * @ORM\Table(name="persona") | ||
12 | + * @ORM\Entity(repositoryClass="UBV\PracticaBundle\Repository\personaRepository") | ||
13 | + */ | ||
14 | +class persona | ||
15 | +{ | ||
16 | + /** | ||
17 | + * @var int | ||
18 | + * | ||
19 | + * @ORM\Column(name="id", type="integer") | ||
20 | + * @ORM\Id | ||
21 | + * @ORM\GeneratedValue(strategy="AUTO") | ||
22 | + */ | ||
23 | + private $id; | ||
24 | + | ||
25 | + /** | ||
26 | + * @var string | ||
27 | + * @Assert\NotNull(message= "Por favor introduzca su Nombre", groups={"Default"}) | ||
28 | + * @Assert\NotBlank( message= "Por favor introduzca Nombre valido Valido", groups={"Default"}) | ||
29 | + * @Assert\Length( | ||
30 | + * min = 2, | ||
31 | + * max = 45, | ||
32 | + * minMessage = "Tu Nombre debe tener como minimo {{ limit }} letras", | ||
33 | + * maxMessage = "Tu Nombre no debe exceder de {{ limit }} letras" | ||
34 | + * ) | ||
35 | + * @Assert\Regex( | ||
36 | + * pattern="/\d/", | ||
37 | + * match=false, | ||
38 | + * message="Tu Nombre no debe contener numeros" | ||
39 | + *) | ||
40 | + * @ORM\Column(name="nombre", type="string", length=255) | ||
41 | + * | ||
42 | + */ | ||
43 | + private $nombre; | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + /** | ||
48 | + * @var string | ||
49 | + * @Assert\NotNull(message= "Por favor introduzca su Apellido", groups={"Default"}) | ||
50 | + * @Assert\NotBlank( message= "Por favor introduzca Apellido valido Valido", groups={"Default"}) | ||
51 | + * @Assert\Length( | ||
52 | + * min = 2, | ||
53 | + * max = 45, | ||
54 | + * minMessage = "Tu Apellido debe tener como minimo {{ limit }} letras", | ||
55 | + * maxMessage = "Tu Apellido no debe exceder de {{ limit }} letras" | ||
56 | + * ) | ||
57 | + * @Assert\Regex( | ||
58 | + * pattern="/\d/", | ||
59 | + * match=false, | ||
60 | + * message="Tu Apellido no debe contener numeros" | ||
61 | + *) | ||
62 | + * @ORM\Column(name="apellido", type="string", length=255) | ||
63 | + */ | ||
64 | + private $apellido; | ||
65 | + | ||
66 | + /** | ||
67 | + * @var string | ||
68 | + * @Assert\NotNull(message= "Por favor introduzca su Cedula", groups={"Default"}) | ||
69 | + * @Assert\NotBlank( message= "Por favor introduzca Cedula valido Valido", groups={"Default"}) | ||
70 | + * @Assert\Length( | ||
71 | + * min = 4, | ||
72 | + * max = 10, | ||
73 | + * minMessage = "Tu Cedula debe tener como minimo {{ limit }} numeros", | ||
74 | + * maxMessage = "Tu Cedula no debe exceder de {{ limit }} numeros" | ||
75 | + * ) | ||
76 | + * @ORM\Column(name="cedula", type="string", length=255, unique=true) | ||
77 | + */ | ||
78 | + private $cedula; | ||
79 | + | ||
80 | + | ||
81 | + /** | ||
82 | + * Get id | ||
83 | + * | ||
84 | + * @return int | ||
85 | + */ | ||
86 | + public function getId() | ||
87 | + { | ||
88 | + return $this->id; | ||
89 | + } | ||
90 | + | ||
91 | + /** | ||
92 | + * Set nombre | ||
93 | + * | ||
94 | + * @param string $nombre | ||
95 | + * | ||
96 | + * @return persona | ||
97 | + */ | ||
98 | + public function setNombre($nombre) | ||
99 | + { | ||
100 | + $this->nombre = $nombre; | ||
101 | + | ||
102 | + return $this; | ||
103 | + } | ||
104 | + | ||
105 | + /** | ||
106 | + * Get nombre | ||
107 | + * | ||
108 | + * @return string | ||
109 | + */ | ||
110 | + public function getNombre() | ||
111 | + { | ||
112 | + return $this->nombre; | ||
113 | + } | ||
114 | + | ||
115 | + /** | ||
116 | + * Set apellido | ||
117 | + * | ||
118 | + * @param string $apellido | ||
119 | + * | ||
120 | + * @return persona | ||
121 | + */ | ||
122 | + public function setApellido($apellido) | ||
123 | + { | ||
124 | + $this->apellido = $apellido; | ||
125 | + | ||
126 | + return $this; | ||
127 | + } | ||
128 | + | ||
129 | + /** | ||
130 | + * Get apellido | ||
131 | + * | ||
132 | + * @return string | ||
133 | + */ | ||
134 | + public function getApellido() | ||
135 | + { | ||
136 | + return $this->apellido; | ||
137 | + } | ||
138 | + | ||
139 | + /** | ||
140 | + * Set cedula | ||
141 | + * | ||
142 | + * @param string $cedula | ||
143 | + * | ||
144 | + * @return persona | ||
145 | + */ | ||
146 | + public function setCedula($cedula) | ||
147 | + { | ||
148 | + $this->cedula = $cedula; | ||
149 | + | ||
150 | + return $this; | ||
151 | + } | ||
152 | + | ||
153 | + /** | ||
154 | + * Get cedula | ||
155 | + * | ||
156 | + * @return string | ||
157 | + */ | ||
158 | + public function getCedula() | ||
159 | + { | ||
160 | + return $this->cedula; | ||
161 | + } | ||
162 | +} | ||
163 | + |
src/UBV/PracticaBundle/Entity/personas.php
@@ -0,0 +1,128 @@ | @@ -0,0 +1,128 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace UBV\PracticaBundle\Entity; | ||
4 | + | ||
5 | +use Doctrine\ORM\Mapping as ORM; | ||
6 | + | ||
7 | +/** | ||
8 | + * personas | ||
9 | + * | ||
10 | + * @ORM\Table(name="personas") | ||
11 | + * @ORM\Entity(repositoryClass="UBV\PracticaBundle\Repository\personasRepository") | ||
12 | + */ | ||
13 | +class personas | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @var int | ||
17 | + * | ||
18 | + * @ORM\Column(name="id", type="integer") | ||
19 | + * @ORM\Id | ||
20 | + * @ORM\GeneratedValue(strategy="AUTO") | ||
21 | + */ | ||
22 | + private $id; | ||
23 | + | ||
24 | + /** | ||
25 | + * @var string | ||
26 | + * | ||
27 | + * @ORM\Column(name="nombre", type="string", length=255) | ||
28 | + */ | ||
29 | + private $nombre; | ||
30 | + | ||
31 | + /** | ||
32 | + * @var string | ||
33 | + * | ||
34 | + * @ORM\Column(name="apellido", type="string", length=255) | ||
35 | + */ | ||
36 | + private $apellido; | ||
37 | + | ||
38 | + /** | ||
39 | + * @var string | ||
40 | + * | ||
41 | + * @ORM\Column(name="cedula", type="string", length=255, unique=true) | ||
42 | + */ | ||
43 | + private $cedula; | ||
44 | + | ||
45 | + | ||
46 | + /** | ||
47 | + * Get id | ||
48 | + * | ||
49 | + * @return int | ||
50 | + */ | ||
51 | + public function getId() | ||
52 | + { | ||
53 | + return $this->id; | ||
54 | + } | ||
55 | + | ||
56 | + /** | ||
57 | + * Set nombre | ||
58 | + * | ||
59 | + * @param string $nombre | ||
60 | + * | ||
61 | + * @return personas | ||
62 | + */ | ||
63 | + public function setNombre($nombre) | ||
64 | + { | ||
65 | + $this->nombre = $nombre; | ||
66 | + | ||
67 | + return $this; | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
71 | + * Get nombre | ||
72 | + * | ||
73 | + * @return string | ||
74 | + */ | ||
75 | + public function getNombre() | ||
76 | + { | ||
77 | + return $this->nombre; | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * Set apellido | ||
82 | + * | ||
83 | + * @param string $apellido | ||
84 | + * | ||
85 | + * @return personas | ||
86 | + */ | ||
87 | + public function setApellido($apellido) | ||
88 | + { | ||
89 | + $this->apellido = $apellido; | ||
90 | + | ||
91 | + return $this; | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * Get apellido | ||
96 | + * | ||
97 | + * @return string | ||
98 | + */ | ||
99 | + public function getApellido() | ||
100 | + { | ||
101 | + return $this->apellido; | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * Set cedula | ||
106 | + * | ||
107 | + * @param string $cedula | ||
108 | + * | ||
109 | + * @return personas | ||
110 | + */ | ||
111 | + public function setCedula($cedula) | ||
112 | + { | ||
113 | + $this->cedula = $cedula; | ||
114 | + | ||
115 | + return $this; | ||
116 | + } | ||
117 | + | ||
118 | + /** | ||
119 | + * Get cedula | ||
120 | + * | ||
121 | + * @return string | ||
122 | + */ | ||
123 | + public function getCedula() | ||
124 | + { | ||
125 | + return $this->cedula; | ||
126 | + } | ||
127 | +} | ||
128 | + |
src/UBV/PracticaBundle/Form/candidatoType.php
@@ -0,0 +1,134 @@ | @@ -0,0 +1,134 @@ | ||
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 Symfony\Component\Validator\Constraints\NotBlank; | ||
9 | +use Symfony\Component\Validator\Constraints\Length; | ||
10 | +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||
11 | +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; | ||
12 | +use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||
13 | + | ||
14 | +class candidatoType extends AbstractType | ||
15 | +{ | ||
16 | + /** | ||
17 | + * {@inheritdoc} | ||
18 | + */ | ||
19 | + public function buildForm(FormBuilderInterface $builder, array $options) | ||
20 | + { | ||
21 | + $builder | ||
22 | + ->add('nombre', null, array( | ||
23 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
24 | + 'label'=>'Nombre', | ||
25 | + 'attr' => array('class' => 'form-control','placeholder'=>'Introduzca su nombre'), | ||
26 | + 'label_attr' => array('class' => 'control-label'), | ||
27 | + )) | ||
28 | + ->add('apellido', null, array( | ||
29 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
30 | + 'label'=>'Apellido', | ||
31 | + 'attr' => array('class' => 'form-control','placeholder'=>'Introduzca su apellido'), | ||
32 | + 'label_attr' => array('class' => 'control-label'), | ||
33 | + )) | ||
34 | + ->add('cedula', null, array( | ||
35 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
36 | + 'label'=>'Cedula', | ||
37 | + 'attr' => array('class' => 'form-control','placeholder'=>'Ejemplo:18031258'), | ||
38 | + 'label_attr' => array('class' => 'control-label'), | ||
39 | + )) | ||
40 | + ->add('edad', null, array( | ||
41 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
42 | + 'label'=>'Edad', | ||
43 | + 'attr' => array('class' => 'form-control','placeholder'=>'Ejemplo:18'), | ||
44 | + 'label_attr' => array('class' => 'control-label'), | ||
45 | + )) | ||
46 | + ->add('sexo', 'choice', array( | ||
47 | + 'choices' => array( | ||
48 | + '0' => 'Masculino', | ||
49 | + '1' => 'Femenino' | ||
50 | + ), | ||
51 | + 'empty_value' => 'Ingrese su genero', | ||
52 | + 'empty_data' => null | ||
53 | + )) | ||
54 | + ->add('estadoCivil', EntityType::class, array( | ||
55 | + 'disabled'=>false, | ||
56 | + 'class' => 'UBVPracticaBundle:EstadoCivil', | ||
57 | + 'label' =>"Estado Civil", | ||
58 | + 'empty_data' => "0", | ||
59 | + 'placeholder'=>"Seleccione...", | ||
60 | + 'attr' => array('class' => 'form-control form-control-choice','placeholder'=>''), | ||
61 | + 'label_attr' => array('class' => 'control-label'), | ||
62 | + )) | ||
63 | + ->add('pais', null, array( | ||
64 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
65 | + 'label'=>'Pais', | ||
66 | + 'attr' => array('class' => 'form-control','placeholder'=>'Ejemplo:Venezuela'), | ||
67 | + 'label_attr' => array('class' => 'control-label'), | ||
68 | + )) | ||
69 | + ->add('primaria', null, array( | ||
70 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
71 | + 'label'=>'Escuela', | ||
72 | + 'attr' => array('class' => 'form-control','placeholder'=>'Nombre de la escuela'), | ||
73 | + 'label_attr' => array('class' => 'control-label'), | ||
74 | + )) | ||
75 | + ->add('secundaria', null, array( | ||
76 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
77 | + 'label'=>'Liceo', | ||
78 | + 'attr' => array('class' => 'form-control','placeholder'=>'Nombre del liceo'), | ||
79 | + 'label_attr' => array('class' => 'control-label'), | ||
80 | + )) | ||
81 | + ->add('terciaria', null, array( | ||
82 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
83 | + 'label'=>'Universidad', | ||
84 | + 'attr' => array('class' => 'form-control','placeholder'=>'Nombre de la universidad'), | ||
85 | + 'label_attr' => array('class' => 'control-label'), | ||
86 | + )) | ||
87 | + | ||
88 | + ->add('aldea', null, array( | ||
89 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
90 | + 'label'=>'Aldea', | ||
91 | + 'attr' => array('class' => 'form-control','placeholder'=>'Nombre de la aldea'), | ||
92 | + 'label_attr' => array('class' => 'control-label'), | ||
93 | + )) | ||
94 | + | ||
95 | + ->add('estado', null, array( | ||
96 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
97 | + 'label'=>'Estado', | ||
98 | + 'attr' => array('class' => 'form-control','placeholder'=>'Ejemplo:Distrito Capital'), | ||
99 | + 'label_attr' => array('class' => 'control-label'), | ||
100 | + )) | ||
101 | + ->add('municipio', null, array( | ||
102 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
103 | + 'label'=>'Municipio', | ||
104 | + 'attr' => array('class' => 'form-control','placeholder'=>'Ejemplo:Libertador'), | ||
105 | + 'label_attr' => array('class' => 'control-label'), | ||
106 | + )) | ||
107 | + ->add('parroquia', null, array( | ||
108 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
109 | + 'label'=>'Parroquia', | ||
110 | + 'attr' => array('class' => 'form-control','placeholder'=>'Ejemplo:San José'), | ||
111 | + 'label_attr' => array('class' => 'control-label'), | ||
112 | + )); | ||
113 | + }/** | ||
114 | + * {@inheritdoc} | ||
115 | + */ | ||
116 | + | ||
117 | + public function configureOptions(OptionsResolver $resolver) | ||
118 | + { | ||
119 | + $resolver->setDefaults(array( | ||
120 | + 'data_class' => 'UBV\PracticaBundle\Entity\candidato' | ||
121 | + )); | ||
122 | + } | ||
123 | + | ||
124 | + | ||
125 | + /** | ||
126 | + * {@inheritdoc} | ||
127 | + */ | ||
128 | + public function getBlockPrefix() | ||
129 | + { | ||
130 | + return 'ubv_practicabundle_candidato'; | ||
131 | + } | ||
132 | + | ||
133 | + | ||
134 | +} |
src/UBV/PracticaBundle/Form/estadoType.php
@@ -0,0 +1,37 @@ | @@ -0,0 +1,37 @@ | ||
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 estadoType extends AbstractType | ||
10 | +{ | ||
11 | + /** | ||
12 | + * {@inheritdoc} | ||
13 | + */ | ||
14 | + public function buildForm(FormBuilderInterface $builder, array $options) | ||
15 | + { | ||
16 | + $builder->add('descripcion')->add('codigo'); | ||
17 | + | ||
18 | + }/** | ||
19 | + * {@inheritdoc} | ||
20 | + */ | ||
21 | + public function configureOptions(OptionsResolver $resolver) | ||
22 | + { | ||
23 | + $resolver->setDefaults(array( | ||
24 | + 'data_class' => 'UBV\PracticaBundle\Entity\estado' | ||
25 | + )); | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * {@inheritdoc} | ||
30 | + */ | ||
31 | + public function getBlockPrefix() | ||
32 | + { | ||
33 | + return 'ubv_practicabundle_estado'; | ||
34 | + } | ||
35 | + | ||
36 | + | ||
37 | +} |
src/UBV/PracticaBundle/Form/estadomunicipioType.php
@@ -0,0 +1,47 @@ | @@ -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 | + | ||
9 | +class estadomunicipioType extends AbstractType | ||
10 | +{ | ||
11 | + /** | ||
12 | + * {@inheritdoc} | ||
13 | + */ | ||
14 | + public function buildForm(FormBuilderInterface $builder, array $options) | ||
15 | + { | ||
16 | + $builder | ||
17 | + ->add('estado') | ||
18 | + ->add('municipio', 'collection', array( | ||
19 | + 'type' => new MunicipioType(), | ||
20 | + 'label' => 'Descripcion', | ||
21 | + 'by_reference' => false, | ||
22 | + 'prototype_data' => new Municipio(), | ||
23 | + 'allow_delete' => true, | ||
24 | + 'allow_add' => true, | ||
25 | + 'attr' => array( | ||
26 | + 'class' => 'row municipio' | ||
27 | + ) | ||
28 | + )) | ||
29 | + ; | ||
30 | + } | ||
31 | + /** | ||
32 | + * {@inheritdoc} | ||
33 | + */ | ||
34 | + public function setDefaultOptions(OptionsResolverInterface $resolver) | ||
35 | + { | ||
36 | + $resolver->setDefaults(array( | ||
37 | + 'data_class' => 'UBV\PracticaBundle\Entity\estado', | ||
38 | + )); | ||
39 | + } | ||
40 | + /** | ||
41 | + * {@inheritdoc} | ||
42 | + */ | ||
43 | + public function getBlockPrefix() | ||
44 | + { | ||
45 | + return 'ubv_practicabundle_municipio'; | ||
46 | + } | ||
47 | +} | ||
0 | \ No newline at end of file | 48 | \ No newline at end of file |
src/UBV/PracticaBundle/Form/municipioType.php
@@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
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 | + | ||
10 | +class municipioType extends AbstractType | ||
11 | +{ | ||
12 | + /** | ||
13 | + * {@inheritdoc} | ||
14 | + */ | ||
15 | + public function buildForm(FormBuilderInterface $builder, array $options) | ||
16 | + { | ||
17 | + $builder | ||
18 | + ->add('descripcion') | ||
19 | + ->add('codigo') | ||
20 | + ->add('estado'); | ||
21 | + }/** | ||
22 | + * {@inheritdoc} | ||
23 | + */ | ||
24 | + public function configureOptions(OptionsResolver $resolver) | ||
25 | + { | ||
26 | + $resolver->setDefaults(array( | ||
27 | + 'data_class' => 'UBV\PracticaBundle\Entity\municipio' | ||
28 | + )); | ||
29 | + } | ||
30 | + | ||
31 | + /** | ||
32 | + * {@inheritdoc} | ||
33 | + */ | ||
34 | + public function getBlockPrefix() | ||
35 | + { | ||
36 | + return 'ubv_practicabundle_municipio'; | ||
37 | + } | ||
38 | +} | ||
0 | \ No newline at end of file | 39 | \ No newline at end of file |
src/UBV/PracticaBundle/Form/personaType.php
@@ -0,0 +1,56 @@ | @@ -0,0 +1,56 @@ | ||
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 Symfony\Component\Validator\Constraints\NotBlank; | ||
9 | +use Symfony\Component\Validator\Constraints\Length; | ||
10 | + | ||
11 | +class personaType extends AbstractType | ||
12 | +{ | ||
13 | + /** | ||
14 | + * {@inheritdoc} | ||
15 | + */ | ||
16 | + public function buildForm(FormBuilderInterface $builder, array $options) | ||
17 | + { | ||
18 | + $builder | ||
19 | + ->add('nombre', null, array( | ||
20 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
21 | + 'label'=>'Nombre', | ||
22 | + 'attr' => array('class' => 'form-control','placeholder'=>'Introduzca su nombre'), | ||
23 | + 'label_attr' => array('class' => 'control-label'), | ||
24 | + )) | ||
25 | + ->add('apellido', null, array( | ||
26 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
27 | + 'label'=>'Apellido', | ||
28 | + 'attr' => array('class' => 'form-control','placeholder'=>'Introduzca su apellido'), | ||
29 | + 'label_attr' => array('class' => 'control-label'), | ||
30 | + )) | ||
31 | + ->add('cedula', null, array( | ||
32 | + 'constraints' => new NotBlank(array('groups' => array('Default'))), | ||
33 | + 'label'=>'Cedula', | ||
34 | + 'attr' => array('class' => 'form-control','placeholder'=>'Ejemplo:18031258'), | ||
35 | + 'label_attr' => array('class' => 'control-label'), | ||
36 | + )); | ||
37 | + }/** | ||
38 | + * {@inheritdoc} | ||
39 | + */ | ||
40 | + public function configureOptions(OptionsResolver $resolver) | ||
41 | + { | ||
42 | + $resolver->setDefaults(array( | ||
43 | + 'data_class' => 'UBV\PracticaBundle\Entity\persona' | ||
44 | + )); | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * {@inheritdoc} | ||
49 | + */ | ||
50 | + public function getBlockPrefix() | ||
51 | + { | ||
52 | + return 'ubv_practicabundle_persona'; | ||
53 | + } | ||
54 | + | ||
55 | + | ||
56 | +} |
src/UBV/PracticaBundle/Repository/candidatoRepository.php
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace UBV\PracticaBundle\Repository; | ||
4 | + | ||
5 | +/** | ||
6 | + * candidatoRepository | ||
7 | + * | ||
8 | + * This class was generated by the Doctrine ORM. Add your own custom | ||
9 | + * repository methods below. | ||
10 | + */ | ||
11 | +class candidatoRepository extends \Doctrine\ORM\EntityRepository | ||
12 | +{ | ||
13 | +} |
src/UBV/PracticaBundle/Repository/personaRepository.php
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace UBV\PracticaBundle\Repository; | ||
4 | + | ||
5 | +/** | ||
6 | + * personaRepository | ||
7 | + * | ||
8 | + * This class was generated by the Doctrine ORM. Add your own custom | ||
9 | + * repository methods below. | ||
10 | + */ | ||
11 | +class personaRepository extends \Doctrine\ORM\EntityRepository | ||
12 | +{ | ||
13 | +} |
src/UBV/PracticaBundle/Repository/personasRepository.php
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace UBV\PracticaBundle\Repository; | ||
4 | + | ||
5 | +/** | ||
6 | + * personasRepository | ||
7 | + * | ||
8 | + * This class was generated by the Doctrine ORM. Add your own custom | ||
9 | + * repository methods below. | ||
10 | + */ | ||
11 | +class personasRepository extends \Doctrine\ORM\EntityRepository | ||
12 | +{ | ||
13 | +} |
src/UBV/PracticaBundle/Tests/Controller/candidatoControllerTest.php
@@ -0,0 +1,55 @@ | @@ -0,0 +1,55 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace UBV\PracticaBundle\Tests\Controller; | ||
4 | + | ||
5 | +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
6 | + | ||
7 | +class candidatoControllerTest 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', '/candidato/'); | ||
17 | + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /candidato/"); | ||
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_candidato[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_candidato[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/estadoControllerTest.php
@@ -0,0 +1,55 @@ | @@ -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 @@ | @@ -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/personaControllerTest.php
@@ -0,0 +1,55 @@ | @@ -0,0 +1,55 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +namespace UBV\PracticaBundle\Tests\Controller; | ||
4 | + | ||
5 | +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
6 | + | ||
7 | +class personaControllerTest 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', '/persona/'); | ||
17 | + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /persona/"); | ||
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_persona[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_persona[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 | +} |