本文整理汇总了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();
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
示例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;
}
示例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);
}
示例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'));
示例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);
示例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]);
}