I'm trying to load a service into my Drupal module, but even after checking twice whether I did something wrong, I can't seem to find any error in my code as I did everything as the documentation said and Drupal still gives me a non-existent service error.
Here's the my services.yml file:
services:
rb_weather.wunderground:
class: Drupal\rb_weather\WundergroundWeather
Here's the config form code (the part loading the service):
class RBWeatherSettingsForm extends ConfigFormBase
{
/**
* @var WeatherInterface
*/
private $wunderground;
public function __construct(ConfigFactoryInterface $config_factory, WeatherInterface $wunderground)
{
parent::__construct($config_factory);
$this->wunderground = $wunderground;
}
public static function create(ContainerInterface $container)
{
return new static(
$container->get('config.factory'),
$container->get('rb_weather.wunderground')
);
}
I have included the classes using the "use" command as PhpStorm doesn't complain about that, however, Drupal does not want to recognize it.
My service classes as well as the services.yml file are placed under rb_weather/services folder.
Thanks a lot.