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

Christian Schwan - Dimme GmbH christian.schwan at dimme.ch
Fri Jun 4 17:25:42 CEST 2010


Thx it work now;-)


-----Ursprüngliche Nachricht-----
Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org
[mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von
Jonas Götze
Gesendet: Freitag, 4. Juni 2010 16:41
An: typo3-project-typo3v4mvc at lists.typo3.org
Betreff: Re: [TYPO3-mvc] How to return Array of Domain Model

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_Articl
e>
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
_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
Eingehende eMail ist virenfrei.
Von AVG Free SB überprüft - www.avg.de 
Version: 9.0.829 / Virendatenbank: 271.1.1/2916 - Ausgabedatum: 06/03/10
20:25:00 

Ausgehende eMail ist virenfrei.
Von AVG Free SB überprüft - www.avg.de 
Version: 9.0.829 / Virendatenbank: 271.1.1/2916 - Ausgabedatum: 06/04/10
08:25:00 



More information about the TYPO3-project-typo3v4mvc mailing list