Проблема проверки атрибута Akeneo
У меня действительно простой вопрос. Поэтому я хочу вставить что-то еще в проверку атрибутов.
Я перешел по этой ссылке и вставил весь этот файл в свой комплект. https://docs.akeneo.com/cookbook/validation/customize_validation.html с некоторыми изменениями в файле.
Iclei\Bundle\BackendBundle\Entity\Attribute:
constraints:
- Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: code
- Pim\Bundle\CatalogBundle\Validator\Constraints\SingleIdentifierAttribute: ~
- Pim\Bundle\CatalogBundle\Validator\Constraints\Immutable:
properties:
- code
- attributeType
- scopable
- localizable
- metricFamily
- unique
- Pim\Bundle\CatalogBundle\Validator\Constraints\ValidMetric:
groups:
- pim_catalog_metric
- Pim\Bundle\CatalogBundle\Validator\Constraints\ValidDateRange:
groups:
- pim_catalog_date
- Pim\Bundle\CatalogBundle\Validator\Constraints\ValidNumberRange:
groups:
- pim_catalog_number
- pim_catalog_price_collection
- pim_catalog_metric
properties:
code:
- NotBlank: ~
- Regex:
pattern: /^[a-zA-Z0-9_]+$/
message: Attribute code may contain only letters, numbers and underscores
- Length:
max: 255
- Regex:
pattern: /^(?!(id|associationTypes|categories|categoryId|completeness|enabled|family|groups|associations|products|scope|treeId|values|(.)*_(products|groups))$)/
message: This code is not available
localizable:
- Type: bool
- 'False':
message: An unique attribute can not be localizable
groups: [unique]
scopable:
- NotNull: ~
- 'False':
message: An unique attribute can not be scopable
groups: [unique]
useableAsGridFilter:
- Type: bool
- 'False':
message: This attribute type can't be used as a grid filter
groups:
- pim_catalog_file
- pim_catalog_image
wysiwygEnabled:
- Type: bool
decimalsAllowed:
- Type: bool
negativeAllowed:
- Type: bool
maxCharacters:
- Type: numeric
- Pim\Bundle\CatalogBundle\Validator\Constraints\NotDecimal: {}
- GreaterThanOrEqual:
value: 0
- Range:
max: 255
groups: [pim_catalog_text, pim_catalog_identifier]
- Range:
max: 65535
groups: [pim_catalog_textarea]
sortOrder:
- Type: numeric
- GreaterThanOrEqual:
value: 0
required:
- Type: bool
- 'True':
message: This attribute type must be required
groups:
- pim_catalog_identifier
- 'False':
message: This attribute type can't be required
groups:
- pim_catalog_text
- pim_catalog_textarea
- pim_catalog_number
- pim_catalog_price_collection
- pim_catalog_multiselect
- pim_catalog_simpleselect
- pim_catalog_file
- pim_catalog_image
- pim_catalog_boolean
- pim_catalog_date
- pim_catalog_metric
unique:
- Type: bool
- 'False':
message: This attribute type can't have unique value
groups:
- pim_catalog_textarea
- pim_catalog_price_collection
- pim_catalog_multiselect
- pim_catalog_simpleselect
- pim_catalog_image
- pim_catalog_file
- pim_catalog_metric
- pim_catalog_boolean
maxFileSize:
- Range:
min: 0.01
max: 9999.99
groups: [pim_catalog_file, pim_catalog_image]
- Type:
type: numeric
groups: [pim_catalog_file, pim_catalog_image]
dateMin:
- DateTime:
groups: [pim_catalog_date]
dateMax:
- DateTime:
groups: [pim_catalog_date]
validationRule:
- Choice:
choices: [null, url, email, regexp]
groups: [pim_catalog_text]
validationRegexp:
- Blank:
groups:
- pim_catalog_textarea
- pim_catalog_multiselect
- pim_catalog_simpleselect
- pim_catalog_price_collection
- pim_catalog_number
- pim_catalog_boolean
- pim_catalog_date
- pim_catalog_file
- pim_catalog_image
- pim_catalog_metric
- Pim\Bundle\CatalogBundle\Validator\Constraints\ValidRegex:
groups:
- pim_catalog_text
- pim_catalog_identifier
allowedExtensions:
- NotNull:
groups: [pim_catalog_file, pim_catalog_image]
message: This value should not be blank
translations:
- Valid: ~
group:
- NotBlank: ~
- Valid: ~
Iclei\Bundle\BackendBundle\Entity\AttributeTranslation:
properties:
label:
- Length:
max: 100
Iclei\Bundle\BackendBundle\Entity\AttributeOption:
constraints:
- Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
- code
- attribute
properties:
code:
- NotBlank: ~
- Regex:
pattern: /^[a-zA-Z0-9_ -:]+$/
message: Option code may contain only letters, numbers, underscores, blank spaces
- Length:
max: 255
attribute:
- Valid: ~
Но это не работает. Что я здесь не так делаю? Возможно, это что-то действительно простое, но я не могу его найти.