You are here

public function ILT::removeMember in Opigno Instructor-led Trainings 8

Same name and namespace in other branches
  1. 3.x src/Entity/ILT.php \Drupal\opigno_ilt\Entity\ILT::removeMember()

Removes member from the ILT.

Parameters

int $uid: The user ID.

Return value

$this

Overrides ILTInterface::removeMember

File

src/Entity/ILT.php, line 256

Class

ILT
Defines the ILT entity.

Namespace

Drupal\opigno_ilt\Entity

Code

public function removeMember($uid) {
  $values = $this
    ->get('members')
    ->getValue();
  $values = array_filter($values, function ($value) use ($uid) {
    return $value['target_id'] != $uid;
  });
  $this
    ->set('members', $values);
  return $this;
}