October\Rain\Halcyon\Datasource\FileDatasource
Extends
Implements
- October\Rain\Halcyon\Datasource\DatasourceInterface
Protected Properties
protected string $basePath
basePath is a local path to find the datasource
protected October\Rain\Filesystem\Filesystem $files
Show inherited protected properties
Inherited Protected Properties
- $forceDeleting - indicates if the record is currently being force deleted. (defined in October\Rain\Halcyon\Datasource\Datasource)
- $postProcessor - (defined in October\Rain\Halcyon\Datasource\Datasource)
- $emitterSingleEventCollection - of events to be fired once only. (defined in October\Rain\Halcyon\Datasource\Datasource)
- $emitterEventCollection - of all registered events. (defined in October\Rain\Halcyon\Datasource\Datasource)
- $emitterEventSorted - collection. (defined in October\Rain\Halcyon\Datasource\Datasource)
Public Methods
public __construct()
public __construct($basePath, $files): void
__construct a new datasource instance
public delete()
public delete($dirName, $fileName, $extension): bool
delete against the datasource
public getBasePath()
public getBasePath(): string
getBasePath returns the base path for this datasource
public hasTemplate()
public hasTemplate($dirName, $fileName, $extension): bool
hasTemplate checks if a template is found in the datasource
public insert()
public insert($dirName, $fileName, $extension, $content): bool
insert creates a new template
public lastModified()
public lastModified($dirName, $fileName, $extension): int|null
lastModified date of an object
public makeCacheKey()
public makeCacheKey($name = ''): string
makeCacheKey unique to this datasource
public select()
public select($dirName, $options = []): array
select returns all templates, with available options:
- columns: only return specific columns, eg: ['fileName', 'mtime', 'content']
- extensions: extensions to search for, eg: ['htm', 'md', 'twig']
- fileMatch: pattern to match the filename against using the fnmatch function, eg: *gr[ae]y
public selectOne()
public selectOne($dirName, $fileName, $extension): void
selectOne returns a single template
public update()
public update(
$dirName,
$fileName,
$extension,
$content,
$oldFileName = null,
$oldExtension = null
): int
update an existing template
Inherited Public Methods
- bindEvent() - creates a new event binding. (defined in October\Rain\Halcyon\Datasource\Datasource)
- bindEventOnce() - creates a new event binding that fires once only. (defined in October\Rain\Halcyon\Datasource\Datasource)
- fireEvent() - and call the listeners. (defined in October\Rain\Halcyon\Datasource\Datasource)
- forceDelete() - a record against the datasource. (defined in October\Rain\Halcyon\Datasource\Datasource)
- getPostProcessor() - used by the connection. (defined in October\Rain\Halcyon\Datasource\Datasource)
- unbindEvent() - destroys an event binding. (defined in October\Rain\Halcyon\Datasource\Datasource)
Protected Methods
protected makeFilePath()
protected makeFilePath($dirName, $fileName, $extension): string
makeFilePath helper to make file path
protected validateDirectoryForSave()
protected validateDirectoryForSave($dirName, $fileName, $extension): void
validateDirectoryForSave ensures the requested file can be created in the requested directory
Show inherited protected methods
Inherited Protected Methods
- emitterEventSortEvents() - sorts the listeners for a given event by priority. (defined in October\Rain\Halcyon\Datasource\Datasource)