[TYPO3-extbase] Get field values from database with AJAX

Sacha Storz sacha at typo3.org
Wed May 30 16:50:50 CEST 2012


Hi there,

sorry, this is not a support list, but the ML of the extbase team for 
orga and discussion... For support questions etc. please use

   typo3.projects.typo3v4mvc (on lists.typo3.org)

cheers :)
sacha






On 23.05.2012 13:37, Graf Zahl wrote:
> Hello together,
> I am still new to Extbase Development, but I am slowly proceeding, I
> even managed to get an AJAX call in my Extension, so I can output some
> stuff dynamically.
> However, to make this useful, I would like to read out some fields from
> my database and comfortably put them in an array and encode it in JSON.
> I managed to do the JSON encoding with random values in an array,
>
> $arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5);
> return json_encode($arr);
>
> but I don't seem to understand how to use the repository correctly for
> some output. I'm not talking about the Fluid View here, I'd rather not
> use it here.
>
> So what I basically tried was
>
> $myarray = $this->raceRepository->findAll();
> print_r($myarray);
>
> I just wanted any output (that's why I used print_r), but I got a lot
> more than what I wanted, including some error message like
> "You should never see this warning. If you do, you probably used PHP
> array functions like current() on the
> Tx_Extbase_Persistence_QueryResult. To retrieve the first result, you
> can use the getFirst() method."
>
> I don't even know where to start, that might be my biggest problem here.
> Can I somehow use the getMethods I declared in the Model?
>
> Hope you can help me :)
>
> Regards,
> Zahl



More information about the TYPO3-team-extbase mailing list