$app->render(200, array('reference' => $referenceInfo));
    });
    $app->get('/:id', function ($id) use($app) {
        $reference = new Reference($id);
        $download = $app->request()->params('download');
        if (null != $download && $download) {
            header("Content-Disposition: attachment; filename=\"reference-{$id}.json\"");
        }
        $app->render(200, $reference->GetResults($app->request()->params('filters'), $app->request()->params('pageIndex'), $app->request()->params('pageSize')));
    })->name('references');
    $app->post('/:id', function ($id) use($app) {
        $reference = new Reference($id);
        $result = json_decode($app->request->getBody(), true);
        if (false != $result) {
            if (array_key_exists('name', $result)) {
                $index = $reference->setName($result['name']);
                $app->render(200, array());
            }
        } else {
            $app->render(400, array('error' => true, 'msg' => 'Not JSON'));
        }
    });
    $app->delete('/:id', function ($id) use($app) {
        $reference = new Reference($id);
        $reference->delete();
        Notify(ADMIN_TOPIC, array('action' => 'delete', 'reference' => $id));
        $app->render(200, array());
    });
});
$app->group('/reports', function () use($app) {
    $app->post('/', function () use($app) {
Exemplo n.º 2
0
 public function testBasicInvocation()
 {
     $this->object->setName('test.param');
     $this->assertEquals('parameterValue', $this->object->invoke($this->getContainer()));
 }