예제 #1
0
파일: routes.php 프로젝트: tjbindseil/DB
}, array('before' => 'statsStart', 'after' => 'statsComplete'));
$router->post($routePrefix . 'student/add', function () {
    $con = new StudentController();
    return json_encode($con->addStudent());
}, array('before' => 'statsStart', 'after' => 'statsComplete'));
$router->post($routePrefix . 'student/delete', function () {
    $con = new StudentController();
    return $con->deleteStudent();
}, array('before' => 'statsStart', 'after' => 'statsComplete'));
$router->post($routePrefix . 'student/update', function () {
    $con = new StudentController();
    return json_encode($con->updateStudent());
}, array('before' => 'statsStart', 'after' => 'statsComplete'));
$router->post($routePrefix . 'student/getAllStudents', function () {
    $con = new StudentController();
    return $con->getAllStudents();
}, array('before' => 'statsStart', 'after' => 'statsComplete'));
//INSERT/UPDATE and INSERT/UPDATE-like API calls
/*
Simple insert/update
	inserts or updates row in table with attributes objectArr
	if identifier in objectArr exists in table, update existing row with values in objectArr
	if not, insert new row with values in objectArr and auto-generated identifier
*/
$router->post($routePrefix . 'post/{table}/{objectArr}', function ($table, $objectArr) {
    return Test::getIndex();
}, array('before' => 'statsStart', 'after' => 'statsComplete'));
//DELETE and DELETE-like API calls
/*
Simple Delete
	deletes row in table by id