18 declare(strict_types=1);
30 public function get(
int $id,
string $field): array
33 throw new Exception(
"Invalid field: " . $field);
35 $query =
'SELECT id, ' . self::TABLE_NAME .
'.over, scope, position_id FROM' . PHP_EOL
37 .
' WHERE ' . self::TABLE_NAME .
'.' . $field .
' = ' . $this->db->quote($id,
'integer');
38 $res = $this->db->query($query);
40 while ($rec = $this->db->fetchAssoc(
$res)) {
42 ->withOver((
int) $rec[
'over'])
43 ->withScope((
int) $rec[
'scope'])
44 ->withPositionId((
int) $rec[
'position_id']);
57 if ($authority->
getId() === 0) {
58 $authority = $this->
insert($authority);
68 $id = $this->db->nextId(self::TABLE_NAME);
71 'id' => [
'integer',
$id],
72 'over' => [
'integer', $authority->
getOver() ],
73 'scope' => [
'integer', $authority->
getScope() ],
77 $this->db->insert(self::TABLE_NAME, $values);
80 ->withOver($authority->
getOver())
89 $where = [
'id' => [
'integer', $authority->
getId() ] ];
92 'over' => [
'integer', $authority->
getOver() ],
93 'scope' => [
'integer', $authority->
getScope() ],
97 $this->db->update(self::TABLE_NAME, $values, $where);
100 public function delete(
int $id):
void 102 $query =
'DELETE FROM ' . self::TABLE_NAME . PHP_EOL
103 .
' WHERE id = ' . $this->db->quote($id,
'integer');
105 $this->db->manipulate($query);
113 $query =
'DELETE FROM ' . self::TABLE_NAME . PHP_EOL
114 .
' WHERE position_id = ' . $this->db->quote($position_id,
'integer');
116 $this->db->manipulate($query);
124 $query =
'DELETE FROM ' . self::TABLE_NAME . PHP_EOL
125 .
' WHERE position_id = ' . $this->db->quote($position_id,
'integer') . PHP_EOL
126 .
' AND ' . $this->db->in(
'id', $ids,
true,
'integer');
128 $this->db->manipulate($query);
store(ilOrgUnitAuthority $authority)
deleteLeftoverAuthorities(array $ids, int $position_id)
Deletes orphaned authorities on position save.
update(ilOrgUnitAuthority $authority)
deleteByPositionId(int $position_id)
Deletes all authorities for a position.
insert(ilOrgUnitAuthority $authority)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(ilDBInterface $db)