$this->set('posts', $this->Post->find('all', array(
'conditions' => array(
'Post.deleted !=' => 1,
'Post.postcategory_id' => 1,
'Post.postgroup_id' => 1),
'order' => array('replied DESC')
)));
However, your reply was also basically "right" in that my code is "wrong" :-D
In my afterFind I did not have the if ( isset(... line because I didn't think it was necessary. Yes, it is necessary, after I added that the afterFind started working perfectly :-)
On Sunday, September 23, 2012 11:15:20 AM UTC-4, d6games wrote:
The 2.0 book documentation for "afterFind" is either wrong or it's missing information. The example code...--public function afterFind($results, $primary = false) { foreach ($results as $key => $val) { if (isset($val['Event']['begindate' ])) { $results[$key]['Event']['begindate' ] = $this->dateFormatAfterFind($val ['Event']['begindate']); } } return $results; }
...does not work and generates and error.
I added this code to my model and changed the 'Event' index to my model name 'Post' and when you run you get a repeated "index 'Post' not found".
What requirement is missing from the documentation?
Thanks a lot for your help :-)
Mark
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
No comments:
Post a Comment