What's the best method to get specific data in Magento 2, i.e. to list all the websites in the CMS? In Magento 1 I'd use
Mage::app()->getWebsites()
But that doesn't work in Mag2 anymore. I do see code like this:
$this->storeManager = $storeManager;
$id = $this->storeManager->getStore()->getId();
Which I guess would be a fair starting point, but whenever I call this code in the frontend, I get Notice: Undefined variable: storeManager errors. So appareantly this isn't the way to call that storeManager. My question is; what is the right way?