4 Replies Latest reply on Feb 4, 2011 6:29 AM by JoshBeall

    How can I get rid of a type generated by the Data/Services return type wizard?

    JoshBeall Level 1

      Hi All,


      I have a JSON service that returns an object called "error".  The Data/Services "Configure Return Type" wizard automatically turned this into a class "Error".


      However, this caused over a hundred errors to show up inside the generated classes, "Call to a possibly undefined method Error."  That's because of lines like this:


      throw new Error(propertyName + " is not a data property of entity Agreements"); 


      It's trying to throw a regular "Error" object, but now that there's an "Error" class in the same package, that is taking precedence--and that Error object doesn't have a constructor with a single parameter.  At least, that's what I think is going on.


      I tried to fix it by deleting _ErrorEntityMetadata.as, _Super_Error.as, and Error.as from the valueObjects package.  I then opened the FML file and deleted the definition for the entity "Error" and every reference to the Error entity (class) in my FML file.


      I then changed my JSON service so that it returns an object called "serviceError" instead of just "error".


      But, whenever I re-run the "Configure Return Type" wizard, it regenerates the Error class, even though I've deleted it from everywhere I can find it.  That breaks my project completely!  How can I end this and get Flash Builder to *stop* generating this type!


      In the "Configure Return Type" wizard I very carefully inspected the type of every bit of data coming back to make sure none of them show up as type "Error."  And they don't (as expected, since I changed the object's name to serviceError--now the type of that object is ServiceError.