I have my request in my composer to select elements in a table group(category). When i display the result on a view with one foreach method, i just have une element in the list. I want to know if i use a second foreach to list éléments with thé same request and how or i write two request. Please help me
It’s not at all clear what you’re asking. Please include some code that shows what you’ve tried, and describe the output you’re seeing and how it’s different from what you want.
ok, this my code in controller:
$denonciation = $this->paginate($this->Denonciation->find('all',array( 'order' => array('Denonciation_DateTransfer DESC'))) ->where(['Denonciation_Verification' => 'en cours', 'idVerification IN' == 'Verification_idVerification']) ->group('idVerification') ->contain(['Verification', 'Zone'])); $this->set(compact('denonciation'));
And in my view:
<?php foreach ($denonciation as $denonciation): ?>
<?php endforeach; ?>
I want to display for each reference his list of denonciations. but now when i display it i also have one denonciation for each reference. i want to know how i can display all denonciations for each reference.
This code is retrieving a paginated list of Denonciations, and for each one the Verification and Zone. It sounds like you want a list of References, and for each one all of the Denonciations? (As a very simple analogy, you have a list of students and their birthdays, but you want a list of birthdays and the students born on those days.) If that’s correct, then it’s the original query that’s wrong, it needs to be “flipped”. If the code was baked, you’d be looking for what is generated for the References controller instead of the Denonciations controller.