public function OgRole::delete in Organic groups 8
Deletes an entity permanently.
Throws
\Drupal\Core\Entity\EntityStorageException In case of failures an exception is thrown.
Overrides EntityBase::delete
File
- src/
Entity/ OgRole.php, line 251
Class
- OgRole
- Defines the OG user role entity class.
Namespace
Drupal\og\EntityCode
public function delete() {
// The default roles are required. Prevent them from being deleted for as
// long as the group still exists, unless the group itself is in the process
// of being removed.
if (!$this->parentEntityIsBeingRemoved && $this
->isRequired() && $this
->groupTypeManager()
->isGroup($this
->getGroupType(), $this
->getGroupBundle())) {
throw new OgRoleException('The default roles "non-member" and "member" cannot be deleted.');
}
parent::delete();
}