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


PHP Vehicle::getUser方法代碼示例

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


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

示例1: testCreate

 public function testCreate()
 {
     $vehicle = new Vehicle();
     $vehicle->setMPG(25);
     $vehicle->setUser(new User());
     $vehicle->setMake(new Make());
     $this->assertSame(25, $vehicle->getMPG());
     $this->assertTrue($vehicle->getUser() instanceof User);
     $this->assertTrue($vehicle->getMake() instanceof Make);
 }
開發者ID:pdt256,項目名稱:truecar,代碼行數:10,代碼來源:VehicleTest.php

示例2: generateReportForVehicle

 protected function generateReportForVehicle(Vehicle $vehicle, $options = array())
 {
     $username = $vehicle->getUser()->getUsername();
     $vehicle_slug = $vehicle->getSlug();
     $from = $this->getFrom($options);
     $to = $this->getTo($options);
     $name = $vehicle->getName() . ' - from ' . $from . ' to ' . $to;
     $arguments = array('username' => $username, 'vehicles' => $vehicle_slug, 'name' => '"' . $name . '"');
     $options = array('date_from' => isset($options['date_from']) ? $options['date_from'] : null, 'date_to' => isset($options['date_to']) ? $options['date_to'] : null, 'kilometers_from' => isset($options['kilometers_from']) ? $options['kilometers_from'] : null, 'kilometers_to' => isset($options['kilometers_to']) ? $options['kilometers_to'] : null);
     try {
         $this->runTask('otokou:generateReportPdf', $arguments, $options);
         $this->log('ok: report written.');
     } catch (Exception $exc) {
         $this->log('not ok: no charges found');
     }
 }
開發者ID:rbolliger,項目名稱:otokou,代碼行數:16,代碼來源:otokouBatchGenerateReportsPdfTask.class.php


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