Skip to content

Commit

Permalink
Merge pull request #422 from Kazadri/doctrine-xml-mapping
Browse files Browse the repository at this point in the history
Switch to xml mapping for doctrine
  • Loading branch information
pbalcerzak authored Sep 29, 2022
2 parents d094beb + 5721558 commit a5c389e
Show file tree
Hide file tree
Showing 20 changed files with 346 additions and 405 deletions.
62 changes: 62 additions & 0 deletions src/Resources/config/doctrine/Block.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>

<doctrine-mapping xmlns="https://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

<mapped-superclass name="BitBag\SyliusCmsPlugin\Entity\Block" table="bitbag_cms_block">
<id name="id" column="id" type="integer">
<generator strategy="AUTO"/>
</id>

<field name="code" column="code" type="string" length="64" unique="true"/>

<field name="enabled" column="enabled" type="boolean"/>

<many-to-many field="sections" target-entity="BitBag\SyliusCmsPlugin\Entity\SectionInterface">
<join-table name="bitbag_cms_block_sections">
<join-columns>
<join-column name="block_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
<inverse-join-columns>
<join-column name="section_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</inverse-join-columns>
</join-table>
</many-to-many>

<many-to-many field="products" target-entity="Sylius\Component\Product\Model\ProductInterface">
<join-table name="bitbag_cms_block_products">
<join-columns>
<join-column name="block_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
<inverse-join-columns>
<join-column name="product_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</inverse-join-columns>
</join-table>
</many-to-many>

<many-to-many field="taxonomies" target-entity="Sylius\Component\Taxonomy\Model\TaxonInterface">
<join-table name="bitbag_cms_block_taxonomies">
<join-columns>
<join-column name="block_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
<inverse-join-columns>
<join-column name="taxon_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</inverse-join-columns>
</join-table>
</many-to-many>

<many-to-many field="channels" target-entity="Sylius\Component\Channel\Model\ChannelInterface">
<join-table name="bitbag_cms_block_channels">
<join-columns>
<join-column name="block_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
<inverse-join-columns>
<join-column name="channel_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</inverse-join-columns>
</join-table>
</many-to-many>

</mapped-superclass>
</doctrine-mapping>
70 changes: 0 additions & 70 deletions src/Resources/config/doctrine/Block.orm.yml

This file was deleted.

19 changes: 19 additions & 0 deletions src/Resources/config/doctrine/BlockTranslation.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<doctrine-mapping xmlns="https://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

<mapped-superclass name="BitBag\SyliusCmsPlugin\Entity\BlockTranslation" table="bitbag_cms_block_translation">
<id name="id" column="id" type="integer">
<generator strategy="AUTO"/>
</id>

<field name="name" column="name" type="string" nullable="true"/>

<field name="content" column="content" type="text" nullable="true"/>

<field name="link" column="link" type="text" nullable="true"/>
</mapped-superclass>
</doctrine-mapping>
22 changes: 0 additions & 22 deletions src/Resources/config/doctrine/BlockTranslation.orm.yml

This file was deleted.

31 changes: 31 additions & 0 deletions src/Resources/config/doctrine/FrequentlyAskedQuestion.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>

<doctrine-mapping xmlns="https://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

<mapped-superclass name="BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestion" table="bitbag_cms_faq">
<id name="id" column="id" type="integer">
<generator strategy="AUTO"/>
</id>

<field name="code" column="code" type="string" nullable="false"/>

<field name="position" column="position" type="integer" nullable="false"/>

<field name="enabled" column="enabled" type="boolean" nullable="false"/>

<many-to-many field="channels" target-entity="Sylius\Component\Channel\Model\ChannelInterface">
<join-table name="bitbag_cms_faq_channels">
<join-columns>
<join-column name="faq_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
<inverse-join-columns>
<join-column name="channel_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</inverse-join-columns>
</join-table>
</many-to-many>

</mapped-superclass>
</doctrine-mapping>
35 changes: 0 additions & 35 deletions src/Resources/config/doctrine/FrequentlyAskedQuestion.orm.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>

<doctrine-mapping xmlns="https://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

<mapped-superclass name="BitBag\SyliusCmsPlugin\Entity\FrequentlyAskedQuestionTranslation" table="bitbag_cms_faq_translation">
<id name="id" column="id" type="integer">
<generator strategy="AUTO"/>
</id>

<field name="question" column="question" type="text" nullable="false"/>

<field name="answer" column="answer" type="text" nullable="false"/>

</mapped-superclass>
</doctrine-mapping>

This file was deleted.

61 changes: 61 additions & 0 deletions src/Resources/config/doctrine/Media.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>

<doctrine-mapping xmlns="https://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

<mapped-superclass name="BitBag\SyliusCmsPlugin\Entity\Media" table="bitbag_cms_media">
<id name="id" column="id" type="integer">
<generator strategy="AUTO"/>
</id>

<field name="code" column="code" type="string" length="250" unique="true"/>

<field name="type" column="type" type="string" length="250"/>

<field name="path" column="path" type="string" length="250" unique="true"/>

<field name="mimeType" column="mime_type" type="string" length="250" nullable="true"/>

<field name="enabled" column="enabled" type="boolean"/>

<field name="width" column="width" type="integer" nullable="true"/>

<field name="height" column="height" type="integer" nullable="true"/>

<many-to-many field="sections" target-entity="BitBag\SyliusCmsPlugin\Entity\SectionInterface">
<join-table name="bitbag_cms_media_sections">
<join-columns>
<join-column name="media_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
<inverse-join-columns>
<join-column name="section_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</inverse-join-columns>
</join-table>
</many-to-many>

<many-to-many field="products" target-entity="Sylius\Component\Product\Model\ProductInterface">
<join-table name="bitbag_cms_media_products">
<join-columns>
<join-column name="media_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
<inverse-join-columns>
<join-column name="product_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</inverse-join-columns>
</join-table>
</many-to-many>

<many-to-many field="channels" target-entity="Sylius\Component\Channel\Model\ChannelInterface">
<join-table name="bitbag_cms_media_channels">
<join-columns>
<join-column name="block_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
<inverse-join-columns>
<join-column name="channel_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</inverse-join-columns>
</join-table>
</many-to-many>

</mapped-superclass>
</doctrine-mapping>
Loading

0 comments on commit a5c389e

Please sign in to comment.