Created
May 29, 2019 03:54
-
-
Save altwohill/e2211bc80a52dbbce360f57603fb1e91 to your computer and use it in GitHub Desktop.
Example ModelAdmin issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace { | |
use SilverStripe\ORM\DataObject; | |
class Breed extends DataObject | |
{ | |
private static $db = [ | |
'BreedName' => 'Varchar(255)', | |
]; | |
private static $has_many = [ | |
'Dogs' => Dog::class | |
]; | |
private static $summary_fields = [ | |
'BreedName' => 'Breed', | |
'Dogs.Count' => 'Dogs' | |
]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace { | |
use SilverStripe\ORM\DataObject; | |
class Dog extends DataObject | |
{ | |
private static $db = [ | |
'Name' => 'Varchar(255)', | |
]; | |
private static $has_one = [ | |
'Breed' => Breed::class | |
]; | |
private static $summary_fields = [ | |
'Name' | |
]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace { | |
use SilverStripe\Admin\ModelAdmin; | |
class DogAdmin extends ModelAdmin | |
{ | |
private static $managed_models = [Breed::class]; | |
private static $url_segment = 'dogs'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment