Re: Patch for DataObject's class generator

From: Date: Mon, 13 Dec 2004 13:05:57 +0000
Subject: Re: Patch for DataObject's class generator
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-35032@lists.php.net to get a copy of this message
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 :-) 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

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