src/CoreBundle/Entity/Vehicles/Category.php line 12

Open in your IDE?
  1. <?php
  2. namespace CoreBundle\Entity\Vehicles;
  3. use Application\Sonata\MediaBundle\Entity\Media;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. /**
  7.  * Category
  8.  */
  9. class Category
  10. {
  11.     /**
  12.      * @var integer
  13.      */
  14.     private $id;
  15.     /**
  16.      * @var integer
  17.      */
  18.     private $temp_id;
  19.     /**
  20.      * @var string
  21.      */
  22.     private $title_ru;
  23.     /**
  24.      * @var string
  25.      */
  26.     private $title_ua;
  27.     /**
  28.      * @var integer
  29.      */
  30.     private $position;
  31.     /**
  32.      * @var string
  33.      */
  34.     private $url;
  35.     /**
  36.      * @var Media
  37.      */
  38.     private $image;
  39.     /**
  40.      * Get id
  41.      *
  42.      * @return integer
  43.      */
  44.     public function getId()
  45.     {
  46.         return $this->id;
  47.     }
  48.     /**
  49.      * Set tempId
  50.      *
  51.      * @param integer $tempId
  52.      *
  53.      * @return Category
  54.      */
  55.     public function setTempId($tempId)
  56.     {
  57.         $this->temp_id $tempId;
  58.         return $this;
  59.     }
  60.     /**
  61.      * Get tempId
  62.      *
  63.      * @return integer
  64.      */
  65.     public function getTempId()
  66.     {
  67.         return $this->temp_id;
  68.     }
  69.     /**
  70.      * Set titleRu
  71.      *
  72.      * @param string $titleRu
  73.      *
  74.      * @return Category
  75.      */
  76.     public function setTitleRu($titleRu)
  77.     {
  78.         $this->title_ru $titleRu;
  79.         return $this;
  80.     }
  81.     /**
  82.      * Get titleRu
  83.      *
  84.      * @return string
  85.      */
  86.     public function getTitleRu()
  87.     {
  88.         return $this->title_ru;
  89.     }
  90.     public function getTitle($locale)
  91.     {
  92.         return $locale == 'ru' $this->getTitleRu() : $this->getTitleUa();
  93.     }
  94.     /**
  95.      * Set titleUa
  96.      *
  97.      * @param string $titleUa
  98.      *
  99.      * @return Category
  100.      */
  101.     public function setTitleUa($titleUa)
  102.     {
  103.         $this->title_ua $titleUa;
  104.         return $this;
  105.     }
  106.     /**
  107.      * Get titleUa
  108.      *
  109.      * @return string
  110.      */
  111.     public function getTitleUa()
  112.     {
  113.         return $this->title_ua;
  114.     }
  115.     /**
  116.      * Set position
  117.      *
  118.      * @param integer $position
  119.      *
  120.      * @return Category
  121.      */
  122.     public function setPosition($position)
  123.     {
  124.         $this->position $position;
  125.         return $this;
  126.     }
  127.     /**
  128.      * Get position
  129.      *
  130.      * @return integer
  131.      */
  132.     public function getPosition()
  133.     {
  134.         return $this->position;
  135.     }
  136.     /**
  137.      * Set url
  138.      *
  139.      * @param string $url
  140.      *
  141.      * @return Category
  142.      */
  143.     public function setUrl($url)
  144.     {
  145.         $this->url $url;
  146.         return $this;
  147.     }
  148.     /**
  149.      * Get url
  150.      *
  151.      * @return string
  152.      */
  153.     public function getUrl()
  154.     {
  155.         return $this->url;
  156.     }
  157.     /**
  158.      * Set image
  159.      *
  160.      * @param Media $image
  161.      *
  162.      * @return Category
  163.      */
  164.     public function setImage(Media $image null)
  165.     {
  166.         $this->image $image;
  167.         return $this;
  168.     }
  169.     /**
  170.      * Get image
  171.      *
  172.      * @return Media
  173.      */
  174.     public function getImage()
  175.     {
  176.         return $this->image;
  177.     }
  178.     public function __toString()
  179.     {
  180.         return (string) $this->getTitleRu();
  181.     }
  182.     /**
  183.      * @var integer
  184.      */
  185.     private $vehicle_type;
  186.     /**
  187.      * Set vehicleType
  188.      *
  189.      * @param integer $vehicleType
  190.      *
  191.      * @return Category
  192.      */
  193.     public function setVehicleType($vehicleType)
  194.     {
  195.         $this->vehicle_type $vehicleType;
  196.         return $this;
  197.     }
  198.     /**
  199.      * Get vehicleType
  200.      *
  201.      * @return integer
  202.      */
  203.     public function getVehicleType()
  204.     {
  205.         return $this->vehicle_type;
  206.     }
  207.     /**
  208.      * @var Collection
  209.      */
  210.     private $vehicles;
  211.     /**
  212.      * Constructor
  213.      */
  214.     public function __construct()
  215.     {
  216.         $this->vehicles = new ArrayCollection();
  217.     }
  218.     /**
  219.      * Add vehicle.
  220.      *
  221.      * @param Vehicle $vehicle
  222.      *
  223.      * @return Category
  224.      */
  225.     public function addVehicle(Vehicle $vehicle)
  226.     {
  227.         $this->vehicles[] = $vehicle;
  228.         return $this;
  229.     }
  230.     /**
  231.      * Remove vehicle.
  232.      *
  233.      * @param Vehicle $vehicle
  234.      *
  235.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  236.      */
  237.     public function removeVehicle(Vehicle $vehicle)
  238.     {
  239.         return $this->vehicles->removeElement($vehicle);
  240.     }
  241.     /**
  242.      * Get vehicles.
  243.      *
  244.      * @return Collection
  245.      */
  246.     public function getVehicles()
  247.     {
  248.         return $this->vehicles;
  249.     }
  250.     /**
  251.      * @var string|null
  252.      */
  253.     private $description;
  254.     /**
  255.      * Set description.
  256.      *
  257.      * @param string|null $description
  258.      *
  259.      * @return Category
  260.      */
  261.     public function setDescription($description null)
  262.     {
  263.         $this->description $description;
  264.         return $this;
  265.     }
  266.     /**
  267.      * Get description.
  268.      *
  269.      * @return string|null
  270.      */
  271.     public function getDescriptionByLocale($locale): ?string
  272.     {
  273.         if($locale == 'ru') {
  274.             return $this->getDescriptionRu();
  275.         }
  276.         return $this->getDescriptionUa();
  277.     }
  278.     /**
  279.      * @var string|null
  280.      */
  281.     private $description_ua;
  282.     /**
  283.      * @var string|null
  284.      */
  285.     private $description_ru;
  286.     /**
  287.      * Set descriptionUa.
  288.      *
  289.      * @param string|null $descriptionUa
  290.      *
  291.      * @return Category
  292.      */
  293.     public function setDescriptionUa($descriptionUa null)
  294.     {
  295.         $this->description_ua $descriptionUa;
  296.         return $this;
  297.     }
  298.     /**
  299.      * Get descriptionUa.
  300.      *
  301.      * @return string|null
  302.      */
  303.     public function getDescriptionUa()
  304.     {
  305.         return $this->description_ua;
  306.     }
  307.     /**
  308.      * Set descriptionRu.
  309.      *
  310.      * @param string|null $descriptionRu
  311.      *
  312.      * @return Category
  313.      */
  314.     public function setDescriptionRu($descriptionRu null)
  315.     {
  316.         $this->description_ru $descriptionRu;
  317.         return $this;
  318.     }
  319.     /**
  320.      * Get descriptionRu.
  321.      *
  322.      * @return string|null
  323.      */
  324.     public function getDescriptionRu()
  325.     {
  326.         return $this->description_ru;
  327.     }
  328. }