You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your resource may need a public field that isn't actually a property or field. RESTful provides a solution for this, and in 2.x it's very flexible.
In RESTful 1.x, you could specify create_or_update_passthrough in your public field definitions.
"create_or_update_passthrough":
Determines if a public field that isn't mapped to any property or field, may be passed upon create or update of an entity. Defaults to FALSE.
In RESTful 2.x, instead of create_or_update_passthrough you may specify the HTTP methods that should be available for each field. An example should clarify the concept:
$public_fields['barry'] = array(
// your field definition here...'methods' => array(RequestInterface::METHOD_GET, RequestInterface::METHOD_OPTIONS),
);
RequestInterface::METHOD_GET is a constant defined in RequestInterface; you could instead simply use the string GET. If you use the constant (and it's best practice to do so) then you will need to be sure to include the RequestInterface use statement:
useDrupal\restful\Http\RequestInterface;
If you examine that PHP interface, you will find the following METHOD constants: