I need join and virtual field with the pagination in index.ctp. I wrote same code that is working cakephp 2.x but in cakephp 3.5 this below code is not working. when I am taking 'pdt' to under contain it's show error TestRequest is not associated with pdt and when I am taking separate field then also getting error Unknown column 'TestRequest.pdt' in 'field list'
Where i need correction on below code?
public function index()
{
$this->paginate = [
'contain' => ['OwnerCompanies', 'ProductsMaster','TestRequestDet'],
//'fields' => ['pdt'],
'joins' => [
[
'table' => 'product_data_tests',
'alias' => 'pdt',
'conditions'=> array('TestRequestDet.test_id = pdt.id'),
'type' => 'left'
]
] ];
$this->TestRequest->virtualFields = [
'test_name'=>'pdt.test',
'specification'=>'pdt.specification',
'method'=>'pdt.methods',
];
$testRequest = $this->paginate($this->TestRequest);
$this->set(compact('testRequest'));
$this->set('_serialize', ['testRequest']);
}