src/Entity/Gauge/Supplier.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gauge;
  3. use App\DBAL\EnumSupplierVisibilityType;
  4. use App\Entity\Client\Client;
  5. use App\Entity\Extension\TimestampableTrait;
  6. use App\Repository\Gauge\SupplierRepository;
  7. use DateTimeInterface;
  8. use Ramsey\Uuid\Uuid;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use Ramsey\Uuid\UuidInterface;
  12. /**
  13. * @ORM\Entity(repositoryClass=SupplierRepository::class)
  14. * @ORM\Table(name="suppliers")
  15. */
  16. class Supplier
  17. {
  18. use TimestampableTrait;
  19. /**
  20. * @var UuidInterface
  21. *
  22. * @ORM\Id()
  23. * @ORM\GeneratedValue(strategy="CUSTOM")
  24. * @ORM\Column(type="uuid", unique=true)
  25. * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator")
  26. */
  27. private UuidInterface $id;
  28. /**
  29. * @var string
  30. * @ORM\Column(type="string")
  31. *
  32. * @Assert\NotBlank
  33. * @Assert\Type(type="string")
  34. */
  35. private string $name;
  36. /**
  37. * @var bool
  38. * @ORM\Column(type="boolean")
  39. *
  40. * @Assert\NotNull
  41. * @Assert\Type(type="boolean")
  42. */
  43. private bool $water = false;
  44. /**
  45. * @var bool
  46. * @ORM\Column(type="boolean")
  47. *
  48. * @Assert\NotNull
  49. * @Assert\Type(type="boolean")
  50. */
  51. private bool $electricity = false;
  52. /**
  53. * @var bool
  54. * @ORM\Column(type="boolean")
  55. *
  56. * @Assert\NotNull
  57. * @Assert\Type(type="boolean")
  58. */
  59. private bool $gas = false;
  60. /**
  61. * @var bool
  62. * @ORM\Column(type="boolean")
  63. *
  64. * @Assert\NotNull
  65. * @Assert\Type(type="boolean")
  66. */
  67. private bool $heat = false;
  68. /**
  69. * @var bool
  70. * @ORM\Column(type="boolean")
  71. *
  72. * @Assert\NotNull
  73. * @Assert\Type(type="boolean")
  74. */
  75. private bool $fuel = false;
  76. /**
  77. * @ORM\Column(type="enum_suppliervisibility", options={"default": EnumSupplierVisibilityType::VISIBLE_FOR_CLIENT})
  78. */
  79. private string $visibility = EnumSupplierVisibilityType::VISIBLE_FOR_CLIENT;
  80. /**
  81. * @var Client
  82. * @ORM\ManyToOne(targetEntity="App\Entity\Client\Client")
  83. * @ORM\JoinColumn(name="client_id", referencedColumnName="id", nullable=false)
  84. */
  85. private Client $client;
  86. /**
  87. * @var int
  88. * @ORM\Column(type="integer")
  89. */
  90. private int $usageCount = 0;
  91. /**
  92. * @var DateTimeInterface|null
  93. *
  94. * @ORM\Column(name="merged_at", type="datetime", nullable=true)
  95. */
  96. protected ?DateTimeInterface $mergedAt;
  97. /**
  98. * @var ?string
  99. * @ORM\Column(type="string", nullable=true)
  100. * @Assert\Type(type="string")
  101. */
  102. private ?string $mergedWith = null;
  103. /**
  104. * @return UuidInterface
  105. */
  106. public function getId(): UuidInterface
  107. {
  108. return $this->id;
  109. }
  110. /**
  111. * @param UuidInterface $id
  112. * @return $this
  113. */
  114. public function setId(UuidInterface $id): Supplier
  115. {
  116. $this->id = $id;
  117. return $this;
  118. }
  119. /**
  120. * @return string
  121. */
  122. public function getName(): string
  123. {
  124. return $this->name;
  125. }
  126. /**
  127. * @param string $name
  128. * @return $this
  129. */
  130. public function setName(string $name): Supplier
  131. {
  132. $this->name = $name;
  133. return $this;
  134. }
  135. /**
  136. * @return bool
  137. */
  138. public function isWater(): bool
  139. {
  140. return $this->water;
  141. }
  142. /**
  143. * @param bool $water
  144. * @return $this
  145. */
  146. public function setWater(bool $water): Supplier
  147. {
  148. $this->water = $water;
  149. return $this;
  150. }
  151. /**
  152. * @return bool
  153. */
  154. public function isElectricity(): bool
  155. {
  156. return $this->electricity;
  157. }
  158. /**
  159. * @param bool $electricity
  160. * @return $this
  161. */
  162. public function setElectricity(bool $electricity): Supplier
  163. {
  164. $this->electricity = $electricity;
  165. return $this;
  166. }
  167. /**
  168. * @return bool
  169. */
  170. public function isGas(): bool
  171. {
  172. return $this->gas;
  173. }
  174. /**
  175. * @param bool $gas
  176. * @return $this
  177. */
  178. public function setGas(bool $gas): Supplier
  179. {
  180. $this->gas = $gas;
  181. return $this;
  182. }
  183. /**
  184. * @return bool
  185. */
  186. public function isHeat(): bool
  187. {
  188. return $this->heat;
  189. }
  190. /**
  191. * @param bool $heat
  192. * @return $this
  193. */
  194. public function setHeat(bool $heat): Supplier
  195. {
  196. $this->heat = $heat;
  197. return $this;
  198. }
  199. /**
  200. * @return bool
  201. */
  202. public function isFuel(): bool
  203. {
  204. return $this->fuel;
  205. }
  206. /**
  207. * @param bool $fuel
  208. * @return $this
  209. */
  210. public function setFuel(bool $fuel): Supplier
  211. {
  212. $this->fuel = $fuel;
  213. return $this;
  214. }
  215. /**
  216. * @return int
  217. */
  218. public function getVisibility(): int
  219. {
  220. return $this->visibility;
  221. }
  222. /**
  223. * @param int $visibility
  224. * @return $this
  225. */
  226. public function setVisibility(int $visibility): Supplier
  227. {
  228. $this->visibility = $visibility;
  229. return $this;
  230. }
  231. /**
  232. * @return Client
  233. */
  234. public function getClient(): Client
  235. {
  236. return $this->client;
  237. }
  238. /**
  239. * @param Client $client
  240. * @return $this
  241. */
  242. public function setClient(Client $client): Supplier
  243. {
  244. $this->client = $client;
  245. return $this;
  246. }
  247. /**
  248. * @return int
  249. */
  250. public function getUsageCount(): int
  251. {
  252. return $this->usageCount;
  253. }
  254. /**
  255. * @param int $usageCount
  256. * @return $this
  257. */
  258. public function setUsageCount(int $usageCount): Supplier
  259. {
  260. $this->usageCount = $usageCount;
  261. return $this;
  262. }
  263. /**
  264. * @return DateTimeInterface|null
  265. */
  266. public function getMergedAt(): ?DateTimeInterface
  267. {
  268. return $this->mergedAt;
  269. }
  270. /**
  271. * @param DateTimeInterface|null $mergedAt
  272. * @return $this
  273. */
  274. public function setMergedAt(?DateTimeInterface $mergedAt): Supplier
  275. {
  276. $this->mergedAt = $mergedAt;
  277. return $this;
  278. }
  279. /**
  280. * @return string
  281. */
  282. public function getMergedWith(): string
  283. {
  284. return $this->mergedWith;
  285. }
  286. /**
  287. * @param string $mergedWith
  288. * @return $this
  289. */
  290. public function setMergedWith(string $mergedWith): Supplier
  291. {
  292. $this->mergedWith = $mergedWith;
  293. return $this;
  294. }
  295. /**
  296. * @return DateTimeInterface|null
  297. */
  298. public function getCreatedAt(): ?DateTimeInterface
  299. {
  300. return $this->createdAt;
  301. }
  302. /**
  303. * @param DateTimeInterface|null $createdAt
  304. * @return $this
  305. */
  306. public function setCreatedAt(?DateTimeInterface $createdAt): Supplier
  307. {
  308. $this->createdAt = $createdAt;
  309. return $this;
  310. }
  311. /**
  312. * @return DateTimeInterface|null
  313. */
  314. public function getUpdatedAt(): ?DateTimeInterface
  315. {
  316. return $this->updatedAt;
  317. }
  318. /**
  319. * @param DateTimeInterface|null $updatedAt
  320. * @return $this
  321. */
  322. public function setUpdatedAt(?DateTimeInterface $updatedAt): Supplier
  323. {
  324. $this->updatedAt = $updatedAt;
  325. return $this;
  326. }
  327. }