Skip to content

Commit

Permalink
Add property path checks with forms
Browse files Browse the repository at this point in the history
  • Loading branch information
iquito committed Nov 4, 2019
1 parent 3c41250 commit 5bbae48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions captainhook.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@
"conditions": []
},
{
"action": "vendor/bin/phpunit",
"action": "composer phpunit",
"options": [],
"conditions": []
},
{
"action": "vendor/bin/phpstan analyse src --level=7",
"action": "composer phpstan",
"options": [],
"conditions": []
},
{
"action": "vendor/bin/psalm",
"action": "composer psalm",
"options": [],
"conditions": []
},
{
"action": "vendor/bin/phpcs --standard=ruleset.xml --extensions=php --cache src tests",
"action": "composer phpcs",
"options": [],
"conditions": []
}
Expand Down
4 changes: 2 additions & 2 deletions src/Annotation/StringFilterExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
if ($form->has($key)) {
$propertyPath = $form->get($key)->getPropertyPath();

if (isset($propertyPath)) {
if (isset($propertyPath) && $propertyAccessor->isWritable($model, $propertyPath)) {
$propertyAccessor->setValue($model, $propertyPath, $value);
}
}
Expand All @@ -69,7 +69,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
if ($form->has($key)) {
$propertyPath = $form->get($key)->getPropertyPath();

if (isset($propertyPath)) {
if (isset($propertyPath) && $propertyAccessor->isReadable($model, $propertyPath)) {
$data[$key] = $propertyAccessor->getValue($model, $propertyPath);
}
}
Expand Down

0 comments on commit 5bbae48

Please sign in to comment.