Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor static function outputXML and outputJSON in API #1142

Closed
jeroendesloovere opened this issue Mar 19, 2015 · 4 comments
Closed

Refactor static function outputXML and outputJSON in API #1142

jeroendesloovere opened this issue Mar 19, 2015 · 4 comments
Labels

Comments

@jeroendesloovere
Copy link
Member

Problem

When replacing SPOON_CHARSET by $container->getParameter('kernel.charset'),
Issue: #1138
PR: #1140
We saw that we had to use BackendModel just for getting the container in a static function.

Solution from @WouterSioen

We can remove that use Backend\Core\Engine\Model as BackendModel again if we change these static functions to normal functions if we use $this->output in outputXML and outputJSON

@jeroendesloovere jeroendesloovere self-assigned this Mar 19, 2015
@jeroendesloovere jeroendesloovere changed the title Refactor static functions in API Refactor static function outputXML and outputJSON in API Mar 19, 2015
@WouterSioen
Copy link
Member

The static isAuthorized and isValidRequestMethod methods are kind of a deal breaker.

I'd try to put the api in the container, so you could do BackendModel::get('api')->isAuthorized(), instead off BaseApi::isAuthorized. (and the same for isValidRequestMethod).

This way, all methods that call self::output could be made non-static!

@carakas
Copy link
Member

carakas commented Aug 24, 2016

@jeroendesloovere is this still an issue or was his solved already

@jeroendesloovere
Copy link
Member Author

jeroendesloovere commented Aug 25, 2016

@WouterSioen Can you take a look at this, since you are more aware of the issue.

@WouterSioen WouterSioen removed their assignment Aug 31, 2016
@WouterSioen WouterSioen added this to the 5.0.0 milestone Aug 31, 2016
@WouterSioen
Copy link
Member

The API needs to be deprecated and altered by an easy way to add new API endpoints. This will also fix the usage of SpoonTemplate.

@carakas carakas removed this from the 5.0.0 milestone Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants