My question is related to: How to configure m2m relationship in Sonata Admin?
After configure admin class according to related answer I got:
The form's view data is expected to be of type scalar, array or an instance of \ArrayAccess, but is an instance of class Syloc\Bundle\GooglePlacesBundle\Entity\PlaceType. You can avoid this error by setting the "data_class" option to "Syloc\Bundle\GooglePlacesBundle\Entity\PlaceType" or by adding a view transformer that transforms an instance of class Syloc\Bundle\GooglePlacesBundle\Entity\PlaceType to scalar, array or an instance of \ArrayAccess.
So I added this property:
->add('types', 'collection', array(
'type' => 'text',
'allow_add' => true,
'data_class' => 'Syloc\Bundle\GooglePlacesBundle\Entity\PlaceType',
));
This leads to error:
The form's view data is expected to be an instance of class Syloc\Bundle\GooglePlacesBundle\Entity\PlaceType, but is an instance of class Doctrine\ORM\PersistentCollection. You can avoid this error by setting the "data_class" option to null or by adding a view transformer that transforms an instance of class Doctrine\ORM\PersistentCollection to an instance of Syloc\Bundle\GooglePlacesBundle\Entity\PlaceType.