[TYPO3-mvc] Fluid for, if and ObjectStorage; Extbase Conceptual

Thomas Allmer at at delusionworld.com
Wed Jan 19 01:37:29 CET 2011


hey,

I just started with a Extbase/Fluid project and I have some "starter" 
Questions...

1) getFirst/Last Element in a for
<f:for each="{0: 1, 1: 2, 2: 3}" as="element">
	{element},
</f:for>

output: 1, 2, 3, <<<--- howto get rid of this trailing comma

is there any possibility to find out if it's the last or first element 
in for, or what solution would you suggest?

2) if condition with arrays, Tx_Extbase_Persistence_ObjectStorage
{0: 1, 1: 2, 2: 3} <!-- outputs Array -->
<f:if condition="{0: 1, 1: 2, 2: 3} > 10">
   should only be shown if there are more than 10 elements, but is 
always shown
</f:if>

{heads} <!-- outputs nothing -->
<f:if condition="{heads} > 10">
   this is never shown, {heads} is a 
Tx_Extbase_Persistence_ObjectStorage and contains way more elements 
than 10	- they can all be shown when using f:for
</f:if>

is there any way I can check for the amount of elements that are stored 
in an Array/ObjectStorage and use it in an condition.

I mean I could do a
public function getHeadsCount() {
	return count($this->heads);
}
in my model and use a if on this, but this seems a little dirty. No 
ViewHelper for count?

3) Conceptual Question
I have a "problem" something like this. The Domain Model consists of a 
few Objects. To make it easier let's assume it's like the blog example. 
Now what I need to do is, display a list of filters. These filters are 
dropdowns with all items currently available. For example a list of all 
tags. But there is no repository for tags, as it's usually not needed to 
display tags only. So how to get all tags?

- Make almost every Object an Entity with it's own repository (filtering 
should work for almost everything)?
- Traverse through all blogs/posts to get every tag? (performance?)
- use $query->statement(...) (not really nice?)
- ... any other suggestions?

Maybe you can help me out with this little questions... :)
thx

cheers
-- 
+---------------------------------+-----------------------------------+
| Thomas Allmer                   |   http://www.delusionworld.com    |
| E-mail: at at delusionworld.com    |   phone: +43 699 16217064         |
+---------------------------------+-----------------------------------+


More information about the TYPO3-project-typo3v4mvc mailing list