/** * {@inheritdoc} */ public function getConfiguration() { $this->assertAttributeIsSet(); return $this->attribute->getConfiguration(); }
public function addAttribute(AttributeInterface $attribute) { $this->attributes[$attribute->name()] = $attribute; return $this; }
/** * {@inheritdoc} */ public function getType() { $this->assertAttributeIsSet(); return $this->attribute->getType(); }
/** * @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' => []]); }