[TYPO3-mvc] How to instantiate an object from an UID

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Jan 26 12:29:56 CET 2011


Hey Raymund,

> I'm using a flexform to set information in the backend.
>
> There is a input field that contains a UID for the service to use for
> the listing of projects that provide that service.
>
> Now I would like to read that information transfer it into a Service
> object and pass that to my findByService method of the projects
> repository.
>
> So the question is how do I (Tx_References_Domain_Model_Service)
> $this->settings['service']?

That's quite easy - grab it from the repository:

$service = $this->serviceRepository->findOneByUid( 
intval($this->settings['service']) );

(of course you have to create the instance of the repository first).


-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list