On Aug 30, 2010, at 6:39 AM, Tantius, Richard wrote:
The only problem, now I need to use ZendX_Db_Table instead of Zend_Db_Table in my whole application. My question is, is there maybe a more efficient way instead of introducing a whole new class level to my application, just to make Zend ignore sequences when working with MySql?
Here's how I'd do it in vim:
:cd application/models:n `grep -r -l --include=*.php extends.Zend_Db_Table_Abstract .`/extends Zendc$extends MyProject_AbstractTable:nn.
Repeat the last three steps until you've reached the last of your table classes.
Here's how I'd write the custom Table class, simply overriding a protected function from the base class:
abstract class MyProject_AbstractTable extends Zend_Db_Table_Abstract{protected function _setSequence($sequence){if ($this->_db instanceof Zend_Db_Adapter_Pdo_Mysql || $this->_db instanceof Zend_Db_Adapter_Mysqli){$sequence = (bool) $sequence;}$this->_sequence = $sequence;return $this;}}
Regards,
Bill Karwin
没有评论:
发表评论