concrete5/concrete5-5.7.0 — pull request #1700 by ahukkanen (2014-12-22 18:56:06+00:00)
Title: Initial implementation for #1469

Initial support for using doctrine entities and managing the database through them.

Check #1469 for more information.

Some points on the implementation:
- I don't think the `getEntityManager()` method really belongs in the connection class. I've left it there for backwards compatibility reasons but it should really be outside of the connection since it does not handle anything related to the connection itself.
- Thus, also the need for the ORM facade.
- The name of the `DatabaseStructureManager` came out of my own mindlessness but I didn't come up with any better name for it. It really manages entities but I don't want to create a naming conflict with the Doctrine's EntityManager to keep it more understandable. And Doctrine also contains "SchemaManager", so I didn't like that either.

Further points:
- As previously stated, I would rather keep the proxy classes outside of the "config" folder. They are currently there because of what @aembler said in #1469 but I really think they should conceptually deserve their own folder.
- There is an unmarked TODO that requires the upgrade routine for the next version (or whenever this gets through) to create the core proxies and also the proxies for any installed pacakges. This is not created because the upgrade routine does not yet exist and I didn't want to create it myself at this point (I don't know when and how they are usually created).
- There is another point I've brought up in the forums and in #1665 that I don't believe the entities in the core are currently correctly used. It's not really related to getting this through but it should be considered when refactoring the core code at some point. Entities should really be only dummy PHP object that contain no business logic, only simple data managing functions at most.

The implementation is mostly based on our previous work on this:
https://github.com/mainio/c5pkg_dbentities

And you can test the package implementation by ripping the "Entity" folder from this example:
https://github.com/mainio/c5_entities_example

I really did not get any further pointers on preferred way of implementation from the core team but it's a start.