orientdb-odm icon indicating copy to clipboard operation
orientdb-odm copied to clipboard

Persist and remove methods for Manager

Open tomcyr opened this issue 12 years ago • 8 comments

This is my implementation of persist and remove methods without Unity of Work pattern. I know that Unity of Work exists in all Doctrine Mappers (I'm already using ORM and Mongo ODM Mapper) but in case Orient DB where every method is called by REST API i think that's no sense of using Unity of Work. Maybe you have other ideas or proposal?

tomcyr avatar Jan 25 '13 22:01 tomcyr

Hi @tomcyr,

even though we - for now - have only written the HTTP binding, most likely we will need to also support the binary protocol implementation, which is why we created the binding interface. I remember I also did a few benchmark with the other OrientDB PHP driver (but it was damn slow), so I wouldnt force users to use the HTTP protocol, if they are not willing to.

In any case, this PR is very useful as we can move some methods from the manager to the specific bindings and then let them handle persistence (the HTTP one will probably make a call for every query, the binary one will use transactions or so on). @nrk any thoughts?

Also, what about @lvca's comment on HTTP transactions? Luca, is there a way to send a bunch of queries in one shot trough the HTTP protocol?

odino avatar Jan 27 '13 06:01 odino

Hi @odino, probably now the PHP binary driver fixed the problem about performance? About Transactions it's a simple task to do, probably I could do it in the next week.

lvca avatar Jan 27 '13 22:01 lvca

@lvca the problem itself is how you need to parse stuff, char by char, as in PHP its expensive. A C native driver would help a lot, as we can build a php extension on top of it.

Transactions: yes BLEASE! :)

odino avatar Jan 28 '13 12:01 odino

Hi, probably it wouldn't be so bad using the C driver from PHP but I guess it's not so easy for everyone.

About tx we've: https://github.com/nuvolabase/orientdb/issues/90

Lvc@

On 28 January 2013 13:16, Alessandro Nadalin [email protected]:

@lvca https://github.com/lvca the problem itself is how you need to parse stuff, char by char, as in PHP its expensive. A C native driver would help a lot, as we can build a php extension on top of it.

Transactions: yes BLEASE! :)

— Reply to this email directly or view it on GitHubhttps://github.com/doctrine/orientdb-odm/pull/155#issuecomment-12779249.

lvca avatar Jan 28 '13 14:01 lvca

@odino I don't have quite a clear idea on the matter yet, I prefer to wait and see how transactions are going to be supported by OrientDB in its HTTP REST interface to make a comparison with how they are supported by the binary protocol interface before hazarding an answer :-)

nrk avatar Jan 28 '13 20:01 nrk

Some additions in this commit such as the use of putDocument() in the manager highlight what's probably a flaw in our current abstraction that we should address now that there's some early work on persistence: the manager class currently accepts a Doctrine\OrientDB\Binding\BindingInterface in its constructor, which in turn defines only a BindingInterface::execute() method. As a temporary fix we should change the constructor signature to use Doctrine\OrientDB\Binding\HttpBindingInterface just to play safe.

Next thing is to think about moving more methods from Doctrine\OrientDB\Binding\HttpBindingInterface to Doctrine\OrientDB\Binding\BindingInterface but on the other hand the naming of certain methods do not make sense in a broader abstraction since methods like postDocument() or putDocument() do not really make sense outside the realm of the HTTP REST API, while names like createDocument() and updateDocument() would.

I don't have a clear idea in mind right now, it's just a thought thrown here to keep track of it and spin the discussion to a broader level.

nrk avatar Feb 01 '13 10:02 nrk

@nrk totally up for that

@tomcyr I would still keep this methods outside of the Manager itself. orientdb v1.4.0 implements the multi-operations for HTTP protocol, so it makes sense to base the persistence on top of that

odino avatar Feb 03 '13 05:02 odino

OK guys, I created OrientDbBundle and I implementented persistance methods in my Service class outside Manager so in future this methods can be used from Manager:)

tomcyr avatar Feb 28 '13 02:02 tomcyr