[TYPO3-mvc] Problem getting an instance of an object in controller

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Apr 6 15:25:31 CEST 2011


Hey,

> I need to compare a XML posted object to an object in the database.
>
> What I do is something like:
>
> $rep = t3lib_div::makeInstance('Object_Repos');
> $objectInDb = $rep->findByProperty('PropertyValue');
...
> Is this due to the new inject dependency ?

if your using Extbase 1.3+ then yes. You have to create the instance of 
the repository using the objectManager.

$rep = 
$this->objectManager->get('Tx_Ext_Domain_Repository_ObjectRepository');
...

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list