FEATURE: Allow usage of is*/has* accessors in EEL/Fusion directly #3312
Description
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;
}