[TYPO3-mvc] Best way to convert "tx_ext_domain_model_foo:1" into object?
typo3 at litedesigns.nl
typo3 at litedesigns.nl
Sat Mar 10 10:52:54 CET 2012
Hey Tim,
I'm a newbie too at Extbase, but after digging through the Extbase core i
found this:
$foo =
Tx_Extbase_Dispatcher::getPersistenceManager()->getObjectByIdentifier($uid,
$className);
I just tested it in one of my controllers and it works like a charm :)
$className is the name of your model, something like:
Tx_MyExt_Domain_Model_Foo
Good luck!
Tim
> Hi Tim :)
>> Or did you mean that you do not know yet which kind of model you have
>> /need with your given string?
> Exactly! I want to call
> $object = someMagicFunction( ' tx_ext_domain_model_foo:1' )
> and then handle it depending on the interface it implements.
> Gruess Tim
>
> GSTALTIG GMBH / www.gstaltig.ch
> Sonnenhofstr. 13 / 6020 Emmenbrücke
> tim at gstaltig.ch / 076 488 24 97
>
> -----Ursprüngliche Nachricht-----
> Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org
> [mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von
> typo3 at litedesigns.nl
> Gesendet: Samstag, 10. März 2012 10:14
> An: TYPO3 v4 MVC project
> Betreff: Re: [TYPO3-mvc] Best way to convert "tx_ext_domain_model_foo:1"
> into object?
>
> Hi Tim,
>
> Can't you just use your repository?
>
> $foo = $this->fooRepository->findByUid($uid);
>
> Or did you mean that you do not know yet which kind of model you have
> /need with your given string?
>
> Kind regards,
> Tim
>
>> Hello list
>> I know there must be a function to which I can pass a string like
>> "tx_ext_domain_model_foo:1" to and recieve the populized object back.
>> Extbase does it, so I should be able to call it too, but I havn't
>> found where it is done. It would be nice if someone could give me a
>> hint.
>> Thanks, Tim
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4m
>> vc
>>
>
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>
More information about the TYPO3-project-typo3v4mvc
mailing list