3 ms·
I always disliked ActiveRecord, but I figured ORMs don't have to be ActiveRecord. I created this library 14(!) years ago not too long before this article was wr
by dools 3mo ago
I always disliked ActiveRecord, but I figured ORMs don't have to be ActiveRecord. I created this library 14(!) years ago not too long before this article was written https://github.com/iaindooley/PluSQL https://github.com/iaindooley/PluSQL
The idea is that you like SQL, but it gets repetitive writing joins and accessor code. I had always hoped it would catch on as a pattern: no boilerplate, automatic mapping to objects in your code of any query (whether generated by the ORM or passed in as a raw query) and easy to override/dynamically build bits of the query as you pass the object around.
- hparadiz 3mo agoThat's a query writer. Not an ORM.
- dools 3mo agoNo, it's an ORM because it gives you object based iteration over your query (and the ability to use custom classes for those objects, you just don't have to create classes for every single thing if you don't need them). EDIT: oh wait looks like I never got around to implementing the ability to use custom classes :) this is still in the to do section: come up with a good "mix in" style to cast the objects returned from the iterator to a new class for implementing custom functionality (that one would normally include as part of the "boilerplate" class)
- hparadiz 3mo agoYou are outputting generic QueryRow classes in your code for all results. That doesn't make it an ORM. By your definition PDO would qualify https://www.php.net/manual/en/class.pdorow.php https://www.php.net/manual/en/class.pdorow.php Here's a full report for you https://gist.github.com/hparadiz/a1fe30e88dbbe070878a7ea4f72bd4ac https://gist.github.com/hparadiz/a1fe30e88dbbe070878a7ea4f72...
- dools 3mo agoNo, PDO doesn't qualify, because it lacks the "relational mapping" part. If I want an AI opinion of my project I can always ask a chatbot myself.