Пример #1
0
	public function save(Vehicle_Models_Vehicle $vehicle) 
	{
		$data = array(
			'veId' => $vehicle->getVeId(),
			'plateNo' => $vehicle->getPlateNo(),
			'name' => $vehicle->getName(),
			'color' => $vehicle->getColor(),
			'license' => $vehicle->getLicense(),
			'contactId' => $vehicle->getContactId(),
			'pilot' => $vehicle->getPilot(),
			'user' => $vehicle->getUser(),
			'fuelCons' => $vehicle->getFuelCons(),
			'pDate' => $vehicle->getPDate(),
			'brand' => $vehicle->getBrand(),
			'price' => $vehicle->getPrice(),
			'remark' => $vehicle->getRemark()
		);

		if (null === ($id = $vehicle->getVeId())) {
			unset($data['veId']);
			$this->getDbTable()->insert($data);
		} else {
			$this->getDbTable()->update($data, array('veId = ?' => $vehicle->getVeId()));
		}
	}