Some time ago I opened an issue on magento2 about a possible problem I've spotted in Magento EavSetup class.
In the discussion that follows some Magento devs are saying that for module setup (InstallData and UpgradeData) one should not use Magento Setup classes but the Magento APIs.
For instance: to add an attribute during setup:upgrade we should not use EavSetup but AttributeManagementInterface.
Now I'm a bit confused.
I always taught that those kind of things are what the Setup classes are for. But if we shouldn't use it, why the setup mechanism is implemented the way it is? Why they pass a Setup class to the install/upgrade method if then we should not use it?
How do you do this kind of things? Do you use APIs as they recommends?