dongpao1918
2014-05-15 21:12
浏览 34
已采纳

Silverstripe 3.1 - 与所有关系导出Dataobject?

I need to export the whole data of an dataobject. Database fields and relations.

private static $db = array (
    'URLSegment' => 'Varchar(255)',
    'SKU' => 'Text',
    'Title' => 'Text',
    'Price' => 'Text',
    'Content' => 'HTMLText',
    'ItemConfig' => 'Int',
    'Priority' => 'Int'
);

private static $has_one = array (
    'Visual' => 'Image'
);

private static $has_many = array (
    'Sizes' => 'ShopItem_Size',
    'Colors' => 'ShopItem_Color'
);

private static $many_many = array (
    'Visuals' => 'Image',
    'Categories' => 'ShopCategory'
);

I added everything to getExportFields(). But as expected the result for the relations is "ManyManyList" or "HasManyList"

public function getExportFields() {
    return array(
        'SKU' => 'SKU',
        'Title' => 'Title',
        'Price' => 'Price',
        'Content' => 'Content',
        'ItemConfig' => 'ItemConfig',
        'Visual' => 'Visual',
        'Visuals' => 'Visuals',
        'Sizes' => 'Sizes',
        'Colors' => 'Colors',
        'Categories' => 'Categories'
    );
}

Is it possible to create such an export?

Thank you in advance

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题