以不同的名称显示数据对象

时间:2012-12-04 08:31:30

标签: silverstripe

以下是我的客户数据对象

<?php
 class Customer extends DataObject {
static $db = array(
    'FirstName' => 'Varchar',
    'Surname' => 'Varchar',
    'Email' => 'Varchar',
    'CustomerType' => "Enum('Private,Business','Private')"
);
static $has_one = array(
    'Avatar' => 'Image',
);
static $has_many = array(
    'HostingContracts' => 'HostingContract'
);
static $summary_fields = array(
    'FirstName',
    'Surname',
    'CustomerType'
);
static $searchable_fields = array(
    'FirstName',
    'Surname',
    'HostingContracts.ContractNumber'
);
    }
    ?>

我需要“客户”显示为“客户端”,而不更改对象的类名。 有谁知道如何做到这一点?

1 个答案:

答案 0 :(得分:4)

class Customer extends DataObject {
  static $singular_name = 'Client';
  static $plural_name = 'Clients';
}