1<?
php declare(strict_types=1);
 
   40        $identification = 
$i->serialize();
 
   41        $stakeholder_id = $s->getId();
 
   42        $stakeholder_class_name = $s->getFullyQualifiedClassName();
 
   44        if (strlen($stakeholder_id) > 64) {
 
   45            throw new \InvalidArgumentException(
'stakeholder ids MUST be shorter or equal to than 64 characters');
 
   47        if (strlen($stakeholder_class_name) > 250) {
 
   48            throw new \InvalidArgumentException(
'stakeholder classnames MUST be shorter or equal to than 250 characters');
 
   51        $r = $this->db->queryF(
 
   52            "SELECT " . self::IDENTIFICATION . 
" FROM " . self::TABLE_NAME . 
" WHERE " . self::IDENTIFICATION . 
" = %s AND stakeholder_id = %s",
 
   54            [$identification, $stakeholder_id]
 
   57        if ($r->numRows() === 0) {
 
   62                    self::IDENTIFICATION => [
'text', $identification],
 
   63                    'stakeholder_id' => [
'text', $stakeholder_id],
 
   68        $r = $this->db->queryF(
 
   69            "SELECT id FROM " . self::TABLE_NAME_REL . 
" WHERE id = %s",
 
   73        if ($r->numRows() === 0) {
 
   78                    'id' => [
'text', $stakeholder_id],
 
   79                    'class_name' => [
'text', $stakeholder_class_name],
 
   84        $this->cache[$identification][$stakeholder_id] = $s;
 
   91        $r = $this->db->manipulateF(
 
   92            "DELETE FROM " . self::TABLE_NAME . 
" WHERE " . self::IDENTIFICATION . 
" = %s AND stakeholder_id = %s",
 
   96        unset($this->cache[
$i->serialize()][$s->
getId()]);
 
  106        $rid = 
$i->serialize();
 
  107        if (isset($this->cache[$rid]) && is_array($this->cache[$rid])) {
 
  108            return $this->cache[$rid];
 
  111        $r = $this->db->queryF(
 
  112            "SELECT class_name, stakeholder_id FROM " . self::TABLE_NAME . 
"  
  113            JOIN ".self::TABLE_NAME_REL.
" ON stakeholder_id = id 
  114            WHERE " . self::IDENTIFICATION . 
" = %s",
 
  118        while (
$d = $this->db->fetchAssoc($r)) {
 
  122        return $this->cache[$rid] ?? [];
 
  125    public function preload(array $identification_strings) : void
 
  127        $r = $this->db->query(
 
  128            "SELECT rid, class_name, stakeholder_id FROM " . self::TABLE_NAME
 
  129            . 
" JOIN ".self::TABLE_NAME_REL.
" ON stakeholder_id = id  
  130            WHERE " . $this->db->in(self::IDENTIFICATION,
 
  131                $identification_strings, 
false, 
'text')
 
  133        while (
$d = $this->db->fetchAssoc($r)) {
 
  140        $class_name = 
$data[
'class_name'];
 
  141        $stakeholder = 
new $class_name();
 
  142        $stakeholders[] = $stakeholder;
 
  143        $this->cache[
$data[
'rid']][
$data[
'stakeholder_id']] = $stakeholder;
 
An exception for terminatinating execution or to throw for unit testing.
Interface Identification.
Interface StakeholderDBRepository.
deregister(ResourceIdentification $i, ResourceStakeholder $s)
getStakeholders(ResourceIdentification $i)
@inheritDoc
__construct(\ilDBInterface $db)
populateFromArray(array $data)
preload(array $identification_strings)
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Interface StakeholderRepository.
Interface ResourceStakeholder.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...