21287 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 834 Views |
-
$this->dataRecord->Fieldname versus $this->FieldName

14 July 2010 at 10:30pm Last edited: 14 July 2010 10:33pm
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!
| 834 Views | ||
|
Page:
1
|
Go to Top |

