<?php
namespace App\Entity\MAM;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\MAM\MAMRepository")
* @ORM\Table(
* name="efc.mam",
* uniqueConstraints={
* @ORM\UniqueConstraint(name="mam_un",columns={"id_fonctionnel"})
* }
* )
*/
class MAM
{
// use App\Entity\Commun\PersonneTrait;
// TODO factoriser avec des traits (ex : code postal)
// <editor-fold defaultstate="collapsed" desc="Attributs privés">
use \App\Entity\Commun\IdTrait;
use \App\Entity\Commun\PhotosTrait;
/**
* @ORM\Column(type="string", length=70)
*/
private $id_fonctionnel;
/**
* @ORM\Column(type="string", length=70)
*/
private $nom;
/**
* @ORM\Column(type="string", length=100)
*/
private $adresse;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $adresse_complement;
/**
* @ORM\Column(type="string", length=5)
*/
private $code_postal;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $bureau_distributeur;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $tel_fixe;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $tel_portable;
/**
* @ORM\Column(type="boolean")
*/
private $participe;
/**
* @ORM\Column(type="boolean")
*/
private $archive;
/**
* @ORM\Column(type="boolean")
*/
private $oppose;
/**
* @ORM\Column(type="boolean")
*/
private $supprime;
/**
* @ORM\Column(type="string", length=250, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="datetime")
*/
private $date_maj_departement;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $date_maj_mam;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Referentiel\SecteurPmi", inversedBy="mams")
* @ORM\JoinColumn(name="id_secteur_pmi", referencedColumnName="id")
*/
private $secteur_pmi;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Referentiel\Commune", inversedBy="mams")
* @ORM\JoinColumn(name="id_commune", referencedColumnName="id")
*/
private $commune;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Referentiel\Canton", inversedBy="mams")
* @ORM\JoinColumn(name="id_canton", referencedColumnName="id")
*/
private $canton;
/**
* @ORM\OneToMany(targetEntity="App\Entity\AssistantMaternel\AssistantMaternel", mappedBy="mam")
*/
private $assmats;
/**
* Préférences de publication site grand public
*
* @ORM\OneToOne(targetEntity="App\Entity\OffreAccueil\PreferencesPublicationMAM", mappedBy="mam")
*/
private $preferences_publication;
/**
* Présentation offre d'accueil site grand public
*
* @ORM\OneToOne(targetEntity="App\Entity\OffreAccueil\PresentationMAM", mappedBy="mam")
*/
private $presentation_mam;
/**
* @ORM\OneToMany(targetEntity="App\Entity\OffreAccueil\Photo", mappedBy="mam")
*/
private $photos;
// </editor-fold>
// <editor-fold desc="Accesseurs">
function getIdFonctionnel()
{
return $this->id_fonctionnel;
}
function getNom()
{
return $this->nom;
}
function getAdresse()
{
return $this->adresse;
}
function getAdresseComplement()
{
return $this->adresse_complement;
}
function getCodePostal()
{
return $this->code_postal;
}
function getBureauDistributeur()
{
return $this->bureau_distributeur;
}
function getTelFixe()
{
return $this->tel_fixe;
}
function getTelPortable()
{
return $this->tel_portable;
}
function getParticipe()
{
return $this->participe;
}
function getArchive()
{
return $this->archive;
}
function getOppose()
{
return $this->oppose;
}
function getSupprime()
{
return $this->supprime;
}
function getEmail()
{
return $this->email;
}
function getDateMajDepartement()
{
return $this->date_maj_departement;
}
function getDateMajMAM()
{
return $this->date_maj_mam;
}
function getSecteurPMI()
{
return $this->secteur_pmi;
}
function getCommune()
{
return $this->commune;
}
function getCanton()
{
return $this->canton;
}
function getAssmats()
{
return $this->assmats;
}
public function setIdFonctionnel($idFonctionnel)
{
$this->id_fonctionnel = $idFonctionnel;
return $this;
}
public function setNom($nom)
{
$this->nom = $nom;
return $this;
}
public function setAdresse($adresse)
{
$this->adresse = $adresse;
return $this;
}
public function setAdresseComplement($adresseComplement)
{
$this->adresse_complement = $adresseComplement;
return $this;
}
public function setCodePostal($codePostal)
{
$this->code_postal = $codePostal;
return $this;
}
public function setBureauDistributeur($bureauDistributeur)
{
$this->bureau_distributeur = $bureauDistributeur;
return $this;
}
public function setTelFixe($telFixe)
{
$this->tel_fixe = $telFixe;
return $this;
}
public function setTelPortable($telPortable)
{
$this->tel_portable = $telPortable;
return $this;
}
public function setParticipe($participe)
{
$this->participe = $participe;
return $this;
}
public function setArchive($archive)
{
$this->archive = $archive;
return $this;
}
public function setOppose($oppose)
{
$this->oppose = $oppose;
return $this;
}
public function setSupprime($supprime)
{
$this->supprime = $supprime;
return $this;
}
public function setEmail($email)
{
$this->email = $email;
return $this;
}
public function setDateMajDepartement($dateMajDepartement)
{
$this->date_maj_departement = $dateMajDepartement;
}
public function setDateMajMAM($dateMajMAM)
{
$this->date_maj_mam = $dateMajMAM;
return $this;
}
public function setSecteurPMI($secteurPMI)
{
$this->secteur_pmi = $secteurPMI;
return $this;
}
public function setCommune($commune)
{
$this->commune = $commune;
return $this;
}
public function setCanton($canton)
{
$this->canton = $canton;
return $this;
}
/**
* Set preferences_publication
*
* @param PreferencesPublicationMAM $preferences_publication
*
* @return MAM
*/
public function setPreferencesPublication($preferences_publication)
{
$this->preferences_publication = $preferences_publication;
return $this;
}
/**
* Get preferences_publication
*
* @return PreferencesPublicationMAM
*/
public function getPreferencesPublication()
{
return $this->preferences_publication;
}
/**
* Set presentation_mam
*
* @param PresentationMAM $presentation_mam
*
* @return MAM
*/
public function setPresentationMAM($presentation_mam)
{
$this->presentation_mam = $presentation_mam;
return $this;
}
/**
* Get presentation_mam
*
* @return PresentationMAM
*/
public function getPresentationMAM()
{
return $this->presentation_mam;
}
/**
* Obtient la liste des assmat non archivé de la MAM
* @return array
*/
public function getAssmatsNonArchive()
{
$assmatActives = array();
foreach ($this->assmats as $assmat) {
if (!$assmat->getArchiveCalculeMam()) {
$assmatActives[] = $assmat;
}
}
return $assmatActives;
}
// </editor-fold>
// <editor-fold desc="Méthodes publiques">
/**
* Constructor
*/
public function __construct()
{ }
/*
* Implémentation de JsonSerializable
* Ne liste que les champs modifiables par les utilisateurs
*/
public function jsonSerialize()
{
return [
'id' => $this->id,
'email' => $this->email,
'archive' => $this->archive,
'supprime' => $this->supprime,
];
}
/**
* Obtient une nouvelle instance de PresentationAssmat, initialisée à partir du tableau associatif fourni en paramètre
*
* @param array $data
* @return PresentationAssmat
*/
public static function createFromArray(array $data)
{
$newInstance = new MAM();
return $newInstance->initFromArray($data);
}
/**
* mappe les propriétés sur l'instance à partir d'un tableau associatif
*
* @param array $data
* @return void
*/
public function initFromArray(array $data)
{
foreach ($data as $prop => $value) {
$this->{$prop} = $value;
}
return $this;
}
// </editor-fold>
}