18 declare(strict_types=1);
    33     public function get(
string $operation_string, 
string $description, array $contexts, 
int $list_order = 0): array
    37             $operation = $this->
find($operation_string, $context);
    39                 $operations[] = $operation;
    43             $operation_context = $this->contextRepo->get($context, null);
    46                 ->withOperationString($operation_string)
    47                 ->withDescription($description)
    48                 ->withListOrder($list_order)
    49                 ->withContextId($operation_context->getId());
    50             $new_operation = $this->
store($new_operation);
    52             $operations[] = $new_operation;
    61             $operation = $this->
insert($operation);
    71         $id = $this->db->nextId(self::TABLE_NAME);
    74             'operation_id' => [ 
'integer', 
$id ],
    77             'list_order' => [ 
'integer', $operation->
getListOrder() ],
    78             'context_id' => [ 
'integer', $operation->
getContextId() ]
    81         $this->db->insert(self::TABLE_NAME, $values);
    92         $where = [ 
'operation_id' => [ 
'integer', $operation->
getOperationId() ] ];
    97             'list_order' => [ 
'integer', $operation->
getListOrder() ],
    98             'context_id' => [ 
'integer', $operation->
getContextId() ]
   101         $this->db->update(self::TABLE_NAME, $values, $where);
   106         if ($operation->getOperationId() === 0) {
   110         $query = 
'DELETE FROM ' . self::TABLE_NAME . PHP_EOL
   111             . 
' WHERE operation_id = ' . $this->db->quote($operation->getOperationId(), 
'integer');
   112         $rows = $this->db->manipulate($query);
   122         $context = $this->contextRepo->find($context);
   127         $query = 
'SELECT operation_id, operation_string, description, list_order, context_id FROM' . PHP_EOL
   129             . 
' WHERE ' . self::TABLE_NAME . 
'.operation_string = ' . $this->db->quote($operation_string, 
'string') . PHP_EOL
   130             . 
' AND ' . self::TABLE_NAME . 
'.context_id = ' . $this->db->quote($context->getId(), 
'integer');
   132         $res = $this->db->query($query);
   133         if (
$res->numRows() === 0) {
   137         $rec = $this->db->fetchAssoc(
$res);
   139             ->withOperationString((
string) $rec[
'operation_string'])
   140             ->withDescription((
string) $rec[
"description"])
   141             ->withListOrder((
int) $rec[
"list_order"])
   142             ->withContextId((
int) $rec[
'context_id']);
   147         $query = 
'SELECT operation_id, operation_string, description, list_order, context_id FROM' . PHP_EOL
   149             . 
' WHERE ' . self::TABLE_NAME . 
'.operation_id = ' . $this->db->quote($operation_id, 
'integer');
   151         $res = $this->db->query($query);
   152         if (
$res->numRows() === 0) {
   156         $rec = $this->db->fetchAssoc(
$res);
   158             ->withOperationString((
string) $rec[
'operation_string'])
   159             ->withDescription((
string) $rec[
"description"])
   160             ->withListOrder((
int) $rec[
"list_order"])
   161             ->withContextId((
int) $rec[
'context_id']);
   164     public function getByName(
string $operation_string): array
   166         $query = 
'SELECT operation_id, operation_string, description, list_order, context_id FROM' . PHP_EOL
   168             . 
' WHERE ' . self::TABLE_NAME . 
'.operation_string = ' . $this->db->quote($operation_string, 
'string');
   170         $res = $this->db->query($query);
   171         if (
$res->numRows() === 0) {
   176         while ($rec = $this->db->fetchAssoc(
$res)) {
   178                 ->withOperationString((
string)$rec[
'operation_string'])
   179                 ->withDescription((
string)$rec[
"description"])
   180                 ->withListOrder((
int)$rec[
"list_order"])
   181                 ->withContextId((
int)$rec[
'context_id']);
   190         $operation_context = $this->contextRepo->getById($context_id);
   191         if (!$operation_context) {
   192             throw new ilException(
'Context with id ' . $context_id . 
' does not exist!');
   195         $query = 
'SELECT operation_id, operation_string, description, list_order, context_id FROM' . PHP_EOL
   197             . 
' WHERE ' . self::TABLE_NAME . 
'.context_id = ' . $this->db->quote($operation_context->getId(), 
'integer');
   198         $res = $this->db->query($query);
   201         while ($rec = $this->db->fetchAssoc(
$res)) {
   203                 ->withOperationString((
string)$rec[
'operation_string'])
   204                 ->withDescription((
string)$rec[
"description"])
   205                 ->withListOrder((
int)$rec[
"list_order"])
   206                 ->withContextId((
int)$rec[
'context_id']);
   215         $operation_context = $this->contextRepo->find($context);
   216         if (!$operation_context) {
   217             throw new ilException(
'Context ' . $context . 
' does not exist!');
   220         $query = 
'SELECT operation_id, operation_string, description, list_order, context_id FROM' . PHP_EOL
   222             . 
' WHERE ' . self::TABLE_NAME . 
'.context_id = ' . $this->db->quote($operation_context->getId(), 
'integer');
   223         $res = $this->db->query($query);
   226         while ($rec = $this->db->fetchAssoc(
$res)) {
   228                 ->withOperationString((
string)$rec[
'operation_string'])
   229                 ->withDescription((
string)$rec[
"description"])
   230                 ->withListOrder((
int)$rec[
"list_order"])
   231                 ->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...
 
getOperationsByContextId(int $context_id)
Get operations by context id. 
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
store(ilOrgUnitOperation $operation)
Store operation to db. 
 
getByName(string $operation_string)
Get operation(s) by name. 
 
update(ilOrgUnitOperation $operation)