<?php

class StranasTargetAnswerWithAttachment extends \Phalcon\Mvc\Model
{

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSchema("jaga");
        $this->setSource("stranas_survey_answer_attachment");
        // $this->hasOne("id_attachment", "Attachments", "id");
        $this->belongsTo("id_attachment", "Attachments", "id");
    }

    public function getDetail()
    {
        return $this->Attachments->toArray(['uuid', 'filename', 'keterangan', 'tipe']);
    }
    public function toArray($columns = null)
    {
        $result = parent::toArray($columns);
        $result['files'] = $this->Attachments;

        return $result;
    }
}


