OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – Programming Questions get multiple files from user

This topic contains 1 reply, has 2 voices, and was last updated by Andrey Yatsenko Andrey Yatsenko 1 year, 10 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
  • #40755


    Sorry for my bad English.
    Im new to oro and I want to get multiple files from user in my form and persist them.
    I added my filed to my entity like this:

    I created a collection type like this:

    I added my filed to form type like this:

    After a clear cache and schema update my i went to my form page and it was great.
    Now i could use + button to add more file fileds and i could choose some files.but when i submited the form with some files (i tried it with one or more files) i got this exception:

    Fatal error: Call to undefined method Oro\Bundle\EntityConfigBundle\Config\Id\EntityConfigId::getFieldType() in /var/www/html/my_proj/vendor/oro/platform/src/Oro/Bundle/AttachmentBundle/Validator/ConfigFileValidator.php on line 64

    so I started debuging:
    i find out in ConfigFileValidator class in line 63 :

    I saw, when I was using a simple file field before the $fieldConfigId variable was of type “Oro\Bundle\EntityConfigBundle\Config\Id\FieldConfigId” class, but now when this class want to validate each files in my file collection field $fieldConfigId will be a instance of “Oro\Bundle\EntityConfigBundle\Config\Id\EntityConfigId” class which has no “getFieldType” method and this cause the problem.

    with more debuging i realized the only diference between these two validation is $fieldName, when i used a simple file field the $fieldName variable in ConfigFileValidator was name of my field in my entity but when i used a file collection filed, my field name was 0 (it used index to set field name of each file field).

    so i discovered in this method of “Oro\Bundle\EntityConfigBundle\Provider\ConfigProvider” class :

    when the field name is a valid field name in line 7 of above code it will go to line 8 and a FieldConfigId instance will be returned but when a file in collection is validating and its field name is 0 it fail at line 7 if and because className it valid it will go to line 10 and an instance of EntityConfigId class will be returned.

    how can i solve this problem? is there any better way to do this job?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.

You will be redirected to [title]. Would you like to continue?

Yes No