Remix.run Logo
poncho_romero 10 hours ago

In the PHP back end I work on, I find the ORM immensely helpful because we need to instantiate objects to do things like permissions checks. The alternative seems like much more work. What am I missing with regards to ORMs being a bad idea?

e12e an hour ago | parent | next [-]

I think orms are typically fine. Something like rails can even play reasonably well with legacy databases (but you might need to create a view or two to rename columns names that collide with "magic column names").

There are reasonable arguments for leaving most to the db; effectively exposing some VIEWs and FUNCTIONs as the application interface for any and all bindings. Like legacy java and greenfield php for example.

I'd say it's different work rather than strictly more work.

ozim 9 hours ago | parent | prev [-]

It is just „SQL people” crying out not knowing how to work with ORM. They always claim that devs who use ORM don’t know SQL. But I never seen or hired a dev that doesn’t know SQL and yet for each project we use ORM.

I also never seen anyone claiming that you doesn’t have to know SQL and ORM is enough from the opposite side.

If you really run into spot where your ORM breaks you can always drop to SQL. If you build project „SQL first” you robbed yourself from ORM upsides and you are bound to badly implement your own one in the long run.

frollogaston 9 hours ago | parent [-]

The issue is if you use the ORM, you still need to understand the DB it's on top of. There isn't much point in using such a leaky abstraction when it's easy enough to just use SQL.

ozim 2 hours ago | parent [-]

I just wrote it at the end of my previous comment.

You can use well known library that more people will comfortably using

or

given enough time you will build crooked, half baked ORM of your own.