modules/QSL/SpecialOffersSpendXGetY/src/Model/CategoryOffer.php line 22

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright (c) 2011-present Qualiteam software Ltd. All rights reserved.
  4.  * See https://www.x-cart.com/license-agreement.html for license details.
  5.  */
  6. namespace QSL\SpecialOffersSpendXGetY\Model;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * Category
  10.  *
  11.  * @ORM\Entity
  12.  * @ORM\Table (name="sxgy_category_offers",
  13.  *      uniqueConstraints={
  14.  *          @ORM\UniqueConstraint (name="pair", columns={"offer_id","category_id"})
  15.  *      },
  16.  * )
  17.  */
  18. class CategoryOffer extends \XLite\Model\AEntity
  19. {
  20.     /**
  21.      * Primary key
  22.      *
  23.      * @var integer
  24.      *
  25.      * @ORM\Id
  26.      * @ORM\GeneratedValue (strategy="AUTO")
  27.      * @ORM\Column         (type="integer", options={ "unsigned": true })
  28.      */
  29.     protected $id;
  30.     /**
  31.      * Relation to a category entity
  32.      *
  33.      * @var \Doctrine\Common\Collections\ArrayCollection
  34.      *
  35.      * @ORM\ManyToOne  (targetEntity="XLite\Model\Category", inversedBy="sxgyCategoryOffers")
  36.      * @ORM\JoinColumn (name="category_id", referencedColumnName="category_id", onDelete="CASCADE")
  37.      */
  38.     protected $category;
  39.     /**
  40.      * Relation to an offer entity
  41.      *
  42.      * @var \Doctrine\Common\Collections\ArrayCollection
  43.      *
  44.      * @ORM\ManyToOne  (targetEntity="QSL\SpecialOffersBase\Model\SpecialOffer", inversedBy="sxgyConditionCategories")
  45.      * @ORM\JoinColumn (name="offer_id", referencedColumnName="offer_id", onDelete="CASCADE")
  46.      */
  47.     protected $offer;
  48.     /**
  49.      * Returns the entity identifier.
  50.      *
  51.      * @return integer
  52.      */
  53.     public function getId()
  54.     {
  55.         return $this->id;
  56.     }
  57.     /**
  58.      * Sets a category for the relation.
  59.      *
  60.      * @param \XLite\Model\Category $category Category model.
  61.      *
  62.      * @return CategoryOffer
  63.      */
  64.     public function setCategory(\XLite\Model\Category $category null)
  65.     {
  66.         $this->category $category;
  67.         return $this;
  68.     }
  69.     /**
  70.      * Returns the relation category.
  71.      *
  72.      * @return \XLite\Model\Category
  73.      */
  74.     public function getCategory()
  75.     {
  76.         return $this->category;
  77.     }
  78.     /**
  79.      * Sets a special offer for the relation.
  80.      *
  81.      * @param \QSL\SpecialOffersBase\Model\SpecialOffer $offer Special Offer model
  82.      *
  83.      * @return CategoryOffer
  84.      */
  85.     public function setOffer(\QSL\SpecialOffersBase\Model\SpecialOffer $offer null)
  86.     {
  87.         $this->offer $offer;
  88.         return $this;
  89.     }
  90.     /**
  91.      * Returns the relation special offer.
  92.      *
  93.      * @return \QSL\SpecialOffersBase\Model\SpecialOffer
  94.      */
  95.     public function getOffer()
  96.     {
  97.         return $this->offer;
  98.     }
  99. }