[TYPO3-dev] Attaching file (audio) to model as a direct relation - sys_file_reference removal

Richard Davies richard at ocular.co.nz
Mon May 18 05:50:36 CEST 2015


Hey everyone

At the moment I have a model with a direct relation to a filereference

> /**
>      * Audio
>      *
>      * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
>      */
>     protected $audio = NULL;
>
which works fine for the getAudio method. When I attempt to replace it from
the frontend with

> public function setAudio(\TYPO3\CMS\Extbase\Domain\Model\FileReference
> $audio) {
>         $this->audio = $audio;
>     }
>
it generates a sys_file_reference record but does not delete the old
sys_file_reference. Any use of the getAudio gets the first (lowest UID)
sys_file_reference/FileReference entered.

TCA:
        'audio' => array(
            'exclude' => 1,
            'label' => 'Audio',
            'config' =>
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
                'audio',
                array('maxitems' => 1),
                'mp4,mp3,m4a'
            ),
        ),


Shouldn't the sys_file_reference be deleted? Do I need to do anything to do
with sys_file_reference with storageObjects when using set even if there is
only one record?

Thanks,
Richard



More information about the TYPO3-dev mailing list