I try to improve the flexibility of our own CMS System. The functionality of this CMS system can be extended by Plugins. There are several instances of this "Core" CMS system. At the moment it isn't possible to deactivate such a plugin therefore every instance has all plugins activated although not every instance uses every plugin. Unfortunately it's possible that a newly created plugin is destroying some kind of base functionality of the CMS. My goal is the make the Plugin structure much more flexible. One task is to activate only plugins which will be used by an instance. My problem is that the doctrine mapping is handled by XML Files where for each Table every relation is defined.
For example: Let's assume we have the base class File which would be a "core" functionality. Some day we add a tagging Plugin where we add Tags to Files. For example we upload a "Lionel Messi" image and give it the tags: "Primera Division, soccer, argentinia, ...". A possible XML mapping could look like this:
<?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 http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Db\File" table="file">
<!-- identical for all tables -->
<unique-constraints>
<unique-constraint columns="id"/>
</unique-constraints>
<id name="uid" type="integer" column="uid">
<generator strategy="AUTO"/>
</id>
<field name="id" type="integer" column="id" nullable="true"/>
<field name="title" type="string" column="title" length="255" nullable="true"/>
<one-to-many field="fileTags" target-entity="Tag" mapped-by="file">
</one-to-many>
</entity>
</doctrine-mapping>
The "file" table has a one-to-many relation with the "tag". This relation would be created for every CMS instance although the "tag" plugin is possibly not activated. The relation with "tags" should only be created if the "tag" plugin is active, otherwise no plugin specific mapping should be executed.
How is the best way with doctrine to handle such a task? Thanks for your help!