/** * Constructor * * Instantiate the DB writer object. * * @param \Pop\Db\Record $table * @throws Exception * @return \Pop\Log\Writer\Db */ public function __construct(\Pop\Db\Record $table) { // Check that the table has the appropriate columns. $tableInfo = $table->getTableInfo(); if (!array_key_exists('timestamp', $tableInfo['columns']) || !array_key_exists('priority', $tableInfo['columns']) || !array_key_exists('name', $tableInfo['columns']) || !array_key_exists('message', $tableInfo['columns'])) { throw new Exception("Error: The required table fields ('timestamp', 'priority', 'name' & 'message') do not exist in the table."); } $this->table = $table; }