Вопрос

I try to build a REST interface using the Fat Free Framework. I use the following code to query the database:

$product = new DB\SQL\Mapper($this->db, 'product');
$product->load(array('id=?', $this->productID));

I can now return for instance the title with

echo json_encode($product->title);

But how do I return the whole row? The following won't work

echo json_encode($product);
Это было полезно?

Решение

Found it. Had to use

echo json_encode($product->cast());
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top