Hi,
In Cakephp 2.x, they are using link in queries.
Example :
$branchesArray = $this->find('all', array(
'conditions' => array('AND' => array(
'FacilityGroupItems.facility_group_id' => $groupID,
)
),
'cacher' => true,
'link' => array(
'FacilityGroupItems' => array(
'class' => 'FacilityGroupItems',
'type' => 'inner',
'conditions' => array('AND' => array(
"FacilityGroupItems.branch_id = Branches.id AND
FacilityGroupItems.facility_group_id = $groupID AND
FacilityGroupItems.item_status_id != $soldStatusID AND
FacilityGroupItems.item_status_id != $inactiveStatusID AND
FacilityGroupItems.item_status_id != $workshopStatusID",
"NOT" => array(
"FacilityGroupItems.item_license_id" => null
)
)
),
'fields' => array(
'FacilityGroupItems.branch_id', 'FacilityGroupItems.chassisno'
)
),
),
'fields' => array('Branches.id', 'Branches.name', 'Branches.code', 'Count(FacilityGroupItems.branch_id) as total_vehicles'),
'group' => array('FacilityGroupItems.branch_id')
));
How can I implement this in Cakephp 3.6?
Please suggest.
Regards
Anuj