|As they say on their website:|
"Doctrine is an object relational mapper (ORM) for PHP 5.2.3 and later that sits on top of a powerful database abstraction layer (DBAL). One of its key features is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL), inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication."
I have started using it a little and I like it a lot :)
it is bi-directional in creating classes from tables and tables from classes or yaml files.
I don't have the time to describe it I just wanted to point to this impressive os project that might help you a lot to get to a better way of thinking and implementing things in PHP.