public static function delete($obj, $identifier) { $success = FALSE; // Sanity check if (!is_object($obj)) { return FALSE; } // Initialize telephony driver / check if already initialized $driver = self::getDriver(); $driverName = get_class($driver); // If no driver is set, just return w/ FALSE. if (!$driver) { return FALSE; } // Support for column aggregation automagically as well as special handling of dialplan/numbers if (get_parent_class($obj) != 'Doctrine_Record' and get_parent_class($obj) != 'Bluebox_Record') { $objectName = get_parent_class($obj); Kohana::log('debug', 'Telephony -> Deleting information from ' . $objectName . ' (' . get_class($obj) . ') ' . implode(', ', $identifier) . ' with OID ' . $obj->getOid()); } else { $objectName = get_class($obj); Kohana::log('debug', 'Telephony -> Deleting information from ' . $objectName . ' ' . implode(', ', $identifier) . ' with OID ' . $obj->getOid()); } $modelDriverName = self::$driverName . '_' . $objectName . '_Driver'; // Does the [Doctrine] object we were just passed contain a relevant driver? If so, call it's driver method if (class_exists($modelDriverName, TRUE)) { self::$identifier = $identifier; // Get base model to give to the set() routine, for reference $base = Bluebox_Record::getBaseTransactionObject(); try { kohana::log('debug', 'Telephony -> EVAL ' . $modelDriverName . '::delete($obj, $base);'); $success = eval('return ' . $modelDriverName . '::delete($obj, $base);'); } catch (Exception $e) { Kohana::log('error', 'Telephony -> Eval exception: "' . $objectName . '". ' . $e->getMessage()); } if (!empty($obj['plugins'])) { foreach ($obj['plugins'] as $name => $data) { $pluginName = ucfirst($name); $pluginDriverName = $driverName . '_' . $pluginName . '_Driver'; if (!class_exists($pluginDriverName)) { Kohana::log('debug', 'Telephony -> No telephony plugin driver for delete of "' . $objectName . '" records...'); continue; } Kohana::log('debug', 'Telephony -> Deleting information from plugin ' . $pluginName . ' on ' . $objectName . ' ' . $identifier); try { kohana::log('debug', 'Telephony -> EVAL ' . $pluginDriverName . '::delete($obj, $base);'); $success = eval('return ' . $pluginDriverName . '::delete($obj, $base);'); } catch (Exception $e) { Kohana::log('error', 'Telephony -> Eval exception: "' . $pluginName . '". ' . $e->getMessage()); } } } self::$identifier = NULL; } else { Kohana::log('debug', 'Telephony -> No telephony module driver for delete of "' . $objectName . '" records...'); } Kohana::log('debug', 'Telephony -> Done deleting information from model "' . $objectName . '".'); return $success; }