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 AppDataFixturesAppFixtures::load(DoctrineORMEntityManagerInterface $manager) must be compatible with DoctrineCommonDataFixturesFixtureInterface::load(DoctrineCommonPersistenceObjectManager $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 AppDataFixtures; use DoctrineBundleFixturesBundleFixture; use DoctrineORMEntityManagerInterface; class AppFixtures extends Fixture { public function load(EntityManagerInterface $manager) { // $product = new Product(); // $manager->persist($product); $manager->flush(); } }
Advertisement
Answer
In your base class Fixture
$manager instance of DoctrineCommonPersistenceObjectManager
, so you need change EntityManagerInterface
to ObjectManager
. You cannot override typehint in children class.