I’m wondering - is it problematic to have a large application written in OOP without any ORM? I need to decide what kind of database access to implement in my next project and I’m undecided like never before I used to use a my own home-made ORM, which I liked a lot, it had a code generator from database schema so there was almost no need for any configuration and I got all IDE hints for field names along with column comments from the database. However, this followed the ActiveRecord pattern and the entities were mixed with database access methods and all of that was hard to test, and also I often ended up with huge objects that did far too much.
I am considering a data mapper now but none of the available ones fits my needs. I want something simple and lightweight that allows me to easily develop starting with the database design (as opposed to the php model that is later ‘migrated’), can be easily worked with plain SQL and has not too much overhead. I don’t care about database independence and don’t need too much abstraction. I even thought a minimalist mapping like the one in mikron would be enough for me…
Which led me to a conclusion that perhaps I might as well not use any object mapping and simply fetch data as arrays or plain objects. And if I structure my code properly and follow good separation of concerns then not having an ORM would not be such a bad thing since I would strive to make my application code ORM independent (and entity independent). Simply put, my modules would take certain data as input, do their thing and output whatever is needed so an ORM would be irrelevant.
Is my reasoning sound? I recently made a small web application based on Silex without any ORM - just plain SQL with DBAL. I created a CMS for two tables with forms and validation and didn’t really miss an ORM. Sure, ORM makes simple queries easier to write but this is not a deal breaker and I can treat it as syntactic sugar. The only problem to solve would be how to organize more complicated queries - but I think this can be easily done in classes that would be the equivalent of mapper classes in an ORM.
Generally, when I develop larger applications I tend to follow relational-centric design where I first develop database structure (which often gets large) and then base my code around that - in which case I don’t feel a need for object-relational mapping apart from perhaps cleaner access to data in simple cases. Any opinions welcome!