Find the best Rector rule to solve your problem. Searching through 1007 rules.
Found 4 rules:
Change the argument type for setParameters from array to ArrayCollection and Parameter calls
-$entityManager->createQueryBuilder()->setParameters([
- 'foo' => 'bar'
-]);
+$entityManager->createQueryBuilder()->setParameters(new \Doctrine\Common\Collections\ArrayCollection([
+ new \Doctrine\ORM\Query\Parameter('foo', 'bar')
+]));
Casts Doctrine Expr\x to string where necessary.
$statements->add(
$builder->expr()->like(
- $builder->expr()->lower($column),
- $builder->expr()->lower($builder->expr()->literal('%'.$like.'%'))
+ (string) $builder->expr()->lower($column),
+ (string) $builder->expr()->lower($builder->expr()->literal('%'.$like.'%'))
)
);
Replace Doctrine\ORM\Event\LifecycleEventArgs with specific event classes based on the function call
-use Doctrine\ORM\Event\LifecycleEventArgs;
+use Doctrine\ORM\Event\PrePersistEventArgs;
class PrePersistExample
{
- public function prePersist(LifecycleEventArgs $args)
+ public function prePersist(PrePersistEventArgs $args)
{
// ...
}
}
Change iterate() => toIterable() on query result
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Internal\Hydration\IterableResult;
class SomeRepository extends EntityRepository
{
- public function run(): IterateResult
+ public function run(): iterable
{
/** @var \Doctrine\ORM\AbstractQuery $query */
$query = $this->getEntityManager()->select('e')->from('entity')->getQuery();
- return $query->iterate();
+ return $query->toIterable();
}
}