[TYPO3-mvc] n:1 get uid

Jacco van der Post jacco at id-internetservices.com
Sat Dec 13 18:21:09 CET 2014


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


-- 
Kind Regards

Jacco van der Post


More information about the TYPO3-project-typo3v4mvc mailing list