3 ms·
20 years ago when I was writing PHP, ORMs were not popular (if they even existed). After writing a lot of raw SQL queries, I ended up creating some kind of ORM
by hnfong 4y ago
20 years ago when I was writing PHP, ORMs were not popular (if they even existed). After writing a lot of raw SQL queries, I ended up creating some kind of ORM API for my own use.
I can't imagine anyone preferring to use raw SQL and hand code the mapping from SQL field results to objects. The argument that it's not transferrable knowledge isn't even ORM-specific. You can make the same argument for any hotshot $framework or even $language that you think might fade away in a couple years. There's always a trade off between adopting unproven frameworks and reinventing your own wheel (or coding at a lower abstraction level with all its drawbacks). Even proven tech can go out of fashion, as was during the "NoSQL" craze a few years ago. It's just a matter of making good predictions with industry knowledge. There's no hard law of nature that SQL is going to survive another 10 years (though admittedly that's quite likely).
The number of people agreeing with your blanket, inflexible statement makes me wonder whether I'm in the wrong forum...
- andrewstuart 4y agoMost databases allow you to return the result as JSON. Just do that.