If you define a property called 'name' then accessing it breaks because DataItem::$name is defined as a class property, so doing $data->name won't work.
Outside of the class it probably works because the properties are protected, so you get to the magic accessor, but inside it things will go wrong.
If you define a property called 'name' then accessing it breaks because DataItem::$name is defined as a class property, so doing $data->name won't work.
Outside of the class it probably works because the properties are protected, so you get to the magic accessor, but inside it things will go wrong.