protected function getValuesByAttribute(AttributeInterface $attribute)
    {
        if (null === $this->valuesByAttributes) {
            $this->valuesByAttributes = [];
        }

        if (!array_key_exists($attribute->getCode(), $this->valuesByAttributes)) {
            $this->valuesByAttributes[$attribute->getCode()] = [];
            foreach ($this->values as $value) {
                if ($value->getAttributeCode() === $attribute->getCode()) {
                    $this->addValueByAttribute($value);
                }
            }
        }

        return $this->valuesByAttributes[$attribute->getCode()];
    }
protected function getValuesByAttribute(AttributeInterface $attribute)
    {
        if (null === $this->valuesByAttributes) {
            $this->valuesByAttributes = [];
        }

        if (!array_key_exists($attribute->getCode(), $this->valuesByAttributes)) {
            $this->valuesByAttributes[$attribute->getCode()] = [];
            foreach ($this->values as $value) {
                if ($value->getAttributeCode() === $attribute->getCode()) {
                    $this->addValueByAttribute($value);
                }
            }
        }

        return $this->valuesByAttributes[$attribute->getCode()];
    }
protected function getValuesByAttribute ( AttributeInterface $ attribute ) { if ( null === $ this -> valuesByAttributes ) { $ this -> valuesByAttributes = [ ] ; } if ( ! array_key_exists ( $ attribute -> getCode ( ) , $ this -> valuesByAttributes ) ) { $ this -> valuesByAttributes [ $ attribute -> getCode ( ) ] = [ ] ; foreach ( $ this -> values as $ value ) { if ( $ value -> getAttributeCode ( ) === $ attribute -> getCode ( ) ) { $ this -> addValueByAttribute ( $ value ) ; } } } return $ this -> valuesByAttributes [ $ attribute -> getCode ( ) ] ; }
Cache internally the values indexed by their attribute codes to increase performances

@param AttributeInterface $attribute

@return ValueInterface[]
Cache internally the values indexed by their attribute codes to increase performances