src/Entity/WorkHours.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\WorkHoursRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClass: WorkHoursRepository::class)]
  6. class WorkHours
  7. {
  8. #[ORM\Id]
  9. #[ORM\GeneratedValue]
  10. #[ORM\Column(type: 'integer')]
  11. private $id;
  12. #[ORM\ManyToOne(targetEntity: Workers::class, inversedBy: 'workhours')]
  13. #[ORM\JoinColumn(nullable: false)]
  14. private $worker;
  15. #[ORM\Column(type: 'date', nullable: true)]
  16. private $payed;
  17. #[ORM\Column(type: 'datetime', nullable: true)]
  18. private $created;
  19. #[ORM\ManyToOne(targetEntity: Projects::class, inversedBy: 'workHours')]
  20. private $project;
  21. #[ORM\Column(type: 'integer', nullable: true)]
  22. private $payed_hour_price;
  23. #[ORM\Column(type: 'float', nullable: true)]
  24. private $hours;
  25. #[ORM\Column(type: 'date', nullable: true)]
  26. private $day;
  27. #[ORM\Column(type: 'text', nullable: true)]
  28. private $note;
  29. #[ORM\ManyToOne(targetEntity: ProjectProducts::class, inversedBy: 'workHours')]
  30. private $projectProduct;
  31. #[ORM\Column(type: 'integer', nullable: true)]
  32. private $other_price;
  33. #[ORM\ManyToOne(targetEntity: User::class, cascade: ['persist'])]
  34. private $validated;
  35. #[ORM\Column(type: 'datetime', nullable: true)]
  36. private $validatedDate;
  37. #[ORM\Column(type: 'boolean')]
  38. private $isValidated;
  39. public function __construct()
  40. {
  41. $this->created = new \DateTime();
  42. }
  43. public function getId(): ?int
  44. {
  45. return $this->id;
  46. }
  47. public function getWorker(): ?Workers
  48. {
  49. return $this->worker;
  50. }
  51. public function setWorker(?Workers $worker): self
  52. {
  53. $this->worker = $worker;
  54. return $this;
  55. }
  56. public function getPayed(): ?\DateTimeInterface
  57. {
  58. return $this->payed;
  59. }
  60. public function setPayed(?\DateTimeInterface $payed): self
  61. {
  62. if($this->isValidated){
  63. $this->payed = $payed;
  64. }
  65. return $this;
  66. }
  67. public function getCreated(): ?\DateTimeInterface
  68. {
  69. return $this->created;
  70. }
  71. public function setCreated(?\DateTimeInterface $created): self
  72. {
  73. $this->created = $created;
  74. return $this;
  75. }
  76. public function getProject(): ?Projects
  77. {
  78. return $this->project;
  79. }
  80. public function setProject(?Projects $project): self
  81. {
  82. $this->project = $project;
  83. return $this;
  84. }
  85. public function getPayedHourPrice(): ?int
  86. {
  87. return $this->payed_hour_price;
  88. }
  89. public function setPayedHourPrice(?int $payed_hour_price): self
  90. {
  91. $this->payed_hour_price = $payed_hour_price;
  92. return $this;
  93. }
  94. public function getHours(): ?float
  95. {
  96. return $this->hours;
  97. }
  98. public function setHours(?float $hours): self
  99. {
  100. $this->hours = $hours;
  101. return $this;
  102. }
  103. public function getDay(): ?\DateTimeInterface
  104. {
  105. return $this->day;
  106. }
  107. public function setDay(?\DateTimeInterface $day): self
  108. {
  109. $this->day = $day;
  110. return $this;
  111. }
  112. public function getNote(): ?string
  113. {
  114. return $this->note;
  115. }
  116. public function setNote(?string $note): self
  117. {
  118. $this->note = $note;
  119. return $this;
  120. }
  121. public function getProjectProduct(): ?ProjectProducts
  122. {
  123. return $this->projectProduct;
  124. }
  125. public function setProjectProduct(?ProjectProducts $projectProduct): self
  126. {
  127. if($projectProduct){
  128. $this->setProject($projectProduct->getProject());
  129. }
  130. $this->projectProduct = $projectProduct;
  131. return $this;
  132. }
  133. public function getOtherPrice(): ?int
  134. {
  135. return $this->other_price;
  136. }
  137. public function setOtherPrice(?int $other_price): self
  138. {
  139. $this->other_price = $other_price;
  140. return $this;
  141. }
  142. public function getValidated(): ?User
  143. {
  144. return $this->validated;
  145. }
  146. public function setValidated(?User $validated): self
  147. {
  148. $this->validated = $validated;
  149. return $this;
  150. }
  151. public function getValidatedDate(): ?\DateTimeInterface
  152. {
  153. return $this->validatedDate;
  154. }
  155. public function setValidatedDate(?\DateTimeInterface $validatedDate): self
  156. {
  157. $this->validatedDate = $validatedDate;
  158. return $this;
  159. }
  160. public function getIsValidated(): ?bool
  161. {
  162. return $this->isValidated;
  163. }
  164. public function setIsValidated(bool $isValidated): self
  165. {
  166. $this->isValidated = $isValidated;
  167. return $this;
  168. }
  169. }