From 8b1806dbd440544d335bdeadb8697d7f2b6ece34 Mon Sep 17 00:00:00 2001 From: HypeMC Date: Mon, 11 Oct 2021 23:41:19 +0200 Subject: [PATCH 1/2] Check if json_array type exists before unsetting it --- src/Maker/MakeEntity.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Maker/MakeEntity.php b/src/Maker/MakeEntity.php index d7142c88c..917013d4d 100644 --- a/src/Maker/MakeEntity.php +++ b/src/Maker/MakeEntity.php @@ -374,9 +374,7 @@ private function askForNextField(ConsoleStyle $io, array $fields, string $entity } $type = null; - $types = Type::getTypesMap(); - // remove deprecated json_array - unset($types[Type::JSON_ARRAY]); + $types = $this->getTypesMap(); $allValidTypes = array_merge( array_keys($types), @@ -428,9 +426,7 @@ private function askForNextField(ConsoleStyle $io, array $fields, string $entity private function printAvailableTypes(ConsoleStyle $io) { - $allTypes = Type::getTypesMap(); - // remove deprecated json_array - unset($allTypes[Type::JSON_ARRAY]); + $allTypes = $this->getTypesMap(); if ('Hyper' === getenv('TERM_PROGRAM')) { $wizard = 'wizard 🧙'; @@ -885,4 +881,16 @@ private function getEntityNamespace(): string { return $this->doctrineHelper->getEntityNamespace(); } + + private function getTypesMap(): array + { + $types = Type::getTypesMap(); + + // remove deprecated json_array if it exists + if (\defined(sprintf('%s::JSON_ARRAY', Type::class))) { + unset($types[Type::JSON_ARRAY]); + } + + return $types; + } } From e0ffa99844790a6911370e5a491507cf6a399d0e Mon Sep 17 00:00:00 2001 From: HypeMC Date: Wed, 13 Oct 2021 12:20:59 +0200 Subject: [PATCH 2/2] Fix composer package names --- src/Maker/MakeCrud.php | 2 +- src/Maker/MakeRegistrationForm.php | 2 +- tests/Maker/MakeEntityLegacyTest.php | 4 ++-- tests/Maker/MakeEntityTest.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Maker/MakeCrud.php b/src/Maker/MakeCrud.php index 4bd748c1b..a1e2418d4 100644 --- a/src/Maker/MakeCrud.php +++ b/src/Maker/MakeCrud.php @@ -260,7 +260,7 @@ public function configureDependencies(DependencyBuilder $dependencies) $dependencies->addClassDependency( DoctrineBundle::class, - 'orm-pack' + 'orm' ); $dependencies->addClassDependency( diff --git a/src/Maker/MakeRegistrationForm.php b/src/Maker/MakeRegistrationForm.php index b7250fefa..ec48be354 100644 --- a/src/Maker/MakeRegistrationForm.php +++ b/src/Maker/MakeRegistrationForm.php @@ -479,7 +479,7 @@ public function configureDependencies(DependencyBuilder $dependencies): void $dependencies->addClassDependency( DoctrineBundle::class, - 'orm-pack' + 'orm' ); $dependencies->addClassDependency( diff --git a/tests/Maker/MakeEntityLegacyTest.php b/tests/Maker/MakeEntityLegacyTest.php index c753b964d..388455d21 100644 --- a/tests/Maker/MakeEntityLegacyTest.php +++ b/tests/Maker/MakeEntityLegacyTest.php @@ -509,7 +509,7 @@ public function getTestDetails() '', ]) ->setRequiredPhpVersion(70200) - ->addExtraDependencies('ux-turbo-mercure') + ->addExtraDependencies('symfony/ux-turbo-mercure') ->configureDatabase() ->addReplacement( '.env', @@ -546,7 +546,7 @@ public function getTestDetails() ]) ->setRequiredPhpVersion(70200) ->addExtraDependencies('api') - ->addExtraDependencies('ux-turbo-mercure') + ->addExtraDependencies('symfony/ux-turbo-mercure') ->setFixtureFilesPath(__DIR__.'/../fixtures/legacy/MakeEntity/MakeEntity') ->configureDatabase() ->updateSchemaAfterCommand() diff --git a/tests/Maker/MakeEntityTest.php b/tests/Maker/MakeEntityTest.php index 98b15fd8d..599f7ac76 100644 --- a/tests/Maker/MakeEntityTest.php +++ b/tests/Maker/MakeEntityTest.php @@ -619,7 +619,7 @@ public function getTestDetails() ]) ->setRequiredPhpVersion(80000) ->useDoctrineAttributeMapping() - ->addExtraDependencies('ux-turbo-mercure') + ->addExtraDependencies('symfony/ux-turbo-mercure') ->configureDatabase() ->addReplacement( '.env', @@ -657,7 +657,7 @@ public function getTestDetails() ->setRequiredPhpVersion(80000) ->useDoctrineAttributeMapping() ->addExtraDependencies('api') - ->addExtraDependencies('ux-turbo-mercure') + ->addExtraDependencies('symfony/ux-turbo-mercure') ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntity') ->configureDatabase() ->updateSchemaAfterCommand()