![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-catalog/Model/Product/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** * Catalog Product Website Model * * @method int getWebsiteId() * @method \Magento\Catalog\Model\Product\Website setWebsiteId(int $value) * * @author Magento Core Team <[email protected]> */ namespace Magento\Catalog\Model\Product; class Website extends \Magento\Framework\Model\AbstractModel { /** * Initialize resource model * * @return void */ protected function _construct() { $this->_init(\Magento\Catalog\Model\ResourceModel\Product\Website::class); } /** * Removes products from websites * * @param array $websiteIds * @param array $productIds * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ public function removeProducts($websiteIds, $productIds) { try { $this->_getResource()->removeProducts($websiteIds, $productIds); } catch (\Exception $e) { throw new \Magento\Framework\Exception\LocalizedException( __('Something went wrong while removing products from the websites.') ); } return $this; } /** * Add products to websites * * @param array $websiteIds * @param array $productIds * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ public function addProducts($websiteIds, $productIds) { try { $this->_getResource()->addProducts($websiteIds, $productIds); } catch (\Exception $e) { throw new \Magento\Framework\Exception\LocalizedException( __('Something went wrong while adding products to websites.') ); } return $this; } /** * Retrieve product websites * Return array with key as product ID and value array of websites * * @param int|array $productIds * @return array */ public function getWebsites($productIds) { return $this->_getResource()->getWebsites($productIds); } }