[TYPO3-mvc] n:1 get uid

g4-lisz at tonarchiv.ch g4-lisz at tonarchiv.ch
Sat Dec 13 23:38:30 CET 2014


Hi Jacco

You need to replace the passthrough TCA with a config that references to
the right table, like:

        'media' => array(
            'config' => array(
                'type' => 'select',
                'foreign_table' => 'tx_xx_domain_model_media',
                'minitems' => 0,
                'maxitems' => 1,
            ),
        ),

Cheers,
Till

On 12/13/2014 06:21 PM, Jacco van der Post wrote:
> Hi,
>
> I have model 'media' with 1:n 'comment'.
>
> For a comment I want to get in Extbase the uid of the corresponding
> media record.
>
> In the comments db table is a 'media' field (created by the extension
> builder) which contains the uid.
>
>
> In the comments TCA:
>
> 'media' => array(
>     'config' => array(
>     'type' => 'passthrough',
>     ),
> ),
>
> Stuff like this in the model results in
> $comment->getMedia() giving null :
>
>     /**
>      * Media
>      *
>      * @var string
>      *
>      */
>     protected $media = NULL;
>
>
>     /**
>      * Returns the media
>      *
>      * @return media
>      */
>     public function getMedia() {
>         return $this->media;
>     }
>
>
> What should I change / add? Should I put something like
>
> \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\JaccovanderPost\Myext\Domain\Model\Media>
> $media
>
> in the annotations of the comments model?
>
> Thanks
>
>



More information about the TYPO3-project-typo3v4mvc mailing list