src/Entity/Unit.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use JMS\Serializer\Annotation\Groups;
  5. /**
  6.  * Class Unit
  7.  *
  8.  * @ORM\Entity(repositoryClass="App\Repository\UnitRepository")
  9.  * @ORM\Table(name="malys_unit")
  10.  * @ORM\HasLifecycleCallbacks()
  11.  * @package App\Entity
  12.  */
  13. class Unit
  14. {
  15.     /**
  16.      * @var integer
  17.      *
  18.      * @ORM\Column(name="id", type="integer")
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      * @Groups({"api"})
  22.      */
  23.     protected $id;
  24.     /**
  25.      * @var string
  26.      *
  27.      * @ORM\Column(name="singular_label", type="string", length=255, nullable=false)
  28.      * @Groups({"api"})
  29.      */
  30.     protected $singularLabel;
  31.     /**
  32.      * @var string
  33.      *
  34.      * @ORM\Column(name="plural_label", type="string", length=255, nullable=false)
  35.      */
  36.     protected $pluralLabel;
  37.     /**
  38.      * @var string
  39.      *
  40.      * @ORM\Column(name="sub_unit_short_label", type="string", length=255, nullable=true)
  41.      */
  42.     protected $subUnitShortLabel;
  43.     /**
  44.      * @var float
  45.      *
  46.      * @ORM\Column(name="sub_unit_count", type="float", nullable=true)
  47.      */
  48.     private $subUnitCount;
  49.     public function __toString()
  50.     {
  51.         return $this->getSingularLabel();
  52.     }
  53.     /**
  54.      * @return int
  55.      */
  56.     public function getId()
  57.     {
  58.         return $this->id;
  59.     }
  60.     /**
  61.      * @param int $id
  62.      */
  63.     public function setId($id)
  64.     {
  65.         $this->id $id;
  66.     }
  67.     /**
  68.      * @return string
  69.      */
  70.     public function getSingularLabel()
  71.     {
  72.         return $this->singularLabel;
  73.     }
  74.     public function getLabel()
  75.     {
  76.         return ucfirst($this->getSingularLabel());
  77.     }
  78.     /**
  79.      * @param string $singularLabel
  80.      */
  81.     public function setSingularLabel($singularLabel)
  82.     {
  83.         $this->singularLabel $singularLabel;
  84.     }
  85.     /**
  86.      * @return string
  87.      */
  88.     public function getPluralLabel()
  89.     {
  90.         return $this->pluralLabel;
  91.     }
  92.     /**
  93.      * @param string $pluralLabel
  94.      */
  95.     public function setPluralLabel($pluralLabel)
  96.     {
  97.         $this->pluralLabel $pluralLabel;
  98.     }
  99.     /**
  100.      * @return string
  101.      */
  102.     public function getSubUnitShortLabel()
  103.     {
  104.         return $this->subUnitShortLabel;
  105.     }
  106.     /**
  107.      * @param string $subUnitShortLabel
  108.      */
  109.     public function setSubUnitShortLabel($subUnitShortLabel)
  110.     {
  111.         $this->subUnitShortLabel $subUnitShortLabel;
  112.     }
  113.     /**
  114.      * @return float
  115.      */
  116.     public function getSubUnitCount()
  117.     {
  118.         return $this->subUnitCount;
  119.     }
  120.     /**
  121.      * @param float $subUnitCount
  122.      */
  123.     public function setSubUnitCount($subUnitCount)
  124.     {
  125.         $this->subUnitCount $subUnitCount;
  126.     }
  127. }