267 lines
5.9 KiB
PHP
267 lines
5.9 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|
|
|
/**
|
|
* Scrum
|
|
*
|
|
* @ORM\Entity(repositoryClass="App\Repository\ScrumRepository")
|
|
* @ORM\Table(name="scrum", uniqueConstraints={@ORM\UniqueConstraint(name="name", columns={"name"})} )
|
|
* @UniqueEntity("name", message="Ce nom de groupe existe dèja")
|
|
*/
|
|
class Scrum
|
|
{
|
|
/**
|
|
* @ORM\Column(name="id", type="integer")
|
|
* @ORM\Id
|
|
* @ORM\GeneratedValue(strategy="AUTO")
|
|
*/
|
|
private $id;
|
|
|
|
/**
|
|
* @ORM\Column(name="name", type="string")
|
|
*
|
|
*/
|
|
private $name;
|
|
|
|
/**
|
|
* @ORM\Column(name="category", type="string", nullable=true)
|
|
*
|
|
*/
|
|
private $category;
|
|
|
|
/**
|
|
* @ORM\Column(name="updatedate", type="datetime", nullable=true)
|
|
*
|
|
*/
|
|
private $updatedate;
|
|
|
|
/**
|
|
* @ORM\Column(type="integer")
|
|
*/
|
|
private $giteaid;
|
|
|
|
/**
|
|
* @ORM\Column(type="string")
|
|
*/
|
|
private $giteaname;
|
|
|
|
/**
|
|
* @ORM\Column(type="json")
|
|
*/
|
|
private $giteajson;
|
|
|
|
/**
|
|
* @ORM\ManyToMany(targetEntity="User", mappedBy="scrums")
|
|
*/
|
|
private $users;
|
|
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="Scrumcolumn", mappedBy="scrum", cascade={"persist"}, orphanRemoval=true)
|
|
* @ORM\OrderBy({"rowid" = "ASC"})
|
|
*/
|
|
private $scrumcolumns;
|
|
|
|
/**
|
|
* @ORM\OneToMany(targetEntity="Scrumissue", mappedBy="scrum", cascade={"persist"}, orphanRemoval=true)
|
|
* @ORM\OrderBy({"giteamilestonename" = "DESC", "rowid" = "ASC"})
|
|
*/
|
|
private $scrumissues;
|
|
|
|
public function getStatistique()
|
|
{
|
|
$id=-100;
|
|
$issues=$this->getScrumissues();
|
|
$tab=[];
|
|
foreach($issues as $issue) {
|
|
if($id!=$issue->getGiteamilestone()) {
|
|
$id=$issue->getGiteamilestone();
|
|
$label=($issue->getGiteamilestonename()?$issue->getGiteamilestonename():"Aucun");
|
|
$tab[$id]=["Jalon",$label,0];
|
|
}
|
|
$tab[$id][2]=$tab[$id][2]+1;
|
|
}
|
|
|
|
return $tab;
|
|
}
|
|
|
|
public function __construct()
|
|
{
|
|
$this->users = new ArrayCollection();
|
|
$this->scumcolumns = new ArrayCollection();
|
|
$this->scrumcolumns = new ArrayCollection();
|
|
$this->scrumissues = new ArrayCollection();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getName(): ?string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function setName(string $name): self
|
|
{
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getGiteaid(): ?int
|
|
{
|
|
return $this->giteaid;
|
|
}
|
|
|
|
public function setGiteaid(int $giteaid): self
|
|
{
|
|
$this->giteaid = $giteaid;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getGiteaname(): ?string
|
|
{
|
|
return $this->giteaname;
|
|
}
|
|
|
|
public function setGiteaname(string $giteaname): self
|
|
{
|
|
$this->giteaname = $giteaname;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getGiteajson(): ?array
|
|
{
|
|
return $this->giteajson;
|
|
}
|
|
|
|
public function setGiteajson(array $giteajson): self
|
|
{
|
|
$this->giteajson = $giteajson;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection|User[]
|
|
*/
|
|
public function getUsers(): Collection
|
|
{
|
|
return $this->users;
|
|
}
|
|
|
|
public function addUser(User $user): self
|
|
{
|
|
if (!$this->users->contains($user)) {
|
|
$this->users[] = $user;
|
|
$user->addScrum($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeUser(User $user): self
|
|
{
|
|
if ($this->users->contains($user)) {
|
|
$this->users->removeElement($user);
|
|
$user->removeScrum($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection|Scrumcolumn[]
|
|
*/
|
|
public function getScrumcolumns(): Collection
|
|
{
|
|
return $this->scrumcolumns;
|
|
}
|
|
|
|
public function addScrumcolumn(Scrumcolumn $scrumcolumn): self
|
|
{
|
|
if (!$this->scrumcolumns->contains($scrumcolumn)) {
|
|
$this->scrumcolumns[] = $scrumcolumn;
|
|
$scrumcolumn->setScrum($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeScrumcolumn(Scrumcolumn $scrumcolumn): self
|
|
{
|
|
if ($this->scrumcolumns->contains($scrumcolumn)) {
|
|
$this->scrumcolumns->removeElement($scrumcolumn);
|
|
// set the owning side to null (unless already changed)
|
|
if ($scrumcolumn->getScrum() === $this) {
|
|
$scrumcolumn->setScrum(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection|Scrumissue[]
|
|
*/
|
|
public function getScrumissues(): Collection
|
|
{
|
|
return $this->scrumissues;
|
|
}
|
|
|
|
public function addScrumissue(Scrumissue $scrumissue): self
|
|
{
|
|
if (!$this->scrumissues->contains($scrumissue)) {
|
|
$this->scrumissues[] = $scrumissue;
|
|
$scrumissue->setScrum($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeScrumissue(Scrumissue $scrumissue): self
|
|
{
|
|
if ($this->scrumissues->contains($scrumissue)) {
|
|
$this->scrumissues->removeElement($scrumissue);
|
|
// set the owning side to null (unless already changed)
|
|
if ($scrumissue->getScrum() === $this) {
|
|
$scrumissue->setScrum(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getUpdatedate(): ?\DateTimeInterface
|
|
{
|
|
return $this->updatedate;
|
|
}
|
|
|
|
public function setUpdatedate(?\DateTimeInterface $updatedate): self
|
|
{
|
|
$this->updatedate = $updatedate;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCategory(): ?string
|
|
{
|
|
return $this->category;
|
|
}
|
|
|
|
public function setCategory(?string $category): self
|
|
{
|
|
$this->category = $category;
|
|
|
|
return $this;
|
|
}
|
|
} |