<?php
namespace App\Entity;
use App\Repository\WorkHoursRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: WorkHoursRepository::class)]
class WorkHours
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\ManyToOne(targetEntity: Workers::class, inversedBy: 'workhours')]
#[ORM\JoinColumn(nullable: false)]
private $worker;
#[ORM\Column(type: 'date', nullable: true)]
private $payed;
#[ORM\Column(type: 'datetime', nullable: true)]
private $created;
#[ORM\ManyToOne(targetEntity: Projects::class, inversedBy: 'workHours')]
private $project;
#[ORM\Column(type: 'integer', nullable: true)]
private $payed_hour_price;
#[ORM\Column(type: 'float', nullable: true)]
private $hours;
#[ORM\Column(type: 'date', nullable: true)]
private $day;
#[ORM\Column(type: 'text', nullable: true)]
private $note;
#[ORM\ManyToOne(targetEntity: ProjectProducts::class, inversedBy: 'workHours')]
private $projectProduct;
#[ORM\Column(type: 'integer', nullable: true)]
private $other_price;
#[ORM\ManyToOne(targetEntity: User::class, cascade: ['persist'])]
private $validated;
#[ORM\Column(type: 'datetime', nullable: true)]
private $validatedDate;
#[ORM\Column(type: 'boolean')]
private $isValidated;
public function __construct()
{
$this->created = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getWorker(): ?Workers
{
return $this->worker;
}
public function setWorker(?Workers $worker): self
{
$this->worker = $worker;
return $this;
}
public function getPayed(): ?\DateTimeInterface
{
return $this->payed;
}
public function setPayed(?\DateTimeInterface $payed): self
{
if($this->isValidated){
$this->payed = $payed;
}
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(?\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function getProject(): ?Projects
{
return $this->project;
}
public function setProject(?Projects $project): self
{
$this->project = $project;
return $this;
}
public function getPayedHourPrice(): ?int
{
return $this->payed_hour_price;
}
public function setPayedHourPrice(?int $payed_hour_price): self
{
$this->payed_hour_price = $payed_hour_price;
return $this;
}
public function getHours(): ?float
{
return $this->hours;
}
public function setHours(?float $hours): self
{
$this->hours = $hours;
return $this;
}
public function getDay(): ?\DateTimeInterface
{
return $this->day;
}
public function setDay(?\DateTimeInterface $day): self
{
$this->day = $day;
return $this;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): self
{
$this->note = $note;
return $this;
}
public function getProjectProduct(): ?ProjectProducts
{
return $this->projectProduct;
}
public function setProjectProduct(?ProjectProducts $projectProduct): self
{
if($projectProduct){
$this->setProject($projectProduct->getProject());
}
$this->projectProduct = $projectProduct;
return $this;
}
public function getOtherPrice(): ?int
{
return $this->other_price;
}
public function setOtherPrice(?int $other_price): self
{
$this->other_price = $other_price;
return $this;
}
public function getValidated(): ?User
{
return $this->validated;
}
public function setValidated(?User $validated): self
{
$this->validated = $validated;
return $this;
}
public function getValidatedDate(): ?\DateTimeInterface
{
return $this->validatedDate;
}
public function setValidatedDate(?\DateTimeInterface $validatedDate): self
{
$this->validatedDate = $validatedDate;
return $this;
}
public function getIsValidated(): ?bool
{
return $this->isValidated;
}
public function setIsValidated(bool $isValidated): self
{
$this->isValidated = $isValidated;
return $this;
}
}