Loading src/UnicaenLdap/Entity/Base/People.php +31 −0 Original line number Diff line number Diff line Loading @@ -1513,6 +1513,10 @@ class People extends Entity { $value = $this->preFormat($value); if(empty($value)) { $this->appendOrNot('supannRefId', $value, $append); } foreach ($value as $v) { if (preg_match(self::$attribute_with_label_pattern, $v, $matches)) { if ($append) { Loading Loading @@ -1573,7 +1577,34 @@ class People extends Entity public function setUnicaenTermsOfUse($value = null, $append = false) { $value = $this->preFormat($value); if(empty($value)) { $this->appendOrNot('unicaenTermsOfUse', $value, $append); } foreach ($value as $v) { if (preg_match(self::$attribute_with_label_pattern, $v, $matches)) { if ($append) { $this->appendOrNot('unicaenTermsOfUse', $v, true); } else { $label = $matches['etiquette']; $identifiant = $matches['identifiant']; $currentValues = $this->preFormat($this->unicaenTermsOfUse); array_walk($currentValues, function (&$cv) use ($label, $identifiant) { if (preg_match("/^".$label."(?<identifiant>.+)$/", $cv, $matches)) { if($matches['identifiant'] != $identifiant) { $this->remove('unicaenTermsOfUse', $cv); $cv = null; } } }); if(!in_array($v, $currentValues)) { $currentValues[] = $v; } $this->appendOrNot('unicaenTermsOfUse', array_filter($currentValues), false); } } } return $this; } Loading Loading
src/UnicaenLdap/Entity/Base/People.php +31 −0 Original line number Diff line number Diff line Loading @@ -1513,6 +1513,10 @@ class People extends Entity { $value = $this->preFormat($value); if(empty($value)) { $this->appendOrNot('supannRefId', $value, $append); } foreach ($value as $v) { if (preg_match(self::$attribute_with_label_pattern, $v, $matches)) { if ($append) { Loading Loading @@ -1573,7 +1577,34 @@ class People extends Entity public function setUnicaenTermsOfUse($value = null, $append = false) { $value = $this->preFormat($value); if(empty($value)) { $this->appendOrNot('unicaenTermsOfUse', $value, $append); } foreach ($value as $v) { if (preg_match(self::$attribute_with_label_pattern, $v, $matches)) { if ($append) { $this->appendOrNot('unicaenTermsOfUse', $v, true); } else { $label = $matches['etiquette']; $identifiant = $matches['identifiant']; $currentValues = $this->preFormat($this->unicaenTermsOfUse); array_walk($currentValues, function (&$cv) use ($label, $identifiant) { if (preg_match("/^".$label."(?<identifiant>.+)$/", $cv, $matches)) { if($matches['identifiant'] != $identifiant) { $this->remove('unicaenTermsOfUse', $cv); $cv = null; } } }); if(!in_array($v, $currentValues)) { $currentValues[] = $v; } $this->appendOrNot('unicaenTermsOfUse', array_filter($currentValues), false); } } } return $this; } Loading