No idea im following the docs. If you have a much elegant fashion to
start the db pointer in the init methods of controllers do let me know :)
I managed to work out handling the errors in the error controller, so
display a user friendly error page in the normal error view script and
also log the exception, if a debug config is on
render a developer specific view and display the message and stack in
the view script :D
Karol Grecki wrote:
Dan
I think that's little excessive. Why do you call getConnection() explicitly?
What do you do inside each catch{} block?
Unless you have some smart way to handle such failure it's absolutely
pointless in my opinion.
Karol
Dan Rossi-5 wrote:
Another example for instance, I'll have to duplicate this across
controllers
$this->db = Zend_Registry::get('db');
try {
$this->db->getConnection();
} catch (Zend_Db_Adapter_Exception $e) {
var_dump($e);
// perhaps a failed login credential, or perhaps the RDBMS
is not running
} catch (Zend_Exception $e) {
var_dump($e);
// perhaps factory() failed to load the specified Adapter
class
}
Jack Sleight wrote:
I solve this by creating an ApplicationController which extends
Zend_Controller_Action, and then all my other controllers extend that.
Just make sure to include the file, because ZF wont include it
automatically.
Dan Rossi wrote:
Hi there I meant a common class the controllers can extend to reuse
some functionality, ie getting the registries set in the bootstrap ,
etc. Then it means its only editable in one spot. Maybe via a plugin ?
Karol Grecki wrote: