src/Entity/Protocole.php line 13
<?php
namespace App\Entity;
use App\Repository\ProtocoleRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints\Length;
#[ORM\Entity(repositoryClass: ProtocoleRepository::class)]
class Protocole
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $titre = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $resume = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $protocole = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $administration = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $information = null;
#[ORM\Column(length: 1, nullable: true)]
private ?string $codeDent = null;
#[ORM\Column(length: 1, nullable: true)]
private ?string $codeFracture = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $fracture = null;
#[ORM\Column]
private ?bool $urgence = null;
#[ORM\Column]
private ?bool $favori = null;
#[ORM\ManyToMany(targetEntity: self::class)]
#[ORM\JoinTable(name:"protocole_acteassocie")]
private Collection $actesassocies;
#[ORM\ManyToMany(targetEntity: Categorie::class)]
#[ORM\JoinTable(name:"protocole_categorieassocie")]
private Collection $categoriesassocies;
#[ORM\OneToMany(mappedBy: 'protocoles', targetEntity: Commentaire::class)]
private Collection $commentaires;
#[ORM\Column]
private ?bool $archive = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $urlvideo = null;
#[ORM\OneToMany(mappedBy: 'protocole', targetEntity: Protocoleinstrimg::class)]
private Collection $protocoleinstrimgs;
#[ORM\OneToMany(mappedBy: 'protocole', targetEntity: Protocolephoto::class)]
private Collection $protocolephotos;
#[ORM\ManyToMany(targetEntity: Materiel::class, inversedBy: 'protocoles')]
#[ORM\JoinTable(name:"protocole_materiel")]
private Collection $materiels;
#[ORM\ManyToMany(targetEntity: Categorie::class, inversedBy: 'protocoles')]
#[ORM\JoinTable(name:"protocole_categorie")]
private Collection $categories;
#[ORM\Column(length: 255, nullable: true)]
private ?string $reference = null;
public function __construct()
{
$this->id = 0;
$this->archive = false;
$this->actesassocies = new ArrayCollection();
$this->categoriesassocies = new ArrayCollection();
$this->commentaires = new ArrayCollection();
$this->protocoleinstrimgs = new ArrayCollection();
$this->protocolephotos = new ArrayCollection();
$this->materiels = new ArrayCollection();
$this->categories = new ArrayCollection();
}
public function titreId(): string
{
return $this->getTitre() .' ('. $this->getId() .')';
}
public function __toString(): string
{
return $this->getTitre();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitre(): ?string
{
return $this->titre;
}
public function getTitre4Tri(): ?string
{
$unwanted_array = array( 'Š'=>'S', 'š'=>'s', 'Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E',
'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U',
'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss', 'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'a', 'ç'=>'c',
'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o',
'ö'=>'o', 'ø'=>'o', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ý'=>'y', 'þ'=>'b', 'ÿ'=>'y' );
return strtr( $this->titre, $unwanted_array );
}
public function setTitre(string $titre): self
{
$this->titre = $titre;
return $this;
}
public function getResume(): ?string
{
return $this->resume;
}
public function setResume(?string $resume): self
{
$this->resume = $resume;
return $this;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(?string $reference): self
{
$this->reference = $reference;
return $this;
}
public function getProtocole(): ?string
{
return $this->protocole;
}
public function setProtocole(?string $protocole): self
{
$this->protocole = $protocole;
return $this;
}
public function getAdministration(): ?string
{
return $this->administration;
}
public function setAdministration(?string $administration): self
{
$this->administration = $administration;
return $this;
}
public function getInformation(): ?string
{
return $this->information;
}
public function setInformation(?string $information): self
{
$this->information = $information;
return $this;
}
public function getCodeDent(): ?string
{
return $this->codeDent;
}
public function setCodeDent(?string $codeDent): self
{
$this->codeDent = $codeDent;
return $this;
}
public function getCodeFracture(): ?string
{
return $this->codeFracture;
}
public function setCodeFracture(?string $codeFracture): self
{
$this->codeFracture = $codeFracture;
return $this;
}
public function getFracture(): ?string
{
return $this->fracture;
}
public function setFracture(?string $fracture): self
{
$this->fracture = $fracture;
return $this;
}
public function isUrgence(): ?bool
{
return $this->urgence;
}
public function setUrgence(bool $urgence): self
{
$this->urgence = $urgence;
return $this;
}
public function isFavori(): ?bool
{
return $this->favori;
}
public function setFavori(bool $favori): self
{
$this->favori = $favori;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getActesassocies(): Collection
{
return $this->actesassocies;
}
public function addActesassocy(self $actesassocy): self
{
if (!$this->actesassocies->contains($actesassocy)) {
$this->actesassocies->add($actesassocy);
}
return $this;
}
public function removeActesassocy(self $actesassocy): self
{
$this->actesassocies->removeElement($actesassocy);
return $this;
}
/**
* @return Collection<int, Categorie>
*/
public function getCategoriesassocies(): Collection
{
return $this->categoriesassocies;
}
public function addCategoriesassocy(Categorie $categoriesassocy): self
{
if (!$this->categoriesassocies->contains($categoriesassocy)) {
$this->categoriesassocies->add($categoriesassocy);
}
return $this;
}
public function removeCategoriesassocy(Categorie $categoriesassocy): self
{
$this->categoriesassocies->removeElement($categoriesassocy);
return $this;
}
/**
* @return Collection<int, Commentaire>
*/
public function getCommentaires(): Collection
{
return $this->commentaires;
}
public function addCommentaire(Commentaire $commentaire): self
{
if (!$this->commentaires->contains($commentaire)) {
$this->commentaires->add($commentaire);
}
return $this;
}
public function removeCommentaire(Commentaire $commentaire): self
{
if ($this->commentaires->removeElement($commentaire)) {
}
return $this;
}
public function isArchive(): ?bool
{
return $this->archive;
}
public function getArchive(): ?bool
{
return $this->archive;
}
public function setArchive(bool $archive): self
{
$this->archive = $archive;
return $this;
}
public function getUrlvideo(): ?string
{
return $this->urlvideo;
}
public function setUrlvideo(?string $urlvideo): self
{
$this->urlvideo = $urlvideo;
return $this;
}
/**
* @return Collection<int, Protocoleinstrimg>
*/
public function getProtocoleinstrimgs(): Collection
{
return $this->protocoleinstrimgs;
}
public function addProtocoleinstrimg(Protocoleinstrimg $protocoleinstrimg): self
{
if (!$this->protocoleinstrimgs->contains($protocoleinstrimg)) {
$this->protocoleinstrimgs->add($protocoleinstrimg);
$protocoleinstrimg->setProtocole($this);
}
return $this;
}
public function removeProtocoleinstrimg(Protocoleinstrimg $protocoleinstrimg): self
{
if ($this->protocoleinstrimgs->removeElement($protocoleinstrimg)) {
// set the owning side to null (unless already changed)
if ($protocoleinstrimg->getProtocole() === $this) {
$protocoleinstrimg->setProtocole(null);
}
}
return $this;
}
/**
* @return Collection<int, Protocolephoto>
*/
public function getProtocolephotos(): Collection
{
return $this->protocolephotos;
}
public function addProtocolephoto(Protocolephoto $protocolephoto): self
{
if (!$this->protocolephotos->contains($protocolephoto)) {
$this->protocolephotos->add($protocolephoto);
$protocolephoto->setProtocole($this);
}
return $this;
}
public function removeProtocolephoto(Protocolephoto $protocolephoto): self
{
if ($this->protocolephotos->removeElement($protocolephoto)) {
// set the owning side to null (unless already changed)
if ($protocolephoto->getProtocole() === $this) {
$protocolephoto->setProtocole(null);
}
}
return $this;
}
public function getPhotoDefault()
{
if ($this->protocolephotos == null)
return null;
foreach ($this->protocolephotos as $photo) {
if($photo->getOrdre() == 1)
return $photo;
}
return null;
}
/**
* @return Collection<int, Materiel>
*/
public function getMateriels(): Collection
{
return $this->materiels;
}
public function addMateriel(Materiel $materiel): self
{
if (!$this->materiels->contains($materiel)) {
$this->materiels->add($materiel);
}
return $this;
}
public function removeMateriel(Materiel $materiel): self
{
$this->materiels->removeElement($materiel);
return $this;
}
/**
* @return Collection<int, Categorie>
*/
public function getCategories(): Collection
{
return $this->categories;
}
public function addCategory(Categorie $category): self
{
if (!$this->categories->contains($category)) {
$this->categories->add($category);
}
return $this;
}
public function removeCategory(Categorie $category): self
{
$this->categories->removeElement($category);
return $this;
}
}