Download the PHP package mmoreram/simple-doctrine-mapping without Composer
On this page you can find all versions of the php package mmoreram/simple-doctrine-mapping. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mmoreram/simple-doctrine-mapping
More information about mmoreram/simple-doctrine-mapping
Files in mmoreram/simple-doctrine-mapping
Package simple-doctrine-mapping
Short Description Simple Doctrine Mapping
License MIT
Homepage https://github.com/mmoreram/SimpleDoctrineMapping
Informations about the package simple-doctrine-mapping
Simple Doctrine Mapping for Symfony2
KISS, Remember?
This project provides you an amazing way of adding your entities mapping data
in any Symfony project, without the need of taking part of the auto_mapping
doctrine process.
With a simple compiler pass in your bundle, make sure your entities are mapped properly into database, and provider your bundle users a unique way of overwriting and customization of these entities.
To work with a higher abstraction level of this bundle, use the mapping part of http://github.com/mmoreram/BaseBundle. This bundle makes the best possible integration of SimpleDoctrineMapping in your bundles.
Repeat with me, Keep it simple.
CompilerPass
For those of you who still do not know what is a CompilerPass, try to visualize it as your last chance to configure your container. At this point you can retrieve all your parameter configuration, but you cannot build any service, this is the point where you can dynamically build and complete services.
Once compiled, this container will be read-only.
This CompilerPass let each bundle be responsible for its own entities, defining per each one, the class to be mapped, the path of the mapping file and the manager that will manage it.
You should create your own compiler pass
and add it into the Container. Like this:
And that's it. After the container compilation it will add our mapping information. No magic.
addEntityMapping()
The method addEntityMapping() does not offer us many options, but the necessary to be able to define the entity map in most cases.
Of course, all values are required but the last one.
Parameters
So, imagine that you are working in a public Bundle, I mean, your bundle will be installed by other projects in their vendor folder, but you want to expose your own entity model.
You could think that by using this bundle you force the final user to use your model implementation in all cases, but is not.
If you want to give this power to your users, if you want to expose overridable entities, you can define your model using container parameters.
In that case your bundle will put at users mercy the ability to override all the required parameters by just overriding specific configuration items.
You must finally create these params with your default values.
All versions of simple-doctrine-mapping with dependencies
doctrine/common Version ^2.6
doctrine/orm Version ^2.5
symfony/http-kernel Version ^3.2
symfony/dependency-injection Version ^3.2