src/AtechNet/CoreBundle/Entity/MarketplaceJobProductModel.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\AtechNet\CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping\Column;
  4. use Doctrine\ORM\Mapping\Entity;
  5. use Doctrine\ORM\Mapping\JoinColumn;
  6. use Doctrine\ORM\Mapping\ManyToOne;
  7. use Doctrine\ORM\Mapping\OneToOne;
  8. use Doctrine\ORM\Mapping\Table as Table;
  9. /**
  10.  * MarketplaceJobProductModel
  11.  *
  12.  * @Table(name="marketplace_job_product_models")
  13.  * @Entity
  14.  */
  15. class MarketplaceJobProductModel extends AbstractSignedEntity
  16. {
  17.     /**
  18.      * @var MarketplaceJob
  19.      *
  20.      * @ManyToOne(targetEntity="MarketplaceJob", inversedBy="productModels", cascade={"persist"})
  21.      * @JoinColumn(name="marketplace_job_id", referencedColumnName="id")
  22.      */
  23.     private MarketplaceJob $marketplaceJob;
  24.     /**
  25.      * @var ProductModel
  26.      *
  27.      * @ManyToOne(targetEntity="ProductModel", inversedBy="marketplaceJobProductModels")
  28.      * @JoinColumn(name="product_model_id", referencedColumnName="id")
  29.      */
  30.     private ProductModel $productModel;
  31.     /**
  32.      * @var int
  33.      *
  34.      * @Column(name="synced_qty", type="integer", nullable=false)
  35.      */
  36.     private int $syncedQty = 0;
  37.     /**
  38.      * @var int
  39.      *
  40.      * @Column(name="status", type="integer", length=1)
  41.      */
  42.     private int $status;
  43.     /**
  44.      * @var array|null
  45.      *
  46.      * @Column(name="result", type="array", nullable=true)
  47.      */
  48.     private ?array $result;
  49.     /**
  50.      * @var ProductModel|null
  51.      *
  52.      * @ManyToOne(targetEntity="ProductModel")
  53.      * @JoinColumn(name="alternative_model_for_availability_calculation", referencedColumnName="id", nullable=true)
  54.      */
  55.     private ?ProductModel $alternativeModelForAvailabilityCalculation;
  56.     /**
  57.      * @var MarketplaceListingStatistics
  58.      *
  59.      * @OneToOne(targetEntity="MarketplaceListingStatistics", inversedBy="marketplaceJobProductModel")
  60.      * @JoinColumn(name="marketplace_listing_statistics_id", referencedColumnName="id", nullable=true)
  61.      */
  62.     private $marketplaceListingStatisticsItem;
  63.     public function __construct()
  64.     {
  65.         parent::__construct();
  66.         $this->status = MarketplaceJob::JOB_ITEM_STATUS_PENDING;
  67.     }
  68.     /**
  69.      * @return MarketplaceJob
  70.      */
  71.     public function getMarketplaceJob()
  72.     {
  73.         return $this->marketplaceJob;
  74.     }
  75.     /**
  76.      * @param MarketplaceJob $marketplaceJob
  77.      */
  78.     public function setMarketplaceJob(MarketplaceJob $marketplaceJob)
  79.     {
  80.         $this->marketplaceJob = $marketplaceJob;
  81.     }
  82.     /**
  83.      * @return ProductModel
  84.      */
  85.     public function getProductModel()
  86.     {
  87.         return $this->productModel;
  88.     }
  89.     /**
  90.      * @param ProductModel $productModel
  91.      */
  92.     public function setProductModel($productModel)
  93.     {
  94.         $this->productModel = $productModel;
  95.     }
  96.     /**
  97.      * @return int
  98.      */
  99.     public function getSyncedQty()
  100.     {
  101.         return $this->syncedQty;
  102.     }
  103.     /**
  104.      * @param int $syncedQty
  105.      */
  106.     public function setSyncedQty(int $syncedQty)
  107.     {
  108.         $this->syncedQty = $syncedQty;
  109.     }
  110.     /**
  111.      * @return int
  112.      */
  113.     public function getStatus()
  114.     {
  115.         return $this->status;
  116.     }
  117.     /**
  118.      * @param int $status
  119.      */
  120.     public function setStatus(int $status)
  121.     {
  122.         $this->status = $status;
  123.     }
  124.     /**
  125.      * @return array|null
  126.      */
  127.     public function getResult(): ?array
  128.     {
  129.         return $this->result;
  130.     }
  131.     /**
  132.      * @param array|null $result
  133.      */
  134.     public function setResult(array $result = null)
  135.     {
  136.         $this->result = $result;
  137.     }
  138.     /**
  139.      * @param int $batchId
  140.      */
  141.     public function setBatchIdForTheJob(int $batchId): void
  142.     {
  143.         $this->setResult([
  144.             'batchId' => $batchId,
  145.         ]);
  146.     }
  147.     /**
  148.      * @return null|int
  149.      */
  150.     public function getMarketplaceBatchId(): ?int
  151.     {
  152.         return !is_null($this->getResult()) && array_key_exists('batchId', $this->getResult()) ? $this->getResult()['batchId'] : null;
  153.     }
  154.     /**
  155.      * @return null|int
  156.      */
  157.     public function getErrorResult(): ?string
  158.     {
  159.         return !is_null($this->getResult()) && array_key_exists('message', $this->getResult()) ? $this->getResult()['message'] : null;
  160.     }
  161.     /**
  162.      * @return ProductModel|null
  163.      */
  164.     public function getAlternativeModelForAvailabilityCalculation(): ?ProductModel
  165.     {
  166.         return $this->alternativeModelForAvailabilityCalculation;
  167.     }
  168.     /**
  169.      * @param ProductModel|null $alternativeModelForAvailabilityCalculation
  170.      *
  171.      * @return void
  172.      */
  173.     public function setAlternativeModelForAvailabilityCalculation(?ProductModel $alternativeModelForAvailabilityCalculation): void
  174.     {
  175.         $this->alternativeModelForAvailabilityCalculation = $alternativeModelForAvailabilityCalculation;
  176.     }
  177.     /**
  178.      * @return MarketplaceListingStatistics
  179.      */
  180.     public function getMarketplaceListingStatisticsItem()
  181.     {
  182.         return $this->marketplaceListingStatisticsItem;
  183.     }
  184.     /**
  185.      * @param MarketplaceListingStatistics $marketplaceListingStatisticsItem
  186.      */
  187.     public function setMarketplaceListingStatisticsItem(MarketplaceListingStatistics $marketplaceListingStatisticsItem)
  188.     {
  189.         $this->marketplaceListingStatisticsItem = $marketplaceListingStatisticsItem;
  190.     }
  191. }