Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

API Make Object::config use late static binding

Can now be used in instance scope, like:
  $this->config()->db
and in static scope, like:
  Page::config()->db
  • Loading branch information...
commit 600d9cff53388738cfe8df72e9dc9b5de93d6758 1 parent 3f2b6a5
@hafriedlander hafriedlander authored chillu committed
Showing with 2 additions and 13 deletions.
  1. +2 −13 core/Object.php
View
15 core/Object.php
@@ -52,23 +52,12 @@
*/
public $class;
-
- /**
- * @todo Set this via dependancy injection? Can't call it $config, because too many clashes with form elements etc
- * @var Config_ForClass
- */
- private $_config_forclass = null;
-
/**
* Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
* @return Config_ForClass|null
*/
- public function config() {
- if (!$this->_config_forclass) {
- $this->_config_forclass = Config::inst()->forClass($this->class);
- }
-
- return $this->_config_forclass;
+ static public function config() {
+ return Config::inst()->forClass(get_called_class());
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.