function setModel($m, $id_field = null, $title_field = null) { parent::setModel($m); $this->id_field = $id_field ?: $this->model->id_field; $this->title_field = $title_field ?: $this->model->title_field; return $this->model; }
function setModel($m, $id_field = null, $title_field = null) { parent::setModel($m); $this->id_field = $id_field ?: $this->model->id_field; $this->title_field = $title_field ?: $this->model->title_field; if ($_GET[$this->name]) { if ($_GET['term']) { $this->addCondition($_GET['term']); } $data = $this->getData(); foreach ($data as &$row) { //var_dump($row['_id']->__toString()); echo '<hr>'; $row[$this->id_field] = (string) $row[$this->id_field]; } echo json_encode($data); exit; } }
public function setModel($m, $id_field = null, $title_field = null) { parent::setModel($m); $this->id_field = $id_field ?: $this->model->id_field; $this->title_field = $title_field ?: $this->model->title_field; if ($_GET[$this->name]) { if ($_GET['term']) { $this->addCondition($_GET['term']); } // retrieve data from model $data = $this->getData(); // cast values to string foreach ($data as &$row) { $row[$this->id_field] = (string) $row[$this->id_field]; } echo json_encode($data); exit; } }
function setModel($m, $id_field = null, $title_field = null) { parent::setModel($m); $this->id_field = $id_field ?: $this->model->id_field; $this->title_field = $title_field ?: $this->model->title_field; if ($_GET[$this->name]) { if ($_GET['term']) { $this->addCondition($_GET['term']); } $data = $this->getData(); echo json_encode($data); exit; } }