{"action":"created","issue":{"url":"https://api.github.com/repos/webtechnick/CakePHP-Configuration-Plugin/issues/4","repository_url":"https://api.github.com/repos/webtechnick/CakePHP-Configuration-Plugin","labels_url":"https://api.github.com/repos/webtechnick/CakePHP-Configuration-Plugin/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/webtechnick/CakePHP-Configuration-Plugin/issues/4/comments","events_url":"https://api.github.com/repos/webtechnick/CakePHP-Configuration-Plugin/issues/4/events","html_url":"https://github.com/webtechnick/CakePHP-Configuration-Plugin/issues/4","id":36000647,"number":4,"title":"Configuration loading via component","user":{"login":"Theaxiom","id":57013,"avatar_url":"https://avatars.githubusercontent.com/u/57013?v=3","gravatar_id":"","url":"https://api.github.com/users/Theaxiom","html_url":"https://github.com/Theaxiom","followers_url":"https://api.github.com/users/Theaxiom/followers","following_url":"https://api.github.com/users/Theaxiom/following{/other_user}","gists_url":"https://api.github.com/users/Theaxiom/gists{/gist_id}","starred_url":"https://api.github.com/users/Theaxiom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Theaxiom/subscriptions","organizations_url":"https://api.github.com/users/Theaxiom/orgs","repos_url":"https://api.github.com/users/Theaxiom/repos","events_url":"https://api.github.com/users/Theaxiom/events{/privacy}","received_events_url":"https://api.github.com/users/Theaxiom/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-06-18T16:02:09Z","updated_at":"2016-03-15T09:53:02Z","closed_at":"2016-03-15T09:53:02Z","body":"Here's an idea for you that I just used, it allows your configuration to be loaded earlier and be used within other components:\r\n\r\n// ConfigComponent.php\r\n\r\n\t<?php\r\n\tApp::uses('Component', 'Controller');\r\n\tclass ConfigComponent extends Component {\r\n\t\tpublic $scope = 'Cfg';\r\n\t\tpublic function startup(Controller $controller) {\r\n\t\t\t$Configuration = ClassRegistry::init('Configuration');\r\n\t\t\t$Configuration->configScope = $this->scope;\r\n\t\t\t$Configuration->load();\r\n\t\t}\r\n\t}\r\n\r\n// Config model\r\n\r\n\t<?php\r\n\tApp::uses('AppModel', 'Model');\r\n\tclass Configuration extends AppModel {\r\n\t\tpublic $configScope = 'Cfg';\r\n\t\tfunction load() {\r\n\t\t\t$settings = $this->find('all');\r\n\t\t\tforeach ($settings as $setting) {\r\n\t\t\t\tConfigure::write (\r\n\t\t\t\t\t$this->configScope . '.' . $setting['Configuration']['name'],\r\n\t\t\t\t\t$setting['Configuration']['value']\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\t}"},"comment":{"url":"https://api.github.com/repos/webtechnick/CakePHP-Configuration-Plugin/issues/comments/196746146","html_url":"https://github.com/webtechnick/CakePHP-Configuration-Plugin/issues/4#issuecomment-196746146","issue_url":"https://api.github.com/repos/webtechnick/CakePHP-Configuration-Plugin/issues/4","id":196746146,"user":{"login":"Theaxiom","id":57013,"avatar_url":"https://avatars.githubusercontent.com/u/57013?v=3","gravatar_id":"","url":"https://api.github.com/users/Theaxiom","html_url":"https://github.com/Theaxiom","followers_url":"https://api.github.com/users/Theaxiom/followers","following_url":"https://api.github.com/users/Theaxiom/following{/other_user}","gists_url":"https://api.github.com/users/Theaxiom/gists{/gist_id}","starred_url":"https://api.github.com/users/Theaxiom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Theaxiom/subscriptions","organizations_url":"https://api.github.com/users/Theaxiom/orgs","repos_url":"https://api.github.com/users/Theaxiom/repos","events_url":"https://api.github.com/users/Theaxiom/events{/privacy}","received_events_url":"https://api.github.com/users/Theaxiom/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T09:53:02Z","updated_at":"2016-03-15T09:53:02Z","body":"Closed."}}