Hi again,
how can i get the values from multiple mysql tables?
From UsersController.php
public function searchAction(){
$numberPage = 1;
if ($this->request->isPost()) {
$query = Criteria::fromInput($this->di, 'Vokuro\Models\Users', $this->request->getPost());
$this->persistent->searchParams = $query->getParams();
} else {
$numberPage = $this->request->getQuery("page", "int");
}
$parameters = array();
if ($this->persistent->searchParams) {
$parameters = $this->persistent->searchParams;
}
$users = Users::find($parameters);
if (count($users) == 0) {
$this->flash->notice("The search did not find any users");
return $this->dispatcher->forward(array(
"action" => "index"
));
}
$paginator = new Paginator(array(
"data" => $users,
"limit" => 10,
"page" => $numberPage
));
$this->view->page = $paginator->getPaginate();
}
To views/users/search.volt
{{ content() }}
<ul class="pager">
<li class="previous pull-left">
{{ link_to("users/index", "← Go Back") }}
</li>
<li class="pull-right">
{{ link_to("users/create", "Create users", "class": "btn btn-primary") }}
</li>
</ul>
{% for user in page.items %}
{% if loop.first %}
<table class="table table-bordered table-striped" align="center">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Email</th>
<th>Profile</th>
<th>Banned?</th>
<th>Suspended?</th>
<th>Confirmed?</th>
</tr>
</thead>
{% endif %}
<tbody>
<tr>
<td>{{ user.id }}</td>
<td>{{ user.name }}</td>
<td>{{ user.email }}</td>
<td>{{ user.profile.name }}</td>
<td>{{ user.banned == 'Y' ? 'Yes' : 'No' }}</td>
<td>{{ user.suspended == 'Y' ? 'Yes' : 'No' }}</td>
<td>{{ user.active == 'Y' ? 'Yes' : 'No' }}</td>
<td width="12%">{{ link_to("users/edit/" ~ user.id, '<i class="icon-pencil"></i> Edit', "class": "btn") }}</td>
<td width="12%">{{ link_to("users/delete/" ~ user.id, '<i class="icon-remove"></i> Delete', "class": "btn") }}</td>
</tr>
</tbody>
{% if loop.last %}
<tbody>
<tr>
<td colspan="10" align="right">
<div class="btn-group">
{{ link_to("users/search", '<i class="icon-fast-backward"></i> First', "class": "btn") }}
{{ link_to("users/search?page=" ~ page.before, '<i class="icon-step-backward"></i> Previous', "class": "btn ") }}
{{ link_to("users/search?page=" ~ page.next, '<i class="icon-step-forward"></i> Next', "class": "btn") }}
{{ link_to("users/search?page=" ~ page.last, '<i class="icon-fast-forward"></i> Last', "class": "btn") }}
<span class="help-inline">{{ page.current }}/{{ page.total_pages }}</span>
</div>
</td>
</tr>
<tbody>
</table>
{% endif %}
{% else %}
No users are recorded
{% endfor %}
For example i want the values of the tables
{{ products.id }}
{{ address.name }}
{{ company.name }}
Thx for your help