The CatalogElement class defines the generic product and category model which is used within %ses-brand. It inherits from the general class ValueObject which offers a convenient way of setting properties of instances via the constructor and makes these properties public readable (like $valueObject->name).

Inheriting from CatalogElement there are some sub classes worth mentioning:

Predefined properties for CatalogElement

Each CatalogElement has predefined properties. These methods are validated automated on constructor by the validateProperties() method.

namestringThe name of the catalog
textstringA short introduction text for the catalog
imageImageField (FieldInterface)An image for the catalog
patharrayThe path of the catalog (array of identifier)
urlstringThe internal URL of the catalog. This url should not be used for generating a link! Please use seoUrl instead
seoUrlstringThe human readable URL of the category

The internal permanent URL

parentElementIdentifierstringThe unqique identifier of the parent catalog
identifierstringThe unqique identifier
A list of Field objects
cache identifier of element to use as key in cache storage

There are 4 public methods to set properties:

  • setImage, 
  • setName, 
  • setText, 
  • setCacheIdentifier

Validators for CatalogElement

List of possible validators to used when attributes are set in CatalogElement

checks if the value is a valid string
checks if the value is a valid boolean
checks if the value is a valid float
checks if the value is a valid integer
checks if the value is of given Field Type
checks if the value is an array
checks if the value is an array of concrete class (interface)

Concrete implementations of the CatalogElement class requires you to extend validateProperties(). This method is used to validate all given properties in the constructor of the class. As you do not want to overwrite the given implementation but extend it, you want to use parent::validateProperties($properties) in your implementation.


 * Simple class which extends OrderableProductNode (CatalogElement)
class MyOrderableProductNode extends OrderableProductNode
     * An additional instance of a Field
     * @var FieldInterface
    protected $myField;
    protected function validateProperties(array $properties = array())
        // call validateProperties() from super class to validate default properties
        // ... now validate my specialized property "myField"
        if (
            && !($properties['myField'] instanceof FieldInterface)
        ) {
            $message = 'Attribute "myField" has wrong data type: '
                    . gettype($value)
                    . '. Instance of class FieldInterface expected.';
            throw new \InvalidArgumentException($message);

Class diagram

Sub classes