There are a couple of Zend Framework snippets and how-tos I find myself googling over and over again. I have decided to maintain this list and keep adding to it as I go along.
- Bypassing Zend_Db prepared statements:For complex queries, you may have to write the query out by hand and we recently had to do that. However Zend_Db insists on preparing ALL statements and a PDO bug forced the need to bypass this by accessing the connection object directly.
To do that run:$result = $db->getConnection()->exec('SELECT * FROM users');
- Disable Zend_Layout
public function ajaxAction() { // disable layouts for this action: $this->_helper->layout->disableLayout(); ... }
- Disable Zend_ViewRenderer
public function processingAction() { $this->_helper->layout->disableLayout(); // disable the view for this action. e.g. actions that redirect after processing $this->_helper->viewRenderer->setNoRender(); ... }
No related posts.