* @license PHP License * @package WB */ WBClass::load('WBEvent_Handler_Newsletter_Subscriber'); /** * WBEvent_Handler_Newsletter_Subscriber_Table * * * @version 0.1.0 * @package WB */ class WBEvent_Handler_Newsletter_Subscriber_Table extends WBEvent_Handler_Newsletter_Subscriber { /** * handler config * * Parameters: * - 'table' * - 'primary' either string or '__auto', '__zero', '__none' * * @var array */ protected $config = array( 'table' => 'any', 'primary' => 'id' ); /** * Get Source If Any * * Return xid of source and set namespace, if any * * @param WBEvent * @param $namespace * @return string */ protected function getSource(WBEvent $e, &$namespace = '') { $namespace = $this->config['table']; $key = $this->config['primary']; switch ($this->config['primary']) { case '__zero'; return 0; break; case '__none'; return -1; break; case '__auto'; $table = WBClass::create('WBDatasource_Table'); $key = $table->getIdentifier($this->config['table']); break; default: break; } return $e->get($key, 0); } }