<?php

class StranasNewReportAch extends \Phalcon\Mvc\Model
{

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSchema("jaga");
        $this->setSource("report_ach");
        $this->hasMany("id", "StranasNewReportLog", "id_master", ["params" => ["order" => 'id_triwulan ASC']]);
        $this->hasMany("id", "StranasNewMasterActivities", "id_master", ["params" => ["order" => 'id ASC']]);
        $this->hasOne("id_target", "StranasNewOtherNilai", "id_target");
    }

    public function getDetail($columns = null)
    {
        $result = parent::toArray($columns);
        $result['log'] = $this->StranasNewReportLog;

        return $result;
    }
    
    public function toArray($columns = null)
    {
        $result = parent::toArray($columns);
        $result['log'] = $this->StranasNewReportLog;
        $result['activities'] = $this->StranasNewMasterActivities;
        $result['other'] = $this->StranasNewOtherNilai;
        return $result;
    }

    public function toDetail($columns = null)
    {
        $result = parent::toArray($columns);
        $result['log'] = $this->StranasNewReportLog;

        return $result;
    }
}
