<?php

class StranasTargetCommentWithAttachment extends \Phalcon\Mvc\Model
{

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSchema("jaga");
        $this->setSource("stranas_survey_answer_comment_attachment");
        $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;
    }

}


