I want to retrieve all stores and store views for a given website id. The data is to be shown as a hierarchy in multi select dropdown in the admin form.
I tried using
\Magento\Store\Model\StoreManagerInterface to retrieve stores as follows:
$storeData = $this->StoreManagerInterface->getStores();
The above only gives the details about all the stores. But I am not able to retrieve stores through website Id.