<commit_before><?php

namespace MCUCourseAPI\Models;

use Phalcon\Mvc\Model;

class Courses extends Model
{
    protected $created_at;
    protected $updated_at;

    public function initialize()
    {
        $this->hasMany('id', 'MCUCourseAPI\Models\Teachers', 'course_id', array(
          'alias' => 'Teachers'
        ));
    }
}<commit_msg>Update# add simple times to course for query course<commit_after><?php

namespace MCUCourseAPI\Models;

use Phalcon\Mvc\Model;

class Courses extends Model
{
    public $simple_times;
    protected $created_at;
    protected $updated_at;

    public function initialize()
    {
        $this->hasMany('id', 'MCUCourseAPI\Models\Teachers', 'course_id', array(
          'alias' => 'Teachers'
        ));
    }

    public function afterFetch()
    {
        $this->simple_times = $this->getSimpleTimes();
    }

    protected function getSimpleTimes()
    {
        $teachers = $this->getTeachers();

        $simpleTimes = array();
        $times = null;
        $timesItem = null;
        foreach ($teachers as $teacher) {
            $times = $teacher->getCourseTimes();

            $timesItem = array();
            foreach ($times as $time) {
                array_push($timesItem, $time->time);
            }

            array_push($simpleTimes, array(
              'teacher' => $teacher->teacher,
              'camps' => $teacher->camps,
              'day' => $teacher->course_day,
              'times' => $timesItem
            ));
        }
        return $simpleTimes;
    }
}
{'fraction_non_alphanumeric': 0.13077423552374756, 'fraction_numerical': 0.0, 'mean_word_length': 2.151639344262295, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7085139', 'n_tokens_mistral': 465, 'n_tokens_neox': 454, 'n_words': 96}