In this case, you can add filter in models when you create relation with models.
If you don't know how to use the query result in view, you can use print_r function to print the results, then you can know how to use it.
Also , you can reference this page
http://book.cakephp.org/view/78/Associations-Linking-Models-Together
If you don't know how to use the query result in view, you can use print_r function to print the results, then you can know how to use it.
Also , you can reference this page
http://book.cakephp.org/view/78/Associations-Linking-Models-Together
On Sun, Sep 28, 2008 at 4:30 PM, Mickael Gentil <mickael.gentil@gmail.com> wrote:
Ok, but the conditions are for the select and not for filtering datas wich is the result from this select, no ?
And on my view what name for my select i can use ?
Because $this->ProgramBroadcaster->Program->ProgramFile->ProgramState is a very deeper relationship.
Thanks.
Yudao.On Sun, Sep 28, 2008 at 4:19 AM, glenda guo <gettyying@gmail.com> wrote:
$this->set('programStateList', $this->ProgramBroadcaster->You can add condition in it.Program->ProgramFile->ProgramState->find('list'));
On Sat, Sep 27, 2008 at 10:43 PM, Mickael Gentil <mickael.gentil@gmail.com> wrote:Hi all,
I need some help with a problem.
This is my controller :
<?php
class ProgramBroadcastersController extends AppController {
var $name = 'ProgramBroadcasters';
var $components = array('Filter');
var $paginate = array(
'limit'=>20,
'page'=>1,
'order'=>'ProgramBroadcaster.created DESC',
'fields'=>array('id','broadcaster_id','program_id','play_date','delivery_date','case_number','video_tape_number'),
'contain'=>array(
'Broadcaster'=>array('fields'=>array('id','name')),
'Program'=>array(
'ProgramFile'=>array(
'fields'=>array('id','program_id','program_state_id'),
'ProgramState',
'User'=>array('fields'=>array('lastname','firstname'))
)
)
)
);
public function index()
{
$this->set('broadcasterList', $this->ProgramBroadcaster->Broadcaster->find('list'));
$this->set('programStateList', $this->ProgramBroadcaster->Program->ProgramFile->ProgramState->find('list'));
$filter = $this->Filter->process($this);
$this->set('url',$this->Filter->url);
$this->set('programs', $this->paginate(null, $filter));
}
}
I need to filter datas on ProgramState.id, and i don't know how.
Thanks a lot.
Yudao.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment