[TYPO3-mvc] How to get the plain DB value of a relation field?
Martin Kutschker
masi-no at spam-typo3.org
Wed Jan 27 21:30:26 CET 2010
Franz Koch schrieb:
> Hi,
>
> I've got a TCA field with a DB relation (select) in one of my models,
> that I'd like to get as plain DB-value inside my model. Therefor I added
> "@var string" as annotation to the models property, but I always get a
> Tx_Extbase_Persistence_LazyLoadingProxy injected.
>
> Well, while it's correct TCA definition wise, it's wrong according to my
> annotation. So is this a bug? Or what do I have to do to get the plain
> DB value?
Browsing through the code I stumbled across the possibility to use a custom proxy.
In the model you create two getters. One that accesses the proxy in the standard way, which means
loading the object. The other getter - eg getRawFoobar() - will ask the proxy for the raw uid. In
FLUID you can access it as rawFoobar because FLUID cares about methods starting with "get" not about
real properties.
Masi
More information about the TYPO3-project-typo3v4mvc
mailing list