Models¶

Attribute¶

Every attribute is represented by the Attribute model which by default has the following properties:

Property Description
id Unique id of the attribute
type Attribute’s type (‘text’ by default)
name Attribute’s name (from AttributeTranslation)
configuration Attribute’s configuration
translatable Attribute possibility to be translated
storageType Defines how attribute value should be stored in database
createdAt Date when attribute was created
updatedAt Date of last attribute update

Note

This model uses the TranslatableTrait and implements the AttributeInterface.

For more detailed information go to Sylius Attribute Component Attribute.

Attention

Attribute’s type is an alias of AttributeType service.

AttributeValue¶

This model binds the subject and the attribute, it is used to store the value of the attribute for the subject. It has the following properties:

Property Description
id Unique id of the attribute value
subject Reference to attribute’s subject
attribute Reference to an attribute
value Attribute’s value (not mapped)
text Value of attribute stored as text
boolean Value of attribute stored as boolean
integer Value of attribute stored as integer
float Value of attribute stored as float
datetime Value of attribute stored as datetime
date Value of attribute stored as date
json Value of attribute stored as array

Attention

Value property is used only as proxy, that stores data in proper field. It’s crucial to set attribute value in field, that is mapped as attribute’s storage type.

Note

This model implements the AttributeValueInterface.

For more detailed information go to Sylius Attribute Component AttributeValue.

AttributeTranslation¶

The attribute’s name for different locales is represented by the AttributeTranslation model which has the following properties:

Property Description
id Unique id of the attribute translation
name Attribute’s name for given locale

Note

This model extends the AbstractTranslation class and implements the AttributeTranslationInterface.

For more detailed information go to Sylius Attribute Component AttributeTranslation.