how to put sql query in symfony templates?
i want to show client name instead client in this template i show on the
basis of proposals.clientid=clients.clientid,give me the idea of using sql
in symfony templates and how i do this in this template? here is my
template code:
{% extends '::base.html.twig' %}
{% block body -%}
<div id="pad-wrapper" class="datatables-page">
<table cellpadding="0" cellspacing="0" border="0" class="table"
id="example">
<thead>
<tr role="row">
<th tabindex="0" rowspan="1" colspan="1">Id
</th>
<th tabindex="0" rowspan="1"
colspan="1">Proposalname
</th>
<th tabindex="0" rowspan="1"
colspan="1">Description
</th>
<th tabindex="0" rowspan="1"
colspan="1">Templateid
</th>
<th tabindex="0" rowspan="1" colspan="1">Clientid
</th>
<th tabindex="0" rowspan="1" colspan="1">Status
</th>
<th tabindex="0" rowspan="1"
colspan="1">Createdby
</th>
<th tabindex="0" rowspan="1"
colspan="1">Updatedby
</th>
<th tabindex="0" rowspan="1"
colspan="1">Createddatetime
</th>
<th tabindex="0" rowspan="1"
colspan="1">Updateddatetime
</th>
<th tabindex="0" rowspan="1" colspan="1">Actions
</th>
</tr>
</thead>
<tbody>
{% for entity in entities %}
<tr>
<td><a href="{{ path('proposals_show', { 'id': entity.id
}) }}">{{ entity.id }}</a></td>
<td>{{ entity.proposalName }}</td>
<td>{{ entity.description }}</td>
<td>{{ entity.templateID }}</td>
<td>{{ entity.clientID }}</td>
<td>{% if entity.status =='pending' %}
<span class="label label-info">Pending</span>
{% else %}
<span class="label label-success">Completed</span>
{% endif %}
</td>
<td>{{ entity.createdBy }}</td>
<td>{{ entity.updatedBy }}</td>
<td>{% if entity.createdDatetime %}{{
entity.createdDatetime|date('Y-m-d H:i:s') }}{% endif
%}</td>
<td>{% if entity.updatedDatetime %}{{
entity.updatedDatetime|date('Y-m-d H:i:s') }}{% endif
%}</td>
<td>
<ul>
<li>
<a href="{{ path('proposals_show', { 'id':
entity.id }) }}">show</a>
</li>
<li>
<a href="{{ path('proposals_edit', { 'id':
entity.id }) }}">edit</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<a class="btn btn-success" href="{{ path('proposals_new') }}">Add
Proposals</a>
{% endblock %}
{% block javascripts %}
<script src="{{ asset('js/jquery-1.10.2.js') }}"
type="text/javascript"></script>
<script src="{{ asset('js/jquery.dataTables.js') }}"
type="text/javascript"> </script>
<script src="{{ asset('js/theme.js') }}" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').dataTable({
"sPaginationType": "full_numbers"
});
});
</script>
{% endblock %}
No comments:
Post a Comment