October\Rain\Halcyon\Datasource\FileDatasource

Extends:

Implements:

  • October\Rain\Halcyon\Datasource\DatasourceInterface

FileDatasource

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

Public methods

public void __construct($basePath, $files)

__construct a new datasource instance

Parameters
  • $basePath
  • $files

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

delete against the datasource

Parameters
  • $dirName
  • $fileName
  • $extension

public void getBasePath()

getBasePath returns the base path for this datasource

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 makeFilePath($dirName, $fileName, $extension)

makeFilePath helper to make file path

Parameters
  • $dirName
  • $fileName
  • $extension

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

validateDirectoryForSave ensures the requested file can be created in the requested directory

Parameters
  • $dirName
  • $fileName
  • $extension

Show inherited protected methods

Inherited protected methods