SilverStripe\RestfulServer\RestfulServer::getHandler
Handler for object read.
The data object will be returned in the following format: <ClassName> <FieldName>Value</FieldName> ... <HasOneRelName id="ForeignID" href="LinkToForeignRecordInAPI" /> ... <HasManyRelName> <ForeignClass id="ForeignID" href="LinkToForeignRecordInAPI" /> <ForeignClass id="ForeignID" href="LinkToForeignRecordInAPI" /> </HasManyRelName> ... <ManyManyRelName> <ForeignClass id="ForeignID" href="LinkToForeignRecordInAPI" /> <ForeignClass id="ForeignID" href="LinkToForeignRecordInAPI" /> </ManyManyRelName> </ClassName> Access is controlled by two variables: - static $api_access must be set. This enables the API on a class by class basis - $obj->canView() must return true. This lets you implement record-level security
Signature
protected function getHandler(string
$className,
int
$id,
$relationName )
Parameters
$className
— string$id
— int$relationName
—
Returns
- string
- The serialized representation of the requested object(s) - usually XML or JSON.
Line | Task |
---|---|
272+ | Access checking |