I am trying to access the getServiceLocator function in a model. It works in the controller but when I move it into a model I get NULL when trying to access.
Call to a member function get() on null
It seemed like below link offered a comparable solution but I had trouble implementing
Use another module in our custom helper in zend framework 2
Below is the code I am trying to run in a model.
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class FileManager implements ServiceLocatorAwareInterface {
someFunction(){
$thumbnailer = $this->getServiceLocator()->get('WebinoImageThumb');
}
}
Thank you M