doctrine / DoctrineFixturesBundle

Symfony integration for the doctrine/data-fixtures library
MIT License
2.45k stars 202 forks source link

group delivered as string but not array #301

Open idoraquel opened 4 years ago

idoraquel commented 4 years ago

[2019-12-26 12:12:03] console.ERROR: Error thrown while running command "doctrine:fixtures:load --em=platform --append --group=platform". Message: "Argument 1 passed to Doctrine\Bundle\FixturesBundle\Loader\SymfonyFixturesLoader::getFixtures() must be of the type array, string given, called in /opt/project/backend/vendor/doctrine/doctrine-fixtures-bundle/Command/LoadDataFixturesDoctrineCommand.php on line 116" {"exception":"[object] (TypeError(code: 0): Argument 1 passed to Doctrine\\Bundle\\FixturesBundle\\Loader\\SymfonyFixturesLoader::getFixtures() must be of the type array, string given, called in /opt/project/backend/vendor/doctrine/doctrine-fixtures-bundle/Command/LoadDataFixturesDoctrineCommand.php on line 116 at /opt/project/backend/vendor/doctrine/doctrine-fixtures-bundle/Loader/SymfonyFixturesLoader.php:93)","command":"doctrine:fixtures:load --em=platform --append --group=platform","message":"Argument 1 passed to Doctrine\\Bundle\\FixturesBundle\\Loader\\SymfonyFixturesLoader::getFixtures() must be of the type array, string given, called in /opt/project/backend/vendor/doctrine/doctrine-fixtures-bundle/Command/LoadDataFixturesDoctrineCommand.php on line 116"} []

The main inconsistency here is actually in lines:

$groups   = $input->getOption('group');
$fixtures = $this->fixturesLoader->getFixtures($groups);

$input->getOption returns mixed However ::getFixtures method allows to pass groups only as an array

public function getFixtures(array $groups = []) : array

It is a quite simple fix, i will prepare a pull request for that in a minute