Just a simple tip…
Here’s a typical find() example:
[cc lang=”php”]$this->Post->find(‘first’, array(‘condition’ => array(‘id’ => 5)));[/cc]
Just a quick example on how you can use deep, complex find conditions with OR, AND and NOT arrays in one shot…
We need to get a list of all companies, where:Company.name is either ‘Future Holdings’ OR ‘Steel…
Update 01/07/2010: Good news everyone, for those switching over to cake 1.3, there is a great new feature:http://book.cakephp.org/view/1608/Virtual-fields — — — — — — —
Sometimes you see code that tries to do something like this:
[cc lang=”php”]$this->Company->find(‘all’, array(‘conditions’ =>array(‘Profile.name’=>’test’), ‘fields’=>array(‘Profile.id…
What exactly is the differednce between $this->User->read() and $this->User->find()?
Seemingly, they both retrieve the data (and possibly associated data) for the User model. Yet, there is a an important distinction: read() will also set the data for your model object…
Let’s say you need to know when was the very first user record created.Add a method like this to your User model (assuming you have a ‘created’ field):