Builder for Halcyon queries

Public Properties

public array $columns

columns that should be returned

public array $extensions

extensions filter the query by these file extensions

public string $from

from the directory name which the query is targeting

public bool $selectSingle

selectSingle query should pluck a single record

public string $fileMatch

fileMatch using the specified pattern

public array $orders

orders is the orderings for the query

public int $limit

limit is the maximum number of records to return

public int $offset

offset is the number of records to skip

Protected Properties

protected October\Rain\Halcyon\Datasource\DatasourceInterface $datasource

datasource instance

protected October\Rain\Halcyon\Model $model

model being queried

protected October\Rain\Halcyon\Processors\Processor $processor

processor datasource query post processor instance

protected string $cacheKey

cacheKey that should be used when caching the query

protected int $cacheMinutes

cacheMinutes number of minutes to cache the query

protected array $cacheTags

cacheTags for the query cache

protected string $cacheDriver

cacheDriver to be used

protected bool $loadedFromCache

loadedFromCache is an internal variable to specify if the record was loaded from cache

Public Methods

public __call()

public __call(string $method, array $parameters): mixed 

__call handles dynamic method calls into the method

public __construct()

public __construct($datasource, $processor): void

__construct creates a new query builder instance

public cacheDriver()

public cacheDriver(string $cacheDriver): $this 

cacheDriver indicate that the results, if cached, should use the given cache driver

public cacheTags()

public cacheTags(array|mixed $cacheTags): $this 

cacheTags indicates that the results, if cached, should use the given cache tags

public delete()

public delete(): int 

delete a record from the database.

public find()

public find(string $fileName): mixed|static 

find a single template by its file name.

public first()

public first(): mixed|static 

first executes the query and get the first result

public from()

public from(string $dirName): $this 

from sets the directory name which the query is targeting

public generateCacheKey()

public generateCacheKey(): string 

generateCacheKey for the query

public get()

public get(
    array $columns = [ 0 => '*']
): October\Rain\Halcyon\Collection|static[] 

get executes the query as a "select" statement

public getCacheKey()

public getCacheKey(): string 

getCacheKey gets a unique cache key for the complete query

public getCached()

public getCached(array $columns = [ 0 => '*']): array 

getCached executes the query as a cached "select" statement

public getFresh()

public getFresh(
    array $columns = [ 0 => '*']
): October\Rain\Halcyon\Collection|static[] 

getFresh executes the query as a fresh "select" statement

public getModel()

public getModel(): October\Rain\Halcyon\Model 

getModel instance being queried

public getModels()

public getModels(array $results): October\Rain\Halcyon\Model[] 

getModels gets the hydrated models

public insert()

public insert($values): bool 

insert a new record into the datasource.

public lastModified()

public lastModified(): int 

lastModified returns the last modified time of the object

public limit()

public limit(int $value): $this 

limit sets the "limit" value of the query

public lists()

public lists(string $column, string $key = null): array 

lists is short-hand for pluck()->all()

public offset()

public offset(int $value): $this 

offset sets the "offset" value of the query

public pluck()

public pluck(string $column, string $key = null): Collection 

pluck gets an array with the values of a given column

public remember()

public remember(DateTime|int $minutes, string $key = null): $this 

remember indicates that the query results should be cached

public rememberForever()

public rememberForever(string $key = null): $this 

rememberForever indicates that the query results should be cached forever

public setModel()

public setModel($model): $this 

setModel instance for the model being queried

public skip()

public skip(int $value): October\Rain\Halcyon\Builder|static 

skip is an alias to set the "offset" value of the query

public take()

public take(int $value): October\Rain\Halcyon\Builder|static 

take is an alias to set the "limit" value of the query

public toCompiled()

public toCompiled(): string 

toCompiled gets the compiled file content representation of the query

public update()

public update($values): int 

update a record in the datasource.

public whereFileName()

public whereFileName(string $fileName): $this 

whereFileName switches mode to select a single template by its name

Protected Methods

protected getCache()

protected getCache(): Illuminate\Cache\CacheManager 

getCache object with tags assigned, if applicable

protected getCacheCallback()

protected getCacheCallback(string $fileName): Closure 

getCacheCallback used when caching queries

protected isCacheBusted()

protected isCacheBusted(array $result): bool 

isCacheBusted returns true if the cache for the file is busted. This only applies to single record selection

protected processInitCacheData()

protected processInitCacheData(array $data): array 

processInitCacheData initializes the cache data of each record

protected runSelect()

protected runSelect(): array 

runSelect runs the query as a "select" statement against the datasource

protected validateDirectoryName()

protected validateDirectoryName(string $dirName = null): void

validateDirectoryName validates the supplied directory path

protected validateFileName()

protected validateFileName(string $fileName = null): void

validateFileName validates the supplied filename, extension and path

protected validateFileNameExtension()

protected validateFileNameExtension(
    string $fileName,
    array $allowedExtensions
): void 

validateFileNameExtension validates whether a file has an allowed extension

protected validateFileNamePath()

protected validateFileNamePath(
    string $filePath,
    int $maxNesting = 5
): void 

validateFileNamePath validates a template path Template directory and file names can contain only alphanumeric symbols, dashes and dots.

protected validateFileNamePattern()

protected validateFileNamePattern(string $fileName): boolean 

validateFileNamePattern validates a template file or directory name template file names can contain only alphanumeric symbols, dashes, underscores and dots.