1

When I try to create a new service using db-connected in Apigility, I'm getting the error Error saving field. After receive the error, the service is created but if I select this one, I receive the error Unable to fetch service.

It seems to happen always when I create a db-connected service in a table with name containing "_".

Error while creating the service

Error while accessing the service

The error that I'm getting in console is:

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (Hookit-V1-Rest-Vitrine_usuario-Controller, line 0)

I checked the module's config and the parameters are have been created. in module's config in node zf-apigility O removed the parameter resource_class and the run the service... It worked.

but I can't sync the service in admin.

Does someone knows how to solve it to sync the service in Apigility's admin?

Alessandro Garcez
  • 728
  • 2
  • 6
  • 25
  • Usually, there's a more detailed error message into the server response body. What is the error message for your case ? – Clément Prévost Aug 16 '15 at 19:36
  • @ClémentPrévost, changing some parameters in module's config the service worked fine. but the problem is that I can't sync the service in admin. And the fields are not created. I think it is a bug in apigility-admin-ui. I found it issue in repository https://github.com/zfcampus/zf-apigility-admin-ui/issues/78 – Alessandro Garcez Aug 17 '15 at 15:51

2 Answers2

1

Alessandro Garcez is correct. This issue was resolved in this merge https://github.com/zfcampus/zf-apigility-admin-ui/pull/59

However, this merge has been overwritten and in the latest version, you will get the same issue. I have made a pull request to bring back the fix that Alessandro Garcez mentioned.

Colinz
  • 11
  • 2
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). - [From Review](/review/low-quality-posts/11295703) – Sebastian Brosch Feb 17 '16 at 07:40
  • The exact precise answer to fix this issue would be to add this line to the capitalizeFirstLetter() function in the file src/apigility-ui/service/api.service.js: `string = string.replace(/_(\w)/, function(_,letter) { return letter.toUpperCase(); });` – Colinz Feb 19 '16 at 06:37
0

It seems that when the new service is created, if the table name contains an underscore ( _ ), the API will convert this to what looks like CamelCase.

But when the UI then wants to create the fields for this newly created service, it (the UI) will still use the tablename with the underscore in it, when accessing the api (/apigility/api/module//rest/--Rest--Controller/input-filter)

But the API will this time expect the controller-part being specified with the tablename camedcased: (/apigility/api/module//rest/--Rest--Controller/input-filter)

It had already been fixed but was undone, I don't know why.

There is a opened discussion https://github.com/zfcampus/zf-apigility-admin-ui/issues/78.

For now is possible follow this way:

Change the function capitalizeFirstLetter in file src/apigility-ui/service/api.service.js adding the line var string = string.replace(/(\w)/g, function(,letter) { return letter.toUpperCase(); }); before the return.

Alessandro Garcez
  • 728
  • 2
  • 6
  • 25