Skip to content
Snippets Groups Projects
Commit 0063bdff authored by Laurent Lecluse's avatar Laurent Lecluse
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
No related branches found
No related tags found
No related merge requests found
Pipeline #6036 failed
...@@ -53,6 +53,24 @@ abstract class AbstractEntity ...@@ -53,6 +53,24 @@ abstract class AbstractEntity
*/ */
abstract public function setData(array $data = array()); 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. * Simplifie le format d'une valeur d'un attribut.
* *
......
...@@ -69,8 +69,8 @@ class People extends AbstractEntity ...@@ -69,8 +69,8 @@ class People extends AbstractEntity
$this->dn = $this->processDataValue('dn', true); $this->dn = $this->processDataValue('dn', true);
$this->cn = $this->processDataValue('cn'); $this->cn = $this->processDataValue('cn');
$this->datedenaissance = $this->processDataValue('datedenaissance'); $this->datedenaissance = $this->processDataValue('datedenaissance');
$this->displayname = $this->processDataValue('displayname'); $this->displayname = $this->uniqueValue($this->processDataValue('displayname'));
$this->givenname = $this->processDataValue('givenname'); $this->givenname = $this->uniqueValue($this->processDataValue('givenname'));
$this->mail = $this->processDataValue('mail'); $this->mail = $this->processDataValue('mail');
$this->postaladdress = $this->processDataValue('postaladdress'); $this->postaladdress = $this->processDataValue('postaladdress');
$this->sexe = $this->processDataValue('sexe'); $this->sexe = $this->processDataValue('sexe');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment