Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

[SOLVED]Trying to extend ModelAdmin error


Reply


3 Posts   335 Views

Avatar
Cgull

Community Member, 23 Posts

15 January 2013 at 7:16pm

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?

Avatar
Schmatze

Community Member, 3 Posts

15 January 2013 at 9:30pm

Hi,

Seems like you have a typo:)

Use :

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

instead of:

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

Avatar
Cgull

Community Member, 23 Posts

15 January 2013 at 10:40pm

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

*blush*

Thank you :)