Skip to content

Commit 6db617d

Browse files
committed
Fix for validations resource codes according to sylius product regexp
1 parent d603db3 commit 6db617d

6 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/Resources/config/validation/Block.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@ BitBag\SyliusCmsPlugin\Entity\Block:
1515
minMessage: 'bitbag_sylius_cms_plugin.block.code.min_length'
1616
maxMessage: 'bitbag_sylius_cms_plugin.block.code.max_length'
1717
groups: ['bitbag']
18+
- Regex:
19+
pattern: '/^[\w-]*$/'
20+
message: 'bitbag_sylius_cms_plugin.block.code.regex'
21+
groups: [ 'bitbag' ]
1822
translations:
1923
- Valid: ~

src/Resources/config/validation/FrequentlyAskedQuestion.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestion:
1717
min: 2
1818
minMessage: 'bitbag_sylius_cms_plugin.frequently_asked_question.code.min_length'
1919
groups: ['bitbag']
20+
- Regex:
21+
pattern: '/^[\w-]*$/'
22+
message: 'bitbag_sylius_cms_plugin.frequently_asked_question.code.regex'
23+
groups: [ 'bitbag' ]
2024
position:
2125
- NotBlank:
2226
message: 'bitbag_sylius_cms_plugin.frequently_asked_question.position.not_blank'

src/Resources/config/validation/Media.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ BitBag\SyliusCmsPlugin\Entity\Media:
1515
minMessage: 'bitbag_sylius_cms_plugin.media.code.min_length'
1616
maxMessage: 'bitbag_sylius_cms_plugin.media.code.max_length'
1717
groups: ['bitbag']
18+
- Regex:
19+
pattern: '/^[\w-]*$/'
20+
message: 'bitbag_sylius_cms_plugin.media.code.regex'
21+
groups: [ 'bitbag' ]
1822
file:
1923
- Expression:
2024
expression: '!(this.getPath() == null and this.getFile() == null)'

src/Resources/config/validation/Page.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@ BitBag\SyliusCmsPlugin\Entity\Page:
1515
minMessage: 'bitbag_sylius_cms_plugin.page.code.min_length'
1616
maxMessage: 'bitbag_sylius_cms_plugin.page.code.max_length'
1717
groups: ['bitbag']
18+
- Regex:
19+
pattern: '/^[\w-]*$/'
20+
message: 'bitbag_sylius_cms_plugin.page.code.regex'
21+
groups: [ 'bitbag' ]
1822
translations:
1923
- Valid: ~

src/Resources/config/validation/Section.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@ BitBag\SyliusCmsPlugin\Entity\Section:
1515
minMessage: 'bitbag_sylius_cms_plugin.section.code.min_length'
1616
maxMessage: 'bitbag_sylius_cms_plugin.section.code.max_length'
1717
groups: ['bitbag']
18+
- Regex:
19+
pattern: '/^[\w-]*$/'
20+
message: 'bitbag_sylius_cms_plugin.section.code.regex'
21+
groups: ['bitbag']
1822
translations:
1923
- Valid: ~

src/Resources/translations/validators.en.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ bitbag_sylius_cms_plugin:
88
not_blank: Code cannot be blank.
99
min_length: Code must be at least {{ limit }} characters long.
1010
max_length: Code can not be longer than {{ limit }} characters.
11+
regex: Block code can only be comprised of letters, numbers, dashes and underscores.
1112
name:
1213
min_length: Name must be at least {{ limit }} characters long.
1314
max_length: Name can not be longer than {{ limit }} characters.
@@ -23,6 +24,7 @@ bitbag_sylius_cms_plugin:
2324
not_blank: Code cannot be blank.
2425
min_length: Code must be at least {{ limit }} characters long.
2526
max_length: Code can not be longer than {{ limit }} characters.
27+
regex: Page code can only be comprised of letters, numbers, dashes and underscores.
2628
name:
2729
not_blank: Name cannot be blank.
2830
min_length: Name must be at least {{ limit }} characters long.
@@ -47,6 +49,7 @@ bitbag_sylius_cms_plugin:
4749
not_blank: Code cannot be blank.
4850
min_length: Code must be at least {{ limit }} characters long.
4951
max_length: Code can not be longer than {{ limit }} characters.
52+
regex: Code can only be comprised of letters, numbers, dashes and underscores.
5053
position:
5154
unique: There is an existing FAQ with this position.
5255
not_blank: Position cannot be blank.
@@ -62,6 +65,7 @@ bitbag_sylius_cms_plugin:
6265
not_blank: Code cannot be blank.
6366
min_length: Code must be at least {{ limit }} characters long.
6467
max_length: Code can not be longer than {{ limit }} characters.
68+
regex: Section code can only be comprised of letters, numbers, dashes and underscores.
6569
name:
6670
not_blank: Name cannot be blank.
6771
min_length: Name must be at least {{ limit }} characters long.
@@ -72,6 +76,7 @@ bitbag_sylius_cms_plugin:
7276
not_blank: Code cannot be blank.
7377
min_length: Code must be at least {{ limit }} characters long.
7478
max_length: Code can not be longer than {{ limit }} characters.
79+
regex: Media code can only be comprised of letters, numbers, dashes and underscores.
7580
file:
7681
not_blank: File cannot be blank.
7782
name:

0 commit comments

Comments
 (0)