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
pbalcerzak authored Sep 29, 2022
2 parents d094beb + 5721558 commit a5c389e
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>
78 changes: 0 additions & 78 deletions src/Resources/config/doctrine/Media.orm.yml

This file was deleted.

22 changes: 22 additions & 0 deletions src/Resources/config/doctrine/MediaTranslation.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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\MediaTranslation" table="bitbag_cms_media_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="alt" column="alt" type="text" nullable="true"/>

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

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

This file was deleted.

62 changes: 62 additions & 0 deletions src/Resources/config/doctrine/Page.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"
xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping"
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\Page" table="bitbag_cms_page">
<id name="id" column="id" type="integer">
<generator strategy="AUTO"/>
</id>

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

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

<field name="createdAt" column="created_at" type="datetime" nullable="true">
<gedmo:timestampable on="create"/>
</field>

<field name="updatedAt" column="updated_at" type="datetime" nullable="true">
<gedmo:timestampable on="update"/>
</field>

<field name="publishAt" column="publish_at" type="datetime_immutable" nullable="true"/>

<many-to-many field="sections" target-entity="BitBag\SyliusCmsPlugin\Entity\SectionInterface">
<join-table name="bitbag_cms_page_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_page_products">
<join-columns>
<join-column name="page_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_page_channels">
<join-columns>
<join-column name="page_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>
74 changes: 0 additions & 74 deletions src/Resources/config/doctrine/Page.orm.yml

This file was deleted.

38 changes: 38 additions & 0 deletions src/Resources/config/doctrine/PageTranslation.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?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\PageTranslation" table="bitbag_cms_page_translation">
<id name="id" column="id" type="integer">
<generator strategy="AUTO"/>
</id>

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

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

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

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

<field name="descriptionWhenLinked" column="description_when_linked" type="string" length="1000" nullable="true"/>

<field name="metaKeywords" column="meta_keywords" type="string" length="1000" nullable="true"/>

<field name="metaDescription" column="meta_description" type="string" length="5000" nullable="true"/>

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

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

<many-to-one field="image" target-entity="BitBag\SyliusCmsPlugin\Entity\MediaInterface">
<cascade>
<cascade-persist/>
</cascade>
</many-to-one>

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

This file was deleted.

17 changes: 17 additions & 0 deletions src/Resources/config/doctrine/Section.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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"
xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping"
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\Section" table="bitbag_cms_section">
<id name="id" column="id" type="integer">
<generator strategy="AUTO"/>
</id>

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

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

This file was deleted.

16 changes: 16 additions & 0 deletions src/Resources/config/doctrine/SectionTranslation.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?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\SectionTranslation" table="bitbag_cms_section_translation">
<id name="id" column="id" type="integer">
<generator strategy="AUTO"/>
</id>

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

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

This file was deleted.

0 comments on commit a5c389e

Please sign in to comment.