Document
in
Interface of model objects stored in a `DocumentStore`
Tags
Table of Contents
Methods
- fromString() : static|null
- Creates a model object from its storage representation
- toString() : string
- Returns the storage representation of the model object
Methods
fromString()
Creates a model object from its storage representation
public
static fromString(string $contents, string $key) : static|null
This method is called from DocumentStore::retrieve() and DocumentStore::update() with the contents of the file or an empty string if the file cannot be read.
If the storage representation is valid, create and return the
model object. Otherwise return null
.
Parameters
- $contents : string
- $key : string
Return values
static|nulltoString()
Returns the storage representation of the model object
public
toString() : string
This is method is called from DocumentStore::commit(), and should return a string which could be passed to Document::fromString() yielding an equal object.