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

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

Participant ,
Feb 02, 2011 Feb 02, 2011

Copy link to clipboard

Copied

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.

  -Josh

Views

544

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
Guest
Feb 03, 2011 Feb 03, 2011

Copy link to clipboard

Copied

Hi,

I think you are facing this known issue https://bugs.adobe.com/jira/browse/FB-29770

Please vote it.

To avoid this, in the last page of "Configure Return Type", edit return type name to something else (You can also edit subnodes's name too in the wizard).

-radhakrishna

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
Participant ,
Feb 03, 2011 Feb 03, 2011

Copy link to clipboard

Copied

I think you are facing this known issue https://bugs.adobe.com/jira/browse/FB-29770

Please vote it.

Thanks for the link--I just voted for it.

To avoid this, in the last page of "Configure Return Type", edit return type name to something else (You can also edit subnodes's name too in the wizard).

Actually, that's exactly what I saw doing; I apologize if that wasn't clear in my post.

I closed and restarted Flash Builder, and once I did that Flash Builder stopped generating the Error class.  My guess is that the FML file, even though I had updated it (by deleting all references to the Error class), was cached in some fashion by Flash Builder, and restarting Flash Builder forced it to reread the FML file?

Additional point of clarification: my understanding is that the FML file stores all the metadata about the services that Flash Builder has been able to figure out so far, and when you run the Configure Return Type wizard, it will regenerate *every* type in the FML file, even if that type is not mentioned anywhere in the particular return value that you are working with.

Edited to provide additional thoughts on FML file.

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
Guest
Feb 03, 2011 Feb 03, 2011

Copy link to clipboard

Copied

Actually, instead of manually editing *.fml file to remove entity type, you can delete through Data/Services view. Expand 'Data Types' of a service, Context click on the data type -> click 'Delete'.

-radhakrishna

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
Participant ,
Feb 04, 2011 Feb 04, 2011

Copy link to clipboard

Copied

LATEST

Thanks!  I wish I had known that a few weeks ago! 🙂

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