ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Questions\Persistence\Manipulate Class Reference
+ Collaboration diagram for ILIAS\Questions\Persistence\Manipulate:

Public Member Functions

 __construct (private readonly \ilDBInterface $db, private readonly string $component_name_space)
 
 getTableNameBuilder (?TableSubNameSpace $table_sub_name_space)
 
 withAdditionalStatement (Insert|Update|Replace|Delete $statement)
 
 run ()
 

Private Attributes

array $statements = []
 

Detailed Description

Definition at line 23 of file Manipulate.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Questions\Persistence\Manipulate::__construct ( private readonly \ilDBInterface  $db,
private readonly string  $component_name_space 
)

Definition at line 27 of file Manipulate.php.

30 {
31 }

Member Function Documentation

◆ getTableNameBuilder()

ILIAS\Questions\Persistence\Manipulate::getTableNameBuilder ( ?TableSubNameSpace  $table_sub_name_space)

Definition at line 33 of file Manipulate.php.

35 : TableNameBuilder {
36 return new TableNameBuilder(
37 $this->component_name_space,
38 $table_sub_name_space
39 );
40 }

◆ run()

ILIAS\Questions\Persistence\Manipulate::run ( )

Definition at line 50 of file Manipulate.php.

50 : void
51 {
52 if ($this->statements === []) {
53 return;
54 }
55
56 $atom_query = $this->db->buildAtomQuery();
57
58 $manipulates = [];
59 $locked_tables = [];
60 foreach ($this->statements as $statement) {
61 $table_to_lock = $statement->getTableToLock();
62 if (!in_array($table_to_lock, $locked_tables)) {
63 $atom_query->addTableLock($table_to_lock);
64 $locked_tables[] = $table_to_lock;
65 }
66 $manipulates[] = $statement->toManipulateString($this->db);
67 }
68 $atom_query->addQueryCallable(
69 function (\ilDBInterface $db) use ($manipulates): void {
70 foreach ($manipulates as $manipulate) {
71 $db->manipulate($manipulate);
72 }
73 }
74 );
75 $atom_query->run();
76 }
Interface ilDBInterface.

References ilDBInterface\manipulate().

+ Here is the call graph for this function:

◆ withAdditionalStatement()

ILIAS\Questions\Persistence\Manipulate::withAdditionalStatement ( Insert|Update|Replace|Delete  $statement)

Definition at line 42 of file Manipulate.php.

44 : self {
45 $clone = clone $this;
46 $clone->statements[] = $statement;
47 return $clone;
48 }

Referenced by ILIAS\Questions\Question\Persistence\DatabaseStatementBuilder\addUpdateStatementsToManipulation().

+ Here is the caller graph for this function:

Field Documentation

◆ $statements

array ILIAS\Questions\Persistence\Manipulate::$statements = []
private

Definition at line 25 of file Manipulate.php.


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