cakephp3.5 contain code example
Example: cannot get all value from the contain cakephp
// on each model MUST HAVE THIS ROW for containable the model
public $actsAs = array('Containable');
Ex:
<?php
App::uses('BuildingAppModel', 'Building.Model');
class CreditType extends BuildingAppModel {
public $actsAs = array('Containable');
}
?>
// First: need to check model for the relationship is it correct?
// next: MUST ADD THIS ROW for show all contain
'BuildingFacility' => array(
'fields' => array(
'BuildingFacility.id', // MUST ADD THIS ROW for show all contain
),
'BuildingFacilityLanguage' => array(
'conditions' => array(
'BuildingFacilityLanguage.alias' => $this->lang18,
),
),
'BuildingPost' => array(
'fields' => array(
'BuildingPost.*',
),
'BuildingPostLanguage' => array(
'conditions' => array(
'BuildingPostLanguage.alias' => $this->lang18,
),
),
),
),