silverstripe-australia/silverstripe-gridfieldextensions — pull request #73 by briceburg (2014-12-06 21:58:02+00:00)
Title: support and cast relationship references as ReadonlyField

Allows relationship fields and casts as ReadonlyField by default. Before a fatal error would occur when trying to clone a non object.

Example;

```php
class Attachment extends DataObject {
private static $db = array(
'Title' => 'Varchar',
);

private static $has_one = array(
'File' => 'File'
);

private static $summary_fields = array(
'Title' => 'Title',
'File.Name' => 'File Name',
'File.Size' => 'File Size',
'File.FileType' => 'File Type'
);
}

....

//EditableGridfield usage:

$grid_config->getComponentByType('GridFieldEditableColumns')->setDisplayFields(
array(
'Title' => array(
'title' => 'Title',
'field' => 'TextField'
),
'File.Name' => array(
'title' => 'File Name'
),
'File.Size' => array(
'title' => 'File Size'
)
// ...
);
```

Reference: PR #58