<?

class Safra13_Model_LaudosFinaisUvaQuedaParreiralItensSeguradosEventos extends Agro_Db_Table_Abstract {
	protected $_schema = 'safra13';
	protected $_name = 'laudos_finais_uva_queda_parreiral_itens_segurados_eventos';
	protected $_primary = 'id_laudo_final_item_segurado';
	public $_order = 'id_laudo_final_item_segurado';

	public function delete($idLaudoFinalItemSegurado) {
		$sql = "delete from {$this->_schema}.{$this->_name} where id_laudo_final_item_segurado = $idLaudoFinalItemSegurado";
		$this->_db->query($sql);
	}
	
	public function getEventos($idLaudoFinalItemSegurado) {
		$select = $this->select();
		$select->setIntegrityCheck(false);

		$select->from(array('itens'=> $this->_schema . '.' . $this->_name), array('id_evento'));
		$select->where('itens.id_laudo_final_item_segurado = ?', $idLaudoFinalItemSegurado);

		return $this->fetchAll($select)->toArray();
	}
}