FileAccess Orion

AmountRelation extends Relation
in package

Implement relation extension 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 v3.12.1

Table of Contents

$sub_location  : string|null
$storage  : string
is either a extension or a content relation
$resolved_content  : BaseContent|null
Basic content storage
__construct()  : mixed
Amount relation constructor.
Amount()  : float
Get/Set amount
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
Limit()  : float
Move()  : Result
Move to other folder
Position()  : string|null
Get the target position
RawObject()  : BaseContent|null
Resolve to raw object
Save()  : Result|void|null
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

$sub_location

public string|null $sub_location

Sub relation description, the storage box or something alike

$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()

Amount relation constructor.

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

The root folder, could also be the id

$id : string|null = null

The relation id or, null for new relations

$language : string|null = null

The local language

Return values
mixed

Amount()

Get/Set amount

public Amount([float|null $amount = null ]) : float
Parameters
$amount : float|null = null
Return values
float

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()

public Save([false $force_new_id = false ]) : Result|void|null
Parameters
$force_new_id : false = false
Return values
Result|void|null

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