[TYPO3-english] Add file reference to extension model

Johannes Mueller j.f.mueller at gmx.de
Wed Jul 15 19:36:22 CEST 2015


Hey,
I'm trying to solve the following.
1) CommandController Task runs over all datasets from one extension and creates blurred images out of files with GraphicFunctions. READY
2) The created file is added to the storage as a standalone simple file. READY
Code:
$fileObject = $posterStorage->addFile(
  $convertResult[3],
  $posterStorage->getFolder($blurFolderName),
  $newFileName
);
3) Add the generated file to another field of the model. PARTIALLY DONE.
The problem is, that I'm unable to do this the right way. The model says
public function addPosterWebBlur(\TYPO3\CMS\Extbase\Domain\Model\FileReference $posterWebBlur) {
  $this->posterWebBlur->attach($posterWebBlur);
}
and all is fine, when I hack the core, create such a thing:
public function setFile(\TYPO3\CMS\Core\Resource\File $falFile) {
  $this->$uidLocal = (int)$falFile->getUid();
}

But when I do it via an extension of a class:
class FileReference extends \TYPO3\CMS\Extbase\Domain\Model\FileReference {
  public function setFile(\TYPO3\CMS\Core\Resource\File $falFile) {
    $this->$uidLocal = (int)$falFile->getUid();
  }
}
I just get the following error in the backend and the reference does not get established:
Table 'db_namel.tx_ext_name_domain_model_filereference' doesn't exist.

Anybody around who know how to do this right?
Using Typo7.2

Thanks!


More information about the TYPO3-english mailing list