/**
  * @param int|bool $storeId
  * @return \Magento\Store\Model\Website
  */
 protected function getWebsite($storeId)
 {
     if ($storeId) {
         $websiteId = $this->storeRepository->getById($storeId)->getWebsiteId();
         $website = $this->websiteRepository->getById($websiteId);
     } else {
         $website = $this->websiteRepository->getDefault();
     }
     return $website;
 }
 /**
  * {@inheritdoc}
  */
 public function getWebsite($websiteId = null)
 {
     if ($websiteId === null || $websiteId === '') {
         $website = $this->websiteRepository->getById($this->getStore()->getWebsiteId());
     } elseif ($websiteId instanceof Website) {
         $website = $websiteId;
     } elseif ($websiteId === true) {
         $website = $this->websiteRepository->getDefault();
     } else {
         $website = $this->websiteRepository->getById($websiteId);
     }
     return $website;
 }
Esempio n. 3
0
 /**
  * Retrieve store website
  *
  * @return Website|bool
  */
 public function getWebsite()
 {
     if ($this->getWebsiteId() === null) {
         return false;
     }
     return $this->websiteRepository->getById($this->getWebsiteId());
 }