本文整理汇总了PHP中Car::setBrand方法的典型用法代码示例。如果您正苦于以下问题:PHP Car::setBrand方法的具体用法?PHP Car::setBrand怎么用?PHP Car::setBrand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Car
的用法示例。
在下文中一共展示了Car::setBrand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createAndSaveRawModelWithOneToOneRelation
public static function createAndSaveRawModelWithOneToOneRelation()
{
include_once __DIR__ . '/../scripts/tested_models.php';
$testBrand = new \Brand();
$testBrand->nameBrand = 'Acme';
$testBrand->noteBrand = 10;
$testBrand->save();
$car = new \Car();
$car->nameCar = 'AcmeCarcreateAndSaveRawModelWithOneToOneRelation';
$car->noteCar = '10';
$car->setBrand($testBrand);
$car->save();
$req = \PicORM\Model::getDataSource()->prepare('SELECT count(*) as nb FROM cars WHERE idBrand = ? AND idCar = ?');
$req->execute(array($testBrand->idBrand, $car->idCar));
$resultBDD = $req->fetch(\PDO::FETCH_ASSOC);
return array(array($testBrand, $car, $resultBDD));
}
示例2: shouldBeAbleToMerge
/**
* @test
*/
public function shouldBeAbleToMerge()
{
// given
$car = new Car();
$car->deleteTableData()->yesImSure();
$car->setBrand("Volkswagen");
$car->setModel("Polo 1.6 TDI");
$car->commit();
$this->addCarProperty($car->getId(), "Hk", "75");
$this->addCarProperty($car->getId(), "Mileage", "42000");
$this->addCarProperty($car->getId(), "Year", "2010");
$cars = new CarsWithProperties();
// when
$values = $cars->getValues();
$firstCar = $values[0];
// then
$this->assertNotNull($firstCar['properties']);
}
示例3: Car
$tag3->save();
// setting car's tags
$car->setTag(array($tag, $tag2, $tag3));
// getting car's tags
$car->getTag();
// getting car's tags with custom parameters
// parameters are same as find() method
$car->getTag($where, $order, $limitStart, $limitStop);
// unset relation between $car and $tag2
$car->unsetTag($tag2);
// creating some cars
$car = new Car();
$car->nameCar = "205 GTi";
$car->setBrand($brand);
$car->save();
$car2 = new Car();
$car2->nameCar = "206";
$car2->setBrand($brand);
$car2->save();
$car3 = new Car();
$car3->nameCar = "207";
$car3->setBrand($brand);
$car3->save();
// affecting new cars to $tag2
$tag2->setCar(array($car, $car2, $car3));
} catch (PicORM\Exception $e) {
// !!!! disable showing PicORM\Exception for production because it contains SQL query !!!!
echo '<strong>' . $e->getMessage() . '</strong>';
} catch (Exception $e) {
echo '<strong>' . $e->getMessage() . '</strong>';
}