<?php
class Automobil extends AppModel {
	var $name = 'Automobil';
	var $useTable = 'automobil';
	var $displayField = 'registarska_oznaka';
	
	var $validate = array(
		'customer_id' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				'message' => 'Kupac je obavezan',
				'allowEmpty' => false,
			),
		),
	);
	
	var $belongsTo = array(
		'Customer' => array(
			'className' => 'Customer',
			'foreignKey' => 'customer_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Gorivo' => array(
			'className' => 'Gorivo',
			'foreignKey' => 'gorivo_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
	
	var $hasMany = array(
		'RadniNalog' => array(
			'className' => 'RadniNalog',
			'foreignKey' => 'automobil_id',
			'dependent' => false
		)
	);
}
