нужно вывести именно коменты зарегистрированных пользователей. связь пытаюсь сделать по уроку
хауди Хо<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace app\controllers;
use app\models\User;
use app\models\comment;
/**
* Description of PostController
*
* @author Нико
*/
class PostController extends AppController{
//put your code here
public function indexAction() {
$alias = $this->route['alias'];
$article = \R::findOne('articles', "alias = ? LIMIT 1", [$alias]);
//$comments = \R::findAll('comments', "post_id = ?", [$article->id]);
debug($_SESSION['user']);
if(!$article){
throw new \Exception('Страница не найдена', 404);
}
$vase = \R::dispense( 'user' );
$vase->teflog = "store";
$vases = \R::dispense( 'comments' );
$vases->user_id = 1;
$vases->ownuserList[] = $vase;
\R::store( $vases);
$this->setMeta($article->title);
$this->set(compact('article'));
}
}