ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\Container\Skills\ContainerSkillDBRepository Class Reference
+ Collaboration diagram for ILIAS\Container\Skills\ContainerSkillDBRepository:

Public Member Functions

 __construct (?\ilDBInterface $db=null, ?SkillInternalFactoryService $factory_service=null,)
 
 add (int $cont_obj_id, int $skill_id, int $tref_id)
 
 remove (int $cont_obj_id, int $skill_id, int $tref_id)
 
 removeForSkill (int $skill_node_id, bool $is_reference)
 
 getAll (int $cont_obj_id)
 

Protected Member Functions

 getContainerSkillFromRecord (array $rec)
 

Protected Attributes

ilDBInterface $db
 
SkillInternalFactoryService $factory_service
 

Detailed Description

Definition at line 23 of file class.ContainerSkillDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Container\Skills\ContainerSkillDBRepository::__construct ( ?\ilDBInterface  $db = null,
?SkillInternalFactoryService  $factory_service = null 
)

Definition at line 28 of file class.ContainerSkillDBRepository.php.

References ILIAS\Container\Skills\ContainerSkillDBRepository\$db, $DIC, and ILIAS\Container\Skills\ContainerSkillDBRepository\$factory_service.

31  {
32  global $DIC;
33 
34  $this->db = ($db) ?: $DIC->database();
35  $this->factory_service = ($factory_service) ?: $DIC->skills()->internalContainer()->factory();
36  }
global $DIC
Definition: shib_login.php:26

Member Function Documentation

◆ add()

ILIAS\Container\Skills\ContainerSkillDBRepository::add ( int  $cont_obj_id,
int  $skill_id,
int  $tref_id 
)

Definition at line 38 of file class.ContainerSkillDBRepository.php.

38  : void
39  {
40  $this->db->replace(
41  "cont_skills",
42  [
43  "id" => ["integer", $cont_obj_id],
44  "skill_id" => ["integer", $skill_id],
45  "tref_id" => ["integer", $tref_id]
46  ],
47  []
48  );
49  }

◆ getAll()

ILIAS\Container\Skills\ContainerSkillDBRepository::getAll ( int  $cont_obj_id)
Returns
ContainerSkill[]

Definition at line 75 of file class.ContainerSkillDBRepository.php.

References ILIAS\Container\Skills\ContainerSkillDBRepository\getContainerSkillFromRecord().

75  : array
76  {
77  $skills = [];
78  $set = $this->db->query(
79  "SELECT * FROM cont_skills " .
80  " WHERE id = " . $this->db->quote($cont_obj_id, "integer")
81  );
82 
83  while ($rec = $this->db->fetchAssoc($set)) {
84  $skills[] = $this->getContainerSkillFromRecord($rec);
85  }
86  return $skills;
87  }
+ Here is the call graph for this function:

◆ getContainerSkillFromRecord()

ILIAS\Container\Skills\ContainerSkillDBRepository::getContainerSkillFromRecord ( array  $rec)
protected

Definition at line 89 of file class.ContainerSkillDBRepository.php.

References ILIAS\Repository\int().

Referenced by ILIAS\Container\Skills\ContainerSkillDBRepository\getAll().

89  : ContainerSkill
90  {
91  $rec["skill_id"] = (int) $rec["skill_id"];
92  $rec["tref_id"] = (int) $rec["tref_id"];
93  $rec["id"] = (int) $rec["id"];
94 
95  return $this->factory_service->containerSkill()->skill(
96  $rec["skill_id"],
97  $rec["tref_id"],
98  $rec["id"]
99  );
100  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove()

ILIAS\Container\Skills\ContainerSkillDBRepository::remove ( int  $cont_obj_id,
int  $skill_id,
int  $tref_id 
)

Definition at line 51 of file class.ContainerSkillDBRepository.php.

51  : void
52  {
53  $this->db->manipulate(
54  "DELETE FROM cont_skills WHERE " .
55  " id = " . $this->db->quote($cont_obj_id, "integer") .
56  " AND skill_id = " . $this->db->quote($skill_id, "integer") .
57  " AND tref_id = " . $this->db->quote($tref_id, "integer")
58  );
59  }

◆ removeForSkill()

ILIAS\Container\Skills\ContainerSkillDBRepository::removeForSkill ( int  $skill_node_id,
bool  $is_reference 
)

Definition at line 61 of file class.ContainerSkillDBRepository.php.

61  : void
62  {
63  if (!$is_reference) {
64  $this->db->manipulate("DELETE FROM cont_skills " .
65  " WHERE skill_id = " . $this->db->quote($skill_node_id, "integer"));
66  } else {
67  $this->db->manipulate("DELETE FROM cont_skills " .
68  " WHERE tref_id = " . $this->db->quote($skill_node_id, "integer"));
69  }
70  }

Field Documentation

◆ $db

ilDBInterface ILIAS\Container\Skills\ContainerSkillDBRepository::$db
protected

◆ $factory_service

SkillInternalFactoryService ILIAS\Container\Skills\ContainerSkillDBRepository::$factory_service
protected

The documentation for this class was generated from the following file: