<?php
/*
class StranasTargetLogWithAttachment extends \Phalcon\Mvc\Model
{
    public function initialize()
    {
        $this->setSchema("jaga");
        $this->setSource("target_log");
        $this->hasOne('id_answer', 'StranasTargetAnswer', 'id');
        $this->hasOne('id_answer', 'StranasTargetAnswerWithAttachment', 'id_answer');
    }

    public function toArray($columns = null)
    {
        $result = parent::toArray($columns);
        $result['answer'] = $this->StranasTargetAnswer;
        $result['attachment'] = $this->StranasTargetAnswerWithAttachment;

        return $result;
    }
}
*/


class StranasTargetLogWithAttachment extends \Phalcon\Mvc\Model
{

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSchema("jaga");
        $this->setSource("target_log");
        $this->hasOne('id_answer', 'StranasTargetAnswer', 'id');
        $this->hasMany('id_answer', 'StranasTargetAnswerComment', 'id_answer');
        // $this->hasMany('id_answer', 'StranasTargetAnswerWithAttachment', 'id_answer');
        // $this->hasOne('id_answer', 'StranasSurveyAnswerCommentAttachment', 'id_answer');

        // $this->hasMany("id_answer", "StranasSurveyAnswerAttachment", "id_answer");
        // $this->hasMany("id_answer", "StranasSurveyAnswerComment", "id_answer");
    }

    public function toArray($columns = null)
    {
        $result = parent::toArray($columns);
        $result['answer'] = $this->StranasTargetAnswer;
        // $result['attachment'] = $this->StranasTargetAnswerWithAttachment;
        // $result['attachment'] = $this->StranasSurveyAnswerAttachment;
       $result['comments'] = $this->StranasTargetAnswerComment;

        return $result;
    }
}





