{"action":"opened","issue":{"url":"https://api.github.com/repos/silverstripe/silverstripe-widgets/issues/131","repository_url":"https://api.github.com/repos/silverstripe/silverstripe-widgets","labels_url":"https://api.github.com/repos/silverstripe/silverstripe-widgets/issues/131/labels{/name}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-widgets/issues/131/comments","events_url":"https://api.github.com/repos/silverstripe/silverstripe-widgets/issues/131/events","html_url":"https://github.com/silverstripe/silverstripe-widgets/issues/131","id":163371221,"number":131,"title":"Reading custom DB fields from controller.","user":{"login":"ElGabbu","id":603404,"avatar_url":"https://avatars.githubusercontent.com/u/603404?v=3","gravatar_id":"","url":"https://api.github.com/users/ElGabbu","html_url":"https://github.com/ElGabbu","followers_url":"https://api.github.com/users/ElGabbu/followers","following_url":"https://api.github.com/users/ElGabbu/following{/other_user}","gists_url":"https://api.github.com/users/ElGabbu/gists{/gist_id}","starred_url":"https://api.github.com/users/ElGabbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElGabbu/subscriptions","organizations_url":"https://api.github.com/users/ElGabbu/orgs","repos_url":"https://api.github.com/users/ElGabbu/repos","events_url":"https://api.github.com/users/ElGabbu/events{/privacy}","received_events_url":"https://api.github.com/users/ElGabbu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-01T10:53:21Z","updated_at":"2016-07-01T10:53:21Z","closed_at":null,"body":"Hi all,\r\n\r\nI setup a widget which has a db field:\r\n\r\n```\r\n> private static $db = array(\r\n> \t\t'FeaturedOnly' => 'Boolean'\r\n> \t);\r\n```\r\n\r\nWhen trying to read that property from the controller's function using:\r\n\r\n`$this->widget->FeaturedOnly`\r\n\r\nI didn't get back a value ... the only way I found to manage to ready the correct value was:\r\n\r\n`$this->widget->dbObject('FeaturedOnly')->getValue()`\r\n\r\nSeems a bit cumbersome, I am not sure why my first approach didn't work but I noticed that in the record property of the widget the field was showing as lazy ...\r\n\r\n```\r\n[record:protected] => Array\r\n        (\r\n            [ClassName] => LatestNewsWidget\r\n            [LastEdited] => 2016-07-01 11:40:15\r\n            [Created] => 2016-07-01 11:19:19\r\n            [Title] => Latest News\r\n            [Sort] => 0\r\n            [Enabled] => 1\r\n            [Version] => 1\r\n            [ParentID] => 1\r\n            [ID] => 1\r\n            [RecordClassName] => LatestNewsWidget\r\n            [FeaturedOnly_Lazy] => LatestNewsWidget\r\n        )\r\n```\r\n\r\nThanks"}}
{"actor":{"display_login":"ElGabbu"}}