I have inherited a custom module that is not working and not done yet.
I have a question regarding the UI form components and its relation to naming and usage (for instance: database table name/UI form dataSource/dataProvider)
Code where dataPersistor
is used:
/Save.php
:
$this->dataPersistor->clear('vendor_modulename_referencesameastablename');
$this->dataPersistor->set('vendor_modulename_referencesameastablename', $data);
Table name in db_schema.xml
:
<table name="vendor_modulename_referencesameastablename" resource="default" engine="innodb" comment="vendor_modulename_referencesameastablename Table">
Inside UI Component:
<dataSource name="vendor_modulename_referencesameastablename_listing_data_source" component="Magento_Ui/js/grid/provider">
Insie di.xml
:
<virtualType name="Vendor\ModuleName\Model\ResourceModel\ReferenceSameAsTableName\Grid\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments>
<argument name="mainTable" xsi:type="string">vendor_modulename_referencesameastablename</argument>
<argument name="resourceModel" xsi:type="string">Vendor\ModuleName\Model\ResourceModel\ReferenceSameAsTableName\Collection</argument>
</arguments>
</virtualType>
Question
What is the relation to these elements, basically I want to refactor and primarily rename these entities, especially the database table name.
Do the dataPersistor / UI Component elements and table name need to be the same?