src/Entity/HearingAid.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Enum\HearingAidFrequencyEnum;
  4. use App\Entity\Enum\HearingAidTypeEnum;
  5. use App\Entity\Enum\HearingAidScaleEnum;
  6. use App\Entity\Enum\HearingAidHearingLossEnum;
  7. use App\Repository\HearingAidRepository;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Symfony\Component\HttpFoundation\File\File;
  12. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  13. use Symfony\Component\Validator\Constraints as Assert;
  14. /**
  15.  * @ORM\Entity(repositoryClass=HearingAidRepository::class)
  16.  * @Vich\Uploadable
  17.  */
  18. class HearingAid
  19. {
  20.     /**
  21.      * @ORM\Id()
  22.      * @ORM\GeneratedValue()
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\Column(type="string", length=255)
  28.      */
  29.     private $name;
  30.     /**
  31.      * @ORM\Column(type="text")
  32.      */
  33.     private $description;
  34.     /**
  35.      * @ORM\Column(type="string", length=255)
  36.      */
  37.     private $imagePath;
  38.     /**
  39.      * @assert\File( mimeTypes = {"image/jpeg", "image/png", "image/gif", "image/jpg"})
  40.      * @Vich\UploadableField(mapping="hearing_aid_images", fileNameProperty="imagePath")
  41.      * @var File
  42.      */
  43.     private $imageFile;
  44.     /**
  45.      * @ORM\Column(type="boolean")
  46.      */
  47.     private $rechargeable;
  48.     /**
  49.      * @ORM\Column(type="string")
  50.      */
  51.     private $price;
  52.     /**
  53.      * @ORM\ManyToOne(targetEntity=HearingMaker::class, inversedBy="hearingAids")
  54.      * @ORM\JoinColumn(nullable=false)
  55.      */
  56.     private $hearingMaker;
  57.     /**
  58.      * @ORM\Column(type="datetime", nullable=true)
  59.      */
  60.     private $updatedAt;
  61.     /**
  62.      * @ORM\Column(type="string", length=255)
  63.      */
  64.     private $slug;
  65.     /**
  66.      * @ORM\Column(type="boolean")
  67.      */
  68.     private $volumeControl;
  69.     /**
  70.      * @ORM\Column(type="boolean")
  71.      */
  72.     private $pushButton;
  73.     /**
  74.      * @ORM\Column(type="boolean")
  75.      */
  76.     private $tPosition;
  77.     /**
  78.      * @ORM\Column(type="boolean")
  79.      */
  80.     private $bluetooth;
  81.     /**
  82.      * @ORM\Column(type="boolean")
  83.      */
  84.     private $iphoneConnect;
  85.     /**
  86.      * @ORM\Column(type="boolean")
  87.      */
  88.     private $remoteAdjustment;
  89.     /**
  90.      * @ORM\Column(type="boolean")
  91.      */
  92.     private $smartphoneApp;
  93.     /**
  94.      * @ORM\Column(type="boolean")
  95.      */
  96.     private $androidStreaming;
  97.     /**
  98.      * @ORM\Column(type="boolean")
  99.      */
  100.     private $windReducer;
  101.     /**
  102.      * @ORM\Column(type="boolean")
  103.      */
  104.     private $impulseNoiseReducer;
  105.     /**
  106.      * @ORM\Column(type="boolean")
  107.      */
  108.     private $lowNoiseReducer;
  109.     /**
  110.      * @ORM\Column(type="boolean")
  111.      */
  112.     private $echoReducer;
  113.     /**
  114.      * @ORM\Column(type="boolean")
  115.      */
  116.     private $tinnitusMasker;
  117.     /**
  118.      * @ORM\Column(type="integer")
  119.      */
  120.     private $frequency;
  121.     /**
  122.      * @ORM\Column(type="integer")
  123.      */
  124.     private $type;
  125.     /**
  126.      * @ORM\Column(type="boolean")
  127.      */
  128.     private $discretion;
  129.     /**
  130.      * @ORM\Column(type="smallint", nullable=true)
  131.      */
  132.     private $scale;
  133.     /**
  134.      * @ORM\Column(type="smallint", nullable=true)
  135.      */
  136.     private $hearingLoss;
  137.     public function __construct()
  138.     {
  139.     }
  140.     public function getId(): ?int
  141.     {
  142.         return $this->id;
  143.     }
  144.     public function getName(): ?string
  145.     {
  146.         return $this->name;
  147.     }
  148.     public function setName(string $name): self
  149.     {
  150.         $this->name $name;
  151.         return $this;
  152.     }
  153.     public function getDescription(): ?string
  154.     {
  155.         return $this->description;
  156.     }
  157.     public function setDescription(string $description): self
  158.     {
  159.         $this->description $description;
  160.         return $this;
  161.     }
  162.     public function getImagePath(): ?string
  163.     {
  164.         return $this->imagePath;
  165.     }
  166.     public function setImagePath(string $imagePath): self
  167.     {
  168.         $this->imagePath $imagePath;
  169.         return $this;
  170.     }
  171.     public function hasImage()
  172.     {
  173.         return !is_null($this->imagePath);
  174.     }
  175.     public function setImageFile(File $image null)
  176.     {
  177.         $this->imageFile $image;
  178.         if ($image) {
  179.             $this->updatedAt = new \DateTime('now');
  180.         }
  181.     }
  182.     public function getImageFile()
  183.     {
  184.         return $this->imageFile;
  185.     }
  186.     public function getRechargeable(): ?bool
  187.     {
  188.         return $this->rechargeable;
  189.     }
  190.     public function setRechargeable(bool $rechargeable): self
  191.     {
  192.         $this->rechargeable $rechargeable;
  193.         return $this;
  194.     }
  195.     public function getPrice(): ?int
  196.     {
  197.         return $this->price;
  198.     }
  199.     public function setPrice($price): self
  200.     {
  201.         $this->price $price;
  202.         return $this;
  203.     }
  204.     public function getHearingMaker(): ?HearingMaker
  205.     {
  206.         return $this->hearingMaker;
  207.     }
  208.     public function setHearingMaker(?HearingMaker $hearingMaker): self
  209.     {
  210.         $this->hearingMaker $hearingMaker;
  211.         return $this;
  212.     }
  213.     public function getUpdatedAt(): ?\DateTimeInterface
  214.     {
  215.         return $this->updatedAt;
  216.     }
  217.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  218.     {
  219.         $this->updatedAt $updatedAt;
  220.         return $this;
  221.     }
  222.     public function getSlug(): ?string
  223.     {
  224.         return $this->slug;
  225.     }
  226.     public function setSlug(string $slug): self
  227.     {
  228.         $this->slug $slug;
  229.         return $this;
  230.     }
  231.     public function getVolumeControl(): ?bool
  232.     {
  233.         return $this->volumeControl;
  234.     }
  235.     public function setVolumeControl(bool $volumeControl): self
  236.     {
  237.         $this->volumeControl $volumeControl;
  238.         return $this;
  239.     }
  240.     public function getPushButton(): ?bool
  241.     {
  242.         return $this->pushButton;
  243.     }
  244.     public function setPushButton(bool $pushButton): self
  245.     {
  246.         $this->pushButton $pushButton;
  247.         return $this;
  248.     }
  249.     public function getTPosition(): ?bool
  250.     {
  251.         return $this->tPosition;
  252.     }
  253.     public function setTPosition(bool $tPosition): self
  254.     {
  255.         $this->tPosition $tPosition;
  256.         return $this;
  257.     }
  258.     public function getBluetooth(): ?bool
  259.     {
  260.         return $this->bluetooth;
  261.     }
  262.     public function setBluetooth(bool $bluetooth): self
  263.     {
  264.         $this->bluetooth $bluetooth;
  265.         return $this;
  266.     }
  267.     public function getIphoneConnect(): ?bool
  268.     {
  269.         return $this->iphoneConnect;
  270.     }
  271.     public function setIphoneConnect(bool $iphoneConnect): self
  272.     {
  273.         $this->iphoneConnect $iphoneConnect;
  274.         return $this;
  275.     }
  276.     public function getRemoteAdjustment(): ?bool
  277.     {
  278.         return $this->remoteAdjustment;
  279.     }
  280.     public function setRemoteAdjustment(bool $remoteAdjustment): self
  281.     {
  282.         $this->remoteAdjustment $remoteAdjustment;
  283.         return $this;
  284.     }
  285.     public function getSmartphoneApp(): ?bool
  286.     {
  287.         return $this->smartphoneApp;
  288.     }
  289.     public function setSmartphoneApp(bool $smartphoneApp): self
  290.     {
  291.         $this->smartphoneApp $smartphoneApp;
  292.         return $this;
  293.     }
  294.     public function getAndroidStreaming(): ?bool
  295.     {
  296.         return $this->androidStreaming;
  297.     }
  298.     public function setAndroidStreaming(bool $androidStreaming): self
  299.     {
  300.         $this->androidStreaming $androidStreaming;
  301.         return $this;
  302.     }
  303.     public function getWindReducer(): ?bool
  304.     {
  305.         return $this->windReducer;
  306.     }
  307.     public function setWindReducer(bool $windReducer): self
  308.     {
  309.         $this->windReducer $windReducer;
  310.         return $this;
  311.     }
  312.     public function getImpulseNoiseReducer(): ?bool
  313.     {
  314.         return $this->impulseNoiseReducer;
  315.     }
  316.     public function setImpulseNoiseReducer(bool $impulseNoiseReducer): self
  317.     {
  318.         $this->impulseNoiseReducer $impulseNoiseReducer;
  319.         return $this;
  320.     }
  321.     public function getLowNoiseReducer(): ?bool
  322.     {
  323.         return $this->lowNoiseReducer;
  324.     }
  325.     public function setLowNoiseReducer(bool $lowNoiseReducer): self
  326.     {
  327.         $this->lowNoiseReducer $lowNoiseReducer;
  328.         return $this;
  329.     }
  330.     public function getEchoReducer(): ?bool
  331.     {
  332.         return $this->echoReducer;
  333.     }
  334.     public function setEchoReducer(bool $echoReducer): self
  335.     {
  336.         $this->echoReducer $echoReducer;
  337.         return $this;
  338.     }
  339.     public function getTinnitusMasker(): ?bool
  340.     {
  341.         return $this->tinnitusMasker;
  342.     }
  343.     public function setTinnitusMasker(bool $tinnitusMasker): self
  344.     {
  345.         $this->tinnitusMasker $tinnitusMasker;
  346.         return $this;
  347.     }
  348.     public function getTypeName(): string
  349.     {
  350.         return HearingAidTypeEnum::getTypeName($this->getType());
  351.     }
  352.     public function getFrequencyName(){
  353.         return HearingAidFrequencyEnum::getFrequencyName($this->getFrequency());
  354.     }
  355.     public function getFrequency(): ?int
  356.     {
  357.         return $this->frequency;
  358.     }
  359.     public function setFrequency(int $frequency): self
  360.     {
  361.         $this->frequency $frequency;
  362.         return $this;
  363.     }
  364.     public function getType(): ?int
  365.     {
  366.         return $this->type;
  367.     }
  368.     public function setType(int $type): self
  369.     {
  370.         $this->type $type;
  371.         return $this;
  372.     }
  373.     public function getDiscretion(): ?bool
  374.     {
  375.         return $this->discretion;
  376.     }
  377.     public function setDiscretion(bool $discretion): self
  378.     {
  379.         $this->discretion $discretion;
  380.         return $this;
  381.     }
  382.     public function __toString()
  383.     {
  384.         return $this->getName();
  385.     }
  386.     public function getScale(): ?int
  387.     {
  388.         return $this->scale;
  389.     }
  390.     public function setScale(?int $scale): self
  391.     {
  392.         $this->scale $scale;
  393.         return $this;
  394.     }
  395.     public function getHearingLoss(): ?int
  396.     {
  397.         return $this->hearingLoss;
  398.     }
  399.     public function setHearingLoss(?int $hearingLoss): self
  400.     {
  401.         $this->hearingLoss $hearingLoss;
  402.         return $this;
  403.     }
  404. }