* @license PHP License * @package WB * @subpackage eventHandler */ WBClass::load('WBEvent_Handler'); /** * WBEvent_Handler_Table * * @version 0.1.0 * @package Wombat * @subpackage eventHandler */ class WBEvent_Handler_Table extends WBEvent_Handler { /** * Table access * @var WBDatasource_Table */ protected $table; /** * Constructor * */ public function __construct() { parent::__construct(); $this->table = WBClass::create('WBDatasource_Table'); } /** * Get Identifying Key of Record * * @param WBEvent $e * @return string * @throws Exception in case of error */ protected function getKey4Config(WBEvent $e) { if (empty($this->config['table'])) { WBClass::load('WBException_Config'); throw new WBException_Config('Table must not be empty!', 1, __CLASS__); return ''; } $key = ''; if (!empty($this->config['key'])) { $key = $this->config['key']; return $key; } if (!empty($this->config['keyindex'])) { $index = $this->config['keyindex']; if (!is_array($index)) { $index = array($index); } $key = array(); foreach ($index as $i) { $key[] = $e->get($i); } $key = implode('-', $key); } if (empty($key)) { WBClass::load('WBException_Config'); throw new WBException_Config('Key may not be empty', 2, __CLASS__); } return $key; } }