Skip to content
Snippets Groups Projects
Commit 262ee39f authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Bug : problème d'injection

parent 90be2156
No related branches found
No related tags found
No related merge requests found
Pipeline #32048 passed
......@@ -15,7 +15,7 @@ abstract class MigrationAction
public function __construct(MigrationManager $manager)
public final function init(MigrationManager $manager)
{
$this->manager = $manager;
$this->setBdd($this->manager->getBdd());
......
......@@ -164,13 +164,13 @@ class MigrationManager
foreach ($scripts as $index => $script) {
if (is_string($script) && class_exists($script)) {
$script = new $script($this);
$script = new $script();
$scripts[$index] = $script;
}
if (!$script instanceof MigrationAction) {
throw new \Exception('Le script de migration ' . $script::class . ' doit correspondre à une classe héritée de ' . MigrationAction::class);
}
$script->init($this);
if (!method_exists($script, self::ACTION_BEFORE) && !method_exists($script, self::ACTION_AFTER)) {
throw new \Exception('Le script de migration ' . $script::class . ' doit avoir une ou des méthodes ' . self::ACTION_BEFORE . ' et/ou ' . self::ACTION_AFTER);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment