Are there any potential pitfalls or drawbacks to fetching the DB adapter from Zend_Registry in every model in ZendFramework?
Fetching the DB adapter from Zend_Registry in every model can lead to tight coupling and make it difficult to unit test the models in isolation. To solve this issue, it's better to inject the DB adapter into the models through their constructors or setter methods.
class MyModel
{
protected $db;
public function __construct(Zend_Db_Adapter_Abstract $db)
{
$this->db = $db;
}
// Rest of the model code here
}