4
votes

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();
    }
}
2
Your app fixture dont do anything. You can remove It. Fixtures are needed only in test environment. You can make compeser install --nodev (something similar) for prevent development libs Will installed in your production Server. And, if hoy are not using fixtures, you can remove the package. Composer remove bundle fixture.(something similar)Curlas
Probably you Will find other errors. Dont make composer update in producction environments. You can edit your composer.json file and go back symfony yo your previous versionCurlas
Thanks for your quick and complete response !! i use the fixtures for simulate the " properties "( house in sold ) but it's right that i can remove it.. I am sure, if i go back in previous version, that's good !Philippe Vandevoorde

2 Answers

2
votes

In your base class Fixture $manager instance of Doctrine\Common\Persistence\ObjectManager, so you need change EntityManagerInterface to ObjectManager. You cannot override typehint in children class.

7
votes

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