wernerdweight / doctrine-xinclude-xml-driver-bundle
Symfony bundle providing XInclude support for XML mapping of Doctrine.
Installs: 1 009
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 1
Type:symfony-bundle
Requires
- php: >=8.1
- symfony/framework-bundle: ^4.0|^5.0|^6.0
- symfony/orm-pack: ^1.0|^2.0
- thecodingmachine/safe: ^2.4
Requires (Dev)
- symfony/phpunit-bridge: ^4.3|^5.0|^6.0
- thecodingmachine/phpstan-safe-rule: ^1.2
- wernerdweight/cs: ^3.0
This package is auto-updated.
Last update: 2024-11-06 16:36:35 UTC
README
Symfony bundle providing XInclude support for XML mapping of Doctrine.
Installation
1. Download using composer
composer require wernerdweight/doctrine-xinclude-xml-driver-bundle
2. Enable the bundle
Enable the bundle in your kernel:
<?php // config/bundles.php return [ // ... WernerDweight\DoctrineXIncludeXmlDriverBundle\DoctrineXIncludeXmlDriverBundle::class => ['all' => true], ];
Configuration
No configuration is required. This bundle automatically replaces the default XML driver with an XInclude-capable XML driver.
Usage
Add XInclude xmlns to the doctrine-mapping
tag and you can then use xi:include
tag to include mapping from other XML files. You can use xpointer
to specify included parts of the linked XML file (see xpointer or browse stack overflow).
<!-- SomeEntity.orm.xml --> <?xml version="1.0" encoding="utf-8"?> <doctrine-mapping xmlns:xi="http://www.w3.org/2001/XInclude" ...> <entity name="SomeEntity"> <xi:include href="Deletable.trait.xml" parse="xml" xpointer="xpointer(//entity/*)"/> ... </entity> </doctrine-mapping> <!-- Deletable.trait.xml --> <?xml version="1.0" encoding="utf-8"?> <entity> <field name="deletedAt" type="datetime" /> <many-to-one field="deletedBy" target-entity="User"> <join-columns> <join-column name="deleted_by_id" referenced-column-name="id"/> </join-columns> </many-to-one> </entity>
License
This bundle is under the MIT license. See the complete license in the root directiory of the bundle.