diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index e99c75b65be..0bf8309070e 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -172,13 +172,14 @@ more details, see the main :ref:`choice_label ` doc :doc:`PropertyAccessor component ` For example, if the translations property is actually an associative - array of objects, each with a name property, then you could do this:: + array of objects, each with a ``name`` property, then you could do this:: + use App\Entity\Genre; use Symfony\Bridge\Doctrine\Form\Type\EntityType; // ... $builder->add('genre', EntityType::class, [ - 'class' => 'App\Entity\Genre', + 'class' => Genre::class, 'choice_label' => 'translations[en].name', ]);