Finder
class Finder
Properties
protected SourceInterface | $source | The source instance. |
|
protected Processor | $processor | The source query processor instance. |
|
protected Model | $model | The model being queried. |
|
array | $extensions | Filter by these file extensions. |
|
array | $columns | The columns that should be returned. |
|
string | $in | The directory name which the finder is targeting. |
|
bool | $select | Query should pluck a single record. |
|
string | $fileMatch | Match files using the specified pattern. |
|
array | $orders | The orderings for the query. |
|
int | $limit | The maximum number of records to return. |
|
int | $offset | The number of records to skip. |
|
protected string | $cacheKey | The key that should be used when caching the query. |
|
protected int | $cacheSeconds | The number of seconds to cache the query. |
|
protected array | $cacheTags | The tags for the query cache. |
|
protected string | $cacheDriver | The cache driver to be used. |
|
protected bool | $loadedFromCache | Internal variable to specify if the record was loaded from cache. |
Methods
Switches mode to select a single template by its name.
Set the directory name which the finder is targeting.
Set the "offset" value of the query.
Set the "limit" value of the query.
Get an array with the values of a given column.
Insert a new record into the source.
Update a record in the source.
Delete a source from the filesystem.
Returns the last modified time of the object.
Execute the query as a fresh "select" statement.
Run the query as a "select" statement against the source.
Validate the supplied filename, extension and path.
Validates whether a file has an allowed extension.
Validates a template path.
Indicate that the query results should be cached forever.
Indicate that the results, if cached, should use the given cache tags.
Indicate that the results, if cached, should use the given cache driver.
Execute the query as a cached "select" statement.
Returns true if the cache for the file is busted. This only applies to single record selection.
Get the cache object with tags assigned, if applicable.
Get a unique cache key for the complete query.
Generate the unique cache key for the query.
Get the Closure callback used when caching queries.
Initialize the cache data of each record.
Clears the internal request-level object cache.
Handle dynamic method calls into the method.
Details
at line 118
__construct(SourceInterface $source, Processor $processor)
Create a new query finder instance.
at line 131
$this
whereFileName(string $fileName)
Switches mode to select a single template by its name.
at line 145
$this
in(string $dirName)
Set the directory name which the finder is targeting.
at line 159
$this
offset(int $value)
Set the "offset" value of the query.
at line 185
$this
limit(int $value)
Set the "limit" value of the query.
at line 213
mixed|Finder
find(string $fileName)
Find a single template by its file name.
at line 222
mixed|Finder
first()
Execute the query and get the first result.
at line 234
Collection|Finder[]
get(array $columns = ['*'])
Execute the query as a "select" statement.
at line 256
array|Collection
lists(string $column, string $key = null)
Get an array with the values of a given column.
at line 272
bool
insert(array $values)
Insert a new record into the source.
at line 299
int
update(array $values)
Update a record in the source.
at line 330
bool
delete()
Delete a source from the filesystem.
at line 348
int
lastModified()
Returns the last modified time of the object.
at line 368
Collection|Finder[]
getFresh(array $columns = ['*'])
Execute the query as a fresh "select" statement.
at line 383
protected array
runSelect()
Run the query as a "select" statement against the source.
at line 404
$this
setModel(Model $model)
Set a model instance for the model being queried.
at line 422
Model[]
getModels(array $results)
Get the hydrated models.
at line 444
Model
getModel()
Get the model instance being queried.
at line 460
protected bool
validateFileName(string $fileName = null)
Validate the supplied filename, extension and path.
at line 487
protected void
validateFileNameExtension(string $fileName, array $allowedExtensions)
Validates whether a file has an allowed extension.
at line 507
protected bool
validateFileNamePath(string $filePath, int $maxNesting = 2)
Validates a template path.
Template directory and file names can contain only alphanumeric symbols, dashes and dots.
at line 545
$this
remember(DateTime|int $seconds, string $key = null)
Indicate that the query results should be cached.
at line 559
$this
rememberForever(string $key = null)
Indicate that the query results should be cached forever.
at line 571
$this
cacheTags(array|mixed $cacheTags)
Indicate that the results, if cached, should use the given cache tags.
at line 585
$this
cacheDriver(string $cacheDriver)
Indicate that the results, if cached, should use the given cache driver.
at line 599
array
getCached(array $columns = ['*'])
Execute the query as a cached "select" statement.
at line 654
protected bool
isCacheBusted(array $result)
Returns true if the cache for the file is busted. This only applies to single record selection.
at line 677
protected CacheManager
getCache()
Get the cache object with tags assigned, if applicable.
at line 688
string
getCacheKey()
Get a unique cache key for the complete query.
at line 697
string
generateCacheKey()
Generate the unique cache key for the query.
at line 716
protected Closure
getCacheCallback($columns)
Get the Closure callback used when caching queries.
at line 730
protected array
processInitCacheData(array $data)
Initialize the cache data of each record.
at line 746
static
clearInternalCache()
Clears the internal request-level object cache.
at line 760
mixed
__call(string $method, array $parameters)
Handle dynamic method calls into the method.