You are here

public function Registration::removeGroup in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Registration.php \Drupal\rng\Entity\Registration::removeGroup()
  2. 3.x src/Entity/Registration.php \Drupal\rng\Entity\Registration::removeGroup()

Remove a group from the registration.

Parameters

int $group_id: The ID of a registration_group entity.

Return value

\Drupal\rng\RegistrationInterface Returns registration for chaining.

Overrides RegistrationInterface::removeGroup

File

src/Entity/Registration.php, line 183

Class

Registration
Defines the registration entity class.

Namespace

Drupal\rng\Entity

Code

public function removeGroup($group_id) {
  foreach ($this->groups
    ->getValue() as $key => $value) {
    if ($value['target_id'] == $group_id) {
      $this->groups
        ->removeItem($key);
    }
  }
  return $this;
}