[TYPO3-english] showAction & uid for model object
    Tomasz Krawczyk 
    tomkrawc at gmail.com
       
    Sun Nov 23 10:12:04 CET 2014
    
    
  
W dniu 2014-11-22 23:25, Jigal van Hemert pisze:
> Hi,
>
> You also don't retrieve records from the database, but you get objects
> from the repository.
>
> For your purpose you inject the repository object for the model you want
> to use in your controller class. Then you query the repository, get the
> object(s) and finally pass them to the view layer.
>
> If you can read German there is an excellent book by Patrick Lobacher
> [1] or a series of articles by Anja Leichsenring [2] about writing
> extensions with Extbase.
>
I don't know German but I managed to solve my problem.
I found an answer in the Repository.
/**
  * myRepository
  *
  * @var \Vendor\ExtName\Domain\Repository\MyRepository
  * @inject
  */
protected $myRepository = NULL;
/**
  * action show
  *
  * @return void
  */
public function showAction() {
     $x = GeneralUtility::makeInstance('Vendor\\ExtName\\SomeClass');
     $myID = $x->getId();
     //\Vendor\\ExtName\\Domain\Model\ModelClass $mc;
     $mc = $this->myRepository->findByUid($myID);
     $this->view->assign('mc', $mc);
}
Thanks!
    
    
More information about the TYPO3-english
mailing list