• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Data/Services PHP problem creating entry into database

New Here ,
Nov 14, 2010 Nov 14, 2010

Copy link to clipboard

Copied

Hi,

I am using Flash Builder with Flex 4.1 SDK.

I have no bproblem connecting to a database, but some commands don't work.

When I connect to a database using the wizard in the Data/Services section, I use the "click here to generate a sample" link from the "Configure PHP services" wizard.

Flash Builder then creates the basic CRUD methods for me (count[ServiceName], create[ServiceName], delete[ServiceName], getAll[ServiceName], get[ServiceName]ByID).

Most of the methods work, but the create method doesn't work.

After hours of analysing the code, I noticed that, in the _Super_[ServiceName].as file of the services.[yourservice] package, the create method used another Class to pass its data.

While most methods use the "mx.rpc.AsyncToken", create uses the "mx.data.ItemReference" class as the return type.

I changed the create method so it would use the  "mx.rpc.AsyncToken" and I got things working.

I also commented the following chunk of code for thing to get working:

dmOperation = new mx.data.ManagedOperation("createUsers", "create");

dmOperation.parameters = "item";

_usersRPCDataManager.addManagedOperation(dmOperation);

I was then able to use the create method.

I am pretty sure I am missing an important part of knowledge here.

While some methods use the mx.data.ItemReference, most of the methods use the mx.rpc.AsyncToken.

Can somebody explain to me what I should do in order to be on the right path?

Thank you for your time

Views

1.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Nov 16, 2010 Nov 16, 2010

I think you need to call commit() on the service after calling create(). Try it. That should solve the problem.

Votes

Translate

Translate
New Here ,
Nov 15, 2010 Nov 15, 2010

Copy link to clipboard

Copied

Hey

I have the same problem...i have 2 different classes and on the other i got it work by changing the return type to a already used / coded vo class...

Started to compare the two classes when the other service started doing nothing...and noticed the same things that you posted here.

I used the Network Monitor to follow the remote calls to server and the service that uses the custom vo class worked and the data traffic was ok but when calling the service that the wizard made the code and i didn't touch, it didn't even send any data to the server...event thou the code runned all the way to the

point when it returns the ItemRenderer instance...

I also would like to get more info on this, tried to find some but no luck.

Why this is not working eventhou ItemRenderer inherits AsyncToken, or am I misusing this somehow ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 16, 2010 Nov 16, 2010

Copy link to clipboard

Copied

I think you need to call commit() on the service after calling create(). Try it. That should solve the problem.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 16, 2010 Nov 16, 2010

Copy link to clipboard

Copied

Yep

Thanks Anand that did the trick....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 17, 2010 Nov 17, 2010

Copy link to clipboard

Copied

Thank you sooooooooooo much Anand,

It solved the problem, but can I ask where did you get the info from ?

I would really like to learn why I have to add the commit method.

It might hel me get better at all this.

thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 18, 2013 May 18, 2013

Copy link to clipboard

Copied

LATEST

Hi. I Have same problem, and I still cant resolve it even with commit() method.

Can you show some working example code please?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines