Aswathy S
Aswathy S

Reputation: 731

Fileupload TYPO3 getting null on findAll()

Hi have a backend module extension to upload files. Im using helhum fileupload for reference. File upload is successful. But the file filed of table updates the uid of sys_file_reference instead of no of files. Why it happens?

<f:form.upload  property="file" />

my reference is this Where can I set the table name and no_files in my table and sys_file reference

Upvotes: 0

Views: 183

Answers (2)

Aswathy S
Aswathy S

Reputation: 731

I got the solution for my problem. my model was

/**
     * Sets the file
     *
     * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $file
     * @return void
     */
    public function setFile(\TYPO3\CMS\Extbase\Domain\Model\FileReference $file = NULL)
    {
        $this->file = $file;
    }

I removed the type from argument list .Now its working fine.My updated code is below

/**
 * Sets the file
 *
 * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $file
 * @return void
 */
public function setFile($file = NULL)
{
    $this->file = $file;
}

Upvotes: 0

Claus Due
Claus Due

Reputation: 4271

The property "file" I assume is an 1:1 relation which is why the UID of the file reference is what gets written in to the field.

Had the property been a M:N or 1:N table you would see the number of files, as you expect - and Extbase would need to know you want an ObjectStorage containing FileReference objects on your property.

Regarding the subject, if your Repository returns NULL when you do findAll, this is almost always because of storage page restrictions. To overcome it, override either createQuery and manipulate QuerySettings on the query before it gets returned, setting respectStoragePageUids(false).

Upvotes: 1

Related Questions