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