Catchable Fatal Error: Argument 3 passed to Doctrine\ORM\Event\PreUpdateEventArgs::__construct() must be of the type array, null given, called in /srv/mysite/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 1060 and defined
In controller
removeExpireProducts();
$em->flush();
Inside my service:
function removeExpireProducts()
{
foreach ($products as $product) {
$this->productRemover->removeProduct($product);
}
}
productRemover class:
public function removeProduct(Product $product)
{
$newOffer =
$this->offerGroup
->createOffer($product);
if (null !== $newOffer) {
$this->em->persist($newOffer);
$this->em->flush();
}
$this->em->remove($product);
}