function list_by_premises_id() { $premises_id = empty($_GET['pid']) ? 0 : $_GET['pid']; $_house = new House(); $houses = $_house->findByPremisesId($premises_id); echo header("Content-type: application/json; charset=utf-8"); echo json_encode($houses); }
function get_one_premises() { $pid = empty($_GET['pid']) ? 0 : $_GET['pid']; $_premises = new Premises(); $premises = $_premises->findPremisesById($pid); $_house = new House(); $houses = $_house->findByPremisesId($pid); $premises['houses'] = $houses; header("Content-type: application/json; charset=utf-8"); echo json_encode($premises); }