Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » [SOLVED]Trying to extend ModelAdmin error

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

Page: 1
Go to End
Author Topic: 259 Views
  • Cgull
    Avatar
    Community Member
    23 Posts

    [SOLVED]Trying to extend ModelAdmin error Link to this post

    Hello,

    I try to follow the ModelAdmin but I don't totally understand what I should do and getting errors.

    What I did:
    Created a files in msite/code
    1. Donation.php

    class Donation extends DataObject
    {
       static $db = array('Name'=>'Varchar(100)');
       
       static $has_one = array('DonationAmount' => 'Amount');
    }

    2. DonationAmount.php

    class DonationAmount extends DataObject
    {
       static $db = array('Amount'=>'Varchar(100)');
       
       static $has_many = array('Donations' => 'Donation');
    }

    3. ClunyDonations.php

    class ClunyDonations extends ModelAdmin
    {
       public static $manage_models = array('Donation', 'DonationAmount');
       
       static $url_segment = 'donations';
       
       static $menu_title = 'Donations';
    }

    In my admin menu I now see Donations, but clicking on it I get this error:
    ModelAdmin::getManagedModels():
                You need to specify at least one DataObject subclass in public static $managed_models.
                Make sure that this property is defined, and that its visibility is set to "public"
    IN GET /clunysilver/admin/donations/
    Line 277 in C:\wamp\www\clunysilver\framework\admin\code\ModelAdmin.php

    What am I missing?

  • Schmatze
    Avatar
    Community Member
    3 Posts

    Re: [SOLVED]Trying to extend ModelAdmin error Link to this post

    Hi,

    Seems like you have a typo:)

    Use :

    public static $managed_models = array('Donation', 'DonationAmount');

    instead of:

    public static $manage_models = array('Donation', 'DonationAmount');

  • Cgull
    Avatar
    Community Member
    23 Posts

    Re: [SOLVED]Trying to extend ModelAdmin error Link to this post

    Oh dear, these stupid silly spelling mistakes....

    *blush*

    Thank you

    259 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.