本文整理匯總了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);
}
示例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');
}
}