Re: Patch for DataObject's class generator

From: Date: Mon, 13 Dec 2004 13:22:56 +0000
Subject: Re: Patch for DataObject's class generator
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-35033@lists.php.net to get a copy of this message
"Markus Wolff" <wolff@21st.de> wrote in message news:41BD93B5.1090700@21st.de... > Torsten Roehr wrote: > > with approval from Alan I have created a patch for DO's class generator on > > top of the current CVS version to optionally generate getter and setter > > methods. > [...] > > Any comments are greatly appreciated! > > Hah! We'll see about that :-) Markus, it really is! ;) > IMHO, it's a nice convenience thing to have skeleton getter/setter > mehotds automatically generated with the DataObjects. However, putting > them inside the auto-code section in the DO, which is overwritten each > time you run the generator (read: each time you change something in the > database schema) is kind of besides the point. > > When you work with setters/getters instead of raw properties, you will > most probably want the possibility to write some code inside of them, > which sets or gets your values appropriately. Having this code > overwritten is not really what one would wish for :-) > > So, to make this useful, these methods should either be auto-generated > outside the auto-code section, or, even better, you must check for the > existence of a method with the same name *outside the auto-code > section*, and if it already exists, do not generate it again. This way, > you could have the skeleton methods in the auto-code section and move > them out of there if you need to have your own code within them. > > Regards, > Markus This problem is something I already pointed out on PEAR general. I'll try to change it to only generate methods that don't exist outside the auto-generated code. Here's a sample of what a generated class will look like with getters and setters: http://www.zilleon.com/PEAR/DB/DataObject/Person.php.txt Regards, Torsten

« previous php.pear.dev (#35033) next »