Skip to content

Commit

Permalink
Add missing services and validation files
Browse files Browse the repository at this point in the history
  • Loading branch information
marekrzytki committed Jun 5, 2024
1 parent 981851f commit 26cec03
Show file tree
Hide file tree
Showing 20 changed files with 652 additions and 78 deletions.
25 changes: 0 additions & 25 deletions src/Resources/config/serializer/Entity.Media.xml

This file was deleted.

29 changes: 29 additions & 0 deletions src/Resources/config/serializer/Entity.Media.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BitBag\SyliusCmsPlugin\Entity\Media:
exclusion_policy: ALL
xml_root_name: media
properties:
id:
expose: true
type: integer
xml_attribute: true
groups: [Autocomplete]
code:
expose: true
type: string
groups: [Autocomplete]
path:
expose: true
type: string
groups: [Autocomplete]
relations:
-
rel: self
href:
route: bitbag_sylius_cms_plugin_shop_media_inline
parameters:
_locale: expr(object.getTranslation().getLocale())
code: expr(object.getCode())
virtual_properties:
getName:
serialized_name: name
groups: [Autocomplete]
13 changes: 0 additions & 13 deletions src/Resources/config/serializer/Entity.Section.xml

This file was deleted.

17 changes: 17 additions & 0 deletions src/Resources/config/serializer/Entity.Section.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
BitBag\SyliusCmsPlugin\Entity\Section:
exclusion_policy: ALL
xml_root_name: section
properties:
id:
expose: true
type: integer
xml_attribute: true
groups: [Autocomplete]
code:
expose: true
type: string
groups: [Autocomplete]
virtual_properties:
getName:
serialized_name: name
groups: [Autocomplete]
46 changes: 46 additions & 0 deletions src/Resources/config/validation/Block.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping
http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="BitBag\SyliusCmsPlugin\Entity\Block">
<constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
<option name="fields">
<value>code</value>
</option>
<option name="groups">
<value>bitbag</value>
</option>
<option name="message">bitbag_sylius_cms_plugin.block.code.unique</option>
</constraint>

<property name="code">
<constraint name="NotBlank">
<option name="message">bitbag_sylius_cms_plugin.block.code.not_blank</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
<constraint name="Length">
<option name="min">2</option>
<option name="max">250</option>
<option name="minMessage">bitbag_sylius_cms_plugin.block.code.min_length</option>
<option name="maxMessage">bitbag_sylius_cms_plugin.block.code.max_length</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
<constraint name="Regex">
<option name="pattern">/^[\w-]*$/</option>
<option name="message">bitbag_sylius_cms_plugin.block.code.regex</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
</property>

<property name="translations">
<constraint name="Valid"/>
</property>
</class>
</constraint-mapping>
41 changes: 41 additions & 0 deletions src/Resources/config/validation/BlockTranslation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping
http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="BitBag\SyliusCmsPlugin\Entity\BlockTranslation">
<property name="name">
<constraint name="Length">
<option name="min">2</option>
<option name="max">250</option>
<option name="minMessage">bitbag_sylius_cms_plugin.block.name.min_length</option>
<option name="maxMessage">bitbag_sylius_cms_plugin.block.name.max_length</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
</property>

<property name="link">
<constraint name="Length">
<option name="min">2</option>
<option name="max">250</option>
<option name="minMessage">bitbag_sylius_cms_plugin.block.link.min_length</option>
<option name="maxMessage">bitbag_sylius_cms_plugin.block.link.max_length</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
</property>

<property name="content">
<constraint name="Length">
<option name="min">2</option>
<option name="minMessage">bitbag_sylius_cms_plugin.block.content.min_length</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
</property>
</class>
</constraint-mapping>
62 changes: 62 additions & 0 deletions src/Resources/config/validation/FrequentlyAskedQuestion.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping
http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestion">
<constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
<option name="fields">
<value>position</value>
</option>
<option name="message">bitbag_sylius_cms_plugin.frequently_asked_question.position.unique</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
<constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
<option name="fields">
<value>code</value>
</option>
<option name="message">bitbag_sylius_cms_plugin.frequently_asked_question.code.unique</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>

<property name="code">
<constraint name="NotBlank">
<option name="message">bitbag_sylius_cms_plugin.frequently_asked_question.code.not_blank</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
<constraint name="Length">
<option name="min">2</option>
<option name="minMessage">bitbag_sylius_cms_plugin.frequently_asked_question.code.min_length</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
<constraint name="Regex">
<option name="pattern">/^[\w-]*$/</option>
<option name="message">bitbag_sylius_cms_plugin.frequently_asked_question.code.regex</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
</property>

<property name="position">
<constraint name="NotBlank">
<option name="message">bitbag_sylius_cms_plugin.frequently_asked_question.position.not_blank</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
</property>

<property name="translations">
<constraint name="Valid"/>
</property>
</class>
</constraint-mapping>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping
http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestionTranslation">
<property name="question">
<constraint name="NotBlank">
<option name="message">bitbag_sylius_cms_plugin.frequently_asked_question.question.not_blank</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
<constraint name="Length">
<option name="min">2</option>
<option name="minMessage">bitbag_sylius_cms_plugin.frequently_asked_question.question.min_length</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
</property>

<property name="answer">
<constraint name="NotBlank">
<option name="message">bitbag_sylius_cms_plugin.frequently_asked_question.answer.not_blank</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
<constraint name="Length">
<option name="min">2</option>
<option name="minMessage">bitbag_sylius_cms_plugin.frequently_asked_question.answer.min_length</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
</property>
</class>
</constraint-mapping>
68 changes: 68 additions & 0 deletions src/Resources/config/validation/Media.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping
http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="BitBag\SyliusCmsPlugin\Entity\Media">
<constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
<option name="fields">
<value>code</value>
</option>
<option name="groups">
<value>bitbag</value>
</option>
<option name="message">bitbag_sylius_cms_plugin.media.code.unique</option>
</constraint>
<constraint name="BitBag\SyliusCmsPlugin\Validator\Constraint\FileMatchesType">
<option name="groups">
<value>bitbag</value>
</option>
<option name="messageImage">bitbag_sylius_cms_plugin.media.file.type_image</option>
<option name="messageVideo">bitbag_sylius_cms_plugin.media.file.type_video</option>
<option name="field">type</option>
</constraint>

<property name="code">
<constraint name="NotBlank">
<option name="message">bitbag_sylius_cms_plugin.media.code.not_blank</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
<constraint name="Length">
<option name="min">2</option>
<option name="max">250</option>
<option name="minMessage">bitbag_sylius_cms_plugin.media.code.min_length</option>
<option name="maxMessage">bitbag_sylius_cms_plugin.media.code.max_length</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
<constraint name="Regex">
<option name="pattern">/^[\w-]*$/</option>
<option name="message">bitbag_sylius_cms_plugin.media.code.regex</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
</property>

<property name="file">
<constraint name="Expression">
<option name="expression">!(this.getPath() == null and this.getFile() == null)</option>
<option name="message">bitbag_sylius_cms_plugin.media.file.not_blank</option>
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
</property>

<property name="translations">
<constraint name="Valid">
<option name="groups">
<value>bitbag</value>
</option>
</constraint>
</property>
</class>
</constraint-mapping>
Loading

0 comments on commit 26cec03

Please sign in to comment.