Hello,
I use CakePhp 2.0.5.
In my project I have the following relations:
Content (belongTo) > Type
Content (belongTo) > Lang
Content (HABTM) > Tag
Type (hasMany) > Content
Lang (hasMany) > Content
Tag (HABTM) > Content
For a listing of records for a blog I have the following code:
$posts = $this->Content->find('all', array(
'order' => 'Content.created DESC',
'fields' => array('Content.id', 'Content.active',
'Content.slug', ...),
'conditions' => array('Type.name' => 'Posts',
'Content.active' => 1, 'Lang.alias' =>
Configure::read('Config.language')),
'contain' => array(
'Lang' => array('fields' => array('Lang.alias')),
'Type' => array('fields' => array('Type.name')),
'Tag' => array('fields' => array('Tag.name',
'Tag.slug'))
)
));
So I get all records such as "Post" and with the current language. But
now I need also filter records by "tag". I tried getting the data from
the model Tag. But that way I can not filter the records by type and
by language.
I do not know how to do this. I need help.
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php