Ejemplo n.º 1
0
<?php

require_once '../before.php';
use Entity\Comment;
if (isset($_GET['id'])) {
    $post = $entityManager->getRepository('Entity\\Post')->find($_GET['id']);
}
if (isset($_POST['submit'])) {
    $comment = new Comment();
    $comment->setMessage($_POST['message']);
    $comment->setAuthor($user);
    $comment->setPost($post);
    $entityManager->persist($comment);
    $entityManager->flush($comment);
}
$comments = $entityManager->getRepository('Entity\\Comment')->findBy(array('post' => $post), array('date' => 'ASC'));
?>

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Les commentaires</title>
    </head>
    <body>
        <h1><?php 
echo $post->getSubject();
?>
</h1>
        <p>
            <?php