Skip to content
Snippets Groups Projects
Commit 98968ae0 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

...

parent 21a53f36
No related branches found
No related tags found
No related merge requests found
......@@ -5,8 +5,10 @@ namespace Octopus\Entity\Db;
// TODO prendre les overwrites, normalisés, phonétiques
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuResultatInterface;
class Individu {
class Individu implements RechercheIndividuResultatInterface
{
/** @var integer */
private $cIndividuChaine;
/** @var Source */
......@@ -75,6 +77,7 @@ class Individu {
return $this->cIndividuChaine;
}
/**
* @return Source
*/
......@@ -229,7 +232,7 @@ class Individu {
if ($active) {
$affectations = array_filter($affectations, function(IndividuAffectation $a) { return ($a->getDateFin() === null);});
}
usort($affectations, function(IndividuAffectation $a, IndividuAffectation $b) { return $a->getDateDebut() > $b->getDateDebut();});
usort($affectations, function(IndividuAffectation $a, IndividuAffectation $b) { return $a->getDateDebut() <=> $b->getDateDebut();});
return $affectations;
}
......@@ -239,7 +242,7 @@ class Individu {
public function getInscriptions()
{
$inscriptions = $this->inscriptions->toArray();
usort($inscriptions, function (IndividuInscription $a, IndividuInscription $b) { return $a->getAnnee() > $b->getAnnee();});
usort($inscriptions, function (IndividuInscription $a, IndividuInscription $b) { return $a->getAnnee() <=> $b->getAnnee();});
return $inscriptions;
}
......@@ -266,4 +269,42 @@ class Individu {
}
return $texte;
}
/** Missing ... */
public function getId()
{
return $this->cIndividuChaine;
}
public function getEmail(): ?string
{
$compteActif = null;
/** @var IndividuCompte $compte */
foreach ($this->comptes as $compte) {
if ($compte->getStatut() === 1) {
$compteActif = $compte;
break;
}
}
return $compteActif->getEmail();
}
public function getUsername(string $attribut = "supannAliasLogin"): string
{
$compteActif = null;
/** @var IndividuCompte $compte */
foreach ($this->comptes as $compte) {
if ($compte->getStatut() === 1) {
$compteActif = $compte;
break;
}
}
return $compteActif->getLogin();
}
public function getDisplayname(): string
{
return $this->prenom_ow.' '.$this->getNomUsage()??$this->getNomFamille();
}
}
\ No newline at end of file
......@@ -94,7 +94,6 @@ class IndividuService {
->setParameter('type', 5)
->orderBy('individu.nomUsage, individu.prenom')
;
$result = $qb->getQuery()->getResult();
return $result;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment