Hi everybody,

I am trying to program a search with contain since nearly a week now and
I still don't get it right.

What I want to do:

Hotel belongsto Hotelmaster (Hotel is a kind of blueprint of
Hotelmaster)
I search for Hotel and want only to find datasets where the related
Hotelmaster fulfills certain conditions. 
To make it worse the result should be paginated.

What I have now in my hotels_controller.php is:

$this->paginate['Hotel'] = array(
                        'limit' => 10,
                        'order' => array ('Hotel.name' => 'asc',
'Saison.id' => 'desc'),
                        'url' => $paginator_params,
                        'condition' => $paramhotel,
                'contain'=> array(
                    'Hotelmaster'=> array(      'conditions'=>
$parammaster,
        
'Praefix'=>array('fields'=>array('Praefix.name'))),
                    'Town'=> array('fields'=>
array('Town.name','Town.id')),
                    'Praefix', //and some more models of no interest
                    'User'=> array('fields'=> 'User.name'))
                );
                
$parammaster is an array depending on my search criteria and can look
like (simple example):
Array
(
    [Hotelmaster.deleted =] => 0
    [Hotelmaster.name LIKE] => "%Novo%"
)

I am not sure if the syntax of my conditions is correct. In some
examples I find on the net the syntax of the conditions within the
contain statement differ from the "normal" conditions. And to make
things worse the whole thing is in a "paginate" and not a "find".

At the moment any search critera have no effect on my search. When I
change the search criteria to something like this
(
    Hotelmaster.deleted = 0
    Hotelmaster.name LIKE "%Novo%"
)

I get 5 search results when having only 2 datasets in my database. Very
weird.

What would be the correct syntax for my $parammaster searchconditions?

Thank you for any help

Anja

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to