I'm pretty new to symfony and symfony forms.
I have a form with an EntityType, that looks like this:
->add('customer', EntityType::class, [
'label' => 'Kunde: ',
'class' => Customer::class,
'choice_label' => 'Name',
'query_builder' => function(EntityRepository $er) {
return $er->createQueryBuilder('c')
->select('CONCAT(c.firstname, " ", c.surname) AS Name');
}
])
But I now get an Error/Warning:
Warning: spl_object_hash() expects parameter 1 to be object, string given
Customer Entity:
/**
* @ORM\Entity(repositoryClass="App\Repository\CustomerRepository")
*/
class Customer
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="firstname", type="string", length=50, nullable=false)
*/
private $firstname;
/**
* @var string
*
* @ORM\Column(name="surname", type="string", length=50, nullable=false)
*/
private $surname;
...
Thank you very much for your time and help.