October\Rain\Halcyon\Datasource\DbDatasource

Overview

DbDatasource looks at the database for templates

Extends
Implements
  • October\Rain\Halcyon\Datasource\DatasourceInterface

Protected Properties

protected string $source

source identifier for this datasource instance

protected string $table

table name of the datasource

protected static array $pathCache

protected static array|null $mtimeCache

Show inherited protected properties

Inherited Protected Properties


Public Methods

public __construct()

public __construct($source, $table): void

__construct a new datasource instance

public delete()

public delete($dirName, $fileName, $extension): bool 

delete against the 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 availableoptions:

  • 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

Show inherited public methods

Inherited Public Methods

Protected Methods

protected flushCache()

protected flushCache(): void

protected getBaseQuery()

protected getBaseQuery(): void

getBaseQuery builder object

protected getQuery()

protected getQuery($withTrashed = true): void

getQuery object

protected makeFilePath()

protected makeFilePath($dirName, $fileName, $extension): string 

makeFilePath helper to make file path

Show inherited protected methods

Inherited Protected Methods