PHP class for manipulating database objects