Skip to content

Commit

Permalink
drop nette/reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
dakorpar committed May 17, 2021
1 parent 28941c1 commit 4fcd3a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"nette/di": "^3.0",
"nette/application": "^3.0",
"nette/forms": "^3.1.2",
"nette/reflection": "^2.4",
"wedo/utilities": "^2.0"
},
"require-dev": {
Expand Down
10 changes: 4 additions & 6 deletions src/Helpers/FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,11 @@ public function createForm(array $properties, BaseRequest $request, Container $f
if ($control instanceof ChoiceControl) {
$itemsAttributes = $property->getAttributes(ChoiceControlItems::class);

if (count($itemsAttributes) === 0) {
throw new NotSupportedException('Choice control must have ChoiceControlItems attribute set!');
if (count($itemsAttributes) > 0) {
/** @var ChoiceControlItems $itemAttribute */
$itemAttribute = $itemsAttributes[0]->newInstance();
$control->setItems($itemAttribute->items, $itemAttribute->useKeys);
}

/** @var ChoiceControlItems $itemAttribute */
$itemAttribute = $itemsAttributes[0]->newInstance();
$control->setItems($itemAttribute->items, $itemAttribute->useKeys);
}
}
}
Expand Down

0 comments on commit 4fcd3a2

Please sign in to comment.