Wednesday, February 22, 2012

How to work with find syntax

Hi,

I have a find statement which look like this:

$results = $this->GObject->find('all', array(
'conditions' => array(
'anotherfield = 1'
),
'fields' => array('....'),
'order' => 'myfield ASC',
'limit' => 2
));

As I am calling this function also at a second place I want to have
the
'order' => 'myfield ASC',
'limit' => 2
only if I pass a variable to the function call.

But I don't know, how the syntax of the find should look then?

Please advice, thanks!!

--
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: