APICHANGE: Group::addByGroupName() now creates the group if one does not already exist (from r83010) (from r94430)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@95611 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-12-16 05:41:08 +00:00
parent 96fdef27bd
commit c0db452069

View File

@ -190,7 +190,8 @@ class Group extends DataObject {
}
/**
* Add a member to a group.
* Add a member to a group. This will create the group if the given
* group code doesn't work.
*
* @param DataObject $member
* @param string $groupcode
@ -201,6 +202,15 @@ class Group extends DataObject {
$member->Groups()->add($group);
$member->write();
}
else {
$group = new Group();
$group->Code = $groupcode;
$group->Title = $groupcode;
$group->write();
$member->Groups()->add($group);
$member->write();
}
}
/**