5 Replies Latest reply on May 18, 2013 6:12 PM by oleg3000

    Data/Services PHP problem creating entry into database

    spaceOpia1

      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