src/Entity/Embeddable/RecordsReceived.php line 13

Open in your IDE?
  1. <?php
  2. namespace MedBrief\MSR\Entity\Embeddable;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use MedBrief\MSR\Entity\RecordsRequest;
  5. /**
  6. * Embeddable object that holds information about received records.
  7. *
  8. * @ORM\Embeddable
  9. */
  10. class RecordsReceived
  11. {
  12. // format constants
  13. public const FORMAT_HARD_COPY = 0;
  14. public const FORMAT_ELECTRONIC = 1;
  15. public const FORMAT_MIXTURE = 2;
  16. /**
  17. * @var int|null
  18. *
  19. * @ORM\Column(name="format", type="integer", nullable=true)
  20. */
  21. protected $format;
  22. /**
  23. * Set format
  24. *
  25. * @param int $format
  26. *
  27. * @return RecordsRequest
  28. */
  29. public function setFormat($format)
  30. {
  31. $this->format = $format;
  32. return $this;
  33. }
  34. /**
  35. * Get format
  36. *
  37. * @return int
  38. */
  39. public function getFormat()
  40. {
  41. return $this->format;
  42. }
  43. /**
  44. * Get formatOptions
  45. *
  46. * @return array
  47. */
  48. public static function getFormatOptions()
  49. {
  50. return [
  51. self::FORMAT_HARD_COPY => 'Hard Copy',
  52. self::FORMAT_ELECTRONIC => 'Electronic',
  53. self::FORMAT_MIXTURE => 'Mixture',
  54. ];
  55. }
  56. /**
  57. * Get formatLabel
  58. *
  59. * @return int
  60. */
  61. public function getFormatLabel()
  62. {
  63. $options = self::getFormatOptions();
  64. return $options[$this->getFormat()] ?? '';
  65. }
  66. }