سؤال

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

enter image description here

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';

Check for more detail

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top