-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jim Wilson wrote:
function instantiate( &$request ) { $uploadForm = new UploadForm($request); wfRunHooks('UploadFormInstantiate', array( &$uploadForm, &$request )); return $uploadForm; }
Well, the obvious limitation here is that you're instantiating the object with a fixed class first. This method means you'd have to either proxy the original object or throw it away and create a new one (hope there's no side effects!)
Subclassing could be a nice way to do things in various circumstances, where proxy objects are IMHO kind of ugly.
Step 2: Replace all calls to the traditional "new Whatever($args)" with "Whatever::instantiate($args)".
Note that we use factory methods fairly extensively, usually with multiple such methods.
- -- brion vibber (brion @ pobox.com / brion @ wikimedia.org)