PHP implementation of the ActiveRecord pattern