load ($_TIME ." < EXTRACT (EPOCH FROM _update)::integer")) throw new Exception (__ ('Unable to load data!')); $json = array (); while ($entity->getItem ()) { $itemId = $entity->getId (); $object = array (); if ($entity->useCode ()) $object [$entity->getCodeColumn ()] = $entity->getCode (); else $object [$entity->getPrimary ()] = $itemId; while ($field = $entity->getField ()) $object [$field->getApiColumn ()] = ApiEntity::toApi ($field, $itemId); $json [] = (object) $object; } header ('Content-Type: application/json; charset=UTF-8'); echo json_encode ($json);