Closed
Description
With this PHP code:
$qb = $this->invoiceRepository->createQueryBuilder('i')
->select('i, c, ba')
->innerJoin('i.customer', 'c', Expr\Join::WITH, 'c.automaticPaymentMethod = :automatic_payment_method')
->innerJoin('c.bankAccount', 'ba', Expr\Join::WITH, 'ba.activated = :activated AND ba.mandateSigned = :mandateSigned AND ba.mandateSignedDate IS NOT NULL')
foreach ($invoices as $invoice) {
$customer = $invoice->getCustomer();
$bankAccount = $customer->getBankAccount();
$bankAccount->setFirstDebit(true);
$this->persist($bankAccount);
}
;
I'll have this error:
Parameter #1 $object of method Doctrine\Common\Persistence\ObjectManagerDecorator::persist() expects object, AppBundle\Entity\BankAccount|null given.
But this is not true
as innerJoin
will drop customers without a bank account. Am I right?
If I'm right, checking if $bankAccount
in this case is overkill and will never match.
Metadata
Metadata
Assignees
Labels
No labels