-
Docs
Backend
-
Behaviors
-
Classes
-
Controllers
-
Database
-
Seeds
-
-
Facades
-
FormWidgets
-
Helpers
-
Exception
- Backend
-
-
Models
-
ReportWidgets
-
Skins
-
Traits
-
Widgets
- ServiceProvider
-
-
Cms
-
Classes
- Asset
- AutoDatasource
- CmsCompoundObject
- CmsController
- CmsException
- CmsObject
- CmsObjectCollection
- CodeBase
- CodeParser
- ComponentBase
- ComponentHelpers
- ComponentManager
- ComponentPartial
- Content
- Controller
- Layout
- LayoutCode
- MediaLibrary
- MediaLibraryItem
- MediaViewHelper
- Meta
- ObjectMemoryCache
- Page
- PageCode
- Partial
- PartialCode
- PartialStack
- Router
- Theme
- ThemeManager
-
Components
-
Contracts
-
Controllers
-
Facades
-
FormWidgets
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ComponentNode
- ComponentTokenParser
- ContentNode
- ContentTokenParser
- DebugExtension
- DefaultNode
- DefaultTokenParser
- Extension
- FlashNode
- FlashTokenParser
- FrameworkNode
- FrameworkTokenParser
- Loader
- PageNode
- PageTokenParser
- PartialNode
- PartialTokenParser
- PlaceholderNode
- PlaceholderTokenParser
- PutNode
- PutTokenParser
- ScriptsNode
- ScriptsTokenParser
- StylesNode
- StylesTokenParser
-
Widgets
- ServiceProvider
-
-
System
-
Behaviors
-
Classes
-
Console
-
Controllers
-
Database
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ServiceProvider
-
-
Events
-
backend
-
ajax
-
filter
-
form
-
list
-
menu
-
page
-
user
-
-
cms
-
ajax
-
block
-
combiner
-
component
-
object
-
page
-
router
-
template
-
theme
-
-
halcyon
-
datasource
-
-
mailer
-
media
-
model
-
system
-
assets
-
console
-
mirror
-
theme
-
-
reportwidgets
-
settings
- extendConfigFile
-
-
translator
-
-
Library
-
Argon
-
Auth
-
Models
- AuthException
- Manager
-
-
Config
-
Cookie
-
Middleware
-
-
Database
-
Attach
-
Behaviors
-
Concerns
-
Connections
-
Connectors
-
Models
-
Relations
-
Schema
-
Traits
-
Updates
- README
- Builder
- Collection
- DatabaseServiceProvider
- DataFeed
- Dongle
- MemoryCache
- Model
- ModelBehavior
- ModelException
- NestedTreeScope
- Pivot
- QueryBuilder
- SortableScope
- TreeCollection
- Updater
-
-
Events
-
Exception
-
Extension
-
Filesystem
-
Flash
-
Foundation
-
Bootstrap
-
Console
-
Exception
-
Http
-
Middleware
- Kernel
-
-
Providers
- Application
- Maker
-
-
Halcyon
-
Datasource
-
Exception
-
Processors
-
Traits
- README
- Builder
- Collection
- HalcyonServiceProvider
- MemoryCacheManager
- MemoryRepository
- Model
-
-
Html
-
Mail
-
Network
-
Parse
-
Router
-
Scaffold
-
Support
-
Translation
-
- Documentation
- API
- Cms
- Classes
- AutoDatasource
Cms\Classes\AutoDatasource
Source: ~/modules/cms/classes/AutoDatasource.php
Extends:
Implements:
Datasource that loads from other data sources automatically
Public properties
public string $activeDatasourceKey
The key for the datasource to perform CRUD operations on
Protected properties
protected array $datasources
The available datasource instances
protected array $pathCache
Local cache of paths available in the datasources
protected boolean $allowCacheRefreshes
Flag on whether the cache should respect refresh requests
Show inherited protected properties
Inherited protected properties
- protected bool $forceDeleting - defined in October\Rain\Halcyon\Datasource\Datasource. Indicates if the record is currently being force deleted.
- protected October\Rain\Halcyon\Processors\Processor $postProcessor - defined in October\Rain\Halcyon\Datasource\Datasource. The query post processor implementation.
- protected array $emitterSingleEventCollection - defined in October\Rain\Halcyon\Datasource\Datasource. Collection of registered events to be fired once only.
- protected array $emitterEventCollection - defined in October\Rain\Halcyon\Datasource\Datasource. Collection of registered events.
- protected array $emitterEventSorted - defined in October\Rain\Halcyon\Datasource\Datasource. Sorted collection of events.
Public methods
public void __construct(array $datasources)
Create a new datasource instance.
Parameters
- array $datasources - Array of datasources to utilize. Lower indexes = higher priority ['datasourceName' => $datasource]
public int delete(string $dirName, string $fileName, string $extension)
Run a delete statement against the datasource, only runs delete on active datasource
Parameters
- string $dirName
- string $fileName
- string $extension
public array getAvailablePaths()
Get all available paths within this datastore
public string getPathsCacheKey()
Generate a paths cache key unique to this datasource
public void getSourcePaths(string $source)
Get the available paths for the specified datasource key
Parameters
- string $source - The string key of the datasource to check
public bool insert(string $dirName, string $fileName, string $extension, string $content)
Creates a new template, only inserts to the active datasource
Parameters
- string $dirName
- string $fileName
- string $extension
- string $content
public int lastModified(string $dirName, string $fileName, string $extension)
Return the last modified date of an object
Parameters
- string $dirName
- string $fileName
- string $extension
public string makeCacheKey(string $name='')
Generate a cache key unique to this datasource.
Parameters
- string $name
public void pushToSource(Model $model, string $source)
Push the provided model to the specified datasource
Parameters
- Model $model - The Halcyon Model to push
- string $source - The string key of the datasource to use
public void removeFromSource(Model $model, string $source)
Remove the provided model from the specified datasource
Parameters
- Model $model - The Halcyon model to remove
- string $source - The string key of the datasource to use
public array select(string $dirName, array $options=array())
Returns all templates.
Parameters
- string $dirName
- array $options - Array of 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 ];
public mixed selectOne(string $dirName, string $fileName, string $extension)
Returns a single template.
Parameters
- string $dirName
- string $fileName
- string $extension
public boolean sourceHasModel(string $source, Model $model)
Check to see if the specified datasource has the provided Halcyon Model
Parameters
- string $source - The string key of the datasource to check
- Model $model - The Halcyon Model to check for
public int update(string $dirName, string $fileName, string $extension, string $content, string $oldFileName=NULL, string $oldExtension=NULL)
Updates an existing template.
Parameters
- string $dirName
- string $fileName
- string $extension
- string $content
- string $oldFileName - Defaults to null
- string $oldExtension - Defaults to null
Inherited public methods
- public self bindEvent($event, $callback, $priority=0) - defined in October\Rain\Halcyon\Datasource\Datasource. Create a new event binding.
- public self bindEventOnce($event, $callback) - defined in October\Rain\Halcyon\Datasource\Datasource. Create a new event binding that fires once only.
- public array fireEvent(string $event, array $params=array(), boolean $halt=false) - defined in October\Rain\Halcyon\Datasource\Datasource. Fire an event and call the listeners.
- public void forceDelete(string $dirName, string $fileName, string $extension) - defined in October\Rain\Halcyon\Datasource\Datasource. Force the deletion of a record against the datasource.
- public October\Rain\Halcyon\Processors\Processor getPostProcessor() - defined in October\Rain\Halcyon\Datasource\Datasource. Get the query post processor used by the connection.
- public self unbindEvent(string $event=NULL) - defined in October\Rain\Halcyon\Datasource\Datasource. Destroys an event binding.
Protected methods
protected DatasourceInterface getActiveDatasource()
Get the datasource for use with CRUD operations
protected Datasource getDatasourceForPath(string $path)
Get the appropriate datasource for the provided path
Parameters
- string $path
protected array getValidPaths(string $dirName, array $options=array())
Get all valid paths for the provided directory, removing any paths marked as deleted
Parameters
- string $dirName
- array $options - Array of options, [ 'extensions' => ['htm', 'md', 'twig'], // Extensions to search for 'fileMatch' => '*gr[ae]y', // Shell matching pattern to match the filename against using the fnmatch function ];
protected string makeFilePath(string $dirName, string $fileName, string $extension)
Helper to make file path.
Parameters
- string $dirName
- string $fileName
- string $extension
protected void populateCache(boolean $refresh=false)
Populate the local cache of paths available in each datasource
Parameters
- boolean $refresh - Default false, set to true to force the cache to be rebuilt
Show inherited protected methods
Inherited protected methods
- protected array emitterEventSortEvents(string $eventName) - defined in October\Rain\Halcyon\Datasource\Datasource. Sort the listeners for a given event by priority.