19 declare(strict_types=1);
    34     public function get(
string $operation_string, 
string $description, array $contexts, 
int $list_order = 0): array
    38             $operation = $this->
find($operation_string, $context);
    40                 $operations[] = $operation;
    44             $operation_context = $this->contextRepo->get($context, null);
    47                 ->withOperationString($operation_string)
    48                 ->withDescription($description)
    49                 ->withListOrder($list_order)
    50                 ->withContextId($operation_context->getId());
    51             $new_operation = $this->
store($new_operation);
    53             $operations[] = $new_operation;
    62             $operation = $this->
insert($operation);
    72         $id = $this->db->nextId(self::TABLE_NAME);
    75             'operation_id' => [ 
'integer', 
$id ],
    78             'list_order' => [ 
'integer', $operation->
getListOrder() ],
    79             'context_id' => [ 
'integer', $operation->
getContextId() ]
    82         $this->db->insert(self::TABLE_NAME, $values);
    93         $where = [ 
'operation_id' => [ 
'integer', $operation->
getOperationId() ] ];
    98             'list_order' => [ 
'integer', $operation->
getListOrder() ],
    99             'context_id' => [ 
'integer', $operation->
getContextId() ]
   102         $this->db->update(self::TABLE_NAME, $values, $where);
   107         if ($operation->getOperationId() === 0) {
   111         $query = 
'DELETE FROM ' . self::TABLE_NAME . PHP_EOL
   112             . 
' WHERE operation_id = ' . $this->db->quote($operation->getOperationId(), 
'integer');
   113         $rows = $this->db->manipulate($query);
   123         $context = $this->contextRepo->find($context);
   128         $query = 
'SELECT operation_id, operation_string, description, list_order, context_id FROM' . PHP_EOL
   130             . 
' WHERE ' . self::TABLE_NAME . 
'.operation_string = ' . $this->db->quote($operation_string, 
'string') . PHP_EOL
   131             . 
' AND ' . self::TABLE_NAME . 
'.context_id = ' . $this->db->quote($context->getId(), 
'integer');
   133         $res = $this->db->query($query);
   134         if (
$res->numRows() === 0) {
   138         $rec = $this->db->fetchAssoc(
$res);
   140             ->withOperationString((
string) $rec[
'operation_string'])
   141             ->withDescription((
string) $rec[
"description"])
   142             ->withListOrder((
int) $rec[
"list_order"])
   143             ->withContextId((
int) $rec[
'context_id']);
   148         $query = 
'SELECT operation_id, operation_string, description, list_order, context_id FROM' . PHP_EOL
   150             . 
' WHERE ' . self::TABLE_NAME . 
'.operation_id = ' . $this->db->quote($operation_id, 
'integer');
   152         $res = $this->db->query($query);
   153         if (
$res->numRows() === 0) {
   157         $rec = $this->db->fetchAssoc(
$res);
   159             ->withOperationString((
string) $rec[
'operation_string'])
   160             ->withDescription((
string) $rec[
"description"])
   161             ->withListOrder((
int) $rec[
"list_order"])
   162             ->withContextId((
int) $rec[
'context_id']);
   165     public function getByName(
string $operation_string): array
   167         $query = 
'SELECT operation_id, operation_string, description, list_order, context_id FROM' . PHP_EOL
   169             . 
' WHERE ' . self::TABLE_NAME . 
'.operation_string = ' . $this->db->quote($operation_string, 
'string');
   171         $res = $this->db->query($query);
   172         if (
$res->numRows() === 0) {
   177         while ($rec = $this->db->fetchAssoc(
$res)) {
   179                 ->withOperationString((
string) $rec[
'operation_string'])
   180                 ->withDescription((
string) $rec[
"description"])
   181                 ->withListOrder((
int) $rec[
"list_order"])
   182                 ->withContextId((
int) $rec[
'context_id']);
   191         $operation_context = $this->contextRepo->getById($context_id);
   192         if (!$operation_context) {
   193             throw new ilException(
'Context with id ' . $context_id . 
' does not exist!');
   196         $query = 
'SELECT operation_id, operation_string, description, list_order, context_id FROM' . PHP_EOL
   198             . 
' WHERE ' . self::TABLE_NAME . 
'.context_id = ' . $this->db->quote($operation_context->getId(), 
'integer');
   199         $res = $this->db->query($query);
   202         while ($rec = $this->db->fetchAssoc(
$res)) {
   204                 ->withOperationString((
string) $rec[
'operation_string'])
   205                 ->withDescription((
string) $rec[
"description"])
   206                 ->withListOrder((
int) $rec[
"list_order"])
   207                 ->withContextId((
int) $rec[
'context_id']);
   216         $operation_context = $this->contextRepo->find($context);
   217         if (!$operation_context) {
   218             throw new ilException(
'Context ' . $context . 
' does not exist!');
   221         $query = 
'SELECT operation_id, operation_string, description, list_order, context_id FROM' . PHP_EOL
   223             . 
' WHERE ' . self::TABLE_NAME . 
'.context_id = ' . $this->db->quote($operation_context->getId(), 
'integer');
   224         $res = $this->db->query($query);
   227         while ($rec = $this->db->fetchAssoc(
$res)) {
   229                 ->withOperationString((
string) $rec[
'operation_string'])
   230                 ->withDescription((
string) $rec[
"description"])
   231                 ->withListOrder((
int) $rec[
"list_order"])
   232                 ->withContextId((
int) $rec[
'context_id']);
 
ilOrgUnitOperationContextDBRepository $contextRepo
 
getOperationsByContextName(string $context)
Get operations by context name. 
 
getById(int $operation_id)
Get operation by id Returns null if no operation is found. 
 
__construct(ilDBInterface $db, ilOrgUnitOperationContextDBRepository $contextRepo)
 
insert(ilOrgUnitOperation $operation)
 
find(string $operation_string, string $context)
Find an existing operation for a specified context Returns null if no operation is found...
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
getOperationsByContextId(int $context_id)
Get operations by context id. 
 
store(ilOrgUnitOperation $operation)
Store operation to db. 
 
getByName(string $operation_string)
Get operation(s) by name. 
 
update(ilOrgUnitOperation $operation)