FileAccess Orion

Relation extends BaseRelation
in package
Uses RangeActive

Implement relation master object

This class provides general interfaces to handle the relation content. This content is used to register contents in folders.

Tags
category

Core content type

author

Tobias Teichner webmaster@teichner.biz

since

File available since v0.19

Table of Contents

$storage  : string
is either a extension or a content relation
$resolved_content  : BaseContent|null
Basic content storage
__construct()  : mixed
Relation constructor.
Copy()  : Result|null
Copy this relation to a new folder
CopyWithContent()  : Result
Move to other folder
Delete()  : Result
Delete relation
Directory()  : Folder
GetAssignedInfo()  : string|null
Get the assignment info from properties
GetFolder()  : string
Get the parent folder of the relation
HasDetailView()  : bool
Has a detail view attribute on true
IsActive()  : bool
Check is active state
IsValid()  : bool
Is valid for filter
Move()  : Result
Move to other folder
Position()  : string|null
Get the target position
RawObject()  : BaseContent|null
Resolve to raw object
Save()  : Result
Store relation
SearchFields()  : array<string|int, mixed>
Return search indexer fields
ToPlainObject()  : object
Convert to plain data set translate and expose the current data attribute as plain resolved object

Properties

$storage

is either a extension or a content relation

protected string $storage = ''

The storage, extensions|relations

$resolved_content

Basic content storage

private BaseContent|null $resolved_content = null

Methods

__construct()

Relation constructor.

public __construct(string $root[, string|null $id = null ][, string|null $language = null ][, string $sub_type = 'relation' ]) : mixed
Parameters
$root : string

The root folder, cal also be the id

$id : string|null = null

The relation id or, null for new relations

$language : string|null = null

The local language

$sub_type : string = 'relation'

A possible sub type

Return values
mixed

Copy()

Copy this relation to a new folder

public Copy([null $target = null ]) : Result|null
Parameters
$target : null = null
Return values
Result|null

CopyWithContent()

Move to other folder

public CopyWithContent(string $target[, string|null $position = null ][, int $order = -1 ]) : Result
Parameters
$target : string

Path to the target folder

$position : string|null = null

The target position

$order : int = -1

The new order offset

Return values
Result

A system result object

Delete()

Delete relation

public Delete([bool $skip = false ][, bool $full = false ]) : Result

Delete the relation and on demand remove the assigned content

Parameters
$skip : bool = false

Skip hooks on demand

$full : bool = false

When true, the sub content will be deleted

Return values
Result

A system result object

GetAssignedInfo()

Get the assignment info from properties

public GetAssignedInfo([string $key = 'type' ]) : string|null
Parameters
$key : string = 'type'

The key, type|value

Return values
string|null

GetFolder()

Get the parent folder of the relation

public GetFolder() : string
Return values
string

HasDetailView()

Has a detail view attribute on true

public HasDetailView() : bool
Return values
bool

IsActive()

Check is active state

public IsActive([array<string|int, mixed>|null $row = null ][, string $from = 'datefrom' ][, string $to = 'dateto' ][, int|null $now = null ]) : bool

Check if the element is active and valid at the current time

Parameters
$row : array<string|int, mixed>|null = null
$from : string = 'datefrom'
$to : string = 'dateto'
$now : int|null = null
Return values
bool

Entry is active based on date from and date to property

IsValid()

Is valid for filter

public IsValid([array<string|int, mixed> $filter = array() ]) : bool

Test if a relation is valid for the defined time span, enabled and has a certain content type assigned

Parameters
$filter : array<string|int, mixed> = array()

A set of filters date_to int A timestamp for date to, when empty use time() date_from int A timestamp for date from, when empty use time() ignore_active bool When true, the is active flag is not checked content_types array List of allowed content types

Return values
bool

Move()

Move to other folder

public Move(string $target[, string|null $position = null ][, int $order = -1 ][, bool $new_id = false ]) : Result
Parameters
$target : string

Path to the target folder

$position : string|null = null

The target position

$order : int = -1

The new order offset

$new_id : bool = false

When true register relation with new id

Return values
Result

A system result object

Position()

Get the target position

public Position() : string|null
Return values
string|null

The position in template

RawObject()

Resolve to raw object

public RawObject([string|null $language = null ]) : BaseContent|null

Fetches the linked raw object from storage based on the assigned values. This method is cached locally.

Parameters
$language : string|null = null

Language code

Return values
BaseContent|null

A system base content object

Save()

Store relation

public Save([bool $force_new_id = false ]) : Result

Save object entry in file system and git repository store the current payload inside the system storage and commit the changes to the local repository

Parameters
$force_new_id : bool = false

Indicate force new id on demand (local id empty)

Return values
Result

A default system result set

SearchFields()

Return search indexer fields

public SearchFields() : array<string|int, mixed>

Convert instance to search indexer values

Return values
array<string|int, mixed>

The search indexer fields

ToPlainObject()

Convert to plain data set translate and expose the current data attribute as plain resolved object

public ToPlainObject([string $language = null ][, bool $resolve = true ]) : object
Parameters
$language : string = null

A system language code or empty for raw setup

$resolve : bool = true

When set to true the sub content will also be resolved, parent attributes are always present

Return values
object

A simple attribute based php object

Search results