ninebadge/src/ninebadge-1.0/src/Entity/Tallyday.php

187 lines
3.5 KiB
PHP
Raw Normal View History

2022-02-09 09:55:14 +01:00
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Tallyday
*
2022-02-12 09:46:16 +01:00
* @ORM\Table(name="tallyday",indexes={@ORM\Index(name="search_idx", columns={"user_id", "dateof"})})
2022-02-09 09:55:14 +01:00
* @ORM\Entity(repositoryClass="App\Repository\TallydayRepository")
*/
class Tallyday
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="date", nullable=false)
*/
private $dateof;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
2022-02-12 09:46:16 +01:00
private $datestart;
2022-02-09 09:55:14 +01:00
/**
* @ORM\Column(type="datetime", nullable=true)
*/
2022-02-12 09:46:16 +01:00
private $dateend;
2022-02-09 09:55:14 +01:00
/**
2022-02-12 09:46:16 +01:00
* @ORM\Column(type="boolean")
2022-02-09 09:55:14 +01:00
*/
2022-02-12 09:46:16 +01:00
private $validateuser;
2022-02-09 09:55:14 +01:00
/**
2022-02-12 09:46:16 +01:00
* @ORM\Column(type="boolean")
2022-02-09 09:55:14 +01:00
*/
2022-02-12 09:46:16 +01:00
private $validatemaster;
2022-02-09 09:55:14 +01:00
/**
* @ORM\Column(type="boolean")
*/
2022-02-12 09:46:16 +01:00
private $isbreakday;
2022-02-09 09:55:14 +01:00
/**
2022-02-12 09:46:16 +01:00
* @ORM\Column(type="string", nullable=true)
2022-02-09 09:55:14 +01:00
*/
2022-02-12 09:46:16 +01:00
private $name;
2022-02-09 09:55:14 +01:00
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="tallydays")
*/
private $user;
// Calculate
private $timeday;
public function getTimeday() {
$e = new \DateTime('00:00');
$f = clone $e;
2022-02-12 09:46:16 +01:00
if($this->datestart && $this->dateend)
$e->add(date_diff($this->dateend, $this->datestart));
2022-02-09 09:55:14 +01:00
return $f->diff($e);
}
public function getTimedayformatted() {
2022-02-09 18:09:54 +01:00
$interval=$this->getTimeday();
$timeday = sprintf("%02s",(($interval->days*24)) + $interval->h).":".sprintf("%02s",$interval->i);
return $timeday;
2022-02-09 09:55:14 +01:00
}
public function getId(): ?int
{
return $this->id;
}
public function getDateof(): ?\DateTimeInterface
{
return $this->dateof;
}
public function setDateof(\DateTimeInterface $dateof): self
{
$this->dateof = $dateof;
return $this;
}
2022-02-12 09:46:16 +01:00
public function getDatestart(): ?\DateTimeInterface
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
return $this->datestart;
2022-02-09 09:55:14 +01:00
}
2022-02-12 09:46:16 +01:00
public function setDatestart(?\DateTimeInterface $datestart): self
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
$this->datestart = $datestart;
2022-02-09 09:55:14 +01:00
return $this;
}
2022-02-12 09:46:16 +01:00
public function getDateend(): ?\DateTimeInterface
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
return $this->dateend;
2022-02-09 09:55:14 +01:00
}
2022-02-12 09:46:16 +01:00
public function setDateend(?\DateTimeInterface $dateend): self
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
$this->dateend = $dateend;
2022-02-09 09:55:14 +01:00
return $this;
}
2022-02-12 09:46:16 +01:00
public function getValidateuser(): ?bool
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
return $this->validateuser;
2022-02-09 09:55:14 +01:00
}
2022-02-12 09:46:16 +01:00
public function setValidateuser(bool $validateuser): self
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
$this->validateuser = $validateuser;
2022-02-09 09:55:14 +01:00
return $this;
}
2022-02-12 09:46:16 +01:00
public function getValidatemaster(): ?bool
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
return $this->validatemaster;
2022-02-09 09:55:14 +01:00
}
2022-02-12 09:46:16 +01:00
public function setValidatemaster(bool $validatemaster): self
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
$this->validatemaster = $validatemaster;
2022-02-09 09:55:14 +01:00
return $this;
}
2022-02-12 09:46:16 +01:00
public function getUser(): ?User
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
return $this->user;
2022-02-09 09:55:14 +01:00
}
2022-02-12 09:46:16 +01:00
public function setUser(?User $user): self
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
$this->user = $user;
2022-02-09 09:55:14 +01:00
return $this;
}
2022-02-12 09:46:16 +01:00
public function getIsbreakday(): ?bool
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
return $this->isbreakday;
2022-02-09 09:55:14 +01:00
}
2022-02-12 09:46:16 +01:00
public function setIsbreakday(bool $isbreakday): self
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
$this->isbreakday = $isbreakday;
2022-02-09 09:55:14 +01:00
return $this;
}
2022-02-12 09:46:16 +01:00
public function getName(): ?string
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
return $this->name;
2022-02-09 09:55:14 +01:00
}
2022-02-12 09:46:16 +01:00
public function setName(?string $name): self
2022-02-09 09:55:14 +01:00
{
2022-02-12 09:46:16 +01:00
$this->name = $name;
2022-02-09 09:55:14 +01:00
return $this;
}
2022-02-12 09:46:16 +01:00
2022-02-09 09:55:14 +01:00
}