[TYPO3-mvc] connect tt_content and FAL

Christoph Kratz kratz at nterm.de
Thu Oct 16 00:01:04 CEST 2014


Hey Guy's,

i'm new to extbase and try to learn it as soon as possible. Unfortunately i have an issue I can't solve: I try to connect my tt_content model with fal, to read and write content by frontend users. Reading and writing content works very well. But i don't know how to read and write images.

I've tried to connect my image-model (via an object storage) to the content model . no success here.

Here the DB relation:
tt_content.uid = sys_file_reference.uid_foreign
sys_file_reference.uid_local = sys_file.uid

So the tt_content-model should use its "protected uid" as an obect storage? 

Here is my FAL model, which seems to me me totally wrong :-(

---------------------------------------------------------------------------------------------------------
class ManageImage extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
sdfsdf

    //Tx_MyExtension_Domain_Model_MyModel
    /**
     * The ArtikelImages
     *
     * @var string $articleImage
     */
    protected $articleImage;

    /**
     * Returns the articleImage
     *
     * @return string $articleImage
     */
    public function getImage()
    {
        if (empty($this->image)) {
            return false;
            // Alternativ kann hier auch ein Standardbildpfad eingesetzt werden
            // return 'uploads/myVerzeichnis/defaultImage.png
        }

        $imagesArray = explode(',', $this->articleImage);
        foreach ($imagesArray AS $key => &$value) {
            $value = 'uploads/r2gtools/' . $value;
        }
        return $imagesArray;
    }

    /**
     * Sets the articleImage
     *
     * @param string $articleImage
     * @return void
     */
    public function setArticleImage($articleImage)
    {
        $this->articleImage = $articleImage;
    }

}
---------------------------------------------------------------------------------------------------------


and a part of the tt_content model:
---------------------------------------------------------------------------------------------------------
  /**
     * fal Object Storage
     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\R2gtools\Domain\Model\ManageImage> The Image the content is assigned to
     * @lazy
     **/
    protected $uid;

    /**
     * Constructor
     */
    public function __construct() {
        $this->uid(new \TYPO3\R2gtools\Domain\Model\ManageImage);
    }






..






/**
     * Sets the FAL File
     *
     * @param \TYPO3\R2gtools\Domain\Model\ManageImage The attendance range of the offer
     * @return void
     */
    public function setUid(\TYPO3\R2gtools\Domain\Model\ManageImage $uid = NULL) {
        $this->uid = $uid;
    }

    /**
     * Returns the FAL File
     *
     * @return \TYPO3\R2gtools\Domain\Model\ManageImage The attendance range of the offer
     */
    public function getUid() {
        return $this->uid;
    }

---------------------------------------------------------------------------------------------------------

What did I made wrong? Please give me some tips to solve my problem,
Thanks!


More information about the TYPO3-project-typo3v4mvc mailing list