October\Rain\Halcyon\Datasource\DbDatasource

Extends:

Implements:

  • October\Rain\Halcyon\Datasource\DatasourceInterface

DbDatasource

Table Structure:

  • id, unsigned integer
  • source, varchar
  • path, varchar
  • content, longText
  • file_size, unsigned integer (in bytes w/ max 4.29gb)
  • updated_at, datetime
  • deleted_at, datetime, nullable

Protected properties

protected string $source

source identifier for this datasource instance

protected string $table

table name of the datasource

Show inherited protected properties

Inherited protected properties

Public methods

public void __construct($source, $table)

__construct a new datasource instance

Parameters
  • $source
  • $table

public void delete($dirName, $fileName, $extension)

delete against the datasource

Parameters
  • $dirName
  • $fileName
  • $extension

public void hasTemplate($dirName, $fileName, $extension)

hasTemplate checks if a template is found in the datasource

Parameters
  • $dirName
  • $fileName
  • $extension

public void insert($dirName, $fileName, $extension, $content)

insert creates a new template

Parameters
  • $dirName
  • $fileName
  • $extension
  • $content

public void lastModified($dirName, $fileName, $extension)

lastModified date of an object

Parameters
  • $dirName
  • $fileName
  • $extension

public void makeCacheKey($name='')

makeCacheKey unique to this datasource

Parameters
  • $name

public void select($dirName, $options=array())

select returns all templates

Available options: [ 'columns' => ['fileName', 'mtime', 'content'], // Only return specific columns 'extensions' => ['htm', 'md', 'twig'], // Extensions to search for 'fileMatch' => '*gr[ae]y', // Shell matching pattern to match the filename against using the fnmatch function 'orders' => false // Not implemented 'limit' => false // Not implemented 'offset' => false // Not implemented ];

Parameters
  • $dirName
  • $options

public void selectOne($dirName, $fileName, $extension)

selectOne returns a single template

Parameters
  • $dirName
  • $fileName
  • $extension

public void update($dirName, $fileName, $extension, $content, $oldFileName=NULL, $oldExtension=NULL)

update an existing template

Parameters
  • $dirName
  • $fileName
  • $extension
  • $content
  • $oldFileName
  • $oldExtension

Show inherited public methods

Inherited public methods

Protected methods

protected void getBaseQuery()

getBaseQuery builder object

protected void getQuery($ignoreDeleted=true)

getQuery object

Parameters
  • $ignoreDeleted

protected void makeFilePath($dirName, $fileName, $extension)

makeFilePath helper to make file path

Parameters
  • $dirName
  • $fileName
  • $extension

Show inherited protected methods

Inherited protected methods