我有一个类似的查询:
$qb->select('m.id', 'b.id as bId');
$qb->leftJoin('AppBundle\Entity\Bet', 'b', \Doctrine\ORM\Query\Expr\Join::WITH, 'm.id = b.match');
//$qb->where('b.user = :user');
//$qb->setParameters(array('user' => $user->getId()));
return $qb->getQuery()->getResult();
通过此查询,我可以在m
BET
已加入实体bId
的所有行(如果存在(否则我为空)) >
在我的实体BET中,我有一个现场用户。
如何检索betId
的行为空,如果betId
不为空,请检查是否b.user = :user
?
答案 0 :(得分:1)
尝试此查询,这应该可以解决问题:
$ awk '{printf "user \"%s\" there with pass \"pass\" is user \"%s\" here\n", $0, $0}' file
user "user1@domain.com" there with pass "pass" is user "user1@domain.com" here
user "user2@domain.com" there with pass "pass" is user "user2@domain.com" here
user "user3@domain.com" there with pass "pass" is user "user3@domain.com" here
我删除了" WITH"参数,理论上如果你正确定义了映射就不需要它们。如果您愿意或需要,请随意将它们放回去。