class ProductRelationshipExtension extends Twig_Extension

Class ProductRelationshipExtension is injected as twig.extension.empire_product_relationship_plugin service. ProductRelationshipExtension handles the logic and provides necessary data for managed entity in twig.

Properties

protected ProductRelationshipManager $manager
protected $relationships
protected ArrayCollection $relationshipNames

Methods

__construct(ProductRelationshipManager $manager)

EmpirePromoProductsExtension constructor.

getFunctions()

{@inheritdoc}

getRelationship(int $productId, string $relationshipName)

Get relationship entity for specified product and relationship name

array
getRelationshipNames()

Get all relationship names

array
getRelationshipNamesForProduct(int $id)

Get relationship names for specified product

array
getRelationshipPagination(int $relationshipId, int $productId)

Get data for products in relationship

string
getName()

Returns the name of the extension.

array
array

Details

at line 40
__construct(ProductRelationshipManager $manager)

EmpirePromoProductsExtension constructor.

Parameters

ProductRelationshipManager $manager

at line 48
getFunctions()

{@inheritdoc}

at line 67
ProductRelationship|bool getRelationship(int $productId, string $relationshipName)

Get relationship entity for specified product and relationship name

Parameters

int $productId
string $relationshipName

Return Value

ProductRelationship|bool

at line 76
array getRelationshipNames()

Get all relationship names

Return Value

array

at line 91
array getRelationshipNamesForProduct(int $id)

Get relationship names for specified product

Parameters

int $id

Return Value

array

at line 107
array getRelationshipPagination(int $relationshipId, int $productId)

Get data for products in relationship

Parameters

int $relationshipId
int $productId

Return Value

array

at line 118
string getName()

Returns the name of the extension.

Return Value

string The extension name

at line 126
array getAllAvailableRelationshipPositions()

Return Value

array

at line 134
array getAllAvailableRelationshipTypes()

Return Value

array