|Version 9 (modified by 12 years ago) ( diff ),|
S3XRC - S3Resource
Resources are dynamic, document-alike representations of data objects on the Eden server. As such, they can represent both single instances as well as structured sets of data objects.
Note: in the database context, a single instance of a data object is typically called a record (or row), with fields (or columns) as its atomic elements. However, even though S3Resources are typically bound to a relational database and therefore the record/field terminology is often used in this regard, they are not intended to provide any object-relational mapping (ORM).
In the context of the Model-View-Controller (MVC) architecture, S3Resources are controller-generated objects. Typically, the controller generates a resource in response to an incoming HTTP request and returns a view of it (output) to the client:
To parse the URL and the incoming HTTP request and to generate a corresponding resource, the controller can make use of the S3Request helper class.
A S3Resource consists of elements which can be either resources themselves (container type) or data (atomic types).
Container type elements within a resource can be:
- primary resources (independent data objects)
- component resources (objects which are part of a primary object)
- referenced resources (objects which are referenced by primary or component resources)
This interface is used by the s3_rest_controller() function:
res, req = s3xrc.parse_request(module, resource) output = res.execute_request(req, **attr)
res is the S3Resource instance, and
req the S3Request instance.