[TYPO3-mvc] How to return Array of Domain Model

Dmitri Pisarev dimaip at gmail.com
Fri Jun 4 16:11:00 CEST 2010


On 04.06.2010 17:22, Christian Schwan - Dimme GmbH wrote:
> Hello,
>
>
>
> I got stuck be the following problem:
>
>
>
> DB Tables:
>
>
>
>
>
> -          Product with article field
>
> -          Article with the id of the Product
>
> -
>
>
>
> Tx_Productpresenter_Domain_Model_Product
>
>
>
>
>
>                  /**
>
>                   * @var Tx_Productpresenter_Domain_Model_Article
>
>                   */
>
>                  protected $article;
>
>
>
>                  /**
>
>                   * @return string
>
>                   */
>
>                  public function getArticle() {
>
>                                 return $this->article;
>
>                  }
>
>
>
> The Problem is if I have a comma list of articles in the Product table will
> not work..
>
>
>
>
>
> This is my fluid template:
>
>
>
>      <f:for each="{products}" as="product">
>
>      {product.title}<br>
>
>      {product.text}<br><br>
>
>      {product.image}
>
>      {product.darft}
>
>      {product.serie.system.title}
>
>        <f:for each="{product.article}" as="article">
>
>        {article.art}fdfg
>
>        </f:for>
>
>
>
>      </f:for>
>
>
>
> How can I make a array auf the article?? Does anyone can help me?
Hi Christian!
Do you use an Extbase kickstarter? Or did you try to look at blog_example?
Unfortunately I have to run now, so I can not reply in-depth.
In short you need:
1)define your relation in tca.php
2)change your article property to 
Tx_Extbase_Persistence_ObjectStorage<Tx_Productpresenter_Domain_Model_Article>
3)write proper getter for this property.

Regards,
Dmitri.


More information about the TYPO3-project-typo3v4mvc mailing list