[TYPO3-mvc] How to return Array of Domain Model
Jonas Götze
jonnsn at gmail.com
Fri Jun 4 16:40:55 CEST 2010
Hi,
Am 04.06.2010 16:11, schrieb Dmitri Pisarev:
> On 04.06.2010 17:22, Christian Schwan - Dimme GmbH wrote:
>> How can I make a array auf the article?? Does anyone can help me?
If you just want to convert this to an array you could change the
getArticle()-Method. something like:
/**
* @return string
*/
public function getArticle() {
return explode(',',$this->article);
}
But if you want to use some properties or functions from the matching
Article-Objects, you should do it the Way Dmitri explained:
> 1)define your relation in tca.php
> 2)change your article property to
> Tx_Extbase_Persistence_ObjectStorage<Tx_Productpresenter_Domain_Model_Article>
and initiate it in __construct method
$this->articles = new Tx_Extbase_Persistence_ObjectStorage();
(see blog_example Blog-Model for reference).
>
> 3)write proper getter for this property.
>
> Regards,
> Dmitri.
Then Extbase will do all the magic and you can directly use the
Article-Objects :)
Regards Jonas
More information about the TYPO3-project-typo3v4mvc
mailing list