Hello!
I intend to use a project that needs scalable relational and structured database. In short word, I want to build a DMS with specially structured documents and some social aspects.
After doing some design, I thought of a hybrid solution using MySQL for relations and MongoDB for inner structures of objects. Here is what I came with:
The MySQL database contains the relations between objects, meaning the basic tables contain only a BINARY (12) _id
field corresponding to the ObjectId
in MongoDB. I'm considering duplicating some "important metadata", such as VACHAR(*) name
from the MongoDB structures into the fields of their MySQL counterparts, I'm still not sure about that...
What I'm really not sure about is the ways to use both in Phalcon: I though about having three classes per object, let's say I'm referring to the User
object:
- The
UserModel
class referring to the MySQL part of the object with relational information (this->hasMany
,this->hasManyToMany
, etc. would be therre) - The
UserCollection
class, with the inner structure, taken from MongoDB - The actual
User
class that uses these object and simplifies their usage
I'm not exactly convinced about this approach. I'm sure there are less clumsy ways to achieve this and I'm ready to use some kind of Middleware that would handle these classes mor efficiently, but I'm stuck.
Would anyone have ideas, remarks or advice about this?
Thanks a lot!