Join from custom table to customer_entity table and get all data customer in Magento 2
-
03-03-2021 - |
문제
I used this code but it not working. Please help me!
$customerEntity = $locationList->getTable('customer_entity');
$locationList = $this->mpSellerMapLocatorModel->getCollection();
$locationList->getSelect()->join(
$customerEntity.' as cpev',
'main_table.seller_id = cpev.entity_id',
['firstname','lastname']
);
해결책
Try below solution:
$locationList->getSelect() ->join(array('cpev' => 'customer_entity'), 'cpev.entity_id=main_table.seller_id', array('firstname' => 'firstname', 'lastname' => 'lastname'));
Also donot call the collection using model class using $locationList = $this->mpSellerMapLocatorModel->getCollection();
Use Collection Class means {VendorName}/{ModuleName}/Model/ResourceModel/{Entity}/Collection
제휴하지 않습니다 magento.stackexchange