1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Store\Model\ResourceModel;
- use Magento\Framework\App\ResourceConnection;
- /**
- * Store Website Relation Resource Model
- */
- class StoreWebsiteRelation
- {
- /**
- * @var \Magento\Framework\App\ResourceConnection
- */
- private $resource;
- /**
- * StoreWebsiteRelation constructor.
- * @param ResourceConnection $resource
- */
- public function __construct(ResourceConnection $resource)
- {
- $this->resource = $resource;
- }
- /**
- * @param int $websiteId
- * @return array
- */
- public function getStoreByWebsiteId($websiteId)
- {
- $connection = $this->resource->getConnection();
- $storeTable = $this->resource->getTableName('store');
- $storeSelect = $connection->select()->from($storeTable, ['store_id'])->where(
- 'website_id = ?',
- $websiteId
- );
- $data = $connection->fetchCol($storeSelect);
- return $data;
- }
- }
|