96 return self::TABLE_NAME;
118 public function id() : int
130 $this->fetchAllCriterionAssignments();
138 $document = parent::buildFromArray($array);
140 $this->fetchAllCriterionAssignments();
150 $this->setCreationTs(time());
154 foreach ($this->
criteria as $criterionAssignment) {
156 $criterionAssignment->setDocId($this->getId());
157 $criterionAssignment->store();
168 $this->setModificationTs(time());
170 foreach ($this->
criteria as $criterionAssignment) {
172 $criterionAssignment->setDocId($this->getId());
173 $criterionAssignment->store();
176 foreach ($this->initialPersistedCriteria as $criterionAssignment) {
178 $found = array_filter(
181 return $criterionToMatch->getId() == $criterionAssignment->getId();
185 if (0 ===
count($found)) {
186 $criterionAssignment->delete();
198 public function delete()
200 foreach ($this->initialPersistedCriteria as $criterionAssignment) {
202 $criterionAssignment->delete();
205 $this->initialPersistedCriteria = $this->
criteria = [];
224 foreach ($this->
criteria as $currentAssignment) {
226 if ($currentAssignment->equals($criterionAssignment)) {
228 "Cannot attach duplicate criterion with criterion typeIdent %s and value: %s",
235 $this->
criteria[] = $criterionAssignment;
249 return !$currentAssignment->
equals($criterionAssignment);
255 if ($numCriteriaAfterRemoval === $numCriteriaBeforeRemoval) {
257 "Could not find any criterion with criterion typeIdent %s and value: %s",
267 public function fetchAllCriterionAssignments() :
void 269 if (!$this->criteriaFetched) {
270 $this->criteriaFetched =
true;
272 $this->initialPersistedCriteria = [];
276 foreach (
$criteria as $criterionAssignment) {
278 $this->
criteria[] = $criterionAssignment;
buildFromArray(array $array)
Class ilAccessibilityDuplicateCriterionAssignmentException.
Interface ilAccessibilitySignableDocument.
static returnDbTableName()
Class ilAccessibilityDocument.
static where($where, $operator=null)
detachCriterion(ilAccessibilityDocumentCriterionAssignment $criterionAssignment)
$initialPersistedCriteria
Class ilAccessibilityDocumentCriterionAssignment.
criteria()
ilAccessibilityEvaluableCriterion[]