Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Allow usage of is*/has* accessors in EEL/Fusion directly #3312

Open
mhsdesign opened this issue Feb 6, 2024 · 0 comments
Open

FEATURE: Allow usage of is*/has* accessors in EEL/Fusion directly #3312

mhsdesign opened this issue Feb 6, 2024 · 0 comments

Comments

@mhsdesign
Copy link
Member

Is there a reason that fluids property access is slightly different than eels?

In fusion/eel i would also like to call ${fooo.isSomething} which calls the method isSomething() to be more descriptive than ${fooo.something} which feels more like a direct getter and will actually use the getter if defined.

That was brought to fluid as feature but never implemented in ObjectAccess directly: #108

Implementing this would make the RenderingMode object in Neos better usable in php.
To have speaking is* access in eel via renderingMode.isEdit we cheat our way around this by using public readonly properties:
https://github.com/neos/neos-development-collection/blob/e3ff7a4a1f50b2a23c76071536d66506acfa6f8e/Neos.Neos/Classes/Domain/Model/RenderingMode.php#L32-L33

But i just noticed in php how odd it feels and looks to write

if ($renderingMode->isEdit) {
    // bla
}

instead of

if ($renderingMode->isEdit()) {
    // bla
}

so what are the odds of getting this through?
Is this a simple win?

But i also just found out that code in the mentioned pr from 2015 doesnt exist anymore and is part of the default fluid accessor StandardVariableProvider:

                $isMethod = 'is' . $upperCasePropertyName;
                if (method_exists($subject, $isMethod)) {
                    $subject = $subject->$isMethod();
                    continue;
                }
                $hasMethod = 'has' . $upperCasePropertyName;
                if (method_exists($subject, $hasMethod)) {
                    $subject = $subject->$hasMethod();
                    continue;
                }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant