I am working on a huge application in php which contains almost 600 tables to work with, not to mention it requires complex joining for 10 or 15 tables together.

i wanted to ask how much ORM is good to use for this kind of task? i know i can pretty straight forward achieved this writing raw queries on database layer. Since i am using laravel for this task and spinning my head around to get how to make these kinds of complicated joins using ORM , is it achievable using ORM or can't be used to big scale applications?

  • 1
    Could you elaborate on what you’re attempting to accomplish regardless of using a ORM? I’ve personally become jaded against ORM Solutions as they tend to add unneeded complexity and ultimately try to fit OO principals on top of relational data schemes. Not a great fit. Either way what do you think an ORM will give you here? – Andrew T Finnell Apr 1 '18 at 20:28

600 tables

is not something I'd try to tackle by relying on a tool. Sorting this out is going to be work. The application must already have some organizing principle. Work to understand whatever that is now before you abandon reason and reach for a miracle cure.

ORM has plenty of critics. A chief complaint is that what it gives you shouldn't even be called objects since they are turned inside out.

There likely is a sweeping improvement you could make to the code base but please put it off until you really understand how what you already have works and what it's real problems are.

The complex joining is likely a good place to look to make improvements. Once you understand aggregate roots you'll likely find ways to persist domain objects with a repository fairly simply rather then slave them off of a complex database join.

The trick is refactoring from one style to another and keeping your sanity. Move slowly and carefully. Don't be tempted by quick fixes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.