[TYPO3-mvc] setRespectStoragePage via initializeObject()
Franz Koch
typo3.RemoveForMessage at elements-net.de
Wed Feb 9 22:55:52 CET 2011
Hey guys,
>> using thie with extbase 1.3.0 doesnt work. in 1.3 alpha 2 it worked. How
>> do i set respectStoragePage to false in 1.3.0
>>
>> http://forge.typo3.org/projects/typo3v4-mvc/wiki/Default_Orderings_and_Query_Settings_in_Repository
>
> I guess you use t3lib_div::makeInstance() to instance your repository
> object. Have a look at the infos about Dependency Injection (DI)
> http://forge.typo3.org/projects/typo3v4-mvc/wiki/Dependency_Injection_%28DI%29
> You have to use DI or the Object Manager now to instance your object and
> getting initializeObject() called.
you don't necessarily have to use DI, although it's for most cases the
suggested solution. But if you only need a certain repository for one
specific action etc. (thus not as class property/var) you can also
instantiate it using the objectManager.
$myTempRepository =
$this->objectManager->get('Tx_ExtKey_Domain_Repository_MyRepository');
You should use the objectManager for ALL domain related instances you
create in your extension (except objectStorages inside your models and
probably some other exceptions). But in general try to make use of the
objectManager instead of t3lib_div::makeInstance.
And if you need to create a instance from within a custom service etc,
then have the objectManager injected using DI and then make use of it.
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list