[osflash] Return everything inside a VO object issue (CakePHP/cakeAMFPHP)

Marcelo de Moraes Serpa celoserpa at gmail.com
Thu Apr 20 10:39:11 EDT 2006


Well, I guess I found a way... didn´t tested it yet, but I guess it will
work as the logic seems ok

After returning the events rows I want with the Event´s model´s findAll()
method:

function getEvents($offset = '0',$limit='10') {

$events = $this->Event->findAll('event_data > $today');

I would then iterate over this collection:

var $returned_events = Array()

foreach ($events as $e) {

     $def_pic_id = $this->getRandomPic($e['id']);
     $e['defaultPictureID'] = $def_pic_id;
     $returned_events[] = $e;


}

return $returned_events;



}

I only need to find a way to map each of the returned_events[] items to the
EventVO class... does AMFPHP do that automatically when I configure in the
methodTable?

What do you think?

Cheers,

Marcelo Serpa.

On 4/20/06, Marcelo de Moraes Serpa <celoserpa at gmail.com> wrote:
>
>  Hi friends,
>
> I´m having some hard time trying to figure out the solution for what
> should be something simple. Its best explained through an example:
>
> I´m using CakePHP as the framework of the application server and
> cakeAMFPHP which allows me to use Cake´s controller classes as flash
> remoting services.
>
> Now enters my use case: I have a method in the EventsController.php class
> (which is the flash remoting servcie and Cake´s controller class for the
> Event logic unit), the getEvents($offset,$limit) that should return an array
> of Events encapsulated in the EventVO class. I have a property in the
> EventVO class called DefaultImageID, this var should receive an ID of a
> picture, this picture is randomly chosen from the pictures of the albums
> that this Event owns. However, I´m using Cake´s findAll() model´s method
> which already returns an array with the resultset and it gives me no chance
> to "attach" or set additional properties to the array returned for the row
> ...  (as I would do if I was doing it manually with foreach...).
>
> The only solution I could think of is: First I load the events, then, in
> the client-side, I get the id of the event and call the
> getRandomImage($image_id) remote method... however, I think if all this
> could be done inside the getEvents and returned in the EventVO object, it
> would be better... what do you think?
>
> Thanks,
>
> Marcelo.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20060420/74736af0/attachment.htm


More information about the osflash mailing list