<?php

class KorwilAnggaran extends \Phalcon\Mvc\Model
{
    public function initialize()
    {
        $this->setSchema("jaga");
        $this->setSource("korwil_anggaran");
        $this->belongsTo(
            'id_template',
            'KorwilAnggaranTemplate',
            'id'
        );
        $this->belongsTo(
            'id_instansi',
            'Instansi',
            'id'
        );
        $this->belongsTo(
            'id_periode',
            'KorsupgahPeriode',
            'id'
        );
    }

    public function toArray($columns = null)
    {
        $result = parent::toArray($columns);

        return $result;
    }

    public function toDetail()
    {
        $result = $this->toArray();
        $result['template'] = $this->KorwilAnggaranTemplate;
        $result['instansi'] = $this->Instansi;
        $result['periode'] = $this->KorsupgahPeriode;

        return $result;
    }
}
