

You're taking a matter of taste and context-based tradeoffs and acting like those reflect unchallengeable principles. I'm happy not to have to write out all the props twice when there's no tangible performance issue and I've never had any other problems with dynamically getting the model attributes from the schema. My IDE gives me direct insight by inspecting the table.

If not seeing the properties on the model is a huge problem, there are plugins to generate them and put them in the model. In both Rails and Laravel you can define accessors and setters, either overwriting the magic property for the column or defining new properties.

DOCTRINE ELOQUENT LARAVEL CODE
People have been upset about this forever, but everyone else has happily used Active Record and had no major issues, all while enjoying not having to add a dozen lines of code to annotate props. Other ORMs, like that in Ruby on Rails, also do not explicitly set model properties and just map to database columns. Nothing is hidden - at least no more than any ORM that inherits from another class which gives it functionality.Īs for properties - yes, they're not explicitly described but mapped to the database schema. You can look at a Laravel (Eloquent) model and easily see what methods it has. glorified global variables filled with magic methods that you're expected to make extensive use of. And let's not forget the amazing "Facades" a.k.a. The mere fact that models are PHP classes but none of their properties that exist in the database are actually declared as properties in the class because the ORM just "magically" puts them there at runtime should be enough to drive away any sane person. I really have no idea how any experienced programmer can look at it and think it's usable for anything beyond the most simple project. Laravel is great if you just want to get something simple done as fast as possible with the simplest, most elegant (at a glance) code possible and don't care at all about understanding how it works, what's going on under the hood, performance, doing anything the devs didn't expect, etc.Įverything in Laravel is as obscured, "magical" and opinionated as possible for the sake of making the code "beautiful" (again, at a glance) to the detriment of basically everything else.
