Closed
Description
The following code
$result = $this->getEntityManager()
->getRepository(ProductCrossSell::class)
->createQueryBuilder('pcs')
->where('pcs.id IN (:ids)')
->setParameter('ids', $ids)
->delete()
->getQuery()
->getResult();
\PHPStan\dumpType($result);
Is considering $result
as an array. But it's an int: the number of deleted elements. Same with update()
It was introduce by #232 cc @arnaud-lb
Metadata
Metadata
Assignees
Labels
No labels
Activity
arnaud-lb commentedon Jan 24, 2022
Hi @VincentLanglet
I believe that there are two distinct issues here. The first one is that
may be
Query<mixed>
. Could you confirm ?If that's the case, the second issue is that the type of
Query<mixed>::getResult()
should not bearray
because the query may be an INSERT or DELETE query.VincentLanglet commentedon Jan 24, 2022
Indeed
Dumped type: Doctrine\ORM\Query<mixed>
arnaud-lb commentedon Jan 24, 2022
Thank you.
I'm fixing the second issue in #260.
I'm not sure about the cause of the first issue. What is the type of
->getRepository(ProductCrossSell::class)
? Could you confirm that the query is valid ?VincentLanglet commentedon Jan 24, 2022
Yes, it's just a DELETE with a WHERE condition on ids.
github-actions commentedon Feb 25, 2022
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.