<?php

/**
 * Subclass for representing a row from the 'violetactive' table.
 *
 * 
 *
 * @package lib.model
 */ 
class Violetactive extends BaseVioletactive
{
	/**
	 * Initializes internal state of Violetactive object.
	 * @see        parent::__construct()
	 */
	public function __construct()
	{
		// Make sure that parent constructor is always invoked, since that
		// is where any default values for this object are set.
		parent::__construct();
	}

	public function getDealer() {
		$number = str_replace('-', '', $this->getVaProkey());
		$number = substr($number, 0, 6);
		$idDealer = (int)($number/30) + 1;
		$c = new Criteria();
		$c->add(VioletdealerPeer::VD_DEALERID, $idDealer);
		$violetdealer = VioletdealerPeer::doSelectOne($c);
		if ($violetdealer) return $violetdealer->getVdName();
		else return $idDealer;
	}
}
