From 92be9cdad28a38e088c182d05417263c5e18212a Mon Sep 17 00:00:00 2001 From: Stefan Hagspiel Date: Thu, 9 Jan 2025 11:33:19 +0100 Subject: [PATCH] [ORM] use xml mapping, resolves #501 --- .../doctrine/model/DoubleOptInSession.orm.xml | 28 ++++++++++ .../doctrine/model/DoubleOptInSession.orm.yml | 46 ---------------- config/doctrine/model/FormDefinition.orm.xml | 25 +++++++++ config/doctrine/model/FormDefinition.orm.yml | 53 ------------------- config/doctrine/model/OutputWorkflow.orm.xml | 31 +++++++++++ config/doctrine/model/OutputWorkflow.orm.yml | 43 --------------- .../model/OutputWorkflowChannel.orm.xml | 23 ++++++++ .../model/OutputWorkflowChannel.orm.yml | 36 ------------- src/FormBuilderBundle.php | 2 +- 9 files changed, 108 insertions(+), 179 deletions(-) create mode 100644 config/doctrine/model/DoubleOptInSession.orm.xml delete mode 100644 config/doctrine/model/DoubleOptInSession.orm.yml create mode 100644 config/doctrine/model/FormDefinition.orm.xml delete mode 100644 config/doctrine/model/FormDefinition.orm.yml create mode 100644 config/doctrine/model/OutputWorkflow.orm.xml delete mode 100644 config/doctrine/model/OutputWorkflow.orm.yml create mode 100644 config/doctrine/model/OutputWorkflowChannel.orm.xml delete mode 100644 config/doctrine/model/OutputWorkflowChannel.orm.yml diff --git a/config/doctrine/model/DoubleOptInSession.orm.xml b/config/doctrine/model/DoubleOptInSession.orm.xml new file mode 100644 index 00000000..102e535e --- /dev/null +++ b/config/doctrine/model/DoubleOptInSession.orm.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/doctrine/model/DoubleOptInSession.orm.yml b/config/doctrine/model/DoubleOptInSession.orm.yml deleted file mode 100644 index ab5aff9c..00000000 --- a/config/doctrine/model/DoubleOptInSession.orm.yml +++ /dev/null @@ -1,46 +0,0 @@ -FormBuilderBundle\Model\DoubleOptInSession: - type: entity - table: formbuilder_double_opt_in_session - indexes: - token_form: - columns: [ token, form_definition, applied ] - id: - token: - unique: true - column: token - type: uuid - generator: - strategy: CUSTOM - customIdGenerator: - class: Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator - fields: - email: - column: email - type: string - nullable: false - length: 190 - additionalData: - column: additional_data - type: array - nullable: true - dispatchLocation: - column: dispatch_location - type: text - nullable: true - applied: - column: applied - type: boolean - options: - default: 0 - creationDate: - column: creationDate - type: datetime - nullable: false - manyToOne: - formDefinition: - targetEntity: FormBuilderBundle\Model\FormDefinition - orphanRemoval: true - joinColumn: - name: form_definition - referencedColumnName: id - onDelete: CASCADE \ No newline at end of file diff --git a/config/doctrine/model/FormDefinition.orm.xml b/config/doctrine/model/FormDefinition.orm.xml new file mode 100644 index 00000000..387884d3 --- /dev/null +++ b/config/doctrine/model/FormDefinition.orm.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/doctrine/model/FormDefinition.orm.yml b/config/doctrine/model/FormDefinition.orm.yml deleted file mode 100644 index 9812401d..00000000 --- a/config/doctrine/model/FormDefinition.orm.yml +++ /dev/null @@ -1,53 +0,0 @@ -FormBuilderBundle\Model\FormDefinition: - type: entity - table: formbuilder_forms - fields: - id: - type: integer - column: id - id: true - generator: - strategy: AUTO - name: - column: '`name`' - nullable: true - type: string - unique: true - length: 190 - group: - column: '`group`' - nullable: true - type: string - length: 190 - creationDate: - column: creationDate - type: datetime - nullable: false - modificationDate: - column: modificationDate - type: datetime - nullable: false - createdBy: - column: createdBy - type: integer - modifiedBy: - column: modifiedBy - type: integer - configuration: - column: configuration - type: object - nullable: true - conditionalLogic: - column: conditionalLogic - type: object - nullable: true - fields: - column: fields - type: form_builder_fields - nullable: true - oneToMany: - outputWorkflows: - targetEntity: FormBuilderBundle\Model\OutputWorkflow - mappedBy: formDefinition - cascade: - - all \ No newline at end of file diff --git a/config/doctrine/model/OutputWorkflow.orm.xml b/config/doctrine/model/OutputWorkflow.orm.xml new file mode 100644 index 00000000..fb1cc614 --- /dev/null +++ b/config/doctrine/model/OutputWorkflow.orm.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/doctrine/model/OutputWorkflow.orm.yml b/config/doctrine/model/OutputWorkflow.orm.yml deleted file mode 100644 index 3cedb92a..00000000 --- a/config/doctrine/model/OutputWorkflow.orm.yml +++ /dev/null @@ -1,43 +0,0 @@ -FormBuilderBundle\Model\OutputWorkflow: - type: entity - table: formbuilder_output_workflow - fields: - id: - type: integer - column: id - id: true - generator: - strategy: AUTO - name: - column: '`name`' - nullable: true - type: string - length: 190 - funnelWorkflow: - column: funnel_workflow - nullable: false - type: boolean - successManagement: - column: success_management - nullable: true - type: object - manyToOne: - formDefinition: - targetEntity: FormBuilderBundle\Model\FormDefinition - orphanRemoval: true - inversedBy: outputWorkflows - joinColumn: - name: form_definition - referencedColumnName: id - oneToMany: - channels: - targetEntity: FormBuilderBundle\Model\OutputWorkflowChannel - orphanRemoval: true - mappedBy: outputWorkflow - orderBy: - id: ASC - cascade: - - all - uniqueConstraints: - name_form: - columns: [name, form_definition] \ No newline at end of file diff --git a/config/doctrine/model/OutputWorkflowChannel.orm.xml b/config/doctrine/model/OutputWorkflowChannel.orm.xml new file mode 100644 index 00000000..0df61746 --- /dev/null +++ b/config/doctrine/model/OutputWorkflowChannel.orm.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/config/doctrine/model/OutputWorkflowChannel.orm.yml b/config/doctrine/model/OutputWorkflowChannel.orm.yml deleted file mode 100644 index b8845085..00000000 --- a/config/doctrine/model/OutputWorkflowChannel.orm.yml +++ /dev/null @@ -1,36 +0,0 @@ -FormBuilderBundle\Model\OutputWorkflowChannel: - type: entity - table: formbuilder_output_workflow_channel - fields: - id: - type: integer - column: id - id: true - generator: - strategy: AUTO - type: - column: type - type: string - length: 190 - name: - column: name - type: string - length: 190 - configuration: - column: configuration - nullable: true - type: object - funnelActions: - column: funnel_actions - nullable: true - type: object - manyToOne: - outputWorkflow: - targetEntity: FormBuilderBundle\Model\OutputWorkflow - inversedBy: channels - joinColumn: - name: output_workflow - referencedColumnName: id - uniqueConstraints: - ow_name: - columns: [ output_workflow, name ] \ No newline at end of file diff --git a/src/FormBuilderBundle.php b/src/FormBuilderBundle.php index d9c1f4e2..47daa27a 100644 --- a/src/FormBuilderBundle.php +++ b/src/FormBuilderBundle.php @@ -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'