Sunday, March 27, 2011

postCondition?

Hi,

I'm new to cakePHP and OOP.

The code below is from http://book.cakephp.org/view/875/x1-3-Collection#!/view/977/Controller-Methods.
Can someone please explain the postConditons below? I don't understand
how can num_items key contain '>=' and referrer key contain 'LIKE'.
What does the word compact in find('all', compact('condtions')) mean?
Thank you.

/*
Contents of $this->data
array(
'Order' => array(
'num_items' => '4',
'referrer' => 'Ye Olde'
)
)
*/

//Let's get orders that have at least 4 items and contain 'Ye Olde'
$condtions=$this->postConditions(
$this->data,
array(
'num_items' => '>=',
'referrer' => 'LIKE'
)
);
$orders = $this->Order->find("all",compact('condtions'));

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: