TYPO3 / Fluid

Fluid template rendering engine - Standalone version
GNU Lesser General Public License v3.0
151 stars 93 forks source link

Feature Request: Make public properties of classes accessible. #865

Closed ervaude closed 5 months ago

ervaude commented 5 months ago

This feature request is about accessing class properties in fluid via

{foo.bar}

Currently, fluid needs a "getter" method (getProperty, hasProperty, isProperty, etc) to access class properties even if the properties are public:

class Foo
{
    public function __construct(public readonly string $bar) {}

    // getter for fluid
    public function getBar(): string
    {
        return $this->bar;
    }
}

If we could access public properties directly, we could get rid of the getter methods:

class Foo
{
    public function __construct(public readonly string $bar) {}
}

Thanks for looking into this! Cheers

mbrodala commented 5 months ago

Actually this works just fine since ever. What is your specific issue?

See:

lolli42 commented 5 months ago

Uh. Probably my bad, I made Daniel create this issue ;)

ervaude commented 5 months ago

Haha, glad this already works. All the better!