當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Unit::delete方法代碼示例

本文整理匯總了PHP中Unit::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Unit::delete方法的具體用法?PHP Unit::delete怎麽用?PHP Unit::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Unit的用法示例。


在下文中一共展示了Unit::delete方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDelete

 function testDelete()
 {
     $name = "John Doe";
     $password = "password";
     $email = "johndoe@osa.biz";
     $signed_in = 0;
     $test_user = new User($name, $password, $email, $signed_in);
     $test_user->save();
     $course_title = "Literature";
     $subject = "English";
     $course_description = "Deconstructing English literature.";
     $user_id = $test_user->getId();
     $test_course = new Course($course_title, $subject, $course_description, $user_id);
     $test_course->save();
     $unit_title = "Into the Wild";
     $unit_description = "The life and death of Chris McCandless.";
     $course_id = $test_course->getId();
     $test_unit = new Unit($unit_title, $unit_description, $course_id);
     $test_unit->save();
     $unit_title2 = "The Catcher in the Rye";
     $unit_description2 = "Foul-mouthed kid is angsty.";
     $test_unit2 = new Unit($unit_title2, $unit_description2, $course_id);
     $test_unit2->save();
     $test_unit->delete();
     $result = Unit::getAll();
     $this->assertEquals([$test_unit2], $result);
 }
開發者ID:kylepratuch,項目名稱:EdBuilder,代碼行數:27,代碼來源:UnitTest.php

示例2: foreach

 function index_delete()
 {
     $models = json_decode($this->delete('models'));
     foreach ($models as $key => $value) {
         $obj = new Unit(null, $this->entity);
         $obj->where("id", $value->id)->get();
         $data["results"][] = array("data" => $value, "status" => $obj->delete());
     }
     //Response data
     $this->response($data, 200);
 }
開發者ID:nicarayz,項目名稱:linabiz,代碼行數:11,代碼來源:units.php

示例3: catch

        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('PUT /v1/main/unit/@id', function ($id) {
    try {
        $object = Unit::update($id);
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('DELETE /v1/main/unit/@id', function ($id) {
    try {
        $object = Unit::delete($id);
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
//=============================================================================
//UnitType
//=============================================================================
Flight::route('GET /v1/main/unittype', function () {
    try {
        $array = UnitType::selectAll();
        Flight::ok($array);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
開發者ID:rhalf,項目名稱:app_track,代碼行數:31,代碼來源:main.php


注:本文中的Unit::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。