Feature #56529
closedsupport hasProperty and isProperty
100%
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
Updated by Simon Schaufelberger over 10 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
Updated by Simon Schaufelberger over 10 years ago
- Project changed from 517 to 16
Updated by Gerrit Code Review over 10 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
Updated by Simon Schaufelberger over 10 years ago
ups, now i pushed to TYPO3.CMS. Should i make another patch for TYPO3.Flow or can they both use this ticket?
Updated by Alexander Berl over 10 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).
Updated by Simon Schaufelberger over 10 years ago
Alexander, yes you got the point. I didn't do a deep test to see what is really going on in ObjectAccess.
Updated by Simon Schaufelberger over 10 years ago
- Project changed from 16 to 534
Updated by Anja Leichsenring over 10 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
Updated by Simon Schaufelberger over 10 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!
Updated by Alexander Opitz about 10 years ago
- Project changed from 534 to TYPO3 Core
- Category set to Extbase
- Target version set to 7.0
Updated by Mathias Schreiber almost 10 years ago
- Target version changed from 7.0 to 7.1 (Cleanup)
Updated by Gerrit Code Review almost 10 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
Updated by Gerrit Code Review almost 10 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
Updated by Simon Schaufelberger almost 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset e4d5284b5e3e0324430d17da11fee85bbc1f7f10.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed