5099 Posts in 1519 Topics by 1116 members
| Go to End | Next > | |
| Author | Topic: | 667 Views |
-
SS3:Extend Group

7 September 2012 at 10:06pm
Hi all,
In 2.4 I've extended the built-in class Group and now I'm trying to port this to 3.0, but can't get it to work.
Organisation.php looks like this:
<?php
class Organisation extends DataExtension {
...
}Organisations.php looks like this:
<?php
class Organisations extends ModelAdmin {
public static $managed_models = array(
'Group'
);
static $url_segment = 'abc';
static $menu_title = 'abc';
}In _config.php I have this:
Object::add_extension('Group', 'Organisation');Everything looks fine, besides the fact that I can't save a group through this modeladmin. All I get is this error message:
"ERROR [User Error]: singleton() Called without a class
IN POST /mokss/admin/organisations/Group/EditForm/field/Group/item/4/ItemEditForm
Line 372 in /Applications/MAMP/htdocs/*****/framework/core/Core.php"Any clue?
-
Re: SS3:Extend Group

8 September 2012 at 4:46pm
You'll probably need to post the code to Organization. If you remove all the code from organization then try and save does it work?
-
Re: SS3:Extend Group

8 September 2012 at 5:32pm Last edited: 8 September 2012 5:33pm
Thanks for the reply but no, thats the thing, it won't save, even if it's empty.
-
Re: SS3:Extend Group

12 September 2012 at 4:03am
Reflektera, I basically recreated what you did on a fresh SS3.0 install. I was able to add a group and save no problem... Are there any other extensions or classes that could be causing the issue? Here is my code..
<?php
class GroupModelAdmin extends ModelAdmin {
public static $managed_models=array(
'Group'
);public static $url_segment='groupManager';
public static $menu_title='Group Manager';}
?>
<?php
class GroupExtension extends DataExtension {
}
?>
and in my _config.php
Object::add_extension('Group', 'GroupExtension');
Did you make sure to ?flush=all as well after adding your extension?
-
Re: SS3:Extend Group

13 September 2012 at 12:23am
First of all, thanks for trying to help!
I made a fresh installation on my production server, I only tried on my local MAMP before. Copy pasted your code and ?dev/build?flush=all. All I got is a white screen, and I can't se anything special in the log files.
Group Manager appears in CMS though, but still the same error message... I tried it on 3.0.1, guess next step is trying it on 3.0.
-
Re: SS3:Extend Group

13 September 2012 at 12:30am
If memory serves, the white screen is normal though on a dev/build in 3.0 when in live mode.... but still getting the singleton error when saving. Very strange... Please let me know if you have luck in a 3.0 install.
-
Re: SS3:Extend Group

13 September 2012 at 1:05am
It works in 3.0, so something like a bug in the latest version. Guess I'll continue with 3.0 til I can figure out what is wrong with .0.1.
Didn't know about the white screen in live mode. Have to check it out, cause I think I had the site in dev mode...
Thanks again!
-
Re: SS3:Extend Group

14 September 2012 at 12:13am
I tested myself in a fresh 3.0.1 install, and worked okay for me. Maybe something you did in the previous install was causing issues? I would recommend re-downloading 3.0.1 and trying again but with 3.0.2 potentially not that far off, could just wait till that drops and update your 3.0 install.
| 667 Views | ||
| Go to Top | Next > |



