[TYPO3-mvc] Left join query
Franz Koch
typo3.RemoveForMessage at elements-net.de
Mon Jun 28 13:18:23 CEST 2010
Hi,
first, why is your model not named in singular if it reflects only one
keyword, not multiple? In my eyes Tx_BwShop_Domain_Model_Keyword would
be more appropriate.
> What should I change in my findByKeywords function?
>
> public function findByKeywords(Tx_BwShop_Domain_Model_Keywords
> $keyword, $limit=9999, $offset=0) {
> $query = $this->createQuery();
> return $query->matching(
> $query->contains('keywords', $keyword)
> )
> ->setLimit((integer) $limit)
> ->setOffset((integer) $offset)
> ->execute();
> }
I don't think you have to change much, besides of passing the array with
keywords to that function instead of only one. So try this:
public function findByKeywords(array $keywords, $limit=9999, $offset=0) {
$query = $this->createQuery();
return $query->matching(
$query->contains('keywords', $keywords)
)
->setLimit((integer) $limit)
->setOffset((integer) $offset)
->execute();
}
If that doesn't work, try $query->equals('keywords', $keywords) or
$query->in('keywords.uid',$keywords);
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list