symfony 3.4.14 collectionType编辑和删除问题

i have two table in the database that user and Files that each user can have multilpe image so i used Collectiontype for adding multiple image create and read are working well but when i try to edit them i get this error screenshot

i looked every documention but i couldn't find anything to solve my problem here's what i have in usertype and Filestype https://gist.github.com/Bakhshi-Faisal/ffa62cc6b059f662243cf7e2564a03ef

you need to change your form types accordingly:

class UserType extends AbstractType {

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder
        ->add('name')
        ->add('lastName')
        ->add('files',CollectionType::class, array(
              'entry_type' => AppBundle\Form\FilesType::class,
              'allow_add' => true,
              'allow_delete' => true,
        ));
...

class FilesType extends AbstractType {

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder->add('file',FileType::class, array(
              'data_class' => null
        ));
...

You have to use "Data Transforms". Take a look at this