/** * Verify value before set to form * * @param AttributeValueInterface $attributeValue */ protected function verifyValue(AttributeValueInterface $attributeValue) { switch ($attributeValue->getType()) { case AttributeTypes::CHECKBOX: if (!is_bool($attributeValue->getValue())) { $attributeValue->setValue(false); } break; case AttributeTypes::CHOICE: if (!is_array($attributeValue->getValue())) { $attributeValue->setValue(null); } break; case AttributeTypes::MONEY: case AttributeTypes::NUMBER: case AttributeTypes::PERCENTAGE: if (!is_numeric($attributeValue->getValue())) { $attributeValue->setValue(null); } break; } }