public function GroupType::preSave in Group 8
Same name and namespace in other branches
- 2.0.x src/Entity/GroupType.php \Drupal\group\Entity\GroupType::preSave()
Acts on an entity before the presave hook is invoked.
Used before the entity is saved and before invoking the presave hook.
Ensure that config entities which are bundles of other entities cannot have their ID changed.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.
Throws
\Drupal\Core\Config\ConfigNameException Thrown when attempting to rename a bundle entity.
Overrides ConfigEntityBundleBase::preSave
File
- src/
Entity/ GroupType.php, line 252
Class
- GroupType
- Defines the Group type configuration entity.
Namespace
Drupal\group\EntityCode
public function preSave(EntityStorageInterface $storage) {
// Throw an exception if the group type ID is longer than the limit.
if (strlen($this
->id()) > GroupTypeInterface::ID_MAX_LENGTH) {
throw new ConfigEntityIdLengthException("Attempt to create a group type with an ID longer than " . GroupTypeInterface::ID_MAX_LENGTH . " characters: {$this->id()}.");
}
parent::preSave($storage);
}