当前位置: 首页>>代码示例>>PHP>>正文


PHP Car::setBrand方法代码示例

本文整理汇总了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));
 }
开发者ID:peacq,项目名称:picorm,代码行数:17,代码来源:Model.php

示例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']);
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:21,代码来源:CollectionTest.php

示例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>';
}
开发者ID:peacq,项目名称:picorm,代码行数:31,代码来源:relations.php


注:本文中的Car::setBrand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。