I have problem with name of objects. In symfony 4, sonata admin. When create field autocomplete with result from other enitity i got number of this object enitity, why i dont get normal name witch is saved in database ?
->add('child', ModelAutocompleteType::class, [
'property' => 'name',
'multiple' => 'true',
])
And there : Edite App\Entity\Invest..... want there normal name. Can anyone help ?
Try implementing "magic" method __toString()
in you object class:
http://php.net/manual/en/language.oop5.magic.php#object.tostring
and inside it generate name of you object. So, add it like:
public function __toString()
{
return $this->foo;
}
Your function just has to return a string. Use variables you have in your object to generate that string.