I just modified the RemoteObjectAMF0 example to test the single Object
return typing issue.  It seems to have no problem.

If you have my examples from the download (make sure you have the
latest) change the PHP file Login.php as describe below:
In checkLogin function change "return $arr;" to "return $book;", we
now have it return just a typed object BookVO.

Then in the mxml file RemoteObjectAMFOSample.mxml file change:
                [Bindable]
                private var books:ArrayCollection;
                private function resultHandler( event:ResultEvent ):void
                {
                        books = new ArrayCollection( ArrayUtil.toArray( 
event.result ) );
                }

To 

                [Bindable]
                private var books:ArrayCollection;
                [Bindable]
                private var book:BookVO;                
                private function resultHandler( event:ResultEvent ):void
                {
                        books = new ArrayCollection( ArrayUtil.toArray( 
event.result ) );
                        book = BookVO( event.result );
                }

Add a label at the bottom for testing:
<mx:Label text="{ book.name }" />

You'll see that there is now error thrown in the resultHandler like
you are experiencing.  So it must be something with the code, try
breaking the problem down to see if you can find where the issue is.

Note with AMFPHP you can use the advancedsettings.php or you can put
$_explicitType in your PHP objects to force specific object typing. 
You do not need to set the return type in the methodTable but it will
not hurt to do so, as well its easier to read.

Renaun


--- In [email protected], "Oriol Gual" <[EMAIL PROTECTED]> wrote:
>
> Ok then, have you set your return type in your method table? It also
has to
> be the fully qualified name.
> 
> 2006/9/1, joangarnetdotcom <[EMAIL PROTECTED]>:
> >
> > Hi, thanx for you repy.
> > I did set $gateway->setBaseCustomMappingsPath() to point to the
classpath
> > where my PHP classes are.
> > All PHP classes are matching exactly the same "package" path as my AS
> > classes (just to make things easier).
> > I did not set $incoming nor $outgoing in advancedsettings.php as, if I
> > understood well, this is not necessary if you set $_explicitTtpe
with the
> > class' fully qualified name  in the PHP class.
> >
> > Please tell me if I'm wrong or if you think there's some more light on
> > this.
> > Cheers!
> > Joan
> >
> >
> >
> > --- In [email protected], "Oriol Gual" <oriol.gual@> wrote:
> > >
> > > Have you changed your advancedsettings.php to correctly map your
> > classes?
> > >
> > > 2006/8/31, joangarnetdotcom jgarnet@:
> >
> > > >
> > > > Hi, I'm in a Flex2 app.
> > > > I can't manage to map a php return value to the right AS type...
> > > >
> > > > In my service method I have this return statement:
> > > > return new Result( true, new Status() );
> > > >
> > > > In Result.php I have
> > > > public $_explicitType = "org.bestiario.website.Result";
> > > > In Status.php I have
> > > > public $_explicitType = "org.bestiario.website.Status";
> > > > I also have the corresponding Result.as and Status.as classes
on the
> > Flex
> > > > side.
> > > >
> > > > In my HTTP debugger (Charles) I can see the AMF packet coming with
> > correct
> > > > types as you can see here:
> > http://www.joangarnet.com/_otras/charles.gif
> > > >
> > > > But when the callback executes and I do:
> > > > public function onResult( event:* = null ):void
> > > > {
> > > > var res:Result = Result(event.result);
> > > > }
> > > > I get the following exception:
> > > > TypeError: Error #1034: Type Coercion failed: cannot convert
> > > > [EMAIL PROTECTED] to org.bestiario.website.Result.
> > > >
> > > > Any ideas??
> > > > Cheers!
> > > >
> > > > P.S. I'm using Renaun's RemoteObjectAMF0 class to call amfphp
> > services.
> > > >
> > > >
> > >
> > 
> >
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to