Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Add request object #563

Merged
merged 12 commits into from
Nov 2, 2014
Merged

Add request object #563

merged 12 commits into from
Nov 2, 2014

Conversation

rmccue
Copy link
Member

@rmccue rmccue commented Nov 1, 2014

This is essentially a bag of everything relating to the request.

Fixes #552.

@rmccue
Copy link
Member Author

rmccue commented Nov 1, 2014

@WP-API/amigos #reviewmerge

@rmccue rmccue added this to the 2.0 milestone Nov 1, 2014
Also changes get_param to use POST (if relevant), then GET, then the URL
parameters. This mirrors the previous behaviour from v1.
protected $route;

/**
* Attributes (options) for the route that was matched
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are some example options?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added documentation; this is the array used in the registration.

@danielbachhuber
Copy link
Member

Generally, I like this idea a lot. The conservative side of me wonders if it's too magical for core.

@nacin @markjaquith opinions? To summarize, the default argument to our new WP_JSON_Controller class is object implementing ArrayAccess so it can also be used as an array.

*
* @var string
*/
protected $method = '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this default to GET?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to not default here so that it's evident if it hasn't been set. I'd even be happy with defaulting to null.

@rmccue
Copy link
Member Author

rmccue commented Nov 2, 2014

Updated as per review.

Generally, I like this idea a lot. The conservative side of me wonders if it's too magical for core.

The ArrayAccess is a bit magical, but I don't think it's any worse than things like WP_Post using the post fields or falling back to meta otherwise.

I'm going to go ahead and merge this, as I think we're OK with the idea as a whole, and we can PR any other changes we want here.

rmccue added a commit that referenced this pull request Nov 2, 2014
@rmccue rmccue merged commit 5478d4f into joes-registration Nov 2, 2014
@rmccue rmccue deleted the two-request-object branch November 2, 2014 10:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants