<?php
namespace App\Entity\Ged;
use App\Entity\Articles\Article;
use App\Entity\Clients\Client;
use App\Entity\FO\Societe;
use App\Entity\Fournisseurs\Fournisseur;
use App\Entity\GestionComerciale\Commande;
use App\Entity\GestionComerciale\FabricationMultiple;
use App\Entity\Kanban\Fiche;
use App\Entity\Utilisateur\Utilisateur;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use App\Annotations\SecuredEntity;
/**
* Fichier
*
* @ORM\Table("ged__fichier")
* @ORM\Entity(repositoryClass="App\Repository\Ged\FichierRepository")
* @Gedmo\SoftDeleteable(fieldName="dateSuppression",timeAware=false)
* @SecuredEntity(name="Fichier", group="OUTILS")
*/
class Fichier
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(name="id_import", type="string",length=255, nullable=true)
*/
private $idImport;
/**
* @ORM\Column(name="jeton", type="string", length=255, nullable=true)
*/
private $jeton;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Articles\Article")
* @ORM\JoinColumn(nullable=true)
*/
private $article;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\Commande")
* @ORM\JoinColumn(nullable=true)
*/
private $commande;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\GestionComerciale\FabricationMultiple")
* @ORM\JoinColumn(nullable=true)
*/
private $fabricationMultiple;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Clients\Client")
* @ORM\JoinColumn(nullable=true)
*/
private $client;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Fournisseurs\Fournisseur")
* @ORM\JoinColumn(nullable=true)
*/
private $fournisseur;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Utilisateur\Utilisateur")
* @ORM\JoinColumn(nullable=true)
*/
private $utilisateur;
/**
* @ORM\Column(name="date", type="datetime", nullable=true)
*/
private $date;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Ged\Fichier")
* @ORM\JoinColumn(nullable=true)
*/
private $parent;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Ged\Fichier")
* @ORM\JoinColumn(nullable=true)
*/
private $fichierParent;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\FO\Societe")
* @ORM\JoinColumn(nullable=true)
*/
private $societe;
/**
* @ORM\Column(name="visible", type="boolean", nullable=true)
*/
private $visible;
/**
* @ORM\Column(name="bat", type="boolean", nullable=true)
*/
private $bat;
/**
* @ORM\Column(name="renomme", type="boolean", nullable=true)
*/
private $renomme;
/**
* @ORM\Column(name="modifiable", type="boolean", nullable=true)
*/
private $modifiable;
/**
* @ORM\Column(name="supprimable", type="boolean", nullable=true)
*/
private $supprimable;
/**
* @ORM\Column(name="libelle", type="string", length=255, nullable=true)
*/
private $libelle;
/**
* @ORM\Column(name="mime_type", type="string", length=255, nullable=true)
*/
private $mimeType;
/**
* @ORM\Column(name="type", type="string", length=255, nullable=true)
*/
private $type;
/**
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(name="dateMaj", type="datetime", nullable=true)
* @Gedmo\Timestampable(on="update")
*/
private $dateMaj;
/**
* @ORM\Column(name="dateSuppression", type="datetime", nullable=true)
*/
private $dateSuppression;
/**
* @ORM\Column(name="chemin", type="string", length=255, nullable=true)
*/
private $chemin;
/**
* @ORM\Column(name="extension", type="string", length=255, nullable=true)
*/
private $extension;
/**
* @ORM\Column(name="version", type="integer", nullable=true)
*/
private $version;
/**
* @ORM\Column(name="telechargement", type="integer", nullable=true, options={"default" : 0})
*/
private $telechargement;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Kanban\Fiche")
* @ORM\JoinColumn(nullable=true)
*/
private $affaire;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $libelle2;
public function __construct()
{
$this->date = new Datetime();
$this->renomme = false;
$this->telechargement = 0;
$this->modifiable = true;
$this->supprimable = true;
$this->visible = true;
$this->jeton = $this->generateRandomString();
}
public function __toString()
{
return $this->libelle;
}
public function getId(): int
{
return $this->id;
}
public function setDate(?DateTime $date): Fichier
{
$this->date = $date;
return $this;
}
public function getDate(): ?DateTime
{
return $this->date;
}
public function setLibelle(?string $libelle): Fichier
{
$this->libelle = $libelle;
return $this;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setDescription(?string $description): Fichier
{
$this->description = $description;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDateMaj(?DateTime $dateMaj): Fichier
{
$this->dateMaj = $dateMaj;
return $this;
}
public function getDateMaj(): ?DateTime
{
return $this->dateMaj;
}
public function setDateSuppression(?DateTime $dateSuppression): Fichier
{
$this->dateSuppression = $dateSuppression;
return $this;
}
public function getDateSuppression(): ?DateTime
{
return $this->dateSuppression;
}
public function setChemin(?string $chemin): Fichier
{
$this->chemin = $chemin;
return $this;
}
public function getChemin(): ?string
{
return $this->chemin;
}
public function setExtension(?string $extension): Fichier
{
$this->extension = $extension;
return $this;
}
public function getExtension(): ?string
{
return $this->extension;
}
public function setVersion(?int $version): Fichier
{
$this->version = $version;
return $this;
}
public function getVersion(): ?int
{
return $this->version;
}
public function setType(?string $type): Fichier
{
$this->type = $type;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setParent(?Fichier $parent): Fichier
{
$this->parent = $parent;
return $this;
}
public function getParent(): ?Fichier
{
return $this->parent;
}
public function setSociete(?Societe $societe): Fichier
{
$this->societe = $societe;
return $this;
}
public function getSociete(): ?Societe
{
return $this->societe;
}
public function setUtilisateur(?Utilisateur $utilisateur): Fichier
{
$this->utilisateur = $utilisateur;
return $this;
}
public function getUtilisateur(): ?Utilisateur
{
return $this->utilisateur;
}
public function setRenomme(?bool $renomme): Fichier
{
$this->renomme = $renomme;
return $this;
}
public function getRenomme(): ?bool
{
return $this->renomme;
}
public function setFichierParent(?Fichier $fichierParent): Fichier
{
$this->fichierParent = $fichierParent;
return $this;
}
public function getFichierParent(): ?Fichier
{
return $this->fichierParent;
}
public function setMimeType(?string $mimeType): Fichier
{
$this->mimeType = $mimeType;
return $this;
}
public function getMimeType(): ?string
{
return $this->mimeType;
}
public function setModifiable(?bool $modifiable): Fichier
{
$this->modifiable = $modifiable;
return $this;
}
public function getModifiable(): ?bool
{
return $this->modifiable;
}
public function setSupprimable(?bool $supprimable): Fichier
{
$this->supprimable = $supprimable;
return $this;
}
public function getSupprimable(): ?bool
{
return $this->supprimable;
}
public function setIdImport(?string $idImport): Fichier
{
$this->idImport = $idImport;
return $this;
}
public function getIdImport(): ?string
{
return $this->idImport;
}
public function setArticle(?Article $article): Fichier
{
$this->article = $article;
return $this;
}
public function getArticle(): ?Article
{
return $this->article;
}
public function setClient(?Client $client): Fichier
{
$this->client = $client;
return $this;
}
public function getClient(): ?Client
{
return $this->client;
}
public function setVisible(?bool $visible): Fichier
{
$this->visible = $visible;
return $this;
}
public function getVisible(): ?bool
{
return $this->visible;
}
public function setCommande(?Commande $commande): Fichier
{
$this->commande = $commande;
return $this;
}
public function getCommande(): ?Commande
{
return $this->commande;
}
public function setBat(?bool $bat): Fichier
{
$this->bat = $bat;
return $this;
}
public function getBat(): ?bool
{
return $this->bat;
}
public function setJeton(?string $jeton): Fichier
{
$this->jeton = $jeton;
return $this;
}
public function getJeton(): ?string
{
return $this->jeton;
}
public function generateRandomString($length = 30): string
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
public function setFournisseur(?Fournisseur $fournisseur): Fichier
{
$this->fournisseur = $fournisseur;
return $this;
}
public function getFournisseur(): ?Fournisseur
{
return $this->fournisseur;
}
public function setAffaire(?Fiche $affaire): Fichier
{
$this->affaire = $affaire;
return $this;
}
public function getAffaire(): ?Fiche
{
return $this->affaire;
}
public function isVisible(): ?bool
{
return $this->visible;
}
public function isBat(): ?bool
{
return $this->bat;
}
public function isRenomme(): ?bool
{
return $this->renomme;
}
public function isModifiable(): ?bool
{
return $this->modifiable;
}
public function isSupprimable(): ?bool
{
return $this->supprimable;
}
public function getTelechargement(): ?int
{
return $this->telechargement;
}
public function setTelechargement(?int $telechargement): self
{
$this->telechargement = $telechargement;
return $this;
}
public function getFabricationMultiple(): ?FabricationMultiple
{
return $this->fabricationMultiple;
}
public function setFabricationMultiple(?FabricationMultiple $fabricationMultiple): self
{
$this->fabricationMultiple = $fabricationMultiple;
return $this;
}
public function getLibelle2(): ?string
{
return $this->libelle2;
}
public function setLibelle2(?string $libelle2): self
{
$this->libelle2 = $libelle2;
return $this;
}
}