Moved everything under annotations.

Some review is still needed.
master
Polonkai Gergely 11 years ago
parent 60b5eecbc8
commit 00190c3e37

41
TODO

@ -1,6 +1,6 @@
Article
public
roles who can access it
Polls (Entity already exists)
Groups (Entity already exists)
Article check if public
UserForumViewed
it should contain records that show the last viewed post in each forum topic
@ -35,18 +35,6 @@ ForumPost
edit count
text
Vote
id
creator
created at
active
text
others can add new answers
answers
id
creator
text
Library
id
owner
@ -58,7 +46,7 @@ Library
borrower returned
commentable
Program
Event
id
creator
created at
@ -68,34 +56,15 @@ Program
start time
end time (may be null)
description
location
commentable
Document
id
creator
created at
last edited by
last edited timestamp
last edit reason
title
slug
text
group - nullable, onetomany
PrivateChatMessage
id
from user
to user
timestamp
Group
id
name
created by
creation time
leader
members
GroupChatMessage
id
from user

@ -1,16 +1,15 @@
KekRozsakAdminBundle:
resource: "@KekRozsakAdminBundle/Resources/config/routing.yml"
prefix: /admin
resource: "@KekRozsakAdminBundle/Controller/DefaultController.php"
type: annotation
KekRozsakSecurityBundle:
resource: "@KekRozsakSecurityBundle/Resources/config/routing.yml"
prefix: /
resource: "@KekRozsakSecurityBundle/Controller/DefaultController.php"
type: annotation
KekRozsakFrontBundle:
resource: "@KekRozsakFrontBundle/Resources/config/routing.yml"
prefix: /
KekRozsakFrontBundle_Default:
resource: "@KekRozsakFrontBundle/Controller/DefaultController.php"
type: annotation
# Internal routing configuration to handle ESI
#_internal:
# resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
# prefix: /_internal
KekRozsakFrontBundle_Forum:
resource: "@KekRozsakFrontBundle/Controller/ForumController.php"
type: annotation

@ -2,12 +2,23 @@
namespace KekRozsak\AdminBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
/**
* @Route("/admin")
*/
class DefaultController extends Controller
{
public function manageRegsAction($name)
{
return $this->render('KekRozsakAdminBundle:Default:manage_regs.html.twig');
}
/**
* @Route("/jelentkezok", name="KekRozsakAdminBundle_manage_reg")
*/
public function manageRegsAction()
{
$users = $this->getDoctrine()->getEntityManager()->createQuery('SELECT u FROM KekRozsakFrontBundle:User u WHERE u.acceptedBy IS NULL')->getResult();
return $this->render('KekRozsakAdminBundle:Default:manage_regs.html.twig', array (
'users' => $users,
));
}
}

@ -22,7 +22,7 @@ class KekRozsakAdminExtension extends Extension
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
}
}

@ -0,0 +1,4 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
</container>

@ -1,7 +0,0 @@
parameters:
# kek_rozsak_admin.example.class: KekRozsak\AdminBundle\Example
services:
# kek_rozsak_admin.example:
# class: %kek_rozsak_admin.example.class%
# arguments: [@service_id, "plain_value", %parameter%]

@ -1 +1,32 @@
Juj!
{% extends '::main_template.html.twig' %}
{% block title %} - Jelentkezők{% endblock %}
{% block content %}
<h3>Jelentkezők</h3>
{% if users|length > 0 %}
<table>
<thead>
<tr>
<td>Felhasználónév</td>
<td>E-mail cím</td>
<td>Fórum-név</td>
<td>Regisztráció ideje</td>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>
<td>{{ user.displayName }}</td>
<td>{{ user.registeredAt|date('Y-m-d H:i') }}</td>
<td>
<form method="post" action="">
<button type="submit">Engedélyezem</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{%endblock content %}

@ -2,21 +2,28 @@
namespace KekRozsak\FrontBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use KekRozsak\FrontBundle\Form\Type\UserType;
class DefaultController extends Controller
{
/**
* @Route("/", name="KekRozsakFrontBundle_homepage")
*/
public function homepageAction()
{
$mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('main_page' => 1), true, array('created_at', 'DESC'), 1);
$mainPageArticle = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBy(array('mainPage' => 1), true, array('createdAt', 'DESC'), 1);
if (!$mainPageArticle)
throw $this->createNotFoundException('A keresett cikk nem létezik!');
return $this->forward('KekRozsakFrontBundle:Default:article', array('articleSlug' => $mainPageArticle->getSlug()));
}
/**
* @Route("/cikk/{articleSlug}", name="KekRozsakFrontBundle_article")
*/
public function articleAction($articleSlug)
{
$article = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:Article')->findOneBySlug($articleSlug);
@ -29,6 +36,9 @@ class DefaultController extends Controller
));
}
/**
* @Route("/profil", name="KekRozsakFrontBundle_profile_edit")
*/
public function profileEditAction()
{
$user = $this->get('security.context')->getToken()->getUser();

@ -2,14 +2,21 @@
namespace KekRozsak\FrontBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use KekRozsak\FrontBundle\Entity\ForumPost;
use KekRozsak\FrontBundle\Form\Type\ForumPostType;
/**
* @Route("/forum")
*/
class ForumController extends Controller
{
/**
* @Route("", name="KekRozsakFrontBundle_forum_main")
*/
public function mainAction()
{
// TODO: Protect this controller with roles? It is also defined in security.yml
@ -22,6 +29,9 @@ class ForumController extends Controller
));
}
/**
* @Route("/{topicGroupSlug}", name="KekRozsakFrontBundle_forum_topic_list")
*/
public function topicListAction($topicGroupSlug)
{
$groupRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopicGroup');
@ -33,6 +43,9 @@ class ForumController extends Controller
));
}
/**
* @Route("/{topicGroupSlug}/{topicSlug}", name="KekRozsakFrontBundle_forum_post_list")
*/
public function postListAction($topicGroupSlug, $topicSlug)
{
$request = $this->getRequest();
@ -44,12 +57,12 @@ class ForumController extends Controller
// Get the topic based on slug
$topicRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumTopic');
if (!($topic = $topicRepo->findOneBy(array('topic_group' => $topicGroup, 'slug' => $topicSlug))))
if (!($topic = $topicRepo->findOneBy(array('topicGroup' => $topicGroup, 'slug' => $topicSlug))))
throw $this->createNotFoundException('A kért téma nem létezik!');
// Get the list of posts in the requested topic
$postRepo = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:ForumPost');
$posts = $postRepo->findBy(array('topic' => $topic), array('created_at' => 'DESC') /* TODO: , limit, offset */);
$posts = $postRepo->findBy(array('topic' => $topic), array('createdAt' => 'DESC') /* TODO: , limit, offset */);
// Create an empty post object for posting
$post = new ForumPost();

@ -22,7 +22,7 @@ class KekRozsakFrontExtension extends Extension
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
}
}

@ -4,294 +4,340 @@ namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use KekRozsak\FrontBundle\Entity\User;
/**
* KekRozsak\FrontBundle\Entity\Article
* @ORM\Entity
* @ORM\Table(name="articles")
*/
class Article
{
/**
* @var integer $id
*/
private $id;
/**
* @var string $title
*/
private $title;
/**
* @var string $slug
*/
private $slug;
/**
* @var text $text
*/
private $text;
/**
* @var string $source
*/
private $source;
/**
* @var DateTime $created_at
*/
private $created_at;
/**
* @var DateTime $updated_at
*/
private $updated_at;
/**
* @var text $update_reason
*/
private $update_reason;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $created_by;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $updated_by;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
* @return Article
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set slug
*
* @param string $slug
* @return Article
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set text
*
* @param text $text
* @return Article
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return text
*/
public function getText()
{
return $this->text;
}
/**
* Set source
*
* @param string $source
* @return Article
*/
public function setSource($source)
{
$this->source = $source;
return $this;
}
/**
* Get source
*
* @return string
*/
public function getSource()
{
return $this->source;
}
/**
* Set created_at
*
* @param DateTime $createdAt
* @return Article
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->created_at = $createdAt;
return $this;
}
/**
* Get created_at
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->created_at;
}
/**
* Set updated_at
*
* @param DateTime $updatedAt
* @return Article
*/
public function setUpdatedAt(\DateTime $updatedAt)
{
$this->updated_at = $updatedAt;
return $this;
}
/**
* Get updated_at
*
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updated_at;
}
/**
* Set update_reason
*
* @param text $updateReason
* @return Article
*/
public function setUpdateReason($updateReason)
{
$this->update_reason = $updateReason;
return $this;
}
/**
* Get update_reason
*
* @return text
*/
public function getUpdateReason()
{
return $this->update_reason;
}
/**
* Set created_by
*
* @param KekRozsak\FrontBundle\Entity\User $createdBy
* @return Article
*/
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null)
{
$this->created_by = $createdBy;
return $this;
}
/**
* Get created_by
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->created_by;
}
/**
* Set updated_by
*
* @param KekRozsak\FrontBundle\Entity\User $updatedBy
* @return Article
*/
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null)
{
$this->updated_by = $updatedBy;
return $this;
}
/**
* Get updated_by
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getUpdatedBy()
{
return $this->updated_by;
}
/**
* @var boolean $main_page
*/
private $main_page;
/**
* Set main_page
*
* @param boolean $mainPage
* @return Article
*/
public function setMainPage($mainPage)
{
$this->main_page = $mainPage;
return $this;
}
/**
* Get main_page
*
* @return boolean
*/
public function getMainPage()
{
return $this->main_page;
}
}
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer", name="id")
*/
private $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @var string $title
* @ORM\Column(type="string", length=100, nullable=false)
*/
private $title;
/**
* Set title
*
* @param string $title
* @return Article
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @var string $slug
* @ORM\Column(type="string", length=100, nullable=false, unique=true)
*/
private $slug;
/**
* Set slug
*
* @param string $slug
* @return Article
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* @var text $text
* @ORM\Column(type="text", nullable=false)
*/
private $text;
/**
* Set text
*
* @param text $text
* @return Article
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return text
*/
public function getText()
{
return $this->text;
}
/**
* @var string $source
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $source;
/**
* Set source
*
* @param string $source
* @return Article
*/
public function setSource($source)
{
$this->source = $source;
return $this;
}
/**
* Get source
*
* @return string
*/
public function getSource()
{
return $this->source;
}
/**
* @var DateTime $createdAt
* @ORM\Column(type="datetime", nullable=false, name="created_at")
*/
private $createdAt;
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return Article
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @var User $createdBy
* @ORM\ManyToOne(targetEntity="User", inversedBy="articles")
* @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
*/
private $createdBy;
/**
* Set createdBy
*
* @param User $createdBy
* @return Article
*/
public function setCreatedBy(User $createdBy = null)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @var DateTime $updatedAt
* @ORM\Column(type="datetime", nullable=true, name="updated_at")
*/
private $updatedAt;
/**
* Set updatedAt
*
* @param DateTime $updatedAt
* @return Article
*/
public function setUpdatedAt(\DateTime $updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @var User $updatedBy
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
*/
private $updatedBy;
/**
* Set updatedBy
*
* @param User $updatedBy
* @return Article
*/
public function setUpdatedBy(User $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Get updatedBy
*
* @return User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* @var text $updateReason
* @ORM\Column(type="text", nullable=true, name="update_reason")
*/
private $updateReason;
/**
* Set updateReason
*
* @param text $updateReason
* @return Article
*/
public function setUpdateReason($updateReason)
{
$this->updateReason = $updateReason;
return $this;
}
/**
* Get updateReason
*
* @return text
*/
public function getUpdateReason()
{
return $this->updateReason;
}
/**
* @var boolean $mainPage
* @ORM\Column(type="boolean", name="main_page", nullable=true)
*/
private $mainPage;
/**
* Set mainPage
*
* @param boolean $mainPage
* @return Article
*/
public function setMainPage($mainPage)
{
$this->mainPage = $mainPage;
return $this;
}
/**
* Get mainPage
*
* @return boolean
*/
public function getMainPage()
{
return $this->mainPage;
}
/**
* @var boolean $public
* @ORM\Column(type="boolean", nullable=false)
*/
private $public;
/**
* Set public
*
* @param boolean $public
* @return Article
*/
public function setPublic($public)
{
$this->public = $public;
return $this;
}
/**
* Get public
*
* @return boolean
*/
public function getPublic()
{
return $this->public;
}
}

@ -0,0 +1,286 @@
<?php
namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use KekRozsak\FrontBundle\Entity\User;
/**
* KekRozsak\FrontBundle\Entity\Document
* @ORM\Entity
* @ORM\Table(name="documents")
*/
class Document
{
/**
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @var string $title
* @ORM\Column(type="string", length=150, nullable=false, unique=true)
*/
private $title;
/**
* Set title
*
* @param string $title
* @return Document
*/
public function setTitle(string $title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @var string $slug;
* @ORM\Column(type="string", length=150, nullable=false, unique=true)
*/
private $slug;
/**
* Set slug
*
* @param string $slug
* @return Document
*/
public function setSlug(string $slug)
{
$this->slug = $slug;
return $this;
}
/** Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* @var string $text
* @ORM\Column(type="text", nullable=false)
*/
private $text;
/**
* Set text
*
* @param string $text
* @return Document
*/
public function setText(string $text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* @var DateTime $createdAt
* @ORM\Column(type="datetime", name="created_at", nullable=false)
*/
private $createdAt;
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return Document
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @var User $createdBy
* @ORM\ManyToOne(targetEntity="User", inversedBy="createdDocuments")
* @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
*/
private $createdBy;
/**
* Set createdBy
*
* @param User $createdBy
* @return Document
*/
public function setCreatedBy(User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @var DateTime $updatedAt
* @ORM\Column(type="datetime", name="updated_at", nullable=true)
*/
private $updatedAt;
/**
* Set updatedAt
*
* @param DateTime $updatedAt
* @return Document
*/
public function setUpdatedAt(\DateTime $updatedAt = null)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @var User $updatedBy
* @ORM\ManyToOne(targetEntity="User", inversedBy="updatedDocuments")
* @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
*/
private $updatedBy;
/**
* Set updatedBy
*
* @param User $updatedBy
* @return Document
*/
public function setUpdatedBy(User $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Get updatedBy
*
* @return User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* @var string $updateReason
* @ORM\Column(name="update_reason", type="text", nullable=true)
*/
private $updateReason;
/**
* Set updateReason
*
* @param string $updateReason
* @return Document
*/
public function setUpdateReason(string $updateReason = null)
{
$this->updateReason = $updateReason;
return $this;
}
/**
* Get updateReason
*
* @return string
*/
public function getUpdateReason()
{
return $this->updateReason;
}
/**
* @var Group $groups
* @ORM\ManyToMany(targetEntity="Group", mappedBy="documents", fetch="EXTRA_LAZY")
*/
private $groups;
/**
* Set groups
*
* @param Group $groups
* @return Document
*/
public function setGroups(Group $groups = null)
{
$this->groups = $groups;
return $this;
}
/**
* Get groups
*
* @return Group
*/
public function getGroups()
{
return $this->groups;
}
}

@ -4,217 +4,232 @@ namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use KekRozsak\FrontBundle\Entity\User;
use KekRozsak\FrontBundle\Entity\ForumTopic;
use KekRozsak\FrontBundle\Entity\ForumTopicGroup;
/**
* KekRozsak\FrontBundle\Entity\ForumPost
* @ORM\Entity
* @ORM\Table(name="forum_posts")
*/
class ForumPost
{
/**
* @var integer $id
*/
private $id;
/**
* @var datetime $created_at
*/
private $created_at;
/**
* @var datetime $updated_at
*/
private $updated_at;
/**
* @var string $update_reason
*/
private $update_reason;
/**
* @var text $text
*/
private $text;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $created_by;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $updated_by;
/**
* @var KekRozsak\FrontBundle\Entity\ForumTopic
*/
private $topic;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set created_at
*
* @param datetime $createdAt
* @return ForumPost
*/
public function setCreatedAt($createdAt)
{
$this->created_at = $createdAt;
return $this;
}
/**
* Get created_at
*
* @return datetime
*/
public function getCreatedAt()
{
return $this->created_at;
}
/**
* Set updated_at
*
* @param datetime $updatedAt
* @return ForumPost
*/
public function setUpdatedAt($updatedAt)
{
$this->updated_at = $updatedAt;
return $this;
}
/**
* Get updated_at
*
* @return datetime
*/
public function getUpdatedAt()
{
return $this->updated_at;
}
/**
* Set update_reason
*
* @param string $updateReason
* @return ForumPost
*/
public function setUpdateReason($updateReason)
{
$this->update_reason = $updateReason;
return $this;
}
/**
* Get update_reason
*
* @return string
*/
public function getUpdateReason()
{
return $this->update_reason;
}
/**
* Set text
*
* @param text $text
* @return ForumPost
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return text
*/
public function getText()
{
return $this->text;
}
/**
* Set created_by
*
* @param KekRozsak\FrontBundle\Entity\User $createdBy
* @return ForumPost
*/
public function setCreatedBy(\KekRozsak\FrontBundle\Entity\User $createdBy = null)
{
$this->created_by = $createdBy;
return $this;
}
/**
* Get created_by
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getCreatedBy()
{
return $this->created_by;
}
/**
* Set updated_by
*
* @param KekRozsak\FrontBundle\Entity\User $updatedBy
* @return ForumPost
*/
public function setUpdatedBy(\KekRozsak\FrontBundle\Entity\User $updatedBy = null)
{
$this->updated_by = $updatedBy;
return $this;
}
/**
* Get updated_by
*
* @return KekRozsak\FrontBundle\Entity\User
*/
public function getUpdatedBy()
{
return $this->updated_by;
}
/**
* Set topic
*
* @param ForumTopic $topic
* @return ForumPost
*/
public function setTopic(ForumTopic $topic)
{
$this->topic = $topic;
$topic->setLastPost($this);
return $this;
}
/**
* Get topic
*
* @return KekRozsak\FrontBundle\Entity\ForumTopic
*/
public function getTopic()
{
return $this->topic;
}
}
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* @var datetime $createdAt
* @ORM\Column(type="datetime", name="created_at", nullable=false)
*/
private $createdAt;
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return ForumPost
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @var User $createdBy
* @ORM\ManyToOne(targetEntity="User", inversedBy="forumPosts")
* @ORM\JoinColumn(name="created_by_id", referencedColumnName="id")
*/
private $createdBy;
/**
* Set createdBy
*
* @param User $createdBy
* @return ForumPost
*/
public function setCreatedBy(User $createdBy)
{
$this->createdBy = $createdBy;
return $this;
}
/**
* Get createdBy
*
* @return User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @var datetime $updatedAt
* @ORM\Column(type="datetime", name="updated_at", nullable=true)
*/
private $updatedAt;
/**
* Set updatedAt
*
* @param DateTime $updatedAt
* @return ForumPost
*/
public function setUpdatedAt(\DateTime $updatedAt = null)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @var User $updatedBy
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="updated_by_id", referencedColumnName="id")
*/
private $updatedBy;
/**
* Set updatedBy
*
* @param User $updatedBy
* @return ForumPost
*/
public function setUpdatedBy(User $updatedBy = null)
{
$this->updatedBy = $updatedBy;
return $this;
}
/**
* Get updatedBy
*
* @return User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* @var string $updateReason
* @ORM\Column(type="text", name="update_reason", nullable=true)
*/
private $updateReason;
/**
* Set updateReason
*
* @param string $updateReason
* @return ForumPost
*/
public function setUpdateReason($updateReason = null)
{
$this->updateReason = $updateReason;
return $this;
}
/**
* Get updateReason
*
* @return string
*/
public function getUpdateReason()
{
return $this->updateReason;
}
/**
* @var ForumTopic $topic
* @ORM\ManyToOne(targetEntity="ForumTopic", inversedBy="posts")
*/
private $topic;
/**
* Set topic
*
* @param ForumTopic $topic
* @return ForumPost
*/
public function setTopic(ForumTopic $topic)
{
$this->topic = $topic;
if (($this->topic->getLastPost() === null) || ($this->topic->getLastPost()->getCreatedAt() > $this->createdAt))
$topic->setLastPost($this);
return $this;
}
/**
* Get topic
*
* @return ForumTopic
*/
public function getTopic()
{
return $this->topic;
}
/**
* @var text $text
* @ORM\Column(type="text", nullable=false)
*/
private $text;
/**
* Set text
*
* @param string $text
* @return ForumPost
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return string
*/
public function getText()
{
return $this->text;
}
}

@ -4,305 +4,321 @@ namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use KekRozsak\FrontBundle\Entity\User;
use KekRozsak\FrontBundle\Entity\ForumTopicGroup;
use KekRozsak\FrontBundle\Entity\ForumPost;
/**
* KekRozsak\FrontBundle\Entity\ForumTopic
* @ORM\Entity
* @ORM\Table(name="forum_topics", uniqueConstraints={@ORM\UniqueConstraint(columns={"topic_group_id", "title"}), @ORM\UniqueConstraint(columns={"topic_group_id", "slug"})})
*/
class ForumTopic
{
/**
* @var integer $id
*/
private $id;
/**
* @var string $title
*/
private $title;
/**
* @var string $slug
*/
private $slug;
/**
* @var datetime $created_at
*/
private $created_at;
/**
* @var datetime $updated_at
*/
private $updated_at;
/**
* @var text $update_reason
*/
private $update_reason;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $created_by;
/**
* @var KekRozsak\FrontBundle\Entity\User
*/
private $updated_by;
/**
* @var KekRozsak\FrontBundle\Entity\ForumTopicGroup
*/
private $topic_group;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
* @return ForumTopic
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set slug
*
* @param string $slug
* @return ForumTopic
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set created_at
*
* @param datetime $createdAt
* @return ForumTopic
*/
public function setCreatedAt($createdAt)
{
$this->created_at = $createdAt;
return $this;
}
/**
* Get created_at
*
* @return datetime
*/
public function getCreatedAt()
{
return $this->created_at;
}
/**
* Set updated_at
*
* @param datetime $updatedAt
* @return ForumTopic
*/
public function setUpdatedAt($updatedAt)
{
$this->updated_at = $updatedAt;
return $this;
}
/**
* Get updated_at
*
* @return datetime
*/
public function getUpdatedAt()
{
return $this->updated_at;
}
/**
* Set update_reason
*
* @param text $updateReason