Relation
Table of Contents
Methods
- __construct() : mixed
- areItemsBound() : bool
- Returns true if the items are bound
- bindItems() : Result
- Bind the provided items with each other
- create() : Relation
- Create a new Relation Object
- getChildElements() : array<string|int, ItemIdentifier>
- Returns ItemIdentifier objects of elements that are children to the provided parent Only the items that are bound by this relation are taken into account
- getChildEntityTypeId() : int
- Returns $entityTypeId of the child type
- getIdentifier() : RelationIdentifier
- Returns an identifier that is associated with this relation
- getParentElements() : array<string|int, ItemIdentifier>
- Returns ItemIdentifier objects of elements that are parents to the provided child Only the items that are bound by this relation are taken into account
- getParentEntityTypeId() : int
- Returns $entityTypeId of the parent type
- getSettings() : Settings
- hasEqualIdentifier() : bool
- Returns true if this relation is described by the identifier (has same parent and child entityTypeId)
- isChildrenListEnabled() : bool
- Returns true if a list (grid) of child elements, associated with this relation, should be displayed on a parent element details page Always true for predefined relations
- isPredefined() : bool
- Returns true if this relation is predefined (set on the system level) and can not be changed, unbound, etc.
- replaceAllItemBindings() : Result
- Unbind the provided items
- setChildrenListEnabled() : $this
- setSettings() : self
- setStorageStrategy() : $this
- Set a StorageStrategy object, that would be used in methods that communicate with the DB.
- unbindItems() : Result
- Unbind the provided items
Methods
__construct()
public
__construct(RelationIdentifier $identifier, Settings $settings) : mixed
Parameters
- $identifier : RelationIdentifier
- $settings : Settings
areItemsBound()
Returns true if the items are bound
public
areItemsBound(ItemIdentifier $parent, ItemIdentifier $child) : bool
Parameters
- $parent : ItemIdentifier
- $child : ItemIdentifier
Return values
boolbindItems()
Bind the provided items with each other
public
bindItems(ItemIdentifier $parent, ItemIdentifier $child) : Result
Parameters
- $parent : ItemIdentifier
- $child : ItemIdentifier
Return values
Resultcreate()
Create a new Relation Object
public
static create(int $parentEntityTypeId, int $childEntityTypeId[, bool $isChildrenListEnabled = true ]) : Relation
Parameters
- $parentEntityTypeId : int
- $childEntityTypeId : int
- $isChildrenListEnabled : bool = true
Return values
RelationgetChildElements()
Returns ItemIdentifier objects of elements that are children to the provided parent Only the items that are bound by this relation are taken into account
public
getChildElements(ItemIdentifier $parent) : array<string|int, ItemIdentifier>
Parameters
- $parent : ItemIdentifier
Return values
array<string|int, ItemIdentifier>getChildEntityTypeId()
Returns $entityTypeId of the child type
public
getChildEntityTypeId() : int
Return values
intgetIdentifier()
Returns an identifier that is associated with this relation
public
getIdentifier() : RelationIdentifier
Return values
RelationIdentifiergetParentElements()
Returns ItemIdentifier objects of elements that are parents to the provided child Only the items that are bound by this relation are taken into account
public
getParentElements(ItemIdentifier $child) : array<string|int, ItemIdentifier>
Parameters
- $child : ItemIdentifier
Return values
array<string|int, ItemIdentifier>getParentEntityTypeId()
Returns $entityTypeId of the parent type
public
getParentEntityTypeId() : int
Return values
intgetSettings()
public
getSettings() : Settings
Return values
SettingshasEqualIdentifier()
Returns true if this relation is described by the identifier (has same parent and child entityTypeId)
public
hasEqualIdentifier(RelationIdentifier $identifier) : bool
Parameters
- $identifier : RelationIdentifier
Return values
boolisChildrenListEnabled()
Returns true if a list (grid) of child elements, associated with this relation, should be displayed on a parent element details page Always true for predefined relations
public
isChildrenListEnabled() : bool
Return values
boolisPredefined()
Returns true if this relation is predefined (set on the system level) and can not be changed, unbound, etc.
public
isPredefined() : bool
Return values
boolreplaceAllItemBindings()
Unbind the provided items
public
replaceAllItemBindings(ItemIdentifier $oldItem, ItemIdentifier $newItem) : Result
Parameters
- $oldItem : ItemIdentifier
- $newItem : ItemIdentifier
Return values
ResultsetChildrenListEnabled()
public
setChildrenListEnabled(bool $isChildrenListEnabled) : $this
Parameters
- $isChildrenListEnabled : bool
Return values
$thissetSettings()
public
setSettings(Settings $settings) : self
Parameters
- $settings : Settings
Return values
selfsetStorageStrategy()
Set a StorageStrategy object, that would be used in methods that communicate with the DB.
public
setStorageStrategy(StorageStrategy $storageStrategy) : $this
(Relation::areItemsBound, Relation::bindItems, etc.)
Parameters
- $storageStrategy : StorageStrategy
Return values
$thisunbindItems()
Unbind the provided items
public
unbindItems(ItemIdentifier $parent, ItemIdentifier $child) : Result
Parameters
- $parent : ItemIdentifier
- $child : ItemIdentifier