News for hackers. Stuff that matters.
Re:The Last PHP PDO Library You Will Ever Need by leftnode on Friday November 04, 2011 @07:18AM (#3195629)
I'm interested in your counter arguments too. I'm sure there is some component or aspect I'm missing.
Re:The Last PHP PDO Library You Will Ever Need by Ramone on Friday November 04, 2011 @08:19AM (#3195749)
It's really all about factoring. You'll notice now that you have model logic in your controller. If you want to reuse that elsewhere, you'll first have to extract it to another class. That class is effectively a SQL generation library, except it's not useful in a general sense and it's not as well tested. The more you do this, the more you converge on reinventing a full blown ORM.

I'm not saying there aren't downsides to ORMs, but the counter-arguments to SQL in your controller are pretty obvious.

Re:The Last PHP PDO Library You Will Ever Need by wvenable on Friday November 04, 2011 @12:10PM (#3196571)
I disagree. Yes, this should be refactored and placed in a model; but that would be something like Clients::getReadMetrics() that would contain the same SQL. I don't see that heading towards a full ORM or even remotely like SQL generation.
Re:The Last PHP PDO Library You Will Ever Need by PedroCandeias on Friday November 04, 2011 @07:50AM (#3195684)
You'll get none from me. Funny reading your post, because it perfectly describes my own experience this year: starting to learn another language (ruby), then getting pulled right back into php for a big client project. And I also decided to ditch ORM and stick to PDO, which by the way is one hell of a library.
Re:The Last PHP PDO Library You Will Ever Need by rmccue on Friday November 04, 2011 @09:23AM (#3195936)
Couple of small things: you shouldn't `return ($var);`, since that returns the result of the statement `($var)`. Use `return $var;` instead, and return them by reference where possible.

I also would have gone with naming consistent with PDO's (i.e. `halfCamelCase` rather than `lower_case`), but that's personal preference. Consistency would be nice though.