FileRef
FileRef
Represents a reference to an external file whose contents should replace a data-sync field value.
class FileRef extends \Hazaar\Model\StructExtends: Hazaar\Model\Struct
Recognises the ::file(relative/path) marker - a sibling convention to Macro's ::table(field):criteria, not an extension of it, since Macro's own grammar has no way to express a filesystem path (its parenthetical group only matches \w+, so a path containing / or . can never be parsed as a Macro).
Properties
path
The relative path to the file, as written in the sync data (not yet resolved/validated).
public string $pathType: string
Methods
Matches a ::file(...) marker in a string and returns a FileRef instance if found.
public (string $field): ?selfReturns: self
Parameters
| Parameter | Type | Description |
|---|---|---|
$field | string | the string to match against the file-reference pattern |
resolve
Resolves and loads the referenced file's contents.
public resolve(string $baseDir): stringReturns: string
The path must be relative and must not resolve outside of $baseDir - both an absolute path and a .. traversal (including through symlinks, via the realpath containment check) are rejected.
Parameters
| Parameter | Type | Description |
|---|---|---|
$baseDir | string | the directory the path is resolved relative to |
Generated by Hazaar API Doc Generator on Sun, 23 Aug 2026 10:49:44 +0000