<?php

class Sistema_Model_OrgaosExpedidores extends Agro_Db_Table_Abstract {
	protected $_schema = 'sistema';
	protected $_name = 'orgao_expedidor';
	protected $_primary = 'id';
	public $_order = 'ds_nome_orgao';
	
	public function save(array $data) {
		$Row = ($data[id] ? $this->find($data[id])->current() : $this->createRow());
		
		$Row->ds_nome_orgao = $data[ds_nome_orgao];
		
		return $Row->save();
	}
	
	public function getName($id) {
		$Row = $this->find($id)->current();
		return $Row->{$this->_order};
	}
}