当前位置: 首页>>代码示例>>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;未经允许,请勿转载。