Multiple file upload

Hi,

I have an object with a OneToMany ArrayCollection of PersistentResource as property.

/**
     * @var \Doctrine\Common\Collections\ArrayCollection<\Neos\Flow\ResourceManagement\PersistentResource>
     * @ORM\OneToMany(mappedBy="myObject")
     */
    protected $documents;

In the fluid template I have:

<input type="file" name="documents[]" id="documents" multiple/>

When I create or update the object I have an error :

Exception #1 in line 1794 of /Users/mehdiguermazi/Sites/hakkadist/Packages/Libraries/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php: Notice: Undefined index: myObject in /Users/mehdiguermazi/Sites/hakkadist/Packages/Libraries/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php line 1794

28 Neos\Flow\Error\ErrorHandler::handleError(8, “Undefined index: myObject”, “/Users/mehdiguermazi/Sites/hakkadist/Packages/Libr…ine/ORM/Persisters/Entity/BasicEntityPersister.php”, 1794, array|6|)
27 Doctrine\ORM\Persisters\Entity\BasicEntityPersister::getOneToManyStatement(array|16|, Medissix\myObjectCatalog\Domain\Model\myObject)
26 Doctrine\ORM\Persisters\Entity\BasicEntityPersister::loadOneToManyCollection(array|16|, Medissix\myObjectCatalog\Domain\Model\myObject, Doctrine\ORM\PersistentCollection)
25 Doctrine\ORM\UnitOfWork::loadCollection(Doctrine\ORM\PersistentCollection)
24 Doctrine\ORM\PersistentCollection::doInitialize()

It’s because the Resource object from Flow doesn’t have your annotated property myObject. What you instead should do, is to create your own object named Document and in that have a OneToOne to a Resource. And adjust your model to be

   /**
     * @var \Doctrine\Common\Collections\ArrayCollection<Document>
     * @ORM\OneToMany(mappedBy="myObject")
     */
    protected $documents;