doctrine/orientdb-odm — pull request #186 by mitom (2014-12-13 19:38:45+00:00)
Title: Feature unit of work

This is still heavily a **WIP**.

It's my first step in getting the manager to actually manage entities. It is able to persist a document into the database. (It should be able to do multiple ones in a single transaction, but I haven't tested that yet.)

It can't yet handle embedded documents, links and edges.

I ran into some issues with the current implementation. The biggest one was the class annotation allowing several ODB classes to be mapped to a single PHP class, which makes it impossible to determine which ODB class is a new document should be, so now it takes the class property literally.

I decided to implement persistence by default using sql batches, which provide the highest performance since everything can be squeezed into 1 transaction (if I am correct). I added the PersisterInterface in case different implementations should be supported in the future, but I am actually against it. Inferior implementations shouldn't be encouraged in any sense and should a superior one appear, it should be the new standard. If you agree I will remove it, so any response on that?

I also changed the filling of proxies from the public vars/setters implementation to use Closures if available, or fall back to reflection. Public setters may have logic applied to them, in which case simply hydrating the value would result in a change.

Any problem with the changes above? I believe all of them are necessary.