Skip to content

Commit

Permalink
Simplify validation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Dec 11, 2024
1 parent 3a51cf9 commit 22e356b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
11 changes: 2 additions & 9 deletions src/Resources/config/validation/Promotion.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
</constraint>
<property name="code">
<constraint name="NotBlank">
<option name="message">setono_sylius_catalog_promotion.promotion.code.not_blank</option>
<option name="groups">setono_sylius_catalog_promotion</option>
</constraint>
<constraint name="Regex">
Expand All @@ -27,29 +26,23 @@
</property>
<property name="name">
<constraint name="NotBlank">
<option name="message">setono_sylius_catalog_promotion.promotion.name.not_blank</option>
<option name="groups">setono_sylius_catalog_promotion</option>
</constraint>
<constraint name="Length">
<option name="min">2</option>
<option name="min">1</option>
<option name="max">255</option>
<option name="minMessage">setono_sylius_catalog_promotion.promotion.name.min_length</option>
<option name="maxMessage">setono_sylius_catalog_promotion.promotion.name.max_length</option>
<option name="groups">setono_sylius_catalog_promotion</option>
</constraint>
</property>
<property name="description">
<constraint name="Length">
<option name="min">2</option>
<option name="min">1</option>
<option name="max">255</option>
<option name="minMessage">setono_sylius_catalog_promotion.promotion.description.min_length</option>
<option name="maxMessage">setono_sylius_catalog_promotion.promotion.description.max_length</option>
<option name="groups">setono_sylius_catalog_promotion</option>
</constraint>
</property>
<property name="discount">
<constraint name="NotBlank">
<option name="message">setono_sylius_catalog_promotion.promotion.discount.not_blank</option>
<option name="groups">setono_sylius_catalog_promotion</option>
</constraint>
<constraint name="Range">
Expand Down
14 changes: 2 additions & 12 deletions src/Resources/translations/validators.en.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
setono_sylius_catalog_promotion:
promotion:
code:
unique: The promotion with given code already exists.
regex: Promotion code can only be comprised of letters, numbers, dashes and underscores.
not_blank: Please enter promotion code.
name:
max_length: Promotion name must not be longer than 1 character.|Promotion name must not be longer than {{ limit }} characters.
min_length: Promotion name must be at least 1 character long.|Promotion name must be at least {{ limit }} characters long.
not_blank: Please enter promotion name.
description:
max_length: Promotion description must not be longer than 1 character.|Promotion description must not be longer than {{ limit }} characters.
min_length: Promotion description must be at least 1 character long.|Promotion description must be at least {{ limit }} characters long.
not_blank: Please enter promotion description.
unique: A promotion with given code already exists.
regex: Promotion code can only be comprised of letters (a-z), numbers (0-9), dashes (-) and underscores (_).
discount:
not_blank: Please enter discount.
range: Please enter value between 0% and 100%.
end_date_cannot_be_set_prior_start_date: End date cannot be set prior start date.

0 comments on commit 22e356b

Please sign in to comment.