/** * @return array */ public function getPlugins() { return Zend_Db_Table_Plugin_Broker::getPlugins($this); }
/** * Set row field value * * @param string $columnName The column key. * @param mixed $value The value for the property. * @return void * @throws Zend_Db_Table_Row_Exception */ public function __set($columnName, $value) { $tableClass = $this->getTableClass(); $columnName = $this->_transformColumn($columnName); if (!array_key_exists($columnName, $this->_data)) { require_once 'Zend/Db/Table/Row/Exception.php'; throw new Zend_Db_Table_Row_Exception("Specified column \"{$columnName}\" is not in the row"); } if (!isset($this->_stackData[self::STACK_SET][$columnName])) { $this->_stack(self::STACK_SET, $columnName, true); foreach (Zend_Db_Table_Plugin_Broker::getPlugins($tableClass) as $plugin) { $result = $plugin->setColumn($this, $columnName, $value); if (property_exists($this, $columnName)) { $value = $this->{$columnName}; unset($this->{$columnName}); } elseif ($value !== null) { $value = $result; } } $this->_stack(self::STACK_SET, $columnName, false); } $this->_data[$columnName] = $value; $this->_modifiedFields[$columnName] = true; }
/** * Notify plugins of an event * * @param Zend_Loader_PluginLoader_Interface $loader */ public static function notify($className = null, $suffix = null, array &$args = array()) { $plugins = Zend_Db_Table_Plugin_Broker::getPlugins($className); if (!$plugins) { return false; } $method = array_shift($args); $ret = count($plugins); $stack = false; foreach ($plugins as $plugin) { $class = get_class($plugin); if (!method_exists($plugin, $method . $suffix)) { require_once 'Zend/Db/Table/Row/Exception.php'; throw new Zend_Db_Table_Row_Exception("Cannot notify non-existing event '{$method}' in plugin '{$class}'"); } $result = call_user_func_array(array($plugin, $method . $suffix), $args); if ($result === false) { $ret = false; break; } } return $ret; }