[TYPO3-mvc] bug? extbase doesn't use getter

Dmitri Pisarev dimaip at gmail.com
Wed Jun 9 13:09:39 CEST 2010


On 09.06.2010 14:46, Bastian Waidelich wrote:
> Dmitri Pisarev wrote:
>
> Hi again,
>
>> Dennis, I hope you do realize it's not really clean either, and
>> definitely needs some review/testing...
>
> I just had a very short look at your patch and noticed one little glitch:
> Instead of trying to figure out the right getter method, you should make
> use of
> Tx_Extbase_Reflection_ObjectAccess::getProperty()
> like:
> $arr[$property->name] =
> Tx_Extbase_Reflection_ObjectAccess::getProperty($object, $property->name);
>
> That will make sure that it works with array-classes too.
>
> Bastian
Thanks Bastian!
I tried to rewrite it like this:
$arr = array();

         $rc = new ReflectionClass(get_class($object));
         $properties = $rc->getProperties();
         foreach ($properties as $property) {

             if (count($columns) > 0 && !in_array($property->name, 
$columns)) {
                 // Current property should not be returned
                 continue;
             }
             $arr[$property->name] = 
Tx_Extbase_Reflection_ObjectAccess::getProperty($object, $property->name);
         }
         return $arr;

But it throws a #1263391473: The property "_localizedUid" on the subject 
was not accessible.

Shall I try to catch it and just skip it?

Dmitri.


More information about the TYPO3-project-typo3v4mvc mailing list