Nope, there is no "extbase magic" doing this job for you. You have to implement it yourself. But lucky you, its not that hard. Just add a method to your repository like this one:
public function findByUserAndCoupon($validcoupon, $validuser) {
$query = $this->createQuery();
$query->matching(
$query->logicalAnd(
$query->equals('user', $validuser),
$query->equals('coupon', validcoupon)
)
);
$result = $query->execute();
return $result;
}
Now you can call this like you tried before. The strings 'user'
and 'coupon'
in the logicalAnd Statement have to be the fieldnames of the database.