<?php

class Sistema_Model_TipoArquivo extends Agro_Db_Table_Abstract {
	protected $_schema = 'sistema';
	protected $_name = 'tipo_arquivo';
	protected $_primary = 'id';
	public $_order = 'ds_tipo_arquivo';
	
	public function save(array $data) {
		$Row = ($data[id] ? $this->find($data[id])->current() : $this->createRow());
		
		$Row->ds_nome_arquivo = $data[ds_nome_arquivo];
		$Row->ds_tipo_arquivo = $data[ds_tipo_arquivo];
		
		return $Row->save();
	}
	
	public function getIdArquivo($nome) {
		$Row = $this->fetchRow("ds_nome_arquivo = '$nome'");
		
		return $Row->id;
	}
}