3 declare(strict_types=1);
28 public function select(array $ref_ids) : array
30 if (count($ref_ids) === 0) {
36 .
"FROM " . static::TABLE_NAME .
PHP_EOL 38 . implode(
',', $ref_ids)
43 $data[
$row[
'ref_id']] = [$row[
'condition_operator'], (int) $row[
'value']];
47 foreach ($ref_ids as $ref_id) {
49 $op = self::STD_ALWAYS_OPERATOR;
53 if (array_key_exists($ref_id,
$data)) {
54 list($op, $value) =
$data[$ref_id];
56 $conditions[] = new \ilLSPostCondition($ref_id, $op, $value);
61 public function delete(array $ref_ids)
63 if (count($ref_ids) === 0) {
69 . implode(
',', $ref_ids)
71 $this->db->manipulate(
$query);
74 protected function insert(array $ls_post_conditions)
76 foreach ($ls_post_conditions as $condition) {
78 "ref_id" => array(
"integer", $condition->getRefId()),
79 "condition_operator" => array(
"text", $condition->getConditionOperator())
81 $this->db->insert(static::TABLE_NAME,
$values);
88 public function upsert(array $ls_post_conditions)
90 if (count($ls_post_conditions) === 0) {
95 function ($condition) {
96 return (
int) $condition->getRefId();
101 $ilAtomQuery = $this->db->buildAtomQuery();
102 $ilAtomQuery->addTableLock(static::TABLE_NAME);
103 $ilAtomQuery->addQueryCallable(
105 $this->
delete($ref_ids);
106 $this->
insert($ls_post_conditions);
Storage for ilLSPostConditions.
upsert(array $ls_post_conditions)
const STD_ALWAYS_OPERATOR
__construct(\ilDBInterface $db)
insert(array $ls_post_conditions)