src/Entity/Gauge/ShareOfGauges.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gauge;
  3. use App\Entity\Extension\TimestampableTrait;
  4. use App\Repository\Gauge\ShareOfGaugesRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7. * @ORM\Entity(repositoryClass=ShareOfGaugesRepository::class)
  8. * @ORM\Table(name="share_of_gauges")
  9. */
  10. class ShareOfGauges
  11. {
  12. use TimestampableTrait;
  13. /**
  14. * @ORM\Id()
  15. * @ORM\GeneratedValue()
  16. * @ORM\Column(type="integer")
  17. */
  18. private ?int $id = null;
  19. /**
  20. * @var Gauge $gauge
  21. * @ORM\ManyToOne(targetEntity="App\Entity\Gauge\Gauge", inversedBy="shares")
  22. * @ORM\JoinColumn(name="gauge_id", referencedColumnName="id", nullable=false)
  23. */
  24. private Gauge $gauge;
  25. /**
  26. * @var null|string
  27. * @ORM\Column(type="string", nullable=true)
  28. */
  29. private ?string $title = null;
  30. /**
  31. * @var null|string
  32. * @ORM\Column(type="string", nullable=true)
  33. */
  34. private ?string $holderIco = null;
  35. /**
  36. * @var null|string
  37. * @ORM\Column(type="string", nullable=true)
  38. */
  39. private ?string $holderName = null;
  40. /**
  41. * @var float
  42. * @ORM\Column(type="float")
  43. */
  44. private float $part;
  45. /**
  46. * @return int|null
  47. */
  48. public function getId(): ?int
  49. {
  50. return $this->id;
  51. }
  52. /**
  53. * @param int|null $id
  54. * @return ShareOfGauges
  55. */
  56. public function setId(?int $id): ShareOfGauges
  57. {
  58. $this->id = $id;
  59. return $this;
  60. }
  61. /**
  62. * @return Gauge
  63. */
  64. public function getGauge(): Gauge
  65. {
  66. return $this->gauge;
  67. }
  68. /**
  69. * @param Gauge $gauge
  70. * @return ShareOfGauges
  71. */
  72. public function setGauge(Gauge $gauge): ShareOfGauges
  73. {
  74. $this->gauge = $gauge;
  75. return $this;
  76. }
  77. /**
  78. * @return string|null
  79. */
  80. public function getTitle(): ?string
  81. {
  82. return $this->title;
  83. }
  84. /**
  85. * @param string|null $title
  86. * @return ShareOfGauges
  87. */
  88. public function setTitle(?string $title): ShareOfGauges
  89. {
  90. $this->title = $title;
  91. return $this;
  92. }
  93. /**
  94. * @return string|null
  95. */
  96. public function getHolderIco(): ?string
  97. {
  98. return $this->holderIco;
  99. }
  100. /**
  101. * @param string|null $holderIco
  102. * @return ShareOfGauges
  103. */
  104. public function setHolderIco(?string $holderIco): ShareOfGauges
  105. {
  106. $this->holderIco = $holderIco;
  107. return $this;
  108. }
  109. /**
  110. * @return string|null
  111. */
  112. public function getHolderName(): ?string
  113. {
  114. return $this->holderName;
  115. }
  116. /**
  117. * @param string|null $holderName
  118. * @return ShareOfGauges
  119. */
  120. public function setHolderName(?string $holderName): ShareOfGauges
  121. {
  122. $this->holderName = $holderName;
  123. return $this;
  124. }
  125. /**
  126. * @return float
  127. */
  128. public function getPart(): float
  129. {
  130. return $this->part;
  131. }
  132. /**
  133. * @param float $part
  134. * @return ShareOfGauges
  135. */
  136. public function setPart(float $part): ShareOfGauges
  137. {
  138. $this->part = $part;
  139. return $this;
  140. }
  141. /**
  142. * @return string
  143. */
  144. public function getOutName():string
  145. {
  146. if ($this->holderName !== null && $this->title !== null) {
  147. return sprintf('%s - %s', $this->title, $this->holderName);
  148. }
  149. if ($this->holderName !== null) {
  150. return $this->holderName;
  151. }
  152. return $this->title;
  153. }
  154. }