Hi there,
Chapter 5 of the SilverStripe book by Ingo Schommer and Steven Broschart, specifically pages 149-150, states that to access a property of the model in the controller, the dataRecord property should be used. For example:
class MyPage extends Page {
static $db = array { 'MyField' => 'VarChar' };
function getCMS() { ... }
}
class MyPage_Controller extends Page_Controller {
$myField1 = $this->MyField;
$myField2 = $this->dataRecord->MyField;
}
myField1 and myField2 store the same content when echo'd out. What is the advantage of using dataRecord or is it used for other situations? Examples please.
thanks!