Example #1
0
 /**
  * Returns product specified variant attribute by name
  *
  * @param \XLite\Model\Product $model Product
  * @param string               $name  Attribute name
  *
  * @return \XLite\Model\Attribute
  */
 protected function findProductSpecifiedAttribute($model, $name)
 {
     /** @var \XLite\Model\Attribute $item */
     return array_reduce($model->getAttributes()->toArray(), function ($carry, $item) use($name) {
         return null === $carry && $name === $item->getName() ? $item : $carry;
     }, null);
 }
 /**
  * {@inheritDoc}
  */
 public function getAttributes()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getAttributes', array());
     return parent::getAttributes();
 }