TL;DR: Is there any way in Magento 2 to make the method getTable
from a resource collection model to return the same table name for 2 different parameters?
Detailed Explanation
I will start with an example from Magento 1.
Let's say I have a table called module_entiti1_entity2
.
I needed to declare this table in my config.xml
like this
<module_resource>
<class>....</class>
<entities>
<entity1_entity2>
<table>module_entiti1_entity2</table>
</entity1_entity2>
</entities>
</module_resource>
Then I can get the table name from a resource collection model for example like this:
$collection->getTable('module/entity1_entity2');
But if I want I can use multiple aliases for the same table.
If my config.xml
section becomes
<module_resource>
<class>....</class>
<entities>
<entity1_entity2>
<table>module_entiti1_entity2</table>
</entity1_entity2>
<entity2_entity1>
<table>module_entiti1_entity2</table>
</entity2_entity1>
</entities>
</module_resource>
I can retrieve my table in 2 ways:
$collection->getTable('module/entity1_entity2');
$collection->getTable('module/entity2_entity1');
In Magento 2 there is no more table declaration like above.
I can get my table name like this $collection->getTable('module_entity1_entity2')
.
Is there a way to tell magento that for the parameter module_entity2_entity1
to return the same table name as for the parameter module_entity1_entity2
?