Closed navarr closed 3 years ago
Can such dependencies be specified via di.xml
currently so that a module would have soft dependency on Commerce module?
I think references to classes that do not exist in the project should lead to an exception being thrown.
I my opinion the best approach is to deliver Commerce edition related functionality in a separate module installed only for Commerce edition. This should also ensure the correct dependency between modules (and versioning i.e. when using composer).
If a constructor asks for an object of a class type and has a default value of NULL, provide NULL instead of throwing an exception if the class type cannot be provided.
This would allow extensions that can support Commerce features to use Dependency Injection for Commerce classes ("or NULL") without having to use ObjectManager directly