BUG with Phalcon\Mvc\Model\Row

Found bug regarding Phalcon\Mvc\Model\Row when i try to set some value for it it works as expected but if i try to set Model as value that Row becomes Model.

I'm doing someting like that

$query->columns([
                'COUNT(topic.forum_topic_id) AS total_topics',
                'IFNULL(SUM(topic.replies), 0) AS total_posts',
                'MAX(topic.last_forum_post_id) AS last_forum_post_id',
            ]);
$topics = $query->getQuery()->execute();
//topics are instances of Phalcon\Mvc\Model\Row

$result = [];
foreach ($topics as $topic) {
    //get_class($topic) is Phalcon\Mvc\Model\Row
    if ($topic->last_forum_post_id) {
        $topic->post = $this->forumPostsRepository->getById($topic->last_forum_post_id);
        //for some reason all topic becomes Model (Forum\Models\ForumPosts) that is returned by get
        //get_class($topic) is Forum\Models\ForumPosts
    }
    $result[$topic->forum_category_id] = $topic;
}

any ideas why its happening so? i tried to set something else to $topic->post and it remains Phalcon\Mvc\Model\Row



48.3k

Can you revise your post to include the earlier setup of the $query variable.