I’ve got two tables (items / tags). Item has and belongs to many tags – tag has and belongs to many items.
It’s no problem for me to fetch all related tags like:
$item = ORM::factory('item', 4);
foreach($item->tags as $tag){....}
But how can i fetch only one… and maybe a specific one?
Thanks in advance!
In Kohana 3 you can do this:
Inside
where()you put the condition you want.Edit:
I did a little research and in Kohana 2.3.x the
wheresyntax is different, instead ofwhere('somevalue', '=', $value)you should writewhere('somevalue', $value). Orwhere('somevalue >', $value),where('somevalue !=', $value), etc.