Skip to content

Instantly share code, notes, and snippets.

@taai
Created August 15, 2012 17:07
Show Gist options
  • Save taai/3361654 to your computer and use it in GitHub Desktop.
Save taai/3361654 to your computer and use it in GitHub Desktop.
self::get_called_class() throws error
<?php
abstract class Base_DB_ORM_Model extends Kohana_Object {
public function get_errors_filename()
{
$self = get_class($this);
return call_user_func(array($self, 'errors_filename'));
}
public static function errors_filename() {
$class_name = self::get_called_class();
// Just get the Model's name and strip the 'Model_Leap_'
return substr($class_name, 11);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment