protected function RestWSEntityResourceController::validateFields in RESTful Web Services 7.2
Validates an entity's fields before they are saved.
Parameters
EntityDrupalWrapper $wrapper: A metadata wrapper for the entity.
Throws
2 calls to RestWSEntityResourceController::validateFields()
- RestWSEntityResourceController::create in ./
restws.entity.inc - Create a new resource.
- RestWSEntityResourceController::update in ./
restws.entity.inc - Update an existing resource.
File
- ./
restws.entity.inc, line 452 - RESTful web services module integration for entities.
Class
- RestWSEntityResourceController
- Controller for entity-bases resources.
Code
protected function validateFields($wrapper) {
try {
field_attach_validate($wrapper
->type(), $wrapper
->value());
} catch (FieldValidationException $e) {
throw new RestWSException($e
->getMessage(), 422);
}
}