Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function getConfiguration()
 {
     $this->assertAttributeIsSet();
     return $this->attribute->getConfiguration();
 }
Пример #2
0
 public function addAttribute(AttributeInterface $attribute)
 {
     $this->attributes[$attribute->name()] = $attribute;
     return $this;
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function getType()
 {
     $this->assertAttributeIsSet();
     return $this->attribute->getType();
 }
Пример #4
0
 /**
  * @param DataInterface      $data
  * @param AttributeInterface $attribute
  * @param array              $context
  * @return ValueInterface
  * @throws UnexpectedValueException
  */
 public function createValue(DataInterface $data, AttributeInterface $attribute, array $context = null)
 {
     $valueClass = $this->getValueClass();
     /** @var ValueInterface $value */
     $value = new $valueClass($data, $attribute);
     $data->addValue($value);
     if ($value instanceof ContextualValueInterface && count($attribute->getContextMask())) {
         /** @var ContextualValueInterface $value */
         if (!$context) {
             $context = $this->getContext();
         }
         foreach ($attribute->getContextMask() as $key) {
             $value->setContextValue($key, $context[$key]);
         }
     }
     return $value;
 }
 /**
  * @param AttributeInterface $attribute
  */
 public function setAttributeDefaults(AttributeInterface $attribute)
 {
     $attribute->setUnique(true);
     $attribute->setRequired(true);
 }
 /**
  * @param AttributeInterface $attribute
  */
 public function setAttributeDefaults(AttributeInterface $attribute)
 {
     $attribute->addValidationRule(['Valid' => []]);
 }