I'm using Sonata Admin in my project. I need to render a field that doesn't belong to entity.
Consider entity User with fields username & password. But I also need a extra field as hobby in form but it is not needed in User entity.
$formMapper
->add('username')
->add('password')
->add('hobby');
But I'm getting the symfony error as,
Neither the property "hobby" nor one of the methods "getHobby()", "hobby()", "isHobby()", "hasHobby()", "__get()" exist and have public access in class "App\Entity\User".
How can I solve this? Thanks in advance!!