Feature #56529

support hasProperty and isProperty

Added by Simon Schaufelberger almost 6 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2014-03-04
Due date:
% Done:

100%

PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

The way how you currently check for existence of a value in fluid is not nice.

<f:if condition="{object.hasChildren}">
[...]
</f:if>

results in a method in the Model:

public function getHasChildren()

Instead it should be possible to just write:

public funtion hasChildren()

Same for "is".

Inspired by: https://github.com/czenker/cz_simple_cal/blob/master/Classes/Domain/Model/Base.php


Related issues

Related to TYPO3.Flow - Feature #56556: support hasProperty and isProperty New 2014-03-04

Associated revisions

Revision e4d5284b (diff)
Added by Simon Schaufelberger almost 5 years ago

[FEATURE] Support 'has*' for properties in ObjectAccess

Support calling object methods starting with 'has'.

Change-Id: Iec4913203b07fee70e6f5bb3ea9d980d2febc5c9
Resolves: #56529
Releases: master
Reviewed-on: http://review.typo3.org/28036
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>

History

#1 Updated by Simon Schaufelberger almost 6 years ago

or is it half implemented here already? at least i found "is" but not "has".

Flow:

\Packages\Framework\TYPO3.Flow\Classes\TYPO3\Flow\Reflection\ObjectAccess.php

CMS:

\typo3\sysext\extbase\Classes\Reflection\ObjectAccess.php

#2 Updated by Simon Schaufelberger almost 6 years ago

  • Project changed from TYPO3.Fluid to TYPO3.Flow

#3 Updated by Gerrit Code Review almost 6 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28036

#4 Updated by Simon Schaufelberger almost 6 years ago

ups, now i pushed to TYPO3.CMS. Should i make another patch for TYPO3.Flow or can they both use this ticket?

#5 Updated by Alexander Berl almost 6 years ago

The current behaviour is different from what you want to achieve. Currently, when you write "{object.something}" in a Fluid template, it checks if a method "getSomething" or "isSomething" exists in object, and if so calls it.
With your supplied patch, this would only extend to also support "hasSomething", but what you seem to want (correct me if I'm wrong) is to have Fluid also recognize "{object.isSomething}" or "{object.hasSomething}" to call object::isSomething() or object::hasSomething() respectively.

The best way is to push a change for Flow, when it gets merged it will also be backported to TYPO3 CMS anyway, so no need for a seperate changeset (unless you desperately want to speed up the availability in TYPO3 CMS).

#6 Updated by Simon Schaufelberger almost 6 years ago

Alexander, yes you got the point. I didn't do a deep test to see what is really going on in ObjectAccess.

#7 Updated by Simon Schaufelberger almost 6 years ago

  • Project changed from TYPO3.Flow to Extbase MVC Framework

#8 Updated by Anja Leichsenring over 5 years ago

this is still in the wrong repository and tracker. Please close this ticket and abandon your patch, both belong to the TYPO3.CMS project and will never reach Flow Fluid. Your ticket needs to go here [http://forge.typo3.org/projects/package-typo3-fluid], and the patch must be pushed to the correct repository.
Check out a local copy of the Packages/TYPO3.Fluid.git repo, apply your patch and push from there. That should give your patch the correct context.

Thanks Anja

#9 Updated by Simon Schaufelberger over 5 years ago

Anja, this patch is NOT about fluid as fluid supports everything already. This patch is about the object access and that is in coded in extbase!

#10 Updated by Alexander Opitz about 5 years ago

  • Project changed from Extbase MVC Framework to TYPO3 Core
  • Category set to Extbase
  • Target version set to 7.0

#11 Updated by Mathias Schreiber almost 5 years ago

  • Target version changed from 7.0 to 7.1 (Cleanup)

#12 Updated by Gerrit Code Review almost 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/28036

#13 Updated by Gerrit Code Review almost 5 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/28036

#14 Updated by Simon Schaufelberger almost 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#15 Updated by Riccardo De Contardi about 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF