Marcus
Well-known member
I have two questions here:
1. If there exist multiple result items, can I use just fetchOne() and does it always include limit(1)?
2. Can I write the query as below, or would it need a one-to-many relationship and should be written as where(Sugar|brown)?
1. If there exist multiple result items, can I use just fetchOne() and does it always include limit(1)?
2. Can I write the query as below, or would it need a one-to-many relationship and should be written as where(Sugar|brown)?
PHP:
/** @var \XF\Mvc\Entity\Finder $mojito*/
$mojitos= \XF::app()->finder('XF:Lemon')
->with('Sugar',true)
->where([
'Sugar.type' => "brown",
'cold' => 'yes',
'rum' => 'yes'
])
->fetchOne();
Last edited: