Unfortunately I'm working on a software who's based on an old versione
of Cake (1.2.0.5875 pre-beta), and I couldn't find any "Containable"
in it, so I suppose is a later addiction.
I had to find a workaround/hack to add Tag search and here it is:
$this->paginate('Article', array(
'Article.name LIKE \'%foo%\' or Article.id IN (
select articles_tags.article_id
from tags
left join articles_tags on articles_tags.tag_id = tags.id
where tags.name LIKE \'%foo%\'
)
));
Strict to the framework rules? Not so much
Does it work? Like a charm but requires MySQL 5+ to support subqueries
like ... IN (subquery) ...
Cheers
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment