[TYPO3-mvc] Nesting Objects

Mathias Gisch mathiasgisch at googlemail.com
Sat Aug 8 11:09:43 CEST 2009


Hi Sebastian,

thanks for the clarification. I understand your concerns.  I therefore  
tried to implement a ViewHelper which gives the requested  
functionality via
<car:getObjectProperty property="{key}">{car}</car:getObjectProperty>:

class Tx_CarDemo_View_GetObjectPropertyViewHelper extends  
Tx_Fluid_Core_ViewHelper_AbstractViewHelper {

         /**
          * Renders the Output
          *
          * @param string $property Property to retrieve
          */

         public function render($property) {

                 $property =  
t3lib_div::underscoredToUpperCamelCase($property);
                 $localObj = $this->renderChildren();
                 if ($localObj instanceof  
Tx_Extbase_DomainObject_AbstractEntity) {
                         if (method_exists($localObj,'get'.$property)) {
                                         return  
call_user_func(array($localObj, 'get'.$property));
                                 } else {
                                         return 'No getter for "'. 
$property.'" on '.get_class($localObj);
                                 }

                         }
         }

}



> Hi Mathias,
>
>
>> Is this possible with the current ViewHelpers, or do I have to  
>> write my own
>> Viewhelper? I could not get it to work.
> Nope that's not possible, so you'd need a custom ViewHelper for this.
>
> To me it sounds like quite complex, pretty much like the $$variable
> construct in PHP, and if possible, I'd like to avoid implementing this
> in Fluid as it would bloat the language quite a bit. (At least that is
> my gut feeling right now :-)
>
> Greets,
> Sebastian
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list