Custom find Methods in Behavior
Hey,
I heard of this cool method of writing custom find methods in
tehtreags's bakery post
(http://bakery.cakephp.org/articles/view/model-repletion) and now tried
to use it in a Behavior, but failed.
Im using cake 1.3.0
The Code:
http://pastebin.com/92753BmZ
The Problem:
- I have an article Model which acts as Featurable
- In the Featurable behavior setup method I set the models
_findMethods['featured'] as true. and define a function
_findFeatured($state, $query, $results=array())
- When I do an Article->find('featured'), it seems to look for the right
find function, but cannot find it, which results in a SQL error, because
the query is "_findFeatured"
- When I define the _findFeatured(...) method in the actual Article
Model, it works
I think it has something to do with the _findFeatured function being
protected. Am I right? Is there any way to add custom find methods in a
behavior?
Thanks
Max
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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 For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home