|
Re: Best practices in a thin-controller application: msg#00124php.zend.framework.mvc
On Sat, Jul 19, 2008 at 1:35 AM, Adam Jensen <jazzslider-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
So -- would you advocate, e.g., a model constructor roughly like function __construct($id = null) { if (! $id) { throw new Exception("missing id parameter"); } if (!$this->isValidId($id)) {throw new Exception("invalid id"); } // instantiate a subclass of Zend_Db_Table_Abstract $this->someTable if (! $object = $this->someTable->find($id)) { throw new Exception("record $id not found"); } // continue initializing etc } I seem to recall reading somewhere that throwing exceptions in a constructor is bad form but I forget where or why. -- David Mintz http://davidmintz.org/ The subtle source is clear and bright The tributary streams flow through the darkness |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: How to populate a select form element from a different module/controller/model?: 00124, Bryce Lohr |
|---|---|
| Next by Date: | Re: Best practices in a thin-controller application: 00124, Bryce Lohr |
| Previous by Thread: | Re: Best practices in a thin-controller applicationi: 00124, Adam Jensen |
| Next by Thread: | Re: Best practices in a thin-controller application: 00124, Bryce Lohr |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |