Closed anhskohbo closed 10 years ago
Your removeColumn function will fail because of $names = func_get_args();
. I suggest you duplicate the remove_column function instead of alias. Have also done the same on my fork and have encountered it.
btw: I think it's Camel Case and not Came Case?
Much more elegant method of camelCase (and CamelCase) to snake_case conversion below. Just put it anywhere in Datatables class.
/**
* PR #93
* camelCase to snake_case magic method
*/
public function __call($name, $arguments)
{
$name = strtolower(preg_replace('/([^A-Z])([A-Z])/', "$1_$2", $name));
if (method_exists($this, $name)) {
return call_user_func_array(array($this, $name),$arguments);
} else {
trigger_error('Call to undefined method '.__CLASS__.'::'.$name.'()', E_USER_ERROR);
}
}
Tested and ready to go. In case of not finding the method it triggers native php error that is handled properly by Laravel (shows the debug info etc.)
Anhskohbo i'm going to add my implementation of this functionality into branch. Your proposed change is simply not universal enough and will needlessly expand the code. I hope you don't mind, are you OK with that?
never mind :)
Use camelCase style inside of snake_case