Property | Type | Description | |
---|---|---|---|
$documentClass | |||
$formatter | |||
$name | |||
$path | |||
$queryClass |
Method | Description | |
---|---|---|
__construct ( string $name, |
Constructor | |
delete ( mixed $id ) : boolean | Delete a document from the repository using its ID. | |
findAll ( ) : array | Returns all the documents within this repo. | |
findById ( string $id ) : |
Returns a single document based on it's ID | |
getAllFiles ( ) : array | Get an array containing the path of all files in this repository | |
getFilename ( string $id ) : string | Gets just the filename for a document based on it's ID. | |
getName ( ) : string | Returns the name of this repository | |
getPath ( ) : string | Returns the filesystem path of this repository. | |
getPathForDocument ( string $id ) : string | Get the filesystem path for a document based on it's ID. | |
query ( ) : |
A factory method that initialises and returns an instance of a Query object. | |
store ( JamesMoss\Flywheel\DocumentInterface $document ) : boolean | Store a Document in the repository. | |
update ( JamesMoss\Flywheel\DocumentInterface $document ) : boolean | Store a Document in the repository, but only if it already exists. The document must have an ID. |
Method | Description | |
---|---|---|
generateId ( ) : string | Generates a random, unique ID for a document. The result is returned in base62. This keeps it shorted but still human readable if shared in URLs. | |
getIdFromPath ( string $path, string $ext ) : string | Get a document's ID base on its filesystem path | |
validateId ( string $id ) : boolean | Checks to see if a document ID is valid | |
validateName ( string $name ) : boolean | Validates the name of the repo to ensure it can be stored in the filesystem. | |
write ( string $path, string $contents ) : boolean | Writes data to the filesystem. |
public __construct ( string $name, |
||
$name | string | The name of the repository. Must match /[A-Za-z0-9_-]{1,63}+/ |
$config | The config to use for this repo |
protected generateId ( ) : string | ||
return | string | The generated ID. |
public getAllFiles ( ) : array | ||
return | array | An array, item is a file |
public getFilename ( string $id ) : string | ||
$id | string | The ID of the document. |
return | string | The filename of the document, including extension. |
public getPathForDocument ( string $id ) : string | ||
$id | string | The ID of the document. |
return | string | The full filesystem path of the document. |
public query ( ) : |
||
return | A new Query class for this repo. |
protected validateId ( string $id ) : boolean | ||
$id | string | The ID to check |
return | boolean | True if valid, otherwise false |
protected validateName ( string $name ) : boolean | ||
$name | string | The name to validate against |
return | boolean | Returns true if valid. Throws an exception if not. |