Commit 0063bdff authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Posibilité e ne retourner qu'une seule valeur si on est sûr que jamais on...

Posibilité e ne retourner qu'une seule valeur si on est sûr que jamais on n'aura besoin d'un tableau
parent 4a5b0ba6
Pipeline #6036 failed with stage
in 10 seconds
......@@ -52,6 +52,24 @@ abstract class AbstractEntity
* @return self
*/
abstract public function setData(array $data = array());
/**
* Prend un attribut LDAP en entrée. Si l'atribut a plusieurs valeurs on n'en prend qu'une seule
*
* @param $value
*
* @return mixed
*/
protected function uniqueValue($value)
{
if (is_array($value) && isset($value[0])){
return $value[0];
}
return $value;
}
/**
* Simplifie le format d'une valeur d'un attribut.
......
......@@ -69,8 +69,8 @@ class People extends AbstractEntity
$this->dn = $this->processDataValue('dn', true);
$this->cn = $this->processDataValue('cn');
$this->datedenaissance = $this->processDataValue('datedenaissance');
$this->displayname = $this->processDataValue('displayname');
$this->givenname = $this->processDataValue('givenname');
$this->displayname = $this->uniqueValue($this->processDataValue('displayname'));
$this->givenname = $this->uniqueValue($this->processDataValue('givenname'));
$this->mail = $this->processDataValue('mail');
$this->postaladdress = $this->processDataValue('postaladdress');
$this->sexe = $this->processDataValue('sexe');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment