Abstract RESTful controller
Create a new resource
Parameters: | mixed – |
---|---|
Return type: | mixed |
Delete an existing resource
Parameters: | mixed – |
---|---|
Return type: | mixed |
Delete the entire resource collection
Not marked as abstract, as that would introduce a BC break (introduced in 2.1.0); instead, raises an exception if not implemented.
Return type: | mixed |
---|---|
Throws : | ExceptionRuntimeException |
Return single resource
Parameters: | mixed – |
---|---|
Return type: | mixed |
Retrieve HEAD metadata for the resource
Not marked as abstract, as that would introduce a BC break (introduced in 2.1.0); instead, raises an exception if not implemented.
Parameters: | null|mixed – |
---|---|
Return type: | mixed |
Throws : | ExceptionRuntimeException |
Respond to the OPTIONS method
Typically, set the Allow header with allowed HTTP methods, and return the response.
Not marked as abstract, as that would introduce a BC break (introduced in 2.1.0); instead, raises an exception if not implemented.
Return type: | mixed |
---|---|
Throws : | ExceptionRuntimeException |
Respond to the PATCH method
Not marked as abstract, as that would introduce a BC break (introduced in 2.1.0); instead, raises an exception if not implemented.
Return type: | mixed |
---|---|
Throws : | ExceptionRuntimeException |
Replace an entire resource collection
Not marked as abstract, as that would introduce a BC break (introduced in 2.1.0); instead, raises an exception if not implemented.
Parameters: | mixed – |
---|---|
Return type: | mixed |
Throws : | ExceptionRuntimeException |
Update an existing resource
Parameters: |
|
---|---|
Return type: | mixed |
Basic functionality for when a page is not available
Return type: | array |
---|
Dispatch a request
If the route match includes an “action” key, then this acts basically like a standard action controller. Otherwise, it introspects the HTTP method to determine how to handle the request, and which method to delegate to.
Parameters: |
|
---|---|
Return type: | mixed|Response |
Throws : | ExceptionInvalidArgumentException |
Handle the request
Parameters: | MvcEvent – |
---|---|
Return type: | mixed |
Throws : | ExceptionDomainException if no route matches in event or invalid HTTP method |
Process post data and call create
Parameters: | Request – |
---|---|
Return type: | mixed |
Check if request has certain content type
Return type: | boolean |
---|
Register a handler for a custom HTTP method
This method allows you to handle arbitrary HTTP method types, mapping them to callables. Typically, these will be methods of the controller instance: e.g., array($this, ‘foobar’). The typical place to register these is in your constructor.
Additionally, as this map is checked prior to testing the standard HTTP methods, this is a way to override what methods will handle the standard HTTP methods. However, if you do this, you will have to retrieve the identifier and any request content manually.
Callbacks will be passed the current MvcEvent instance.
To retrieve the identifier, you can use “$id = $this->getIdentifier($routeMatch, $request)”, passing the appropriate objects.
To retrive the body content data, use “$data = $this->processBodyContent($request)”; that method will return a string, array, or, in the case of JSON, an object.
Parameters: |
|
---|---|
Return type: | AbstractRestfulController |
Retrieve the identifier, if any
Attempts to see if an identifier was passed in either the URI or the query string, returning if if found. Otherwise, returns a boolean false.
Parameters: |
|
---|---|
Return type: | false|mixed |
Process the raw body content
If the content-type indicates a JSON payload, the payload is immediately decoded and the data returned. Otherwise, the data is passed to parse_str(). If that function returns a single-member array with a key of “0”, the method assumes that we have non-urlencoded content and returns the raw content; otherwise, the array created is returned.
Parameters: | mixed – |
---|---|
Return type: | object|string|array |