I have seen various MVC frameworks in addition to stand alone ORM frameworks for PHP, along with other ORM questions here however, the majority of the questions request for existing frameworks to obtain began with, that is not what I am searching for. (I've also read this SO question but I am unsure things to model of it, and also the solutions are vague.)

Rather, I believed I'd learn best through getting my hands dirty and really writing my very own ORM, a simple one. Except I do not really understand how to get began, especially because the code I see in other ORMs is really complicated.

With my PHP 5.2.x (this will be significant) MVC framework I've got a fundamental custom database abstraction layer, which has:

  • Quite simple techniques like connect($host, $user, $pass, $base), query($sql, $binds), etc
  • Subclasses for every DBMS it supports
  • A category (and particular subclasses) to represent SQL result sets

But doesn't have:

  • Active Record functionality, that we assume is definitely an ORM factor (correct me if I am wrong)

EDIT: to clarify, I have only a database abstraction layer. I do not have models yet, however when I implement them I would like these to be native ORM models (as they say), hence this.

I have educate yourself just a little about ORM, and from the understanding they offer a way to further abstract data models in the database itself by representing data as simply PHP-based classes/objects again, correct me should i be wrong or have skipped out by any means.

Still, I would like some simple tips from other people who's dabbled pretty much with ORM frameworks. Can there be other things I have to be aware of, simple example code that i can make reference to, or assets I'm able to read?