I have an error after having tried an update ( composer update ) in my Symfony project.
I looked for a solution and I found it was necessary to modify the use and the type-hint in the entity and the constructor.. which I have done!
Then, I restarted an update but a different error occurred and the update was not fully completed.
Result: my site is down and a compatibility error is displayed.
watch this:
Compile Error: Declaration of App\DataFixtures\AppFixtures::load(Doctrine\ORM\EntityManagerInterface $manager) must be compatible with Doctrine\Common\DataFixtures\FixtureInterface::load(Doctrine\Common\Persistence\ObjectManager $manager) in AppFixtures.php line 8`
I don't understand, what the compatibility is?
I don't know how to post my code.. ( controllers, YAML, entity, .. ) but I got try. my project is on GitHub before the bug, maybe it can be useful ( if you need..)
here my AppFixtures.php :
<?php
namespace App\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\ORM\EntityManagerInterface;
class AppFixtures extends Fixture
{
public function load(EntityManagerInterface $manager)
{
// $product = new Product();
// $manager->persist($product);
$manager->flush();
}
}
To correct lhor kostrov now with symfony 4.3 i guess,
you need to use ObjectManager from Doctrine\Persistence\ObjectManager
and not from Doctrine\Common\Persistence\ObjectManager
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With