Jump to:

23377 Posts in 18296 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Changing datatype IDs to titles in ModelAdmin

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 198 Views
  • lozhowlett
    Avatar
    Community Member
    146 Posts

    Changing datatype IDs to titles in ModelAdmin Link to this post

    Guys

    Please see attached, I have a model VehicleType

    <?php
    class VehicleType extends DataObject
    {
    static $db = array (
    'VehicleTypeName' => 'Varchar(255)',
    'VehicleRegRequired' => 'Boolean'
    );

    static $has_one = array(
    );

    static $has_many = array(
    'Tariffs' => 'Tariff'
    );

    static $searchable_fields = array(
    'VehicleTypeName',
    'VehicleRegRequired'
    );

    static $summary_fields = array(
    'VehicleTypeName',
    'VehicleRegRequired'
    );

    }

    When I create a new Vehicle type in admin it says "Saved #1". I want to to say "Saved "Car"" instead. Is this possible?

    Thanks

    Attached Files
  • kinglozzer
    Avatar
    Community Member
    138 Posts

    Re: Changing datatype IDs to titles in ModelAdmin Link to this post

    You should be able to do it like this:

    public function getTitle() {
       return $this->VehicleTypeName;
    }

    198 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.