Silverstripe File relation in ModelAdmin doesnt publish

后端 未结 1 316
一生所求
一生所求 2021-01-20 03:27

Im using SilverStripe4 and the ModelAdmin to manage DataObjects.

The DataObject has a has_one on File. Everything works so far but on frontend controller the File

相关标签:
1条回答
  • 2021-01-20 04:13

    You can add the following to your DataObject:

    private static $owns = ['FileRelationName'];
    

    Example with a relation:

    private static $has_one = ['File' => File::class];
    private static $owns = ['File'];
    

    Any related object that is being declared as "owned" in this way will be published with the DataObject itself.

    0 讨论(0)
提交回复
热议问题