Feature #56529

support hasProperty and isProperty

Added by Simon Schaufelberger over 1 year ago. Updated 7 months ago.

Status:Resolved Start date:2014-03-04
Priority:Should have Due date:
Assigned To:- % Done:

100%

Category:Extbase Spent time: -
Target version:7.1 (Cleanup)
PHP Version: Sprint Focus:
Complexity:

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
Added by Simon Schaufelberger 7 months 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 over 1 year 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 over 1 year ago

  • Project changed from TYPO3.Fluid to TYPO3.Flow

#3 Updated by Gerrit Code Review over 1 year 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 over 1 year 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 over 1 year 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 over 1 year 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 over 1 year ago

  • Project changed from TYPO3.Flow to Extbase MVC Framework

#8 Updated by Anja Leichsenring over 1 year 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 1 year 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 10 months ago

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

#11 Updated by Mathias Schreiber 7 months ago

  • Target version changed from 7.0 to 7.1 (Cleanup)

#12 Updated by Gerrit Code Review 7 months 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 7 months 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 7 months ago

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

Also available in: Atom PDF