Bug #67337

hasProperty and isProperty not working on 7.3?

Added by Tobias Braumann almost 7 years ago. Updated almost 7 years ago.

Must have
Target version:
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


According to TYPO3 CMS 7.1 - What's New and to the Ticket #56529 it should be possible to use hasProperty and isProperty inside Fluid without adding a get the object method. But i didn't get it to work.

Is it bug or was it remove again?

My code looks like this:
class Collector implements CollectorInterface {
public function hasConfiguration() {
return true;

public function isTest() {
return true;
I created an instance of Collector with the objectManager.

In fluid it looks like this:


always get null, with get at the beginning of the methods it still works fine


Updated by Mathias Schreiber almost 7 years ago

  • Status changed from New to Needs Feedback
  • Assignee set to Mathias Schreiber

Shouldn't is be the other way around?
Check this: https://review.typo3.org/#/c/28036/4/typo3/sysext/extbase/Classes/Reflection/ObjectAccess.php

IMO the method can be public function test().
Or I get it all wrong


Updated by Tobias Braumann almost 7 years ago

I think you got i wrong. The Presentation said:

Method has() in ObjectAccess
For the usage in Fluid, object.property and object.isProperty already support the following methods:
- isProperty() # is isn't working too
- getProperty() # only this works with object.property
New since TYPO3 CMS 7.1: hasProperty()
This calls method $object->hasProperty() if object.hasProperty is used in Fluid


Updated by Mathias Schreiber almost 7 years ago

from reading the code (not the presentation) I take these possibilities:

$getterMethodName = 'has' . ucfirst($propertyName);
if (is_callable(array($subject, $getterMethodName))) {
    return $subject->{$getterMethodName}();

To me it seems that the propertyName is "test" and the respective getter is build to be "hasTest"

if (substr($methodName, 0, 3) === 'has') {
    $declaredPropertyNames[] = lcfirst(substr($methodName, 3));

The other way around.
You go "hasTest" and the code builds (mind the substr) "test" from that.


Updated by Anja Leichsenring almost 7 years ago

You need a property declared to be returned by the method. So judging by the example you gave, I guess you missed the property declaration. Try this:

protected $property = TRUE;

protected $anotherProperty = array();

public function isProperty() {
  return $this->property();

public function hasAnotherProperty() {
  return $this->anotherProperty();


Updated by Anja Leichsenring almost 7 years ago

Finally I got the failure here. In fluid, you always request the property, the inner implementation is not known. You do <f:debug>{property}</f:debug> and this is it. The system will find out what kind of getter to call, by simly looking up the provided methods. This is not known and not needed in fluid.


Updated by Anja Leichsenring almost 7 years ago

  • Status changed from Needs Feedback to Closed

this is no bug, but user error. Don't call methods in fluid templates.


Updated by Tobias Braumann almost 7 years ago

Thx, now i know what Mathias mean. You are both right! I tested it and it works, but it didn't feel right and i think this behavior differs from what is describe in #56529 or what stands in the official TYPO3 CMS 7.1 - What's New presentation.

Also available in: Atom PDF