PHP Class Webiny\Component\Entity\Attribute\Many2ManyAttribute

Inheritance: extends AbstractCollectionAttribute, use trait Webiny\Component\Mongo\MongoTrait
Mostra file Open project: Webiny/Framework Class Usage Examples

Protected Properties

Property Type Description
$addedItems
$intermediateCollection

Public Methods

Method Description
__construct ( $attribute = null, AbstractEntity $entity = null, $collectionName )
getValue ( array $params = [], boolean $processCallbacks = true ) : null | EntityCollection Get attribute value
hasValue ( )
save ( ) Insert links into DB
setValue ( null $value = null, boolean $fromDb = false ) Set or get attribute value
unlink ( string | AbstractEntity $item ) : boolean Remove item from many2many collection (removes the link between entities)
unlinkAll ( ) : boolean Remove all items from man2many collection (removes the links between entities)

Protected Methods

Method Description
extractClassName ( $class ) : string Extract short class name from class namespace
load ( ) : EntityCollection Load many2many attribute value (prepares MongoCursor, lazy loads data)
unlinkItem ( string | AbstractEntity $item ) : boolean Unlink given item (only removes the aggregation record)

Method Details

__construct() public method

public __construct ( $attribute = null, AbstractEntity $entity = null, $collectionName )
$entity Webiny\Component\Entity\AbstractEntity

extractClassName() protected method

Extract short class name from class namespace
protected extractClassName ( $class ) : string
$class
return string

getValue() public method

Get attribute value
public getValue ( array $params = [], boolean $processCallbacks = true ) : null | EntityCollection
$params array
$processCallbacks boolean
return null | Webiny\Component\Entity\EntityCollection

hasValue() public method

public hasValue ( )

load() protected method

Load many2many attribute value (prepares MongoCursor, lazy loads data)
protected load ( ) : EntityCollection
return Webiny\Component\Entity\EntityCollection

save() public method

Insert links into DB
public save ( )

setValue() public method

Set or get attribute value
public setValue ( null $value = null, boolean $fromDb = false )
$value null
$fromDb boolean

unlinkAll() public method

Remove all items from man2many collection (removes the links between entities)
public unlinkAll ( ) : boolean
return boolean

unlinkItem() protected method

Unlink given item (only removes the aggregation record)
protected unlinkItem ( string | AbstractEntity $item ) : boolean
$item string | Webiny\Component\Entity\AbstractEntity
return boolean

Property Details

$addedItems protected_oe property

protected $addedItems

$intermediateCollection protected_oe property

protected $intermediateCollection