Answer the question
In order to leave comments, you need to log in
Validate as NumberType but give choice via ChoiceType?
It was
->add(
'rating', // TODo - should be select with options from 1 to 5
NumberType::class,
[
'attr' => [
'placeholder' => 'Rating',
],
]
)
->add(
'rating',
ChoiceType::class,
[
'choice_label' => 'Rating',
'choices' => array(
'One' => 1,
'Two' => 2,
'Three' => 3,
'Four' => 4,
'Five' => 5,
),
]
)
PropertyAccessor requires a graph of objects or arrays to operate on, but it found type "integer" while trying to traverse path "Rating" at property "Rating".
...
$this->rating = 0.0;
...
/**
* @return int
*/
public function rating() : int
{
return $this->rating;
}
/**
* @param int $rating
*/
public function changeRating(int $rating) : void
{
$this->rating = $rating;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question