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

Should class yii\rest\Serializer support a public property $params like Pagination and Sort? #8349

Closed
fproject opened this issue May 11, 2015 · 4 comments

Comments

@fproject
Copy link

This will be useful when we want to use an array parameters (name => value) to specify fields and expand parameters instead of using values come from Yii::$app->getRequest().

The implementing logic is just like the params property of yii\data\Pagination or yii\data\Sort

@klimov-paul
Copy link
Member

I am unsure it such enhancement violates the HATEOS REST, but still: #8404

@cebe
Copy link
Member

cebe commented May 13, 2015

isn't this already possible using the $request property? @fproject please describe your use case in more detail.

@fproject
Copy link
Author

In my case, I have fields and expand values come from a calculation on serveral HTTP request parameters, not directly from the parameters themselves.
And then, I want to set them to yii\rest\Serializer. Curently the only way is mocking a Request object that return these values via get method.

I think if we support using an array parameters (name => value) just like the params property of yii\data\Pagination or yii\data\Sort, it will be easier and more understandable.

And I also think this will not violate HATEOAS constraints.

@yii-bot
Copy link

yii-bot commented Apr 5, 2018

Issue moved to yiisoft/yii-api#10

@yii-bot yii-bot closed this as completed Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants