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


PHP Brand::delete方法代碼示例

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


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

示例1: testBasic

 public function testBasic()
 {
     $brand = new \Brand(array('title' => 'Apple'));
     $brand->save();
     $brand = \Brand::loadOne(1);
     $brand->attachFileFromPath('logo', __DIR__ . '/../README.md');
     $this->assertEquals('01/1/logo/README.md', $brand->logo[0]['link'], 'original file name');
     $brand->attachFileFromPath('logo', __DIR__ . '/../README.md');
     $this->assertEquals('01/1/logo/README_1.md', $brand->logo[1]['link'], 'duplicate of original file name');
     $brand = \Brand::loadOne(1);
     $this->assertEquals(2, count($brand->logo), 'loaded two files on demand');
     $brand->delete();
     $this->assertEmpty(FSService::getInstance()->in(__DIR__ . '/upload/01/')->find(), 'No files left after deleting');
     $brand = new \Brand(array('title' => 'Apple'));
     $_FILES['logo'] = array('tmp_name' => __DIR__ . '/../README.md', 'name' => 'readme.md');
     $_FILES['info_file'] = array('tmp_name' => __DIR__ . '/../README.md', 'name' => 'readme.md');
     $brand->setFieldNameForAlias('info', 'info_file');
     $brand->save();
     $this->assertEquals(2, count(FSService::getInstance()->in(__DIR__ . '/upload/02/2')->find()), 'Two files saved to object');
     $brand->delete();
     $brand = new \Brand(array('title' => 'Apple'));
     $_FILES['logo'] = array('tmp_name' => __DIR__ . '/../README.md', 'name' => 'readme.md');
     $_FILES['info'] = array('tmp_name' => __DIR__ . '/../README.md', 'name' => 'readme.md');
     $brand->skipFileAliasForSave('logo');
     $brand->save();
     $this->assertEquals(1, count(FSService::getInstance()->in(__DIR__ . '/upload/03/3')->find()), 'Skipped logo');
     $brand->delete();
 }
開發者ID:solve,項目名稱:database,代碼行數:28,代碼來源:ModelAbilityFilesTest.php

示例2: Brand

 function test_delete()
 {
     $name = "Nike";
     $test_brand = new Brand($name, $id);
     $test_brand->save();
     $name2 = "Adidas";
     $test_brand2 = new Brand($name2, $id);
     $test_brand2->save();
     $test_brand->delete();
     $this->assertEquals([$test_brand2], Brand::getAll());
 }
開發者ID:jeffaustin81,項目名稱:shoe_store,代碼行數:11,代碼來源:BrandTest.php

示例3: Brand

 function test_delete()
 {
     $test_name = "Helmut Lang";
     $test_id = 1;
     $test_brand = new Brand($test_name, $test_id);
     $test_brand->save();
     $test_name2 = "Y-3";
     $test_id2 = 2;
     $test_brand2 = new Brand($test_name2, $test_id2);
     $test_brand2->save();
     $test_brand->delete();
     $result = Brand::getAll();
     $this->assertEquals([$test_brand2], $result);
 }
開發者ID:juliocesardiaz,項目名稱:Shoes,代碼行數:14,代碼來源:BrandTest.php

示例4: testDeleteBrand

 function testDeleteBrand()
 {
     //Arrange
     $brand_name = "Sketchers";
     $test_brand = new Brand($brand_name);
     $test_brand->save();
     $another_brand = "Doc Martin";
     $test_brand2 = new Brand($another_brand);
     $test_brand2->save();
     //Act
     $test_brand->delete();
     $result = Brand::getAll();
     //Assert
     $this->assertEquals([$test_brand2], $result);
 }
開發者ID:kellimargaret,項目名稱:Shoe_Stores,代碼行數:15,代碼來源:BrandTest.php

示例5: testDeleteJoins

 function testDeleteJoins()
 {
     // Arrange
     $name = "Get Your Kicks Co.";
     $test_Store = new Store($name);
     $test_Store->save();
     $name = "Babbling Brooks";
     $test_Brand = new Brand($name);
     $test_Brand->save();
     // Act
     $test_Brand->addStore($test_Store);
     $test_Brand->delete();
     $result = $test_Store->getBrands();
     // Assert
     $this->assertEquals([], $result);
 }
開發者ID:ben-pritchard,項目名稱:Epicodus-Assessment---PHP-Many-to-Many-in-Silex,代碼行數:16,代碼來源:brandTest.php

示例6: testDelete

 function testDelete()
 {
     //Arrange
     $brand_name = "Nike";
     $id = 1;
     $test_brand = new Brand($brand_name, $id);
     $test_brand->save();
     $brand_name2 = "Reebok";
     $id2 = 2;
     $test_brand2 = new Brand($brand_name2, $id2);
     $test_brand2->save();
     //Act
     $test_brand->delete();
     //Assert
     $this->assertEquals([$test_brand2], Brand::getAll());
 }
開發者ID:jtorrespdx,項目名稱:Shoe_stores,代碼行數:16,代碼來源:BrandTest.php

示例7: Brand

 function test_delete()
 {
     //Arrange
     $name = "Nike";
     $website = "http://www.nike.com";
     $test_brand = new Brand($name, $website);
     $test_brand->save();
     $name2 = "Adidas";
     $website2 = "http://www.adidas.com";
     $test_brand2 = new Brand($name2, $website2);
     $test_brand2->save();
     //Act
     $test_brand->delete();
     //Assert
     $result = Brand::getAll();
     $this->assertEquals([$test_brand2], $result);
 }
開發者ID:ashlinaronin,項目名稱:shoes,代碼行數:17,代碼來源:BrandTest.php

示例8: deleteBrand

 public function deleteBrand()
 {
     $id = null;
     if (!empty($_GET['id'])) {
         $id = (int) $_GET['id'];
     }
     $brand = new Brand();
     $brand->withId($id);
     if ($brand->hasId()) {
         $brand->delete();
     }
     header('Location: ' . $this->getUrl('brands'));
     exit;
 }
開發者ID:Aqro,項目名稱:findguidelines,代碼行數:14,代碼來源:AdministrationController.php

示例9: Brand

 function test_find()
 {
     //Arrange
     $name = "Nike";
     $test_brand = new Brand($name);
     $test_brand->save();
     $name2 = "Adidas";
     $test_brand2 = new Brand($name2);
     $test_brand2->save();
     //Act
     $test_brand->delete();
     $result = Brand::find($test_brand2->getId());
     //Assert
     $this->assertEquals($test_brand2, $result);
 }
開發者ID:r-hills,項目名稱:Shoes,代碼行數:15,代碼來源:BrandTest.php

示例10: Brand

 $brand->nameBrand = "Citroen";
 $brand->noteBrand = 10;
 $brand->save();
 $brand2 = new Brand();
 $brand2->nameBrand = "Renault";
 $brand2->noteBrand = 10;
 $brand2->save();
 $brand3 = new Brand();
 $brand3->nameBrand = "Peugeot";
 $brand3->noteBrand = 15;
 $brand3->save();
 // update existing brand
 $brand->nameBrand = "Audi";
 $brand->save();
 // delete brand
 $brand->delete();
 // select all brand
 $result = Brand::find();
 // select one brand
 $result = Brand::findOne(array('idBrand' => 1));
 // select one brand with order by
 $result = Brand::findOne(array('noteBrand' => 10), array('nameBrand' => 'ASC'));
 // Criteria with exact value (noteBrand=10)
 $collection = Brand::find(array('noteBrand' => 10));
 // Criteria with custom operator (noteBrand >= 10)
 $collection = Brand::find(array('noteBrand' => array('operator' => '>=', 'value' => 10)));
 // Criteria with Raw SQL
 $collection = Brand::find(array('noteBrand' => array('IN(9,10,11)')));
 // Criteria with custom operator (noteBrand >= 10)
 // order by field
 $collection = Brand::find(array('noteBrand' => array('operator' => '>=', 'value' => 10)), array('noteBrand' => 'ASC'));
開發者ID:peacq,項目名稱:picorm,代碼行數:31,代碼來源:model.php

示例11: function

    if (isset($_SESSION['app']) && isset($_COOKIE['app'])) {
        $brand->updateImage();
    } else {
        echo "<script>window.location='../../'</script>";
    }
});
// GET
$app->get('/brands', function () use($brand) {
    $brand->getBrands();
});
$app->get('/brands/:id', function ($id) use($brand) {
    $brand->getBrand($id);
});
$app->delete('/brands/:id', function ($id) use($brand) {
    if (isset($_SESSION['app']) && isset($_COOKIE['app'])) {
        $brand->delete($id);
    } else {
        echo "<script>window.location='../../'</script>";
    }
});
// $app->post('/brands', function() use($brand, $app) {
//   $request = $app->request();
//   $body = $request->getBody();
//   $data = json_decode($body);
//   $brand->insert($data);
// });
$app->put('/brands/:id', function ($id) use($brand, $app) {
    if (isset($_SESSION['app']) && isset($_COOKIE['app'])) {
        $request = $app->request();
        $body = $request->getBody();
        $data = json_decode($body);
開發者ID:jhonrsalcedo,項目名稱:BSG,代碼行數:31,代碼來源:index.php

示例12: Brand

 function test_delete()
 {
     //Arrange
     $name = "Nike";
     $id = null;
     $test_brand = new Brand($name, $id);
     $test_brand->save();
     $name2 = "Adidas";
     $test_brand2 = new Brand($name2, $id);
     $test_brand2->save();
     //Act
     $test_brand->delete();
     $result = Brand::getAll();
     //Assert
     $this->assertEquals($test_brand2, $result[0]);
 }
開發者ID:jcubed22,項目名稱:Shoes,代碼行數:16,代碼來源:BrandTest.php


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