0

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!

1 Answer 1

2

Add map inside construct method. Ex:

$this->_map['fields']['employee_id'] = 'main_table. employee_id';

Check for more detail

1
  • hmmmm intriguing nice one! you save the day :) Commented Apr 23, 2020 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.