{"action":"created","issue":{"url":"https://api.github.com/repos/phemellc/yii2-settings/issues/37","repository_url":"https://api.github.com/repos/phemellc/yii2-settings","labels_url":"https://api.github.com/repos/phemellc/yii2-settings/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/phemellc/yii2-settings/issues/37/comments","events_url":"https://api.github.com/repos/phemellc/yii2-settings/issues/37/events","html_url":"https://github.com/phemellc/yii2-settings/issues/37","id":124821082,"number":37,"title":"add option to create entry on get()","user":{"login":"schmunk42","id":649031,"avatar_url":"https://avatars.githubusercontent.com/u/649031?v=3","gravatar_id":"","url":"https://api.github.com/users/schmunk42","html_url":"https://github.com/schmunk42","followers_url":"https://api.github.com/users/schmunk42/followers","following_url":"https://api.github.com/users/schmunk42/following{/other_user}","gists_url":"https://api.github.com/users/schmunk42/gists{/gist_id}","starred_url":"https://api.github.com/users/schmunk42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schmunk42/subscriptions","organizations_url":"https://api.github.com/users/schmunk42/orgs","repos_url":"https://api.github.com/users/schmunk42/repos","events_url":"https://api.github.com/users/schmunk42/events{/privacy}","received_events_url":"https://api.github.com/users/schmunk42/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-04T19:22:35Z","updated_at":"2016-02-10T20:40:00Z","closed_at":null,"body":"How about adding a forth parameter to `get()` which would create a deactivated entry, if there is no setting in the database yet?\r\n\r\nStatic helper as an example:\r\n\r\n```\r\nclass Settings\r\n{\r\n    static function get($key, $section, $default = null, $create = true)\r\n    {\r\n        $value = \\Yii::$app->settings->get($key, $section, $default);\r\n        if ($value === $default && $create !== false) {\r\n            \\Yii::$app->settings->set($key, $default, $section);\r\n            \\Yii::$app->settings->deactivate($key, $section);\r\n        }\r\n        return $value;\r\n    }\r\n}\r\n```\r\n\r\nAny thoughts?\r\n\r\nPS: I think the check should be improved a bit... \r\n"},"comment":{"url":"https://api.github.com/repos/phemellc/yii2-settings/issues/comments/182574436","html_url":"https://github.com/phemellc/yii2-settings/issues/37#issuecomment-182574436","issue_url":"https://api.github.com/repos/phemellc/yii2-settings/issues/37","id":182574436,"user":{"login":"mnglkhn","id":704285,"avatar_url":"https://avatars.githubusercontent.com/u/704285?v=3","gravatar_id":"","url":"https://api.github.com/users/mnglkhn","html_url":"https://github.com/mnglkhn","followers_url":"https://api.github.com/users/mnglkhn/followers","following_url":"https://api.github.com/users/mnglkhn/following{/other_user}","gists_url":"https://api.github.com/users/mnglkhn/gists{/gist_id}","starred_url":"https://api.github.com/users/mnglkhn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnglkhn/subscriptions","organizations_url":"https://api.github.com/users/mnglkhn/orgs","repos_url":"https://api.github.com/users/mnglkhn/repos","events_url":"https://api.github.com/users/mnglkhn/events{/privacy}","received_events_url":"https://api.github.com/users/mnglkhn/received_events","type":"User","site_admin":false},"created_at":"2016-02-10T20:40:00Z","updated_at":"2016-02-10T20:40:00Z","body":"Hmm, now that I've re-read your initial post, your request is a rather specific one. \r\nPls disregard my suggestion."}}