In Magento 2, to my understanding, dependency for each interface should be declared somewhere in the di.xml files, either in app/etc/
or < module_dir >/etc/
or some deeper directories to override.
But when I was tracing the schema setup code, I couldn't seem to find the dependency relation anywhere.
For example:
namespace Vendor\Mod\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\DB\Ddl\Table;
class InstallSchema implements InstallSchemaInterface
{
/**
* Installs DB schema for a module
*
* @param SchemaSetupInterface $setup
* @param ModuleContextInterface $context
* @return void
*/
public function install(
SchemaSetupInterface $setup,
ModuleContextInterface $context)
{
...
}
}
Though in the book it said:
"... Magento\Setup\Module\Setup is the one extending \Magento\Framework\Module\Setup and implementing SchemaSetupInterface."
it didn't help much to sort out my problem.
Also, I've noticed that components under Magento\Framework\ are not regular magento2-modules.(not sure if it makes any difference here.)
So, why is the DI declaration not needed in this case? How did magento know which implementation to use?
Thanks for the help.