Magento 2.3.4 Custom uiComponent admin form joint table Add New gives ambiguous query
-
13-04-2021 - |
質問
Collection:
protected function _initSelect()
{
parent::_initSelect();
$this->getSelect()->joinLeft(
['secondTable' => $this->getTable('ekvi_employee_salary')], //2nd table name by which you want to join
'main_table.employee_id = secondTable.employee_id', // common column which available in both table
'*' // '*' define that you want all column of 2nd table. if you want some particular column then you can define as ['column1','column2']
)->where('secondTable.store_id = ? ', 0);
return $this;
}
Backend Admin Add New E.G: .../admin_fkozk7/routeId/module/new/key/zzzzzzzz
The issue That I have is when Adding new Employee It loads the joint with the WHERE Condition and employee_id would be empty hence is the error. How Should this be resolved/approached when adding new raw?
Anyone Appreciate!
解決
Add map inside construct method. Ex:
$this->_map['fields']['employee_id'] = 'main_table. employee_id';
所属していません magento.stackexchange