19declare(strict_types=1);
39 public function select(array $ref_ids): array
41 if ($ref_ids === []) {
47 "SELECT ref_id, condition_operator, value" . PHP_EOL
48 .
"FROM " . static::TABLE_NAME . PHP_EOL
49 .
"WHERE ref_id IN (" . implode(
',', $ref_ids) .
")" . PHP_EOL
52 $result = $this->db->query($query);
54 while ($row = $this->db->fetchAssoc($result)) {
55 $data[$row[
'ref_id']] = [$row[
'condition_operator'], $row[
'value']];
68 $conditions[] = new \ilLSPostCondition(
$ref_id, $op, $value);
75 if ($ref_ids === []) {
84 "DELETE FROM " . static::TABLE_NAME . PHP_EOL
85 .
"WHERE ref_id IN (" . implode(
',', $ref_ids) .
")" . PHP_EOL
93 foreach ($ls_post_conditions as $condition) {
95 "ref_id" => [
"integer", $condition->getRefId()],
96 "condition_operator" => [
"text", $condition->getConditionOperator()],
97 "value" => [
"text", $condition->getValue()]
106 public function upsert(array $ls_post_conditions): void
108 if ($ls_post_conditions === []) {
112 $ref_ids = array_map(
117 $ilAtomQuery = $this->db->buildAtomQuery();
118 $ilAtomQuery->addTableLock(static::TABLE_NAME);
119 $ilAtomQuery->addQueryCallable(
121 $this->
delete($ref_ids,
$db);
Storage for ilLSPostConditions.
insert(array $ls_post_conditions, ilDBInterface $db)
__construct(ilDBInterface $db)
upsert(array $ls_post_conditions)
const STD_ALWAYS_OPERATOR
A PostCondition does restrict the progression of a user through the learning sequence.
insert(string $table_name, array $values)
manipulate(string $query)
Run a (write) Query on the database.