From 1372df4cf2d81a1533b536dd2f3ae2848ea86b4b Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 9 Oct 2019 11:14:14 +0100 Subject: [PATCH 1/2] improve uuid steps --- .../set/doctrine/doctrine-id-to-uuid-step-1.yaml | 4 +--- .../set/doctrine/doctrine-id-to-uuid-step-2.yaml | 11 +++-------- .../set/doctrine/doctrine-id-to-uuid-step-3.yaml | 14 +++++++------- .../set/doctrine/doctrine-id-to-uuid-step-4.yaml | 9 +++++++++ config/set/doctrine/doctrine-id-to-uuid.yaml | 12 ------------ 5 files changed, 20 insertions(+), 30 deletions(-) create mode 100644 config/set/doctrine/doctrine-id-to-uuid-step-4.yaml delete mode 100644 config/set/doctrine/doctrine-id-to-uuid.yaml diff --git a/config/set/doctrine/doctrine-id-to-uuid-step-1.yaml b/config/set/doctrine/doctrine-id-to-uuid-step-1.yaml index b325020e643..661347ea34f 100644 --- a/config/set/doctrine/doctrine-id-to-uuid-step-1.yaml +++ b/config/set/doctrine/doctrine-id-to-uuid-step-1.yaml @@ -1,5 +1,3 @@ services: - # first, run these rule → then look at step-1 + # add uuid id property Rector\Doctrine\Rector\Class_\AddUuidToEntityWhereMissingRector: ~ - Rector\Doctrine\Rector\Class_\AddUuidMirrorForRelationPropertyRector: ~ - Rector\Doctrine\Rector\Class_\AlwaysInitializeUuidInEntityRector: ~ diff --git a/config/set/doctrine/doctrine-id-to-uuid-step-2.yaml b/config/set/doctrine/doctrine-id-to-uuid-step-2.yaml index dd5b5bf5c4c..53d132a1d31 100644 --- a/config/set/doctrine/doctrine-id-to-uuid-step-2.yaml +++ b/config/set/doctrine/doctrine-id-to-uuid-step-2.yaml @@ -1,9 +1,4 @@ services: - # properties - Rector\Doctrine\Rector\Property\AddUuidAnnotationsToIdPropertyRector: ~ - Rector\Doctrine\Rector\Property\RemoveTemporaryUuidColumnPropertyRector: ~ - Rector\Doctrine\Rector\Property\RemoveTemporaryUuidRelationPropertyRector: ~ - - # methods - Rector\Doctrine\Rector\ClassMethod\ChangeGetIdTypeToUuidRector: ~ - Rector\Doctrine\Rector\ClassMethod\ChangeSetIdTypeToUuidRector: ~ + # add relations uuid properties + Rector\Doctrine\Rector\Class_\AddUuidMirrorForRelationPropertyRector: ~ + Rector\Doctrine\Rector\Class_\AlwaysInitializeUuidInEntityRector: ~ diff --git a/config/set/doctrine/doctrine-id-to-uuid-step-3.yaml b/config/set/doctrine/doctrine-id-to-uuid-step-3.yaml index 98be98dd23f..dd5b5bf5c4c 100644 --- a/config/set/doctrine/doctrine-id-to-uuid-step-3.yaml +++ b/config/set/doctrine/doctrine-id-to-uuid-step-3.yaml @@ -1,9 +1,9 @@ services: - Rector\Doctrine\Rector\MethodCall\ChangeSetIdToUuidValueRector: ~ - Rector\Doctrine\Rector\MethodCall\ChangeGetUuidMethodCallToGetIdRector: ~ - Rector\Doctrine\Rector\ClassMethod\ChangeReturnTypeOfClassMethodWithGetIdRector: ~ - Rector\Doctrine\Rector\Identical\ChangeIdenticalUuidToEqualsMethodCallRector: ~ + # properties + Rector\Doctrine\Rector\Property\AddUuidAnnotationsToIdPropertyRector: ~ + Rector\Doctrine\Rector\Property\RemoveTemporaryUuidColumnPropertyRector: ~ + Rector\Doctrine\Rector\Property\RemoveTemporaryUuidRelationPropertyRector: ~ - # add Uuid type declarations - Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedParamTypeRector: ~ - Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector: ~ + # methods + Rector\Doctrine\Rector\ClassMethod\ChangeGetIdTypeToUuidRector: ~ + Rector\Doctrine\Rector\ClassMethod\ChangeSetIdTypeToUuidRector: ~ diff --git a/config/set/doctrine/doctrine-id-to-uuid-step-4.yaml b/config/set/doctrine/doctrine-id-to-uuid-step-4.yaml new file mode 100644 index 00000000000..98be98dd23f --- /dev/null +++ b/config/set/doctrine/doctrine-id-to-uuid-step-4.yaml @@ -0,0 +1,9 @@ +services: + Rector\Doctrine\Rector\MethodCall\ChangeSetIdToUuidValueRector: ~ + Rector\Doctrine\Rector\MethodCall\ChangeGetUuidMethodCallToGetIdRector: ~ + Rector\Doctrine\Rector\ClassMethod\ChangeReturnTypeOfClassMethodWithGetIdRector: ~ + Rector\Doctrine\Rector\Identical\ChangeIdenticalUuidToEqualsMethodCallRector: ~ + + # add Uuid type declarations + Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedParamTypeRector: ~ + Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector: ~ diff --git a/config/set/doctrine/doctrine-id-to-uuid.yaml b/config/set/doctrine/doctrine-id-to-uuid.yaml deleted file mode 100644 index a0ef4edd519..00000000000 --- a/config/set/doctrine/doctrine-id-to-uuid.yaml +++ /dev/null @@ -1,12 +0,0 @@ -services: - # first, run this rule - Rector\Doctrine\Rector\Class_\AddUuidToEntityWhereMissingRector: ~ - - # second, diff and migrate wih Doctrine - - # third, run this rule - # Rector\Doctrine\Rector\Class_\AddUuidMirrorForRelationPropertyRector: ~ - - # fourth, diff and migrate wih Doctrine - - # then run this to validate the change: bin/console doctrine:schema:update --dump-sql From b5b235884970c6707e6c88aac6c6596bb2975ae9 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 9 Oct 2019 11:19:51 +0100 Subject: [PATCH 2/2] fix set error report --- bin/run_all_sets.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/run_all_sets.php b/bin/run_all_sets.php index 253bfc727a1..7e5b1356eb2 100644 --- a/bin/run_all_sets.php +++ b/bin/run_all_sets.php @@ -27,10 +27,10 @@ foreach ($setProvider->provide() as $setName) { $process = new Process($command, __DIR__ . '/..'); - echo sprintf('Set "%s" is OK' . PHP_EOL, $setName); try { $process->mustRun(); + echo sprintf('Set "%s" is OK' . PHP_EOL, $setName); } catch (ProcessFailedException $processFailedException) { if (! Strings::match($processFailedException->getMessage(), '#(Fatal error)|(\[ERROR\])#')) { continue;