2008/10/5 debussy007 <[EMAIL PROTECTED]>: > But I would like for some reasons to create a class which is not linked to a > DB (for some POO reasons ...). However, I won't be able to use something > like: return $this->getAdapter()->query( to return results since it is not > linked to a DB.
This problem has not a simple solution. Entire books has been written on the subject (for instance the monumental Domain Driven Design). The substance is that you have a trade-off between simplicity of design (using a model that relies on database like active records, table data gateway, ecc.) and persistence agnosticism (the ability of classes to not depend on a data persistence layer such as a database). You could build data mappers, repositories, factories and so on to mantain pure model classes, but it's useful only if your domain is very complex: in this case classes are free of worriying about persistence and can concentrate on behaviour. And, finally you should consider the use of a tool like Doctrine. -- Giorgio Sironi Piccolo Principe & Ossigeno Scripter http://www.sourceforge.net/projects/ossigeno
