Skip to main content
4 events
when toggle format what by license comment
Feb 2, 2019 at 8:02 comment added avpaderno @smccabe In that case, the class would not have a constructor that directly creates a new instance of another class. That is the task of the create() method.
Feb 1, 2019 at 21:46 comment added smccabe Wouldn't the create() automatically be inherited from FormBase, and since this class doesn't require any new injections, doesn't need to be recreated?
Aug 27, 2016 at 8:55 comment added crzpiot Thanks for a quick answer. I've updated my code and added the create() method: public static function create(ContainerInterface $container) { return new static($container->get('asphira.contact_types')); } changed my constructor: public function __construct(ContactTypeModel $model) { $this->model = $model; } and created a service: services: asphira.contact_types: class: 'Drupal\asphira\Model\ContactTypeModel' but I still get the same error.
Aug 27, 2016 at 8:17 history answered avpaderno CC BY-SA 3.0