Welcome Guest Search | Active Topics | Members | Log In | Register

pureMVC using ActiveRecords Options · View
drvortex
Posted: Saturday, February 14, 2009 12:10:25 PM
Rank: Ultra Midnight Coder
Groups: Member

Joined: 6/1/2007
Posts: 48
Points: 63
Location: ca
hi mark

please help me I am on a deadline.

i am trying to create a responder using puremvc delegate i do not know if i have to sue a remoteobject or another way.
with the example below clearly doesn't work because ti can't find the method.

I tried ActiveRecords.Artists.findAll()

when I am done I will upload the project so others will know how to do it.



_loginService = new RemoteObject();
_loginService.destination = "GenericDestination";
_loginService.source = "com.artists.Artists";
this.responder = responder;
}

public function LoadArtistsService() : void
{
//var responder:IResponder = new Responder( gotOrder, gotError );
//ActiveRecords.Artists.findFirst(responder);

//responder = addResponder()
//var token:AsyncToken = _loginService.getUser();

// notify this responder when the service call completes
//token.addResponder( responder );
//var call:Object = _loginService.getBooks();

var call:Object = _loginService.findAll();
call.addResponder(responder);
}

thanks for all your help

drvortex
Mark Piller
Posted: Saturday, February 14, 2009 8:01:26 PM

Rank: Administration
Groups: Administration

Joined: 8/21/2006
Posts: 1,607
Points: 4,082
Location: Frisco, TX
What's wrong with ActiveRecords.Artists.findAll() ?

Mark Piller
Midnight Coders, Inc.
twitter: midnightcoder
blog: blog.themidnightcoders.com
website: www.themidnightcoders.com
drvortex
Posted: Sunday, February 15, 2009 7:58:02 AM
Rank: Ultra Midnight Coder
Groups: Member

Joined: 6/1/2007
Posts: 48
Points: 63
Location: ca
hi mark

it doesn't create a event that can be heard in the proxy. it works fine when i do a regular remoteobject.

i saw a method that was call weborb.data.DataServiceClient.prepareRemoteObject() i thought maybe this would do something but i didn't see it in the api.

thanks
drvortex
drvortex
Posted: Sunday, February 15, 2009 8:42:18 AM
Rank: Ultra Midnight Coder
Groups: Member

Joined: 6/1/2007
Posts: 48
Points: 63
Location: ca
hi mark one more thing

in the console i see

[SWF] /php/artistSubmissions/PureMVCProposals/bin/ReviewerPureMVC.swf - 1,327,134 bytes after decompression
Trying connect to WebORB application "/DataService", attempt 0
Got URI for my-rtmp - http://127.0.0.1/php/artistSubmissions/PureMVCProposals/bin/weborb.php
Connecting to URL http://127.0.0.1/php/artistSubmissions/PureMVCProposals/bin/weborb.php/DataService
modified endpoint is:http://127.0.0.1/php/artistSubmissions/PureMVCProposals/bin/weborb.php?clientid=09DEA4B4-3253-1B86-8994-7A99DEFD25FE
creatng AMFChannel
modified endpoint is:http://127.0.0.1/php/artistSubmissions/PureMVCProposals/bin/weborb.php?clientid=09DEA4B4-3253-1B86-8994-7A99DEFD25FE
creatng AMFChannel
Received page #1


which seems that process completed but it is not being seen by the proxy.

thanks
drvortx
Mark Piller
Posted: Sunday, February 15, 2009 8:57:02 AM

Rank: Administration
Groups: Administration

Joined: 8/21/2006
Posts: 1,607
Points: 4,082
Location: Frisco, TX
Could you clarify what you mean by "doesn't create a event that can be heard in the proxy".

Does it return the data?

Mark Piller
Midnight Coders, Inc.
twitter: midnightcoder
blog: blog.themidnightcoders.com
website: www.themidnightcoders.com
drvortex
Posted: Sunday, February 15, 2009 4:24:56 PM
Rank: Ultra Midnight Coder
Groups: Member

Joined: 6/1/2007
Posts: 48
Points: 63
Location: ca
hi mark

when you do a
var token:AsyncToken =_loginService.getUser(); // a normal remoteobject
and then
// notify this responder when the service call completes
token.addResponder( responder );
in the proxy there is a
public function result( rpcEvent : Object ) : void
{

// populate the employee list in the proxy with the results from the service call
data = rpcEvent.result.employees.employee as ArrayCollection;
sendNotification( ApplicationFacade.LOAD_EMPLOYEES_SUCCESS );
}

which receives the rpcevent. it seems it has to be a rpcevent in order for puremvc to capture the service.

I am following the way the the weborb example in the bookstore that uses weborb with puremvc.





the problem is essentially how do i use the wdmf code that is generated by weborb to work.

this is why a simple example of the code created by weborb for pureMVC which I would figure would also rely on the generated code and services created by wdmf would be very helpful.
I figure you or someone else has tested the puremvc code to see that it works.

i thank you again with working with me here.

thanks
drvortex





drvortex
Posted: Sunday, February 15, 2009 4:38:45 PM
Rank: Ultra Midnight Coder
Groups: Member

Joined: 6/1/2007
Posts: 48
Points: 63
Location: ca
hi mark

here is some more detail if I use

if i point the service to my wdmf generated code

_loginService = new RemoteObject();
_loginService.destination = "GenericDestination";
//_loginService.source = "pureMVC.artists.ArtistFacade";
_loginService.source = "com.artists.Artists";

and i call the service

var call:Object = _loginService.findAll();
call.addResponder(responder);

i get

exception 'ReflectionException' with message 'Method findAll does not exist' in /Library/WebServer/CGI-Executables/php/artistSubmissions/Weborb/Util/MethodLookup.php:33

it seems that service can not read the generated code the same way a a typical service call and coded the pre wmdf

but this process does create a rpcevent it is just a fault event

thanks
david

drvortex
Posted: Sunday, February 15, 2009 4:48:04 PM
Rank: Ultra Midnight Coder
Groups: Member

Joined: 6/1/2007
Posts: 48
Points: 63
Location: ca
hi mark

here is some more detail if I use

if i point the service to my wdmf generated code

_loginService = new RemoteObject();
_loginService.destination = "GenericDestination";
//_loginService.source = "pureMVC.artists.ArtistFacade";
_loginService.source = "com.artists.Artists";

and i call the service

var call:Object = _loginService.findAll();
call.addResponder(responder);

i get

exception 'ReflectionException' with message 'Method findAll does not exist' in /Library/WebServer/CGI-Executables/php/artistSubmissions/Weborb/Util/MethodLookup.php:33

it seems that service can not read the generated code the same way a a typical service call and coded the pre wmdf

but this process does create a rpcevent it is just a fault event

if i do this just to reiterate

var call:Object = ActiveRecords.Artists.findAll();
call.addResponder(responder);

no response is created as i said before

if i use

var call:Object = ActiveRecords.Artists.findFirst();
call.addResponder(responder);

i get
Type Coercion failed: cannot convert com.artists::Artists@2187fba1 to mx.rpc.events.ResultEvent.

i think this responds differently because it has a asynctoken response like save and create.

thanks
david

drvortex
Posted: Sunday, February 15, 2009 4:55:34 PM
Rank: Ultra Midnight Coder
Groups: Member

Joined: 6/1/2007
Posts: 48
Points: 63
Location: ca
hi mark

sorry one more thing

i used appPunchder and i was right the data shows up in the text output of the response, it is just not creating a response


drvortex
Posted: Sunday, February 15, 2009 6:16:06 PM
Rank: Ultra Midnight Coder
Groups: Member

Joined: 6/1/2007
Posts: 48
Points: 63
Location: ca
hi mark

there is one idea if the result from DynamicLoadEvent could act just like a service. so the result could be treated just like remoteobject
Mark Piller
Posted: Sunday, February 15, 2009 6:58:36 PM

Rank: Administration
Groups: Administration

Joined: 8/21/2006
Posts: 1,607
Points: 4,082
Location: Frisco, TX
Please help me understand what I'm clearly missing here.... when you call findAll using the WDMF generated API, which part of it does not work in the puremvc context? What is missing? I think trying to get the generated code to work via plan RemoteObject api will not do any good. So let's assume that you have to use findAll, and you get that ActiveCollection back, what do you need to do to plug it into your PureMVC code.

Also one other thing. If you generated the PureMVC code in our console based on the WDMF generated code, it is not recommended. Data Management code generator and the remoting code generator are two different things and should not be combined.

Mark

Mark Piller
Midnight Coders, Inc.
twitter: midnightcoder
blog: blog.themidnightcoders.com
website: www.themidnightcoders.com
drvortex
Posted: Sunday, February 15, 2009 10:16:34 PM
Rank: Ultra Midnight Coder
Groups: Member

Joined: 6/1/2007
Posts: 48
Points: 63
Location: ca
hi mark

i will try to explain the problem is with asynctoken. when you do a normal remote object you can add a responder to the token which can be read by the proxy this all works fine with remoteobject and other services.
all though the ActiveRecords.Artists.findAll(); does work as i said all the records show up in appPuncher. But i can't figure out how to take that result and add it so it gets sent to the proxy.
go to puremvuc http://puremvc.org/pages/downloads/AS3/Demo_AS3_Flex_WebORB_Bookstore.zip

look at the librarydelegate and the bookproxy in the model folder

hope this makes more sense

drvortex
drvortex
Posted: Monday, February 16, 2009 10:34:39 PM
Rank: Ultra Midnight Coder
Groups: Member

Joined: 6/1/2007
Posts: 48
Points: 63
Location: ca
hi mark

i figured it out what the problem was here is the correct service

loginService.destination = "GenericDestination";
loginService.source = "com.artists.ArtistsDataMapper";

i had been using com.artists.Artists

this creates a result
var token:AsyncToken = loginService.findAll()
token.addResponder(responder)

here is the result method
public function result(rpcEvent:Object):void
{
//populate the employee list in the proxy with the results from the service call
data = rpcEvent.result.Result as Array;
sendNotification( ApplicationFacade.ARTIST_LOADED);
}

i will submit a example to you and pureMVC

thanks for all the help

david familian

Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.
This page was generated in 0.213 seconds.