Question

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);
Was it helpful?

Solution

Found it. Had to use

echo json_encode($product->cast());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top