Ejemplo n.º 1
0
 /**
  * @param array $state State to restore entity to.
  */
 public function restoreState(array $state)
 {
     parent::restoreState($state);
     if (isset($state['regular_price'])) {
         $this->regularPrice = $state['regular_price'] !== '' ? (double) $state['regular_price'] : '';
     }
     if (isset($state['sales_enabled'])) {
         $this->sales->setEnabled((bool) $state['sales_enabled']);
     }
     if (isset($state['sales_from'])) {
         $this->sales->setFromTime($state['sales_from']);
     }
     if (isset($state['sales_to'])) {
         $this->sales->setToTime($state['sales_to']);
     }
     if (isset($state['sales_price'])) {
         $this->sales->setPrice($state['sales_price']);
     }
     if (isset($state['stock_manage'])) {
         $this->stock->setManage((bool) $state['stock_manage']);
     }
     if (isset($state['stock_stock'])) {
         $this->stock->setStock((int) $state['stock_stock']);
     }
     if (isset($state['stock_allow_backorders'])) {
         $this->stock->setAllowBackorders($state['stock_allow_backorders']);
     }
     if (isset($state['stock_status'])) {
         $this->stock->setStatus((int) $state['stock_status']);
     }
     if (isset($state['stock_sold'])) {
         $this->stock->setSoldQuantity((int) $state['stock_sold']);
     }
 }
Ejemplo n.º 2
0
 /**
  * @param array $state State to restore entity to.
  */
 public function restoreState(array $state)
 {
     parent::restoreState($state);
     if (isset($state['sales_enabled'])) {
         $this->sales->setEnabled((bool) $state['sales_enabled']);
     }
     if (isset($state['sales_from'])) {
         $this->sales->setFromTime($state['sales_from']);
     }
     if (isset($state['sales_to'])) {
         $this->sales->setToTime($state['sales_to']);
     }
     if (isset($state['sales_price'])) {
         $this->sales->setPrice($state['sales_price']);
     }
 }
Ejemplo n.º 3
0
 /**
  * @param array $state State to restore entity to.
  */
 public function restoreState(array $state)
 {
     parent::restoreState($state);
     if (isset($state['regular_price'])) {
         $this->regularPrice = $state['regular_price'] !== '' ? (double) $state['regular_price'] : '';
     }
     if (isset($state['external_url'])) {
         $this->url = $state['external_url'];
     }
     if (isset($state['sales_enabled'])) {
         $this->sales->setEnabled((bool) $state['sales_enabled']);
     }
     if (isset($state['sales_from'])) {
         $this->sales->setFromTime($state['sales_from']);
     }
     if (isset($state['sales_to'])) {
         $this->sales->setToTime($state['sales_to']);
     }
     if (isset($state['sales_price'])) {
         $this->sales->setPrice($state['sales_price']);
     }
     $this->stock->setManage(false);
 }