Есть контролер:
<?php
class Controller {
protected $f3;
protected $db;
function beforeroute() {
}
function afterroute() {
echo Template::instance()->render('client_layout.html');
}
function __construct() {
$f3=Base::instance();
$db=new DB\SQL(
$f3->get('db_host') . $f3->get('db_name'),
$f3->get('db_user'),
$f3->get('db_pass')
);
$this->f3=$f3;
$this->db=$db;
}
}
class UserController extends Controller {
public function index()
{
$this->f3->set('page_head','Главная странца');
$this->f3->set('view','client/index.html');
}
public function breakage()
{
$breakage = new Breakage($this->db);
$this->f3->set('breakage',$breakage->all());
if($this->f3->exists('POST.create'))
{
$breakage = new Breakage($this->db);
$breakage->datetime=date("Y-m-d H:i:s");
$breakage->add();
$this->f3->reroute('/breakage');
} else
{
$this->f3->set('page_head','Список');
$this->f3->set('view','client/breakage.html');
}
}
}
И есть Модель Breakage:
<?php
class Breakage extends DB\SQL\Mapper {
public function __construct(DB\SQL $db)
{
parent::__construct($db,'breakage');
}
public function all()
{
$this->load();
return $this->query;
}
public function add()
{
$this->copyFrom('POST');
$this->save();
}
public function getById($id)
{
$this->load(array('id=?',$id));
$this->copyTo('POST');
}
}
Как мне сделать чтобы на странице /breakage подгружало еще данные с таблицы city и street