21307 Posts in 5737 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 960 Views |
-
Fatal error in ModelAdmin

12 July 2010 at 4:15am
I am getting the follwing error in ModelAdmin 2.4:
Fatal error: Call to a member function getModelSidebar() on a non-object in cms/code/ModelAdmin.php on line 251:
'Content' => $this->$class->getModelSidebar()
protected function getModelForms() {
$models = $this->getManagedModels();
$forms = new DataObjectSet();
foreach($models as $class => $options) {
if(is_numeric($class)) $class = $options;
$forms->push(new ArrayData(array (
'Title' => (is_array($options) && isset($options['title'])) ? $options['title'] : singleton($class)->i18n_singular_name(),
'ClassName' => $class,
'Content' => $this->$class->getModelSidebar()
)));
}
return $forms;
}I do not understand this. Does anybody know, why this happens and what I can do to make it work?
-
Re: Fatal error in ModelAdmin

12 July 2010 at 5:27am
Hi,
It is tough to solve without the code that is causing the error - believe me ModelAdmin is stable. My first guess would be that you have misspelled one of the static $managed_models = array('nonexistentdataobject','mispelleddataobject'); - if you cannot see any errors there (and you are sure all your data bojects are loading e.g. the FileName.php matches the class FileName extends DataObject()) then post the code of the model admin and data objects managed and maybe I can be more help.
Barry
-
Re: Fatal error in ModelAdmin

12 July 2010 at 9:29am
OMG! My code was ok... The problem was that I've used in one of my classes a reserved word. Renaming it solved it. Thanks for your help.
-
Re: Fatal error in ModelAdmin

1 September 2010 at 12:28am
I just had a similar issue, found this thread so I thourght I'd add mine to it... I had a mangaed_model called 'XYZ' and then I defined a function within the ModelAdmin called 'XYZ'. Renaming the function sorted it all out...
| 960 Views | ||
|
Page:
1
|
Go to Top |


