Skip to content

Commit

Permalink
Merge pull request #1145 from wucdbm/patch-1
Browse files Browse the repository at this point in the history
Support --skip-property-types of ValidateSchemaCommand
  • Loading branch information
veewee committed Jul 11, 2024
2 parents a265d52 + 4ce0156 commit b3986f0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/tasks/doctrine_orm.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ grumphp:
doctrine_orm:
skip_mapping: false
skip_sync: false
skip_property_types: false
triggered_by: ['php', 'xml', 'yml']
```
Expand All @@ -25,6 +26,12 @@ With this parameter you can skip the mapping validation check.
With this parameter you can skip checking if the mapping is in sync with the database.
**skip_property_types**
*Default: false*
With this parameter you can skip checking if Entity field property types match the Doctrine types.
**triggered_by**
*Default: [php, xml, yml]*
Expand Down
2 changes: 2 additions & 0 deletions src/Task/DoctrineOrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static function getConfigurableOptions(): ConfigOptionsResolver
$resolver->setDefaults([
'skip_mapping' => false,
'skip_sync' => false,
'skip_property_types' => false,
'triggered_by' => ['php', 'xml', 'yml'],
]);

Expand Down Expand Up @@ -58,6 +59,7 @@ public function run(ContextInterface $context): TaskResultInterface
$arguments->add('orm:validate-schema');
$arguments->addOptionalArgument('--skip-mapping', $config['skip_mapping']);
$arguments->addOptionalArgument('--skip-sync', $config['skip_sync']);
$arguments->addOptionalArgument('--skip-property-types', $config['skip_property_types']);

$process = $this->processBuilder->buildProcess($arguments);

Expand Down
12 changes: 12 additions & 0 deletions test/Unit/Task/DoctrineOrmTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function provideConfigurableOptions(): iterable
yield 'defaults' => [
[],
[
'skip_property_types' => false,
'skip_mapping' => false,
'skip_sync' => false,
'triggered_by' => ['php', 'xml', 'yml'],
Expand Down Expand Up @@ -120,5 +121,16 @@ public function provideExternalTaskRuns(): iterable
'--skip-sync',
]
];
yield 'skip-property-types' => [
[
'skip_property_types' => true,
],
$this->mockContext(RunContext::class, ['hello.php', 'hello2.php']),
'doctrine',
[
'orm:validate-schema',
'--skip-property-types',
]
];
}
}

0 comments on commit b3986f0

Please sign in to comment.