The EntityTypeManager is injected, but should be typehinted as EntityTypeManagerInterface.
Modules like Webprofiler also implement this interface.
This:
/**
* Constructs a CookieCategoryForm object.
*
* @param \Drupal\Core\Entity\EntityTypeManager $entityTypeManager
* The entityTypeManager.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function __construct(EntityTypeManager $entityTypeManager) {
$this->entityTypeManager = $entityTypeManager;
$this->categoryStorageManager = $entityTypeManager->getStorage('cookie_category');
}
Should become:
/**
* Constructs a CookieCategoryForm object.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entityTypeManager.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function __construct(EntityTypeManagerInterface $entityTypeManager) {
$this->entityTypeManager = $entityTypeManager;
$this->categoryStorageManager = $entityTypeManager->getStorage('cookie_category');
}
I have attached a patch below.
Please advise.
Comments
Comment #2
svenryen commentedComment #4
svenryen commentedFixed - thanks for the patch!