40 function (
$txt, $value) {
41 return "The passed assignment must be unique for the document!";
55 $otherValues = $this->document->criteria();
60 $idCurrent = $otherValue->getId();
61 $idNew = $value->getId();
63 $uniqueIdEquals = $idCurrent === $idNew;
64 if ($uniqueIdEquals) {
68 $valuesEqual = $value->
equals($otherValue) ;
73 $valuesHaveSameNature = $this->
haveSameNature($value, $otherValue);
75 return $valuesHaveSameNature;
93 $valuesHaveSameNature = $this->criterionTypeFactory->findByTypeIdent($value->
getCriterionId())->hasUniqueNature();
95 return $valuesHaveSameNature;
A constraint encodes some resrtictions on values.
haveSameNature(\ilTermsOfServiceDocumentCriterionAssignment $value, \ilTermsOfServiceDocumentCriterionAssignment $otherValue)
Class ilTermsOfServiceDocumentCriterionAssignment.
Class ilTermsOfServiceDocument.
__construct(\ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory, \ilTermsOfServiceDocument $document, Factory $dataFactory, \ilLanguage $lng)
ilTermsOfServiceDocumentCriterionAssignmentConstraint constructor.
filterEqualValues(\ilTermsOfServiceDocumentCriterionAssignment $value)
Class ilTermsOfServiceDocumentCriterionAssignmentConstraint.
Interface ilTermsOfServiceCriterionTypeFactoryInterface.