Ostico / PhpOrient

PhpOrient - Official Php driver based on the binary protocol of OrientDB.
Other
68 stars 37 forks source link

The purpose of setOClass and class auto-detection #9

Open andreyvk opened 9 years ago

andreyvk commented 9 years ago

Hi,

What is the purpose of setting the class if in the end setRid() decides which cluster the record should go to?

To expand further, could it be possible to auto-detect the class or even auto-create it on the database as it normally happens, when you use Java client?

This finally leads to my last question on de/serialization of objects. Is there any roadmap on supporting object database more in the library?

Ostico commented 9 years ago

Surely auto-detection is possible because of ClusterMap class, i set it as an improvement. The method is even useful if you want create a record manually and uniform to a normal extracted record.

Moreover another improvement is to update the ClusterMap class when a "create class/drop class" command is issued from sql.

For the last question, can you explain better which objects ?

andreyvk commented 9 years ago

For my last question I will again refer to Java. As you probably know, the de/serialization of objects in Java is straightforward. So, say if you have class Person and then you save with using db.save(), then you can also retrieve that record as an object of class Person. Here's a short example:

Person p = db.getInstance(Person.class);
p.setThis(...);
p.setThat(...);
db.save(p);

It's a big change from what this library supports now, but I am simply curious of what would be the best way of implementing it at the moment. Maybe some serialization util or smth?

Ostico commented 9 years ago

For now in my mind was only to fully implement the protocol, next step is to increase the code coverage to have more reliable client and to make safer the develop of next features.

Further step ( when it will be stable on the OrientDB side ) is the schemaless bynary protocol.

I don't know if i will implement abstraction like query builders and/or Active records objects on the driver because the driver is a low level interface to a binary communication. Leaving it simple permit an easy implementation inside other advanced tools like ORM.

I'm thinking about that, maybe a new project can be made over the driver to implement more advanced functionalities.

andreyvk commented 9 years ago

I see now. Thanks for letting me know. In any case, it's great to have this project going forward as there's really no other better option available :)