Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ORM] use xml mapping, resolves #501 #503

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions config/doctrine/model/DoubleOptInSession.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="FormBuilderBundle\Model\DoubleOptInSession" table="formbuilder_double_opt_in_session">
<indexes>
<index name="token_form" columns="token,form_definition,applied"/>
</indexes>
<id name="token" type="uuid" column="token">
<generator strategy="CUSTOM"/>
<custom-id-generator class="Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator"/>
</id>
<field name="email" type="string" column="email" length="190" nullable="false"/>
<field name="additionalData" type="array" column="additional_data" nullable="true"/>
<field name="dispatchLocation" type="text" column="dispatch_location" nullable="true"/>
<field name="applied" type="boolean" column="applied">
<options>
<option name="default">0</option>
</options>
</field>
<field name="creationDate" type="datetime" column="creationDate" nullable="false"/>
<many-to-one field="formDefinition" target-entity="FormBuilderBundle\Model\FormDefinition" fetch="LAZY">
<join-columns>
<join-column name="form_definition" referenced-column-name="id" on-delete="CASCADE"/>
</join-columns>
</many-to-one>
</entity>
</doctrine-mapping>
46 changes: 0 additions & 46 deletions config/doctrine/model/DoubleOptInSession.orm.yml

This file was deleted.

25 changes: 25 additions & 0 deletions config/doctrine/model/FormDefinition.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="FormBuilderBundle\Model\FormDefinition" table="formbuilder_forms">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
<field name="name" type="string" column="`name`" length="190" unique="true" nullable="true"/>
<field name="group" type="string" column="`group`" length="190" nullable="true"/>
<field name="creationDate" type="datetime" column="creationDate" nullable="false"/>
<field name="modificationDate" type="datetime" column="modificationDate" nullable="false"/>
<field name="createdBy" type="integer" column="createdBy"/>
<field name="modifiedBy" type="integer" column="modifiedBy"/>
<field name="configuration" type="object" column="configuration" nullable="true"/>
<field name="conditionalLogic" type="object" column="conditionalLogic" nullable="true"/>
<field name="fields" type="form_builder_fields" column="fields" nullable="true"/>
<one-to-many field="outputWorkflows" target-entity="FormBuilderBundle\Model\OutputWorkflow" mapped-by="formDefinition"
fetch="LAZY">
<cascade>
<cascade-all/>
</cascade>
</one-to-many>
</entity>
</doctrine-mapping>
53 changes: 0 additions & 53 deletions config/doctrine/model/FormDefinition.orm.yml

This file was deleted.

31 changes: 31 additions & 0 deletions config/doctrine/model/OutputWorkflow.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="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="FormBuilderBundle\Model\OutputWorkflow" table="formbuilder_output_workflow">
<unique-constraints>
<unique-constraint name="name_form" columns="name,form_definition"/>
</unique-constraints>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
<field name="name" type="string" column="`name`" length="190" nullable="true"/>
<field name="funnelWorkflow" type="boolean" column="funnel_workflow" nullable="false"/>
<field name="successManagement" type="object" column="success_management" nullable="true"/>
<one-to-many field="channels" target-entity="FormBuilderBundle\Model\OutputWorkflowChannel" mapped-by="outputWorkflow"
orphan-removal="true" fetch="LAZY">
<cascade>
<cascade-all/>
</cascade>
<order-by>
<order-by-field name="id" direction="ASC"/>
</order-by>
</one-to-many>
<many-to-one field="formDefinition" target-entity="FormBuilderBundle\Model\FormDefinition" inversed-by="outputWorkflows"
fetch="LAZY">
<join-columns>
<join-column name="form_definition" referenced-column-name="id"/>
</join-columns>
</many-to-one>
</entity>
</doctrine-mapping>
43 changes: 0 additions & 43 deletions config/doctrine/model/OutputWorkflow.orm.yml

This file was deleted.

23 changes: 23 additions & 0 deletions config/doctrine/model/OutputWorkflowChannel.orm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="FormBuilderBundle\Model\OutputWorkflowChannel" table="formbuilder_output_workflow_channel">
<unique-constraints>
<unique-constraint name="ow_name" columns="output_workflow,name"/>
</unique-constraints>
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
<field name="type" type="string" column="type" length="190"/>
<field name="name" type="string" column="name" length="190"/>
<field name="configuration" type="object" column="configuration" nullable="true"/>
<field name="funnelActions" type="object" column="funnel_actions" nullable="true"/>
<many-to-one field="outputWorkflow" target-entity="FormBuilderBundle\Model\OutputWorkflow" inversed-by="channels"
fetch="LAZY">
<join-columns>
<join-column name="output_workflow" referenced-column-name="id"/>
</join-columns>
</many-to-one>
</entity>
</doctrine-mapping>
36 changes: 0 additions & 36 deletions config/doctrine/model/OutputWorkflowChannel.orm.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/FormBuilderBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function getComposerPackageName(): string
protected function configureDoctrineExtension(ContainerBuilder $container): void
{
$container->addCompilerPass(
DoctrineOrmMappingsPass::createYamlMappingDriver(
DoctrineOrmMappingsPass::createXmlMappingDriver(
[$this->getNameSpacePath() => $this->getNamespaceName()],
['form_builder.persistence.doctrine.manager'],
'form_builder.persistence.doctrine.enabled'
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Fields/AbstractFieldCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function setupField(FunctionalTester $I, $options = [], $optional = []
$testFormBuilder = (new TestFormBuilder('dachcom_test'))->setUseAjax(false);

if ($this->type === 'container') {
$subFields = isset($optional['subFields']) ? $optional['subFields'] : [];
$subFields = $optional['subFields'] ?? [];
$testFormBuilder->addFormFieldContainer(
$this->subType,
$this->name,
Expand Down
Loading
Loading