php-api-wrapper icon indicating copy to clipboard operation
php-api-wrapper copied to clipboard

Method call needs to sanitize method name

Open guice opened this issue 5 years ago • 0 comments

In this piece of code:

https://github.com/CristalTeam/php-api-wrapper/blob/4f52883e250b8ea4b38c7c6b09d0ead6a0c562cb/src/Api.php#L48-L53

You check for a method based on the entity attribute name. If the entity is named with a _ or -, there isn't a way to properly overload this.

For example:

$entity = 'entity-attribute'

The proper endpoint is: /api/entity-attribute/

But you can't have a method by the name of getEntity-Attribute.

The solution is to PascalCase the entity name before checking for a get method.

guice avatar Jul 21 '20 19:07 guice